Пример #1
0
        /// <summary>
        ///     This uninstalls the plugin with the given name. If multiple plugins are given, multiple plugins will be
        ///     uninstalled.
        /// </summary>
        /// <remarks>Any dependencies of the plugin will also be uninstalled assuming no other plugin needs them.</remarks>
        /// <param name="names">Names of the plugins to uninstall</param>
        public void Uninstall(params string[] names)
        {
            var args = new ProcessArgumentBuilder();

            args.AppendAll("plugin", "uninstall");
            args.AppendAll(names.ToArray());
            Runner.Invoke(Settings, args);
        }
Пример #2
0
        /// <summary>
        ///     This installs multiple plugins at the same time with the given names or paths
        /// </summary>
        /// <param name="names">A list of names of plugins to install</param>
        /// <param name="configure">Optional settings to control the installation process</param>
        public void Install(IEnumerable <string> names, Action <VagrantPluginInstallSettings> configure = null)
        {
            var settings = new VagrantPluginInstallSettings();

            configure?.Invoke(settings);
            var args = new ProcessArgumentBuilder();

            args.AppendAll("plugin", "install");
            settings.GetToolArguments().Invoke(args);
            args.AppendAll(names.ToArray());
            Runner.Invoke(Settings, args);
        }
Пример #3
0
        /// <summary>
        ///     This takes a snapshot and pushes it onto the snapshot stack.
        /// </summary>
        /// <remarks>
        ///     <para>This is a shorthand for <see cref="Save" /> where you do not need to specify a name.</para>
        ///     <para>
        ///         Warning: If you are using <see cref="Push" /> and <see cref="Pop" />, avoid using <see cref="Save" /> and
        ///         <see cref="Restore" /> which are unsafe to mix.
        ///     </para>
        /// </remarks>
        public void Push()
        {
            var args = new ProcessArgumentBuilder();

            args.AppendAll("snapshot", "push");
            Runner.Invoke(Settings, args);
        }
        private ProcessArgumentBuilder GetArguments(ICakeEnvironment cakeEnvironment, string command, TSettings settings)
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll(cakeEnvironment, command, settings);
            return(builder);
        }
Пример #5
0
        private ProcessArgumentBuilder GetArguments(string host, string command, TSettings settings)
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll(new string[] { host, command }, settings, new string[0]);
            return(builder);
        }
Пример #6
0
        private ProcessArgumentBuilder GetArguments(string command, TSettings settings, string[] containers)
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll(command, settings, containers);
            return(builder);
        }
        private ProcessArgumentBuilder GetArguments(ProtocSettings settings, string[] files)
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll(settings, files);
            return(builder);
        }
Пример #8
0
        ProcessArgumentBuilder GetArguments(Dictionary <string, object> vmOptions, FilePath dartScriptFile, DartSettings settings)
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll(environment, vmOptions, dartScriptFile, settings);
            return(builder);
        }
Пример #9
0
        private ProcessArgumentBuilder GetArguments(string command, TSettings settings, IList <string> additional)
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll(new string[] { command }, settings, additional);
            return(builder);
        }
Пример #10
0
        private ProcessArgumentBuilder GetArguments(string command, TSettings settings, string[] files)
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll(new string[] { command }, settings, files);
            return(builder);
        }
        ProcessArgumentBuilder GetArguments(string command, ResourceHackerSettings settings)
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll(environment, command, settings);
            return(builder);
        }
        private ProcessArgumentBuilder GetArguments(TSettings settings, FilePath[] files)
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll(environment, settings, files);
            return(builder);
        }
Пример #13
0
            public void WhenToolPathIsSet_DoNotThrow()
            {
                TestSettings input = new TestSettings {
                    ToolPath = "tubo"
                };

                ProcessArgumentBuilder builder = new ProcessArgumentBuilder();

                builder.AppendAll(new string[] { "cmd" }, input, new string[] { "arg1" });
            }
Пример #14
0
        /// <summary>
        ///     This updates the plugins that are installed within Vagrant.
        /// </summary>
        /// <remarks>
        ///     If you specified version constraints when installing the plugin, this command will respect those constraints.
        ///     If you want to change a version constraint, re-install the plugin using
        ///     <see cref="Install(string,System.Action{Cake.Vagrant.Settings.VagrantPluginInstallSettings})" />
        /// </remarks>
        /// <param name="name">If a name is specified, only that single plugin will be updated</param>
        public void Update(string name = null)
        {
            var args = new ProcessArgumentBuilder();

            args.AppendAll("plugin", "update");
            if (name.HasValue())
            {
                args.Append(name);
            }
            Runner.Invoke(Settings, args);
        }
Пример #15
0
        /// <summary>
        ///     This command is the inverse of <see cref="Push" />: it will restore the pushed state.
        /// </summary>
        /// <param name="configure">Optional settings to control the restore</param>
        public void Pop(Action <VagrantSnapshotRestoreSettings> configure = null)
        {
            var settings = new VagrantSnapshotRestoreSettings(true);

            configure?.Invoke(settings);
            var args = new ProcessArgumentBuilder();

            args.AppendAll("snapshot", "pop");
            settings.GetToolArguments().Invoke(args);
            Runner.Invoke(Settings, args);
        }
Пример #16
0
        /// <summary>
        ///     This command saves a new named snapshot.
        /// </summary>
        /// <remarks>If this command is used, the <see cref="Push" /> and <see cref="Pop" /> subcommands cannot be safely used.</remarks>
        /// <param name="name">Name of the snapshot</param>
        /// <example>
        ///     <code><![CDATA[
        /// Vagrant.Snapshot.Save("CakeScript");
        /// ]]></code>
        /// </example>
        public void Save(string name)
        {
            if (!name.HasValue())
            {
                throw new ArgumentNullException(nameof(name));
            }
            var args = new ProcessArgumentBuilder();

            args.AppendAll("snapshot", "save", name);
            Runner.Invoke(Settings, args);
        }
        public void WhenOnlyPasswordIsSet_ArgumentIsRedacted()
        {
            var builder = new ProcessArgumentBuilder();

            builder.AppendAll("login", new DockerRegistryLoginSettings {
                Password = "******"
            }, new string[0]);

            var actual = builder.RenderSafe();

            Assert.That(actual, Is.EqualTo("login --password \"[REDACTED]\""));
        }
            public void WhenStringInput_AddsAsArgument()
            {
                TestSettings input = new TestSettings {
                    String = "tubo"
                };

                ProcessArgumentBuilder builder = new ProcessArgumentBuilder();

                builder.AppendAll("cmd", input, new string[] { "arg1" });
                var actual = builder.Render();

                Assert.That(actual, Is.EqualTo("cmd --string \"tubo\" arg1"));
            }
Пример #19
0
            public void WhenToolPathIsSet_DoNotIncludeIt()
            {
                TestSettings input = new TestSettings {
                    ToolPath = "tubo"
                };

                ProcessArgumentBuilder builder = new ProcessArgumentBuilder();

                builder.AppendAll(new string[] { "cmd" }, input, new string[] { "arg1" });
                var actual = builder.Render();

                Assert.That(actual, Is.EqualTo("cmd arg1"));
            }
Пример #20
0
        /// <summary>
        /// Creates arguments for the tool.
        /// </summary>
        /// <param name="command"></param>
        /// <param name="settings"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public static ProcessArgumentBuilder GetArguments(string command, TSettings settings, AssemblyOptionSettings[] args)
        {
            var builder = new ProcessArgumentBuilder();

            builder.Append(command);
            builder.AppendAll(settings);
            foreach (var arg in args)
            {
                var arguments = arg.CollectAll();
                var text      = string.Join(",", arguments);
                builder.Append($"/assembly=\"{arg.Assembly}\"{(arguments.Length > 0 ? ";": "")}" + text);
            }
            return(builder);
        }
Пример #21
0
            public void WhenStringInput_AddsAsArgument()
            {
                TestSettings input = new TestSettings {
                    String = "tubo"
                };

                ProcessArgumentBuilder builder = new ProcessArgumentBuilder();
                var environment = FakeEnvironment.CreateWindowsEnvironment();

                environment.WorkingDirectory = ".";
                builder.AppendAll(environment, input, new FilePath[] { "arg1" });
                var actual = builder.Render();

                Assert.That(actual, Is.EqualTo("--string=\"tubo\" arg1"));
            }
Пример #22
0
        /// <summary>
        ///     This command restores the named snapshot.
        /// </summary>
        /// <param name="name">Name of the snapshot to restore</param>
        /// <param name="configure">Optional settings to control the restore</param>
        public void Restore(string name, Action <VagrantSnapshotRestoreSettings> configure = null)
        {
            if (!name.HasValue())
            {
                throw new ArgumentNullException(nameof(name));
            }
            var settings = new VagrantSnapshotRestoreSettings();

            configure?.Invoke(settings);
            var args = new ProcessArgumentBuilder();

            args.AppendAll("snapshot", "restore", name ?? string.Empty);
            settings.GetToolArguments().Invoke(args);
            Runner.Invoke(Settings, args);
        }