Skip to content

Instantly share code, notes, and snippets.

@nlindley
Created August 22, 2012 18:45
Show Gist options
  • Save nlindley/3428268 to your computer and use it in GitHub Desktop.
Save nlindley/3428268 to your computer and use it in GitHub Desktop.
Quick and dirty AppleScript to set up my terminal windows the way I like for a Rails project.
tell application "Finder"
set FolderPath to (choose folder default location alias ((home as text) & "RailsApps"))
set PosixPath to POSIX path of FolderPath
end tell
tell application "Terminal"
activate
-- Application folders
tell application "System Events" to tell process "Terminal" to keystroke "n" using command down
set the number of rows of front window to 72
set the position of front window to {100, 20}
do script "cd " & PosixPath & "app/models/" in front window
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script "cd " & PosixPath & "app/views/" in front window
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script "cd " & PosixPath & "app/controllers/" in front window
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script "cd " & PosixPath & "app/helpers/" in front window
-- Cucumber folders
tell application "System Events" to tell process "Terminal" to keystroke "n" using command down
set the number of rows of front window to 72
set the position of front window to {600, 20}
do script "cd " & PosixPath & "features/" in front window
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script "cd " & PosixPath & "features/step_definitions/" in front window
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script "cd " & PosixPath & "features/support/" in front window
-- Actually running the thing
tell application "System Events" to tell process "Terminal" to keystroke "n" using command down
set the number of rows of front window to 72
set the position of front window to {1100, 20}
do script "cd " & PosixPath & " && guard" in front window
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script "cd " & PosixPath & " && rails c" in front window
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script "cd " & PosixPath & " && rails s" in front window
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment