Class: Ober::Runner
- Inherits:
-
Object
- Object
- Ober::Runner
- Defined in:
- lib/ober/runner.rb,
lib/ober/runner/rvm.rb
Direct Known Subclasses
Defined Under Namespace
Classes: RVM
Instance Method Summary collapse
- #produce_shellout(cmd, opts) ⇒ Object
- #run(cmd, opts = {}, &block) ⇒ Object
- #run_silent(cmd, opts = {}) ⇒ Object
Instance Method Details
#produce_shellout(cmd, opts) ⇒ Object
6 7 8 |
# File 'lib/ober/runner.rb', line 6 def produce_shellout cmd, opts Mixlib::ShellOut.new(cmd, opts) end |
#run(cmd, opts = {}, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ober/runner.rb', line 10 def run cmd, opts={}, &block puts " $ #{cmd}" output = run_silent(cmd, opts, &block) if output output.lines.each do |line| puts " > #{line.chomp}" end end output end |
#run_silent(cmd, opts = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ober/runner.rb', line 23 def run_silent cmd, opts={} shellout = produce_shellout(cmd, opts) shellout.run_command shellout.error! shellout.stdout rescue Mixlib::ShellOut::ShellCommandFailed => ex if block_given? return yield(ex) else raise ex end end |