Skip to content

Instantly share code, notes, and snippets.

@a-bash
Forked from oliverbarnes/start_on_project.scpt
Created April 6, 2012 15:56
Show Gist options
  • Save a-bash/2320984 to your computer and use it in GitHub Desktop.
Save a-bash/2320984 to your computer and use it in GitHub Desktop.
Automating iterm 2 sessions for a rails 3 project using applescript
-- open terminal sessions
tell application "iTerm 2"
activate
set myterm to (make new terminal)
tell myterm
-- start mongo
launch session "Default"
tell the last session
write text "cd ~/Projects/killerapp; bundle exec rake mongo:start"
end tell
-- start redcar
launch session "Default"
tell the last session
write text "cd ~/Projects/killerapp; redcar ."
end tell
-- wait for mongo to finish starting up
delay 5
-- start server
launch session "Default"
tell the last session
write text "cd ~/Projects/killerapp; rails server"
end tell
-- start spork
launch session "Default"
tell the last session
write text "cd ~/Projects/killerapp; bundle exec spork cucumber & bundle exec spork &"
end tell
-- now wait for spork to finish starting up
delay 20
-- run tests for the first time
launch session "Default"
tell the last session
write text "cd ~/Projects/killerapp; bundle exec cucumber ; bundle exec rspec"
end tell
end tell
end tell
--way for server to finish starting up
delay 10
-- open localhost and dev site on chrome
tell i term application "Google Chrome"
activate
set mywindow to (make new window)
tell active tab of mywindow
set URL to "http://localhost:3000/"
end tell
tell mywindow
set newTab to make new tab with properties {URL:"http://killerapp.heroku.com/"}
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment