Skip to content

Instantly share code, notes, and snippets.

@lrdiv
Created December 6, 2015 07:19
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrdiv/4dfb6b19ed82cbdf5002 to your computer and use it in GitHub Desktop.
Save lrdiv/4dfb6b19ed82cbdf5002 to your computer and use it in GitHub Desktop.
Scripting iTerm 2
(* Note: `cdnr` and `cdnem` are custom aliases for this project *)
tell application "iTerm"
(* Creates a new window for our project *)
set newWindow to (create window with default profile)
select first window
tell the current window
(* cd to rails directory and start server *)
activate current session
tell the current session
write text "cdnr;"
write text "thin start -C dev/thin.yml;"
end
(* creates a new tab *)
set newTab to (create tab with default profile)
select last tab
(* cd to rails directory and start sidekiq *)
tell the current session
write text "cdnr;"
write text "sidekiq;"
end tell
(* creates a new tab *)
set newTab to (create tab with default profile)
select last tab
(* cd to ember directory and start server *)
tell the current session
write text "cdnem;"
write text "ember s;"
end tell
(* creates a new tab *)
set newTab to (create tab with default profile)
select last tab
(* cd to rails directory *)
tell the current session
write text "cdnr;"
write text "clear;"
end tell
(* creates a new tab *)
set newTab to (create tab with default profile)
select last tab
(* cd to ember directory *)
tell the current session
write text "cdnem;"
write text "clear;"
end tell
end tell
end tell
@lrdiv
Copy link
Author

lrdiv commented Dec 6, 2015

The goal of this script is to create a new iTerm window with 5 tabs.
Tab 1) Runs the rails server
Tab 2) Runs sidekiq on the rails server
Tab 3) Runs the ember-cli server
Tab 4) cd to the rails application (for running bundle install or rake tasks)
Tab 5) cd to the ember application (for running npm install or bower install)

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