Ruby on Rails OSX Console Aliases 2
I found that every day when I goto work in the morning I do the same things whenever I go to work on a rails project:
- open firefox
- open iTerm
- cd ~/Code/railsprojectx
- mate .
- script/server
- open another tab in iTerm
- svn update
- goto http://localhost:3000
Sure it only takes a few seconds, but it wasn't very DRY. :) I figured I could create a shell alias to basically reduce all that to a single command. I also thought I'd finally start giving mongrel a try. So this is what I came up with for an rdev command (along with a bunch of my other rails related aliases):
alias rdev='svn update;mate .;mongrel_rails start -d;sleep 2;open http://localhost:3000;tail -f log/development.log'
alias ss='script/server'
alias sc='script/console'
alias sg='script/generate'
alias sp='script/plugin'
alias sr='script/runner'
alias rt='rake test'
alias rtu='rake test:units'
alias rtr='rake test:recent'
alias mr='mongrel_rails start -d'
alias mrs='mongrel_rails stop'Just stick that in your ~/.profile file and either reopen your console or run:
. ~/.profileTrackbacks
Use the following link to trackback from your own site:
http://juju.org/articles/trackback/892
Juju
Another technique that I use is doing rake tasks... seems like a good fit.
I do the same thing. :-) I typically have a few projects on the go, so I write a script for each one. When I want to start working on a new project, I just source the relevant script.
I also use pushd and popd so that I can run (say, ) console from wherever I happen to be without cd'ing to $PROJECT.