Class: Wordmove::Hook::Local

Inherits:
Object
  • Object
show all
Defined in:
lib/wordmove/hook.rb

Class Method Summary collapse

Class Method Details

.loggerObject



65
66
67
# File 'lib/wordmove/hook.rb', line 65

def self.logger
  parent.logger
end

.run(commands, simulate = false) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/wordmove/hook.rb', line 69

def self.run(commands, simulate = false)
  logger.task "Running local hooks"

  commands.each do |command|
    logger.task_step true, "Exec command: #{command}"
    return true if simulate

    stdout_return = `#{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}"
    end
  end
end