achiurizo / consular Goto Github PK
View Code? Open in Web Editor NEWTerminal automation
Home Page: http://rdoc.info/github/achiu/consular/master/file/README.md
License: MIT License
Terminal automation
Home Page: http://rdoc.info/github/achiu/consular/master/file/README.md
License: MIT License
It could be useful to send some keystrokes to the system (not just the Terminal window). This way one could ask SizeUp to resize/move the windows, โฆ
I would like to encourage you to support the XDG base directory standard (http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html). The upshot of which means using ~/.config/terminator/
instead of ~/.terminator/
. (Of course backward compatibility can be maintained).
I try to encourage projects to use XDG whenever it applies. It a good standard that's becoming increasing popular and has a number of benefits, in particular uncluttering our home directories of all those dot files.
Right now we can create tabs, also add support for creating new windows as well.
after an upgrade to 0.2.0 termitor fails loding this workflow:
tab "echo 'mongod and redis'", "mongod &", "redis-server &"
tab "echo 'a2b_seo server'", "cd ~/Documents/rails/a2b_seo_mfg/", "rails s -p 4002"
tab "echo 'a2b_seo console'", "cd ~/Documents/rails/a2b_seo_mfg/", "rails c"
tab "a2bapi" do
run "cd ~/Documents/rails/a2b_seo_mfg/"
run "mate ."
run "open http://localhost:4002/mitfahrgelegenheit"
run "rake log:clear"
run "ls"
run "git st"
end
terminitor-0.2.0/lib/terminitor/abstract_core.rb:31:in `run_in_window': undefined method `each_pair' for nil:NilClass (NoMethodError)
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.2.0/lib/terminitor/abstract_core.rb:21:in `process!'
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.2.0/lib/terminitor/runner.rb:30:in `execute_core'
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.2.0/lib/terminitor/cli.rb:13:in `start'
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.3/lib/thor/task.rb:22:in `run'
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.3/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.3/lib/thor.rb:246:in `dispatch'
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.3/lib/thor/base.rb:389:in `start'
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.2.0/bin/terminitor:3:in `<top (required)>'
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/bin/terminitor:19:in `load'
from /Users/nofail/.rvm/gems/ruby-1.9.2-p0/bin/terminitor:19:in `<main>'
Refactor terminal manipulation to use an adapter. Allow easy contributions for other platforms. Add a guide for adding a new adapter.
class AbstractTerminal; end;
class MacTerminal; end;
class DebianTerminal; end;
# ...
Would something like this be possible? If not it sure would be handy:
We should be able to share our projects online and allows other people to download and easily execute the project workflows others created.
I created a Termfile using terminitor create
and added my commands. The problem is all tabs open to the home directory, rather than to the working directory. I remember in version 0.5 I could have them open in the working directory. I don't know if this is a bug or a feature.
Here is my Termfile:
terminitor delete foo
should remove the file in yml
Defining projects in ruby could give us a heap of flexibility. Allowing commands to be modified by console arguments is something that would be very awkward otherwise.
Below is my idea of a very nice project definition.
To open the project with two tabs - "main", and "log", and in the development environment:
terminitor start mewzet --tabs ml -e production
~/.terminitor/mewzet.rb:
opts = Trollop::options do
opt :tabs, "Specify which tabs to open - m => main, l => log, i => irb", :short => 't', :default => "mli"
opt :environment, "The rails environment", :short => 'e', :default => "development"
end
def mtab (name, opt)
return unless opts["tabs"].include? opt
tab name do
# we usually want to start from the projects root:
run "cd /Users/Arthur/Work/mewzet.com/current"
yield
end
end
window "Mewzet Project" do
mtab "main", "m" do
run "gitx"
run "mate ."
# get passenger warmed up:
run "touch tmp/restart.txt; curl mewzet.local > /dev/null"
end
mtab "log", "l" do
run "tail -f log/#{opts['environment']}.log"
end
mtab "irb", "i" do
run "irb -e #{opts['environment']}"
end
Note that this all become possible with nesquena's "New sexy dsl syntax" - http://github.com/achiu/terminitor/issues#issue/15
The extra features of my project - all tabs cd to the same dir, the rails environment can be specified, and we can choose which tabs to open - are all defined in my project.
I wanted to set up 2 windows, one of them miniaturized. But all tabs opened in the same window, and I saw the error below in the first tab where I had run the command.
Error setting 'miniaturized = true' on app("/Applications/Utilities/Terminal.app").windows.ID(5177).tabs[1]
CommandError
OSERROR: -1728
MESSAGE: Can't get reference.
OFFENDING OBJECT: app("/Applications/Utilities/Terminal.app").windows.ID(5177).tabs[1].miniaturized
COMMAND: app("/Applications/Utilities/Terminal.app").windows.ID(5177).tabs[1].miniaturized.set(true)
This is what my Termfile looks like.
I just tried to install terminator (gem install terminator
) and it actually worked normally. But when I try to use it, the terminator command is not found. I am using the latest version of rvm (HEAD) and I tried to install terminator with ruby 1.9.2 and ruby 1.8.6. I never got any error messages. When I look at the gemdir, the terminator executable is not present in the bin directory, but all the other files are present in the other directories (cache, doc, gems and specifications). I am using Mac OS X 10.6.5 and Terminal Version 2.1.1 (273).
While executing terminitor open
for a Termfile specifying multiple windows and tabs on OS X with the keyboard layout set to "Dvorak - Qwerty Cmd" only the very last window or tab specified remains open. All other windows and tabs execute but then immediately close.
Workaround: switch to "U.S." keyboard (System Preferences > Language & Text > Input Sources) and run terminitor open
then switch back to "Dvorak - Qwerty Cmd".
When I run terminitor start project
all of my tabs/windows open correctly but the prompts are garbled with content like: "% \e]2;terminal\a" and "% \e]2;resque\a" etc.
I'm using zsh and I think it has to do with my terminal color setup. Anyone know how to fix this?
Note that this is tied to the feature request for the ability to create windows and not just tabs.
When a new window is created the ability to call a hotkey on the new window is very desirable. If you use SizeUp or another layout management application, being able to call a hotkey on individual terminal windows to put two stacked terminals on the left and one large terminal on the right, for instance, would be massively cool and functional. It is part of my "set up my terminal for this project" routine, and automating it would relieve a pretty ugly pain point I have when organizing my project workspace.
It would be very useful if the tab name were set to the same name defined in the workspace file. You can do this by setting PS1:
PS1=$PS1"\e]2;Tab Name Here\a"
This preserves the user's current prompt setting while setting the title. I'm putting that as the first line in the workflow for now:
When I first set up Terminitor for my project, most commands didn't work because /usr/local/bin wasn't in the PATH. I found out that this was because Terminitor starts $SHELL in new tabs, and $SHELL points to /bin/bash, but calling /bin/bash starts Bash in non-login mode which doesn't read the contents of /etc/profile, only /bin/bash --login causes this file to load. I've fixed it by setting SHELL="/bin/bash --login" in .bash_profile, but I'm wondering if there isn't a better way to do this from inside Terminitor... If not, then maybe it's worth adding that to the docs? I suppose there must be more people than just me that have this problem.
and verify open task for yml still works and remove from readme
After we have adapters, create an iTerm Adapter
Support linux tab opening through separate script, make Mac OS X terminal controller into an Adapter.
class MacTerminal < AbstractTerminal
class DebianTerminal < AbstractTerminal
to make this easy to extend.
I normally ser a diffrerent theme when I'm SSHing to the server.
it should be possible to set the theme of the tab through apple script, but I'm quite a newbie in apple script, so I guess you guy could help me in this case.
window("name") do
run "ls"
end
This fails, complaining about << not being able to be used on a hash.
I believe the @_context or @_old_context is not being set correctly when a window is created.
Am I just "doing it wrong"?
If I add a tab on the window it works -- but I just want to execute code in the new window, nothing more.
The bounds settings in following snippet work fine for me in Terminal, but not in iTerm. Here the bounds have no effect:
window :name => "1", :bounds => [0,1060, 630, 1600] do run "cd ~/myProject/" run "mvim" end window :name => "2" do run "cd ~/myProject/" run "rails server" end
Allow a cold task to be run that is an intial setup:
define cold task to clone or setup a git repo:
$ terminitor project --cold
will execute a setup
This only happens occasionally - and when I rerun the command, it works properly.
/Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.0.5/lib/terminitor/runner.rb:55:in open_tab': undefined method
tabs' for 1..1:Range (NoMethodError)
from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.0.5/lib/terminitor/runner.rb:19:in block in do_project' from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.0.5/lib/terminitor/runner.rb:15:in
each'
from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.0.5/lib/terminitor/runner.rb:15:in do_project' from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.0.5/lib/terminitor.rb:20:in
start'
from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.2/lib/thor/task.rb:22:in run' from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.2/lib/thor/invocation.rb:118:in
invoke_task'
from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.2/lib/thor.rb:246:in dispatch' from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/thor-0.14.2/lib/thor/base.rb:389:in
start'
from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/gems/terminitor-0.0.5/bin/terminitor:3:in <top (required)>' from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/bin/terminitor:19:in
load'
from /Users/nicholaswyoung/.rvm/gems/ruby-1.9.2-p0/bin/terminitor:19:in `
~ $ gem install terminitor
Building native extensions. This could take a while...
ERROR: Error installing terminitor:
ERROR: Failed to build gem native extension.
/home/roman/.rvm/rubies/ree-1.8.7-head/bin/ruby extconf.rb
create /home/roman/.rvm/gems/ree-1.8.7-head@rails3/gems/rb-appscript-0.6.1/src/osx_ruby.h ...
create /home/roman/.rvm/gems/ree-1.8.7-head@rails3/gems/rb-appscript-0.6.1/src/osx_intern.h ...
creating Makefile
make
Makefile:184: warning: overriding commands for target `/home/roman/.rvm/gems/ree-1.8.7-head@rails3/gems/rb-appscript-0.6.1/lib'
Makefile:182: warning: ignoring old commands for target `/home/roman/.rvm/gems/ree-1.8.7-head@rails3/gems/rb-appscript-0.6.1/lib'
gcc -I. -I/home/roman/.rvm/rubies/ree-1.8.7-head/lib/ruby/1.8/x86_64-linux -I/home/roman/.rvm/rubies/ree-1.8.7-head/lib/ruby/1.8/x86_64-linux -Isrc -fPIC -g -O2 -Wall -c src/SendThreadSafe.c
In file included from src/SendThreadSafe.c:75:0:
src/SendThreadSafe.h:73:53: fatal error: ApplicationServices/ApplicationServices.h: No such file or directory
compilation terminated.
make: *** [SendThreadSafe.o] Error 1
Gem files will remain installed in /home/roman/.rvm/gems/ree-1.8.7-head@rails3/gems/rb-appscript-0.6.1 for inspection.
Results logged to /home/roman/.rvm/gems/ree-1.8.7-head@rails3/gems/rb-appscript-0.6.1/./gem_make.out
Hi,
I try to use terminitor with iTerm2. I could not find how to set the title of a tab. I've tried:
tab :name => "console" do
run "rails console"
end
but without success, the new tab is titled with the default tab title "Shell".
I have a number of tabs that are dependent on the completion of a set of commands in tab 1 (a git pull and a rake db:migrate, for example). It would be great if I could have the other tabs wait for the completion of every command in tab 1.
I'd be happy to build this out, but I wasn't sure if you had a design strategy in mind.
This seems to work (inside open_tab):
session.name.set(options[:name]) if options[:name]
I'm using a very simple Ruby DSL but always get this:
/Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/cores/mac_core.rb:18:in execute_command': undefined method
do_script' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:34:in run_in_window' from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:33:in
each'
from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:33:in run_in_window' from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:30:in
each_pair'
from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:30:in run_in_window' from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/abstract_core.rb:21:in
process!'
from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/runner.rb:21:in send' from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/runner.rb:21:in
execute_core'
from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/lib/terminitor/cli.rb:13:in start' from /Library/Ruby/Gems/1.8/gems/thor-0.14.1/lib/thor/task.rb:22:in
send'
from /Library/Ruby/Gems/1.8/gems/thor-0.14.1/lib/thor/task.rb:22:in run' from /Library/Ruby/Gems/1.8/gems/thor-0.14.1/lib/thor/invocation.rb:118:in
invoke_task'
from /Library/Ruby/Gems/1.8/gems/thor-0.14.1/lib/thor.rb:246:in dispatch' from /Library/Ruby/Gems/1.8/gems/thor-0.14.1/lib/thor/base.rb:389:in
start'
from /Library/Ruby/Gems/1.8/gems/terminitor-0.1.0/bin/terminitor:3
from /usr/bin/terminitor:19:in `load'
from /usr/bin/terminitor:19
Being able to delay the execution of some commands would be awesome. An example is delaying my command to open Firefox to my rails app ( open -a /Applications/Firefox.app 'http://raidfive.local:3000' ) for a few seconds until my rails server has been most likely started up fully. I'm not sure if this is possible, but just a suggestion.
Is there a way to use the first tab rather than opening a second to run the first set of tab commands?
i started rails server in one tab and autotest in another.
But autotest fails because server isn't started.
So, is there any way to pause the second command from firing for few seconds so that rails server is started?
Building native extensions. This could take a while...
ERROR: Error installing terminitor:
text-hyphen requires Ruby version < 1.9.
Add a fetch command that takes a github username and github repo and runs the cold and instructions from the termfile
terminitor fetch achiu rack_recaptcha
and this can download the Termfile from the repo and download and execute cold and instructions.
It would be awesome if there was a way of creating new split panes within iTerm 2 in addition to tabs. Something like the following would be cool but I feel it might be clobbering your lovely syntax.
tab :split => "vertically" do
pane "gitx"
pane "ls"
end
DSL should have command to close current tab (or ability to send keystrokes).
In my workflow I'm creating new window and I want to close current active window.
Improve our syntax to use ruby for a better dsl description of tabs and windows:
# ~/.terminitor/foo.rb
setup do
# setup here for cold run
end
window "foo" do
tab "bar" do
run "cd /foo/bar/baz"
end
tab "baz" do
run "gitx"
end
end
Howdy! I just downloaded 0.3.1 and got this error when running terminitor start PROJ
:
/Library/Ruby/Gems/1.8/gems/terminitor-0.3.1/lib/terminitor/abstract_core.rb:40:in `[]': odd number of arguments for Hash (ArgumentError)
This is probably a 1.8.6 thing, so, I apologize, that's just what I have. Anyways here's the failing line in abstract_core.rb:
window_options = Hash[window_options.to_a + tab_options.to_a] # safe merge
My project file looks like this:
window do
before "cd ~/code/work/mandelbrot/advertiser"
tab "rails s"
tab "ls"
tab "tail -f log/test.log"
tab "spork"
tab "rake jasmine"
end
So, that line in abstract_core.rb above evaluates to:
window_options = Hash[[]]
which is causing the "odd number of arguments" error. If I change that line to
window_options = Hash[*(window_options.to_a + tab_options.to_a)] # safe merge
then it seems to work.
The way I've found I use terminitor is that I have a project that lives in a certain directory. If I want to open multiple tabs, I have to put "cd /path/to/project" as the first command for each tab. It would be nice if I could specify that once, perhaps something like:
before do
run "cd /path/to/project"
end
tab "one" do
run "padrino start -p 3000"
end
tab "two" do
run "compass compile"
end
It could even work within windows...
window do
before { ... }
tab { ... }
tab { ... }
end
Terminitor returns the same command-not-found error with every shell that I've tried on my Mac:
[~] terminitor open foo
skip .terminitor/foo.yml
/Users/me/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/erb.rb:719: command not found: /Users/me/.terminitor/foo.yml
I can't figure out what it's trying to do? I had problems with my first terminitor setup file (same error) so I copied the foo.yml file verbatim as a test. Same error both times. It cites the name of the file in the command-not-found error.
I don't understand the 'skip' line in the output?
When terminitor opens tabs I would prefer that they open in the same order that I define them in the termfile (I'm just particular like that). I notice that tabs are stored in a hash in dsl.rb, so probably in Ruby 1.9 the tabs are opened in order, but in 1.8 that's not the case. So probably all that needs to happen is to change it to an OrderedHash (can we include only that from ActiveSupport?).
People should be able create a Termfile
which contains the script to execute to setup development of their particular project. A bundler for local development.
For instance, a project 'foo' is in a git repo. A new developer can do this:
$ git clone git://path/to/foo.git
$ bundle install
$ terminitor start
and bundler will install dependencies and terminitor would start the preferred local development for that project in your terminal (open up gitx, start autotest, open default text editor, etc)
When I attempted to run "terminator init", with Mac OS X - Terminal, I received an error with rb-appscript-0.5.3. Upon updating that gem to 0.6, everything worked fine. It seems line 20 of terminator.gemspec needs to be:
s.add_dependency "rb-appscript", "~>0.6"
After we setup Adapters, Build a Linux Adapter.
Allow a terminit gist to be run automatically:
$ terminitor start http://gist.github.com/5674
This will execute the gist.
The Github gem this depends on, depends in turn on "text-hyphen" which is incompatible with Ruby 1.9.
We need a concept of re-usable tasks that can be applied in a project.
We need to add a 'list' task that prints out available commands to run.
terminitor list
Just like the title suggests it would be nice to allow the user to create a set of windows and not just tabs. I've forked the project and will try to whip something up, but until you receive a pull request please consider adding this functionality.
Note that this is related to a feature request allowing you to call a hotkey on a new window in order to automatically lay out new windows using something like SizeUp.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.