Class: Foreplay::Engine::Remote::Check
- Inherits:
-
Object
- Object
- Foreplay::Engine::Remote::Check
- Includes:
- Foreplay
- Defined in:
- lib/foreplay/engine/remote/check.rb
Constant Summary
Constants included from Foreplay
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#instructions ⇒ Object
readonly
Returns the value of attribute instructions.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Instance Method Summary collapse
-
#initialize(h, s, i) ⇒ Check
constructor
A new instance of Check.
- #list_commands(step) ⇒ Object
- #list_file_contents(id) ⇒ Object
- #perform ⇒ Object
Methods included from Foreplay
Constructor Details
#initialize(h, s, i) ⇒ Check
Returns a new instance of Check.
5 6 7 8 9 |
# File 'lib/foreplay/engine/remote/check.rb', line 5 def initialize(h, s, i) @host = h @steps = s @instructions = i end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/foreplay/engine/remote/check.rb', line 3 def host @host end |
#instructions ⇒ Object (readonly)
Returns the value of attribute instructions.
3 4 5 |
# File 'lib/foreplay/engine/remote/check.rb', line 3 def instructions @instructions end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
3 4 5 |
# File 'lib/foreplay/engine/remote/check.rb', line 3 def steps @steps end |
Instance Method Details
#list_commands(step) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/foreplay/engine/remote/check.rb', line 35 def list_commands(step) commands = Foreplay::Engine::Step.new(step, instructions).build commands.each do |command| puts "#{host}#{INDENT * 2}#{command}" unless step['silent'] end end |
#list_file_contents(id) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/foreplay/engine/remote/check.rb', line 25 def list_file_contents(id) i = instructions[id] if i.is_a? Hash i.each { |k, v| puts "#{host}#{INDENT * 2}#{k}: #{v}" } else puts "#{host}#{INDENT * 2}#{i}" end end |
#perform ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/foreplay/engine/remote/check.rb', line 11 def perform steps.each do |step| puts "#{host}#{INDENT}#{(step['commentary'] || step['command']).yellow}" unless step['silent'] == true if step.key? 'key' list_file_contents step['key'] else list_commands step end end '' end |