public static void DockerComposeExec(this ICakeContext context, DockerComposeExecSettings settings, string service, string command, params string[] args)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (string.IsNullOrEmpty(service))
            {
                throw new ArgumentNullException(nameof(service));
            }
            if (string.IsNullOrEmpty(command))
            {
                throw new ArgumentNullException(nameof(command));
            }

            var runner = new GenericDockerComposeRunner <DockerComposeExecSettings>(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);

            var arguments = new List <string> {
                service, command
            };

            if (args.Length > 0)
            {
                arguments.AddRange(args);
            }

            runner.Run("exec", settings ?? new DockerComposeExecSettings(), arguments.ToArray());
        }
示例#2
0
        public static void DockerComposeRestart(this ICakeContext context, DockerComposeRestartSettings settings, params string[] services)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            var runner = new GenericDockerComposeRunner <DockerComposeRestartSettings>(context.FileSystem, context.Environment, context.ProcessRunner, context.Globber);

            runner.Run("restart", settings ?? new DockerComposeRestartSettings(), services);
        }
示例#3
0
        public static void DockerComposeDown(this ICakeContext context, DockerComposeDownSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            var runner = new GenericDockerComposeRunner <DockerComposeDownSettings>(context.FileSystem, context.Environment, context.ProcessRunner, context.Globber);

            runner.Run("down", settings ?? new DockerComposeDownSettings(), new string[0]);
        }
        public static void DockerComposeRun(this ICakeContext context, DockerComposeRunSettings settings, string service, string command, params string[] args)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (string.IsNullOrEmpty(service))
            {
                throw new ArgumentNullException(nameof(service));
            }
            var           runner    = new GenericDockerComposeRunner <DockerComposeRunSettings>(context.FileSystem, context.Environment, context.ProcessRunner, context.Globber);
            List <string> arguments = new List <string>();

            arguments.Add(service);
            if (command != null)
            {
                arguments.Add(command);
            }
            arguments.AddRange(args);
            runner.Run("run", settings ?? new DockerComposeRunSettings(), arguments.ToArray());
        }