Class: RooOnRails::Shell

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

Constant Summary collapse

CommandFailed =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#run(cmd) ⇒ Object



8
9
10
11
# File 'lib/roo_on_rails/shell.rb', line 8

def run(cmd)
  result = Bundler.with_clean_env { %x{#{cmd}} }
  return [$?.success?, result]
end

#run!(cmd) ⇒ Object

Raises:



13
14
15
# File 'lib/roo_on_rails/shell.rb', line 13

def run!(cmd)
  raise CommandFailed.new(cmd) unless run(cmd).first
end

#run?(cmd) ⇒ Boolean

Returns:

  • (Boolean)


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

def run?(cmd)
  run(cmd).first
end