Class: Producer::Core::Testing::MockRemote
- Defined in:
- lib/producer/core/testing/mock_remote.rb
Instance Attribute Summary
Attributes inherited from Remote
Instance Method Summary collapse
Methods inherited from Remote
#cleanup, #config, #environment, #fs, #initialize, #user_name
Constructor Details
This class inherits a constructor from Producer::Core::Remote
Instance Method Details
#execute(command, output = '', error_output = '') ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/producer/core/testing/mock_remote.rb', line 9 def execute(command, output = '', error_output = '') tokens = command.gsub(/\d?>.*/, '').split program = tokens.shift case program when 'echo' out = tokens.join(' ') << "\n" if command =~ />&2\z/ error_output << out else output << out end when 'true' output << '' when 'false' fail RemoteCommandExecutionError when 'type' fail RemoteCommandExecutionError unless %w[ echo true false type ].include? tokens.first end output end |
#session ⇒ Object
5 6 7 |
# File 'lib/producer/core/testing/mock_remote.rb', line 5 def session fail 'no session for mock remote!' end |