Class: Acmesmith::PostIssuingHooks::Shell
- Defined in:
- lib/acmesmith/post_issuing_hooks/shell.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(command:, ignore_failure: false) ⇒ Shell
constructor
A new instance of Shell.
Methods inherited from Base
Constructor Details
#initialize(command:, ignore_failure: false) ⇒ Shell
Returns a new instance of Shell.
7 8 9 10 |
# File 'lib/acmesmith/post_issuing_hooks/shell.rb', line 7 def initialize(command:, ignore_failure: false) @command = command @ignore_failure = ignore_failure end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/acmesmith/post_issuing_hooks/shell.rb', line 12 def execute puts "=> Executing Post Issueing Hook for #{common_name} in #{self.class.name}" puts " $ #{@command}" status = system({"COMMON_NAME" => common_name}, @command) unless status if @ignore_failure $stderr.puts " ! execution failed" else raise "Execution failed" end end end |