This is just a merely a back up of my script that I use to open all of the windows that I need on iTerm including firing up autotest logs server and mate
#!/bin/sh
if [[ $# == 0 ]]; then
PROJECT_DIR=$PWD
elif [[ $# == 1 && -d "$1" ]]; then
PROJECT_DIR="$@"
else
print "usage: iterm.sh [rails project directory]"
return 1
fi
osascript <<-eof
tell application "iTerm"
make new terminal
tell the last terminal
activate current session
launch session "Default Session"
tell the last session
set name to "konsole"
write text "cd \"$PROJECT_DIR\""
write text "./script/console"
end tell
launch session "Default Session"
tell the last session
set name to "server"
write text "cd \"$PROJECT_DIR\""
write text "./script/server"
end tell
launch session "Default Session"
tell the last session
set name to "LOGS"
write text "cd \"$PROJECT_DIR\""
write text "tail -f log/development.log"
end tell
launch session "Default Session"
tell the last session
set name to "EXECUTOR"
write text "cd \"$PROJECT_DIR\""
write text "clear"
write text "mate ."
end tell
launch session "Default Session"
tell the last session
set name to "Auto Test"
write text "cd \"$PROJECT_DIR\""
write text "autotest -rails"
end tell
end tell
end tell
eof
Usage
chmod 755 terminal_helper.sh
cd #{project_directory}
./terminal_helper.sh