Tuesday, 17 January 2012

Automating Rails Development Environment Startup

I'm a fan of using Window Batch to automate repetitive tasks, so put together a little script that launches all the components of my Rails development environment.

On my system, all my Rails applications are stored in a base directory, along with a folder containing the following batch scripts. To launch the development environment for a particular Rails application, I can simply supply the batch file with the name of that application.

Each batch file contains the command to launch that component:
  • autotest.bat
  • server.bat
  • spork.bat
  • komodoedit.bat
Then these batch files are lauched via this batch file:
  • lde.bat
cd ..\%1 Moves up a directory from our scripts directory, then into our Rails directory. The %1 is the first argument supplied to the batch file - in our case, the name of the Rails application we want to work on.

%~dp0 is the path the batch file was launched from, so takes us back into our scripts directory, allowing us to launch the other batch commands from our Rails application directory.

To use this Rails development environment launcher, we simply open a command prompt, navigate to our useful scripts folder, and execute lde.bat with the name of the application we want to work on - for example:
 lde.bat myApplication
This will launch everything we need to continue developing as rapidly as possible!


Update 10-Feb-2012: 
Files published to public git repo :



As always, comments, opinions and suggestions are welcomed below!

No comments:

Post a Comment

Please leave a comment if you find this blog helpful or interesting! I'd love to hear from you!