Pregunta

I am learning to develop Rails on Windows. As the Rails implementation is far from perfect on Windows, I use a virtual machine to launch the various Rails tools and servers, using Vagrant.

Each time I start my environment, I do the following :

  • open 4 ConEmu Powershell tabs in my folder
  • in the first tab, subl ., then vagrant up and wait for it to finish
  • vagrant ssh (it uses the ssh client from my "Git for Windows" installation, I guess it's OpenSSH) in the first 3 tabs then cd /vagrant in each
  • in the first tab, rake db:migrate then rake test:prepare
  • in the first tab, rails s ; in the second tab, guard -pc
  • the fourth tab is just left alone, it's used for git commands

Can you envision a script, or a series of scripts, that can launch all these commands ? I can think of a convoluted way of how to open the 4 tabs and launch the vagrant ssh (I didn't check if it worked yet), but I don't even know if it's possible to handle ssh sessions this way.

¿Fue útil?

Solución

Here is your starting point. Create powershell script (RunVG.ps1 for example)

Start-Process "vagrant" "up" -Wait -NoNewWindow
Start-Process "vagrant" "ssh", "-new_console:s1THb" -Wait
Start-Process "vagrant" "ssh", "-new_console:s1TVb" -Wait
Start-Process "powershell" "-new_console:s2TVb"
& "vagrant" "ssh"

and run ConEmu with following command line (change path to RunVG.ps1 accordingly)

ConEmu /cmd powershell -NoExit -Command "C:\Vagrant\RunVG.ps1"

After finishing script execution you will get connected ssh in first three tab and powershell in fourth tab. Actually, you'll get 2x2 splits, not tabs. If you don't need splits - use plain "-new_console".

Now, you need only pass additional arguments into your ssh instances for running commands in your tabs. Consult with ssh manual or competent users.

UPD1 Pasting into console example (this must be called from ConEmu's console)

conemuc /GUIMACRO Paste(2,"echo abc\necho def\n")
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top