Class: Wordmove::Hook::Local
- Inherits:
-
Object
- Object
- Wordmove::Hook::Local
- Defined in:
- lib/wordmove/hook.rb
Class Method Summary collapse
- .logger ⇒ Object
-
.run(command_hash, options, simulate = false) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter.
Class Method Details
.logger ⇒ Object
79 80 81 |
# File 'lib/wordmove/hook.rb', line 79 def self.logger Wordmove::Hook.logger end |
.run(command_hash, options, simulate = false) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/wordmove/hook.rb', line 83 def self.run(command_hash, , simulate = false) # rubocop:disable Style/OptionalBooleanParameter wordpress_path = [:wordpress_path] logger.task_step true, "Exec command: #{command_hash[:command]}" return true if simulate stdout_return = `cd #{wordpress_path} && #{command_hash[:command]} 2>&1` logger.task_step true, "Output: #{stdout_return}" if $CHILD_STATUS.exitstatus.zero? logger.success '' else logger.error "Error code: #{$CHILD_STATUS.exitstatus}" raise Wordmove::LocalHookException unless command_hash[:raise].eql? false end end |