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



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

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



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

def run(command)
  capture(command)
  true
end

#run?(command) ⇒ Boolean

Returns:

  • (Boolean)


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

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