-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #95 Adds docker compose cp command
- Loading branch information
1 parent
543b79b
commit 297a98f
Showing
6 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Cake.Core; | ||
using Cake.Core.Annotations; | ||
using System; | ||
|
||
namespace Cake.Docker | ||
{ | ||
// Contains functionality for working with docker compose cp command. | ||
partial class DockerAliases | ||
{ | ||
/// <summary> | ||
/// Runs docker compose cp with default settings. | ||
/// </summary> | ||
/// <param name="context">The context.</param> | ||
/// <param name="source">Source path.</param> | ||
/// <param name="destination">Destination path.</param> | ||
[CakeMethodAlias] | ||
public static void DockerComposeCp(this ICakeContext context, string source, string destination) | ||
{ | ||
DockerComposeCp(context, source, destination, new DockerComposeCpSettings()); | ||
} | ||
/// <summary> | ||
/// Copy files from/to container given <paramref name="settings"/>. | ||
/// </summary> | ||
/// <param name="context">The context.</param> | ||
/// <param name="source">Source path.</param> | ||
/// <param name="destination">Destination path.</param> | ||
/// <param name="settings">The settings.</param> | ||
[CakeMethodAlias] | ||
public static void DockerComposeCp(this ICakeContext context, string source, string destination, DockerComposeCpSettings settings) | ||
{ | ||
if (context == null) | ||
{ | ||
throw new ArgumentNullException(nameof(context)); | ||
} | ||
if (string.IsNullOrEmpty(source)) | ||
{ | ||
throw new ArgumentNullException(nameof(source)); | ||
} | ||
if (string.IsNullOrEmpty(destination)) | ||
{ | ||
throw new ArgumentNullException(nameof(destination)); | ||
} | ||
var runner = new GenericDockerRunner<DockerComposeCpSettings>(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools); | ||
runner.Run("compose cp", settings ?? new DockerComposeCpSettings(), new string[] { source, destination }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace Cake.Docker | ||
{ | ||
/// <summary> | ||
/// Settings for docker compose cp. | ||
/// </summary> | ||
public sealed class DockerComposeCpSettings : AutoToolSettings | ||
{ | ||
/// <summary> | ||
/// Copy to all the containers of the service. | ||
/// </summary> | ||
public bool All { get; set; } | ||
/// <summary> | ||
/// Archive mode (copy all uid/gid information) | ||
/// </summary> | ||
public bool Archive { get; set; } | ||
/// <summary> | ||
/// Always follow symbol link in SRC_PATH | ||
/// </summary> | ||
public bool FollowLink { get; set; } | ||
/// <summary> | ||
/// Index of the container if there are multiple | ||
/// instances of a service [default: 1]. (default 1) | ||
/// </summary> | ||
public int? Index { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--all Copy to all the containers of the service. | ||
-a, --archive Archive mode (copy all uid/gid information) | ||
-L, --follow-link Always follow symbol link in SRC_PATH | ||
--index int Index of the container if there are multiple | ||
instances of a service [default: 1]. (default 1) |