Created
February 2, 2012 16:27
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias sequin='cd $DEV/sequin;rvm use 1.9.2-p290@sequin' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.