Class: Caml::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/caml/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(tasks:, shell:) ⇒ Runner

Returns a new instance of Runner.



3
4
5
6
# File 'lib/caml/runner.rb', line 3

def initialize(tasks:, shell:)
  @tasks = tasks
  @shell = shell
end

Instance Method Details

#run(name, args: {}, opts: {}) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/caml/runner.rb', line 8

def run(name, args: {}, opts: {})
  plan = Plan.resolve(name, @tasks)
  plan.each do |task|
    bindings = task.name == name ? { args: args, opts: opts } : { args: {}, opts: {} }
    return false unless execute_task(task, **bindings)
  end
  true
end