Class | Consular::DSL |
In: |
lib/consular/dsl.rb
|
Parent: | Object |
The DSL class provides the DSL for the Consular scripting file. It provides the basic commands such as:
#setup - commands to run when invoked by 'consular setup' #window - commands to run in the context of a window #tab - commands to run in the context of tab #before - commands to run in the context before every tab context
The DSL class can be extended to provide additional API‘s for core specific DSL.
_context | [R] | |
_setup | [R] | |
_windows | [R] |
Initializes the DSL library and stores the commands.
@param [String] path
path to Consular script/ Termfile
@example
Consular::DSL.new 'foo/bar.term'
@api public
Run commands prior to each tab context.
@param [Array<String>] commands
Commands to be executed.
@param [Proc] block
Proc of commands to run
@example
# Executes `whoami` before tab with `ls` and `gitx` window do before { run 'whoami' } tab 'ls' tab 'gitx' end
@api public
Store commands to run in context.
@param [Array<String>] commands
Array of commands to be executed.
@example
run 'brew update', 'gitx'
@api public
Run commands using prior to the workflow using the command `consular setup`. This allows you to perform any command that needs to be ran prior to setup a particular project/script.
@param [Array<String>] commands
Commands to be executed.
@param [Proc] block
Proc of commands to run.
@example
setup 'bundle install', 'brew update' setup { run 'bundle install' }
@api public
Run commands in the context of a tab.
@param [Array] args
Accepts either: - an array of string commands - a hash containing options for the tab.
@param [Proc] block
@example
tab 'first tab', :settings => 'Grass' do run 'ps aux' end tab 'ls', 'gitx'
@api public
Returns yaml file as Consular formmatted hash
@return [Hash] Return hash format of Termfile
@api semipublic
Run commands in the conext of a window.
@param [Array] args
Hash to pass options to each context of a window. Each core can implement the desired behavior for the window based on the options set here. Can also pass a string as first parameter which will be set as the :name
@param [Proc] block
block of commands to run in window context.
@example
window 'my project', :size => [80, 30] do run 'ps aux' end
@api public