Class: Proxy::RemoteExecution::Ssh::Runners::FakeScriptRunner
- Inherits:
-
Dynflow::Runner::Base
- Object
- Dynflow::Runner::Base
- Proxy::RemoteExecution::Ssh::Runners::FakeScriptRunner
- Defined in:
- lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb
Constant Summary collapse
- DEFAULT_REFRESH_INTERVAL =
1
Class Attribute Summary collapse
-
.data ⇒ Object
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ FakeScriptRunner
constructor
A new instance of FakeScriptRunner.
- #kill ⇒ Object
-
#refresh ⇒ Object
Do one step.
- #start ⇒ Object
Constructor Details
#initialize(*args) ⇒ FakeScriptRunner
Returns a new instance of FakeScriptRunner.
32 33 34 35 36 37 |
# File 'lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb', line 32 def initialize(*args) super # Load the fake output the first time its needed self.class.load_data(ENV['REX_SIMULATE_PATH']) unless self.class.data.frozen? @position = 0 end |
Class Attribute Details
.data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb', line 8 def data @data end |
Class Method Details
.build(options, suspended_action:) ⇒ Object
27 28 29 |
# File 'lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb', line 27 def build(, suspended_action:) new(, suspended_action: suspended_action) end |
.load_data(path = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb', line 10 def load_data(path = nil) if path.nil? @data = <<-BANNER.gsub(/^\s+\| ?/, '').lines | ====== Simulated Remote Execution ====== | | This is an output of a simulated remote | execution run. It should run for about | 5 seconds and finish successfully. BANNER else File.open(File.(path), 'r') do |f| @data = f.readlines.map(&:chomp) end end @data.freeze end |
Instance Method Details
#kill ⇒ Object
52 53 54 |
# File 'lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb', line 52 def kill finish end |
#refresh ⇒ Object
Do one step
44 45 46 47 48 49 50 |
# File 'lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb', line 44 def refresh if done? finish else step end end |
#start ⇒ Object
39 40 41 |
# File 'lib/smart_proxy_remote_execution_ssh/runners/fake_script_runner.rb', line 39 def start refresh end |