Created
August 19, 2009 20:53
-
-
Save johnlauck/170643 to your computer and use it in GitHub Desktop.
Open a rails project terminal session using this AppleScript
This file contains 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
(* | |
Open Project | |
Open a Rails Project | |
opens git-sh, console, server, autospec and a command line | |
*) | |
on run | |
set dirs to {} | |
set commands to {} | |
set end of dirs to "/Users/john/code/rm" | |
set end of commands to "git-sh" | |
set end of dirs to "/Users/john/code/rm" | |
set end of commands to "script/console" | |
set end of dirs to "/Users/john/code/rm" | |
set end of commands to "script/server" | |
set end of dirs to "/Users/john/code/rm" | |
set end of commands to "AUTOFEATURE=true autospec" | |
set end of dirs to "/Users/john/code/rm" | |
set end of commands to "pwd" | |
repeat with index from 1 to count dirs | |
--set command to item index of commands | |
do_project(item index of dirs, item index of commands) | |
end repeat | |
end run | |
on new_terminal_tab() | |
tell application "Terminal" to activate | |
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down | |
end new_terminal_tab | |
on new_terminal_window() | |
tell application "Terminal" to activate | |
tell application "System Events" to tell process "Terminal" to keystroke "n" using command down | |
end new_terminal_window | |
-- this subroutine does the actual work | |
-- | |
on do_project(the_path, the_command) | |
--set the_path to POSIX path of this_item | |
tell application "Terminal" | |
if (count of windows) is 0 then | |
my new_terminal_window() | |
end if | |
activate | |
my new_terminal_tab() | |
do script with command "cd " & quoted form of the_path in window 1 | |
do script with command the_command in window 1 | |
activate | |
end tell | |
end do_project |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment