class Perfume::Shell::SystemCall

Public: Simple system call. Use it when you need to just execute something, eventually silently and you don’t care about the result. Uses ‘system` under the hood. Feel free to inherit from this class, example:

class GitCommit < Perfume::Shell::SystemCall
  args :message

  def cmd
    'git commit -m #{@message.inspect}'
  end
end

Public Instance Methods

call() click to toggle source
# File lib/perfume/shell/system_call.rb, line 22
def call
  Dir.chdir(@root.to_s) do
    before
    log.debug("Executing shell command", cmd: cmd, root: @root.to_s)
    system([ cmd, !!@quiet ? ' &>/dev/null' : nil ].compact.join(' '))
    fail! unless $?.to_i == 0
  end
end
defaults() click to toggle source
Calls superclass method Perfume::Shell::Base#defaults
# File lib/perfume/shell/system_call.rb, line 18
def defaults
  super.merge(quiet: false)
end