Class: Mina::Runner

Inherits:
Object
  • Object
show all
Includes:
Configuration::DSL
Defined in:
lib/mina/runner.rb,
lib/mina/runner/exec.rb,
lib/mina/runner/pretty.rb,
lib/mina/runner/system.rb,
lib/mina/runner/printer.rb

Defined Under Namespace

Classes: Exec, Pretty, Printer, System

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configuration::DSL

included

Constructor Details

#initialize(commands, backend) ⇒ Runner


6
7
8
9
10
11
# File 'lib/mina/runner.rb', line 6

def initialize(commands, backend)
  fail 'You must specify execution mode' if execution_mode.nil?
  fail 'Unsuported execution mode (pretty on windows)' if unsuported_execution_mode?
  @backend = backend
  @commands = commands
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend


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

def backend
  @backend
end

#commandsObject (readonly)

Returns the value of attribute commands


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

def commands
  @commands
end

Instance Method Details

#execution_modeObject


17
18
19
20
21
22
23
24
# File 'lib/mina/runner.rb', line 17

def execution_mode
  @execution_mode ||=
  if fetch(:simulate)
    :printer
  else
    fetch(:execution_mode)
  end
end

#runObject


13
14
15
# File 'lib/mina/runner.rb', line 13

def run
  Mina::Runner.const_get(class_name_for(execution_mode)).new(script).run
end