class Git::Runner

Attributes

command[R]
stdout[R]

Public Class Methods

new(command) click to toggle source
# File lib/git_hook-pre_receive/runner.rb, line 10
def initialize(command)
  @command = command
end

Public Instance Methods

result() click to toggle source
# File lib/git_hook-pre_receive/runner.rb, line 23
def result
  $stderr.puts command if Git.debug_mode
  run
  stdout
end
run() click to toggle source
# File lib/git_hook-pre_receive/runner.rb, line 14
def run
  stdout, stderr, status = Open3.capture3(command)
  fail RuntimeError, "Error executing command #{command}: #{stderr}" unless status.success?

  @stdout = stdout.split("\n")
rescue Errno::ENOENT => e
  fail RuntimeError, "Error executing command #{command}: #{e.message}"
end