Method: Consular::DSL#run

Defined in:
lib/consular/dsl.rb

#run(*commands) ⇒ Object

Store commands to run in context.

Examples:

run 'brew update', 'gitx'

Parameters:

  • commands (Array<String>)

    Array of commands to be executed.



145
146
147
148
149
150
151
152
153
154
155
# File 'lib/consular/dsl.rb', line 145

def run(*commands)
  context = case
            when @_context.is_a?(Hash) && @_context[:tabs]
              @_context[:tabs]['default'][:commands]
            when @_context.is_a?(Hash)
              @_context[:commands]
            else
              @_context
            end
  context << commands.map { |c| c =~ /&$/ ? "(#{c})" : c }.join(" && ")
end