class Stencil::Cmd

Public Class Methods

run(path, cmd=nil) click to toggle source
# File lib/stencil/cmd.rb, line 5
def run(path, cmd=nil)
  if cmd.nil?
    cmd, path = path, cmd
  else
    path = "cd #{path} && "
  end
  
  output = `#{[ path, cmd ].compact.join} 2>&1`

  unless $?.success?
    Msg.error "#{cmd}\n\n#{output}"
  end

  output
end