private void RunVagrantAction(string action, VagrantMachine machine)
        {
            string command;

            if (action == "up")
            {
                command = String.Format("vagrant up{0}", !String.IsNullOrEmpty(machine.Instance.ProviderIdentifier) ? String.Format(" --provider={0}", machine.Instance.ProviderIdentifier) : "virtualbox");
            }
            else if (action == "reload")
            {
                command = "vagrant reload";
            }
            else if (action == "suspend")
            {
                command = "vagrant suspend";
            }
            else if (action == "halt")
            {
                command = "vagrant halt";
            }
            else if (action == "provision")
            {
                command = "vagrant provision";
            }
            else if (action == "destroy")
            {
                command = "vagrant destroy -f";
            }
            else if (action == "rsync")
            {
                command = "vagrant rsync";
            }
            else
            {
                return;
            }

            Process process = new Process();

            process.StartInfo.FileName               = "cmd";
            process.StartInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.Arguments              = String.Format("/C cd /d {0} && {1} {2}", Util.EscapeShellArg(machine.Instance.Path), command, Util.EscapeShellArg(machine.Name));

            TaskOutputWindow outputWindow = new TaskOutputWindow
            {
                Task        = process,
                TaskCommand = process.StartInfo.Arguments,
                TaskAction  = command,
                Target      = machine
            };

            outputWindow.Show();
        }
Exemple #2
0
        public void NativeMenuItemDestroyMachine(VagrantMachine machine)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to destroy this machine?", "Confirm Destructive Action", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                this.PerformAction("destroy", machine);
            }
        }
Exemple #3
0
 public void PerformVagrantAction(string action, VagrantMachine machine)
 {
     if (action == "ssh")
     {
         action = String.Format("cd /d {0} && vagrant ssh {1}", Util.EscapeShellArg(machine.Instance.Path), machine.Name);
         this.RunTerminalCommand(action);
     }
     else
     {
         this.RunVagrantAction(action, machine);
     }
 }
Exemple #4
0
 private void PerformAction(string action, VagrantMachine machine)
 {
     Delegate.PerformVagrantAction(action, machine);
 }
Exemple #5
0
 public void NativeMenuItemRsyncAutoMachine(VagrantMachine machine)
 {
     this.PerformAction("rsync-auto", machine);
 }
Exemple #6
0
 public void NativeMenuItemProvisionMachine(VagrantMachine machine)
 {
     this.PerformAction("provision", machine);
 }
Exemple #7
0
 public void NativeMenuItemHaltMachine(VagrantMachine machine)
 {
     this.PerformAction("halt", machine);
 }
Exemple #8
0
 public void NativeMenuItemReloadMachine(VagrantMachine machine)
 {
     this.PerformAction("reload", machine);
 }
Exemple #9
0
 public void NativeMenuItemSuspendMachine(VagrantMachine machine)
 {
     this.PerformAction("suspend", machine);
 }
Exemple #10
0
 public void NativeMenuItemSSHMachine(VagrantMachine machine)
 {
     this.PerformAction("ssh", machine);
 }
Exemple #11
0
 public void NativeMenuItemUpMachine(VagrantMachine machine)
 {
     this.PerformAction("up", machine);
 }