Sha256: 3a7cd9ec00f41c27b1c8d716422ee15b111c806d5f90ca7948958ef7187fdcc8

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 KB

Contents

module Foreplay
  class Engine
    class Remote
      class Check
        include Foreplay
        attr_reader :host, :steps, :instructions

        def initialize(h, s, i)
          @host = h
          @steps = s
          @instructions = i
        end

        def perform
          steps.each do |step|
            log "#{(step['commentary'] || step['command']).yellow}", host: host, silent: step['silent']

            if step.key? 'key'
              list_file_contents step['key']
            else
              list_commands step
            end
          end

          ''
        end

        def list_file_contents(id)
          i = instructions[id]

          if i.is_a? Hash
            i.each { |k, v| log "#{k}: #{v}", host: host, indent: 1 }
          else
            log i, host: host, indent: 1
          end
        end

        def list_commands(step)
          commands = Foreplay::Engine::Step.new(host, step, instructions).commands

          commands.each do |command|
            log command, host: host, silent: step['silent']
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
foreplay-0.15.2 lib/foreplay/engine/remote/check.rb
foreplay-0.15.1 lib/foreplay/engine/remote/check.rb
foreplay-0.15.0 lib/foreplay/engine/remote/check.rb
foreplay-0.13.5 lib/foreplay/engine/remote/check.rb
foreplay-0.13.4 lib/foreplay/engine/remote/check.rb
foreplay-0.13.3 lib/foreplay/engine/remote/check.rb
foreplay-0.13.2 lib/foreplay/engine/remote/check.rb
foreplay-0.13.1 lib/foreplay/engine/remote/check.rb
foreplay-0.13.0 lib/foreplay/engine/remote/check.rb
foreplay-0.11.2 lib/foreplay/engine/remote/check.rb
foreplay-0.11.1 lib/foreplay/engine/remote/check.rb
foreplay-0.11.0 lib/foreplay/engine/remote/check.rb
foreplay-0.10.3 lib/foreplay/engine/remote/check.rb
foreplay-0.10.2 lib/foreplay/engine/remote/check.rb
foreplay-0.10.1 lib/foreplay/engine/remote/check.rb