Class: RakeCommit::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/rake_commit/shell.rb

Class Method Summary collapse

Class Method Details

.backtick(cmd, raise_on_failure = true) ⇒ Object



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

def self.backtick(cmd, raise_on_failure = true)
  output = `#{cmd}`
  raise "Command failed: #{cmd.inspect}" if raise_on_failure && !$CHILD_STATUS.success?
  output
end

.system(cmd, raise_on_failure = true) ⇒ Object



5
6
7
8
# File 'lib/rake_commit/shell.rb', line 5

def self.system(cmd, raise_on_failure = true)
  successful = Kernel.system(cmd)
  raise if raise_on_failure && !successful
end