Simply define each tab and declare the commands. Note that the session for each tab is maintained, so you just declare actions here as
you would manually type in the terminal. Note that the title for each tab(namely tab1, tab2) are arbitrary, and can be named whatever you want.
They are simply placeholders for the time being for upcoming features.

To use the legacy syntax, you can invoke it with terminitor like so:

$ terminitor edit foo --syntax yml

It is recommended that you move over to the newer Ruby DSL Syntax as it
provides more robust features, however terminitor will still support the older
YAML syntax.

Ruby DSL Syntax

setup 'echo "setup"' # code to run during setup
# open a tab in current window with these commands
tab "echo 'default'", "echo 'default tab'"
window do
before { run 'cd /path' } # run this command before each command.
run 'padrino start' # run in new window
tab "echo 'first tab'", "echo 'of window'" # create a new tab in window and run it.
tab "named tab" do
run "echo 'named tab'"
run "ls"
end
end

The newer Ruby DSL syntax allows for more complicated behavior such as window creation as well as setup blocks that can be executed prior loading a project.

Tabs

to create tabs, we can simply invoke the tab command with either the command arguments like:

tab "echo 'hi'", "gitx"

or even pass it a block:

tab do
run "echo 'hi'"
run "mate ."
end

Windows

to create windows, we can simply invoke the window command with a block containing additional commands like:

window do
run "whoami" # Runs the command in the current window.
tab "echo 'hi'" # Creates another tab
tab "mate ." # And another
tab do # Last hoorah
run "open http://www.google.com"
end
end

Before

Sometimes you'll want to create a few commands that you want to run in each tab instance. You can do that with 'before':

before { run "cd /path" } # execute this command before other commands in the default window
run "whoami"
tab 'uptime'
# In this instance, "cd /path" wil be executed in the default window before 'whoami'
# and also in the tab before 'uptime'.
# You can also use this inside a specific window context:
window do
before 'cd /tmp'
run 'watchr test.watchr' # "cd /tmp" first than run watchr
tab do
run 'padrino start' # "cd /tmp" is ran beforehand and then padrino start is executed
end
end

Setup

The setup block allows you to store commands that can be ran specifically before a project and can be defined with:

the command arguments:

setup "bundle install", "gitx"

or with a block:

setup do
run "echo 'hi'"
run "bundle install"
run 'git remote add upstream git://github.com/achiu/terminitor.git'
end

Once defined, you can invoke your projects setup with:

terminitor setup my_project

Settings

currently only available for Mac OSX Terminal

You can also set settings on each of your tabs and windows. for example, this is possible:

This will create a tab with a title of 'named tab' using Terminals 'Grass' setting.

How about a window with a specific size:

window :bounds => [10,20,300,200] do
end

Currently, the following options are available:

tabs

:settings - [String] Set the tab to terminal settings

:selected - [Boolean] Sets whether the tab is active

:miniaturized - [Boolean] Sets whether its miniaturized

:visible - [Boolean] Sets whether its visible

windows

:bounds - [Array] Sets the bounds

:miniaturized - [Boolean] Sets whether its miniaturized

:visible - [Boolean] Sets whether its visible

Running Terminitor Projects

Once the project file has been declared to your satisfaction, simply execute any project defined in the ~/.config/terminitor directory with:

$ terminitor start foo

This will execute the steps and create the tabs defined and run the various options as expected. That's it. Create as many project files with as many tabs
as you would like and automate your workflow.

Removing Terminitor Projects

If you no longer need a particular project, you can easily remove the terminitor file for the project:

$ terminitor delete foo

to remove a legacy yml syntax file you can run:

$ terminitor delete foo -s=yml

Listing Terminitor Projects

You can also see a full list of available projects with:

$ terminitor list

This will print out the available project files that you can execute. The list also returns whatever text you have in the first comment of each terminitor script.

Creating Termfile for Repo

In addition to creating 'local' projects which can run on your computer (and are stored in your home directory), we also
optionally allow you to create a Termfile within any directory and then you can execute this any time to setup the
environment for that particular project source.

For example, let's say I am in /code/my/foo/project directory which is
a Sinatra application. This application might have a Gemfile which includes all dependencies. You can also generate a Termfile
which contains the ideal development setup for OSX. To generate this file, invoke:

$ terminitor create

This will generate a 'Termfile' in the current project directory and open the file to be edited in the default text editor. The format
of the file is using the new Ruby DSL as described above in the previous section. You should note that the project directory is automatically
the working directory for each tab so you can just say mate . and the project directory containing the Termfile will open.

Now, when you or another developer clones a project, you could simply:

This would clone the project repo, and then install all dependencies and then launch the ideal development environment for the project. Clearly
this makes assumptions about the user's system setup right now, but we have some ideas on how to make this work more effectively on
different configurations in the future.

In addition, you are in the project folder and you wish to remove the Termfile, you can invoke the command:

$ terminitor delete

This will clear the Termfile for the particular project.

Capturing Terminal Settings with Terminitor

Currently Mac OSX Terminal only
Terminitor has the ability to also capture your terminal setup and settings simply with:

$ terminitor edit my_project --capture

this will open up a new terminitor project with the captured settings for you to continuing modifying as you see fit.

Fetching Github Projects with Terminitor

Terminitor can also fetch code repositories off Github. This will have terminitor clone the repo into the current directory:

$ terminitor fetch achiu terminitor

After the repo has been fetched, terminitor will go ahead and run the setup block from the Termfile included in the repository. In the event you wouldn't want the setup block to be executed, simply set setup to false:

$ terminitor fetch achiu terminitor --setup=false

Some notes. Terminitor's fetch command is dependent on the (github-gem) at the current moment. It will try to fetch the repository with read/write access first if you have rights, if not, it will default to git read only. Happy fetching!

Cores

Cores allow Terminitor to operate on a variety of platforms. They abstract the general behavior that terminitor needs to run the commands. Each core would inherit from an (AbstractCore) and define the needed methods. At the moment the following Cores are supported:

Feel free to contribute more cores so that Terminitor can support your terminal of choice :)

Limitations

MacCore

Right now the Mac OS X Terminal tabs are created by invoking keystrokes which means there are limitations with the terminal being in
focus during execution of these commands. Obviously the long term goal is to solve this issue as well but in all honesty, this solution works well enough most of the time.

ITermCore

Currently the iTerm Core only provides basic functionality such as opening tabs, windows, and executing commands within them. The capture
and settings functionality will be integrated soon.

Fetching

The fetch task only pulls off Github repositories at the moment. Later on, this functionality will be extended to non github repository.

This was a great start and made terminal automation easy. However, the repository died long ago, and we had continued using the code for a while.
Finally, we decided the time had come to release this code back to the world as a gem. Thanks to ELC for creating the original source for this project.

Also, we didn't take any code from Project by Josh but that project did inspire us to setup terminit
as a gem. Basically, project is a great gem but there were a couple issues with the fact that the terminal doesn't save the session state in some cases.
I had already been using terminit for years so we decided to package this up for easy use.