Tuesday 13 September 2011

Starting the console ready for rails

Every time I start my computer I spend a couple of minutes getting the console set up the way I want it - I need spork and autotest running, I need the rails console and server - oh and I like to run both dev and production versions of these. It all takes time. Time to make it better.

In response to a question on stackexchange I got an answer that I've adapted. This requires adding the line

eval "$BASH_POST_RC"


at the end of .bashrc

Then in System > Preferences > Startup Applications
click on 'Add'
Name: Rails console
Command:

gnome-terminal --working-directory="/home/chris/development/bureaurails/trunk/server" --tab --title=Terminal --profile=Rails --tab --profile=Rails --title="Dev Console" -e 'bash -c "export BASH_POST_RC=\"rails console\"; exec bash"' --tab --profile=Rails --title="Dev Server" -e 'bash -c "export BASH_POST_RC=\"rails server\"; exec bash"' --tab --profile=Rails --title=Tail -e 'bash -c "export BASH_POST_RC=\"tail -f log/development.log\"; exec bash"' --tab --profile=Rails --title=Autotest -e 'bash -c "export BASH_POST_RC=\"bundle exec autotest\"; exec bash"' --tab --profile=Rails --title=Console -e 'bash -c "export BASH_POST_RC=\"rails console production\"; exec bash"' --tab --profile=Rails --title=Server -e 'bash -c "export BASH_POST_RC=\"rails server -e production -p 4000\"; exec bash"' --tab --profile=Rails --title=Spork -e 'bash -c "export BASH_POST_RC=\"bundle exec spork\"; exec bash"'

Comment: All you ever wanted in a rails console