This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Consular Script DSL
manuelmeurer edited this page Oct 16, 2012
·
2 revisions
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 in new window
run 'padrino start'
# create a new tab in window and run it.
tab "echo 'first tab'", "echo 'of window'"
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.
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
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
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
The setup block allows you to store commands that can be run 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/consular.git'
end
Once defined, you can invoke your projects setup with:
consular setup my_project