class Released::Goals::Shell
TODO: rename
Public Class Methods
new(config = {})
click to toggle source
# File lib/released/goals/shell.rb, line 7 def initialize(config = {}) @command = config.fetch('command') end
Public Instance Methods
achieved?()
click to toggle source
# File lib/released/goals/shell.rb, line 35 def achieved? false end
assess()
click to toggle source
# File lib/released/goals/shell.rb, line 19 def assess sleep 1 end
effectful?()
click to toggle source
# File lib/released/goals/shell.rb, line 15 def effectful? false end
failure_reason()
click to toggle source
# File lib/released/goals/shell.rb, line 39 def failure_reason 'command not executed' end
to_s()
click to toggle source
# File lib/released/goals/shell.rb, line 11 def to_s "shell (#{@command})" end
try_achieve()
click to toggle source
# File lib/released/goals/shell.rb, line 23 def try_achieve stdout = '' stderr = '' piper = Released::Piper.new(stdout: stdout, stderr: stderr) begin piper.run(@command, []) rescue raise "Failed execute command!\n\nstderr:\n#{stderr}\n\nstdout:\n#{stdout}" end end