Nathan Colgate RSS

This is the personal blog of Nathan Colgate Clark. I work at Brand New Box. I developed a content management system for churches.

Archive

May
6th
Fri
permalink

Mac Bash / Shell Script To Launch Development Environment

As my rails apps get more complex, I find myself spending more time getting them booted up.  While this may not be a big deal for you, my early morning brain doesn’t do well with it.

After a bit of searching I found some code for launching rails server in a new terminal tab, opening text mate, launching delayed job in a new terminal tab, and opening the browser.

I put this in a file called rock_and_roll.sh in my Rails.root folder:


#!/bin/sh
osascript -e 'tell application "Terminal"' \
-e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \
-e "do script with command \"cd ~/path/to/my/app/;rails server;\" in selected tab of the front window" \
-e 'end tell' &> /dev/null

osascript -e 'tell application "Terminal"' \
-e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \
-e "do script with command \"cd ~/path/to/my/app/;rake jobs:work;\" in selected tab of the front window" \
-e 'end tell' &> /dev/null

mate .

open http://localhost:3000

Then all I gotta do:


$ cd /path/to/my/app/
$ . rock_and_roll.sh