-
-
Save aenain/ee759ffb39db5d9fc84c to your computer and use it in GitHub Desktop.
#!/usr/bin/osascript | |
set homePath to POSIX path of (path to home folder) | |
set iTermAutomation to load script POSIX file (homePath & "tmuxinator.scpt") | |
set projectDir to homePath & "Desktop/Ruby/growth-republic/iview-prototype" | |
tell iTermAutomation | |
openFullScreenTerminal() | |
activateSessionAndRunCommand("git fetch") | |
splitPaneHorizontally() | |
activateSessionAndRunCommand("bin/rails c") | |
splitPaneVertically() | |
activateSessionAndRunCommand("redis") | |
splitPaneVertically() | |
activateSessionAndRunCommand("bundle exec sidekiq") | |
splitPaneVertically() | |
activateSessionAndRunCommand("bin/rails s") | |
end tell |
global projectDir | |
-- http://www.iterm2.com/#/section/documentation/scripting | |
on activateSessionAndRunCommand(cmd) | |
tell application "iTerm" | |
tell the last terminal | |
activate current session | |
tell current session | |
write text my goToProjectDir() | |
write text cmd | |
end tell | |
end tell | |
end tell | |
end activateSessionAndRunCommand | |
on splitPaneHorizontally() | |
tell application "iTerm" | |
tell the last terminal | |
tell i term application "System Events" to keystroke "d" using command down | |
end tell | |
end tell | |
end splitPaneHorizontally | |
on splitPaneVertically() | |
tell application "iTerm" | |
tell the last terminal | |
tell i term application "System Events" to keystroke "D" using command down | |
end tell | |
end tell | |
end splitPaneVertically | |
on openFullScreenTerminal() | |
tell application "iTerm" | |
activate | |
tell i term application "System Events" | |
-- new terminal with session | |
keystroke "n" using command down | |
delay 1.0 | |
-- fullscreen | |
keystroke return using command down | |
delay 3.0 | |
end tell | |
end tell | |
end openFullScreenTerminal | |
on goToProjectDir() | |
return "cd " & projectDir | |
end goToProjectDir |
@Kayne thanks for the feedback, I will check that as soon as I get Yosemite, probably over the weekend or next week.
@Kayne how do you run the script? I've quickly checked on Yosemite (after upgrade, not clean install though) and I am no longer able to run the config script directly from shell, but running it like this osascript ~/sample_config.applescript
does not lead to reproducing the error. Have you tried to recompile tmuxinator.scpt
using AppleScript Editor? [http://stackoverflow.com/questions/23398435/applescript-error-10810] suggests that either iTerm application could not be found or the process table is full. You can try to replace tell application "iTerm"
with tell application "Applications:iTerm.app"
(set the correct path to iTerm.app file, in my case it is in /Applications/iTerm.app).
Let me know if that helps :)
I implemented this in JS which is new in Yosemite if anyone is curious: https://gist.github.com/pmdarrow/96eb5fcc9c460336fc56.
This is very cool. I wish I had found it a few weeks ago. I just released iTermocil which is a command line tool for iTerm which allows you to easily configure sets of panes and commands:
https://github.com/TomAnthony/itermocil
I am a teamocil user, rather that tmuxinator, so iTermocil is compatible with teamocil files.
On Mavericks it works great, but on Yosemite I'm getting „execution error: An error of type -10810 has occurred. (-10810)”. Have any idea how to fix it? I'm pretty sure error comes from apple script function from tmuxinator.scpt.