This post originated from an RSS feed registered with Ruby Buzz
by James Britt.
Original Post: Yet Another Handy Ruby-on-Windows Script
Feed Title: James Britt: Ruby Development
Feed URL: http://feeds.feedburner.com/JamesBritt-Home
Feed Description: James Britt: Playing with better toys
I do most of my Ruby development on Windows. But most of my time is spent in either gvim or the command line.
When I work on an application, I typically have at least two cmd shells running. One is for the main code directory, and one is for running ICE WATIR, my test-script-server WATIR add-on, which is extremely handy for running tests against a Web application.
It's easy enough to open up these windows by hand (provided you've told File Explorer how to do "Open Command Window Here" form the context menu). But tedious if you find yourself doing it over and over.
So the root dir of each application source tree now tends to have a Ruby file with code like this:
[
'start "The App Name" cd rails',
'start "Test" cd rails\test\ice_watir'
].each do |c|
Thread.new( c ) { |cc| puts `#{cc}`}
end
Each line of the array is a command to start a new shell with a given title, executing a given command ('cd someplace', in this case).
I also make a point of changing the background and text colors of the cmd windows, and tell the shell to use those colors whenever the given window title is used. This way I can quickly tell the shells apart without having to read the window title.
When I go to work on a project, I run the script and start up the needed shells, all nicely titled and colored, each starting in the proper directory.
Oh, one more handy script: You can start an instance of File Explorer for the current directory by running this:
start explorer .,/e
That trailing ,/e tells Explorer to use a two-paneled tree view.
That's too much to type on a regular basis, so I have a batch file for this, named e.bat, someplace in my PATH.
I can now simply run e to pop open a Explorer window.
For doing the same for arbitrary directories, I use a batch file with this: