Skip to content

Instantly share code, notes, and snippets.

@rapimo
Created February 21, 2012 17:18
Show Gist options
  • Save rapimo/1877511 to your computer and use it in GitHub Desktop.
Save rapimo/1877511 to your computer and use it in GitHub Desktop.
iterm2 AppleScript for my Rails Project
-- ~/Library/Application\ Support/iTerm/Scripts/setup_rails.scpt
-- Thanks to http://www.worldgoneweb.com/2011/iterm2-advanced-features/#comment-20560
-- http://www.iterm2.com/#/section/documentation/scripting
tell application "iTerm"
activate
set myterm to (make new terminal)
set cd_to_my_project_path to ("cd ~/Projekte/my_awesome_project")
-- you can altenativly tell the first terminal
tell the first terminal
launch session "Panes"
tell the last session
set name to "guard"
write text cd_to_my_project_path
-- some guys use vim or textmate
write text "mine ."
write text "bundle exec guard"
end tell
tell application "System Events" to keystroke "d" using command down
delay 1
tell the last session
set name to "console"
write text cd_to_my_project_path
write text "bundle exec rails c"
end tell
tell application "System Events" to keystroke "D" using command down
delay 1
tell the last session
set name to "test_log"
write text cd_to_my_project_path
write text "tail -f log/test.log"
end tell
tell application "System Events" to keystroke "d" using command down
delay 1
tell the last session
set name to "unicorn"
write text cd_to_my_project_path
write text "bundle exec unicorn_rails --config-file config/unicorn.development.rb"
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment