class Spud::TaskRunners::SpudTaskRunner::TaskDSL

Public Class Methods

new(driver, filename, file_dsl) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 16
def initialize(driver, filename, file_dsl)
  @__filename = filename
  @__driver = driver

  @__commander = Shell::Command.commander(driver)

  file_dsl.singleton_methods.each do |method|
    define_singleton_method(method, &file_dsl.singleton_method(method))
  end
end

Public Instance Methods

halt(value = nil) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 28
def halt(value = nil)
  value ? throw(:halt, value) : throw(:halt)
end
invoke(task, *ordered, **named) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 71
def invoke(task, *ordered, **named)
  task = task.to_s
  task = task.include?('.') ? task : Task.qualified_name(@__filename, task)
  @__driver.invoke(task, ordered, named)
rescue Error => error
  puts error.message
end
invoke!(task, *ordered, **named) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 80
def invoke!(task, *ordered, **named)
  task = task.to_s
  task = task.include?('.') ? task : Task.qualified_name(@__filename, task)
  @__driver.invoke(task, ordered, named)
end
method_missing(task, *ordered, **named) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 87
def method_missing(task, *ordered, **named)
  task = task.to_s
  task = task.include?('.') ? task : Task.qualified_name(@__filename, task)
  @__driver.invoke(task, ordered, named)
end
sh(command) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 33
def sh(command)
  puts command
  @__commander.(command)
end
sh!(command) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 49
def sh!(command)
  puts command
  result = @__commander.(command)
  raise Error, "sh failed for '#{command}'" unless result.success?
  result
end
shh(command) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 39
def shh(command)
  @__commander.(command)
end
shh!(command) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 57
def shh!(command)
  result = @__commander.(command)
  raise Error, "sh failed for '#{command}'" unless result.success?
  result
end
shhh(command) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 44
def shhh(command)
  @__commander.(command, silent: true)
end
shhh!(command) click to toggle source
# File lib/spud/task_runners/spud_task_runner/task_dsl.rb, line 64
def shhh!(command)
  result = @__commander.(command, silent: true)
  raise Error, "sh failed for '#{command}'" unless result.success?
  result
end