Class: Roast::Workflow::ShellScriptStep
- Defined in:
- lib/roast/workflow/shell_script_step.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
Returns the value of attribute env.
-
#exit_on_error ⇒ Object
Returns the value of attribute exit_on_error.
-
#script_path ⇒ Object
readonly
Returns the value of attribute script_path.
Attributes inherited from BaseStep
#available_tools, #coerce_to, #context_path, #json, #model, #name, #params, #print_response, #resource, #workflow
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(workflow, script_path:, **options) ⇒ ShellScriptStep
constructor
A new instance of ShellScriptStep.
Constructor Details
#initialize(workflow, script_path:, **options) ⇒ ShellScriptStep
Returns a new instance of ShellScriptStep.
9 10 11 12 13 14 |
# File 'lib/roast/workflow/shell_script_step.rb', line 9 def initialize(workflow, script_path:, **) super(workflow, **) @script_path = script_path @exit_on_error = true # default to true @env = {} # custom environment variables end |
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
7 8 9 |
# File 'lib/roast/workflow/shell_script_step.rb', line 7 def env @env end |
#exit_on_error ⇒ Object
Returns the value of attribute exit_on_error.
7 8 9 |
# File 'lib/roast/workflow/shell_script_step.rb', line 7 def exit_on_error @exit_on_error end |
#script_path ⇒ Object (readonly)
Returns the value of attribute script_path.
6 7 8 |
# File 'lib/roast/workflow/shell_script_step.rb', line 6 def script_path @script_path end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/roast/workflow/shell_script_step.rb', line 16 def call validate_script! stdout, stderr, status = execute_script result = if status.success? parse_output(stdout) else handle_script_error(stderr, status.exitstatus) end process_output(result, print_response: @print_response) result end |