Module: Railbow::GitUtils

Defined in:
lib/railbow/git_utils.rb

Overview

Runs git commands defensively: when the git binary is not installed, returns empty output and a failed status instead of raising Errno::ENOENT.

Constant Summary collapse

MISSING_GIT_STATUS =
Object.new

Class Method Summary collapse

Class Method Details

.capture2(*args) ⇒ Object



17
18
19
20
21
# File 'lib/railbow/git_utils.rb', line 17

def capture2(*args)
  Open3.capture2("git", *args)
rescue Errno::ENOENT
  ["", MISSING_GIT_STATUS]
end

.capture3(*args) ⇒ Object



23
24
25
26
27
# File 'lib/railbow/git_utils.rb', line 23

def capture3(*args)
  Open3.capture3("git", *args)
rescue Errno::ENOENT
  ["", "", MISSING_GIT_STATUS]
end