Skip to content

Instantly share code, notes, and snippets.

@hoolymama
Created February 2, 2012 16:27
Show Gist options
  • Save hoolymama/1724390 to your computer and use it in GitHub Desktop.
Save hoolymama/1724390 to your computer and use it in GitHub Desktop.
Applescript functions to set up iTerm and start working on a rails project.
alias sequin='cd $DEV/sequin;rvm use 1.9.2-p290@sequin'
on make_session(namestr, col, project, command)
tell application "iTerm"
tell the last terminal
set mysession to (make new session at the end of sessions)
tell mysession
set name to namestr
set background color to col
exec command "/bin/bash"
write text project
write text command
end tell
end tell
end tell
end make_session
on make_rails_terminal(project)
tell application "iTerm"
activate
set myterm to (make new terminal)
end tell
make_session("server", "0.0 0.0 0.3", project, "thin start")
make_session("console", "0.3 0.0 0.0", project, "rails console")
make_session("test", "0.2 0.2 0.2", project, "")
make_session("shell", "0.2 0.0 0.2", project, "mate .")
make_session("log", "0.2 0.2 0.0", project, "tail -f log/development.log")
end make_rails_terminal
property mrt : load script POSIX file ((the POSIX path of (path to home folder)) & "Library/Application Support/iTerm/include/rails_shells.scpt")
tell mrt
make_rails_terminal("sequin")
end tell
@hoolymama
Copy link
Author

Add items to the Scripts menu in iTerm that will set up shells and stuff for a rails project. Change sequin to the name of your rails project.
In ~/Library/Application\ Support/iTerm make the directories: include and Scripts.
move rails_shells.scpt into include
move sequin.scpt into Scripts
Now when you next open iTerm the script sequin will appear in the menu.

To make it work, you have to have set up a gemset and an alias in your bashrc that will cd to the project directory and set the environment to your gemset as in the gist .bashrc above.

Alternatively, you could change directory and set the gemset explicitly in the applescript. I just like to have that alias available anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment