Class: Bundleup::Shell

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/bundleup/shell.rb

Instance Method Summary collapse

Instance Method Details

#capture(command, raise_on_error: true) ⇒ Object


9
10
11
12
13
14
# File 'lib/bundleup/shell.rb', line 9

def capture(command, raise_on_error: true)
  stdout, stderr, status = capture3(command)
  raise ["Failed to execute: #{command}", stdout, stderr].compact.join("\n") if raise_on_error && !status.success?

  stdout
end

#run(command) ⇒ Object


16
17
18
19
# File 'lib/bundleup/shell.rb', line 16

def run(command)
  capture(command)
  true
end

#run?(command) ⇒ Boolean

Returns:

  • (Boolean)

21
22
23
24
# File 'lib/bundleup/shell.rb', line 21

def run?(command)
  _, _, status = capture3(command)
  status.success?
end