Module: Tumbler::Runner
- Included in:
- Gem, Generate, Manager, Manager::Changelog, Manager::Version
- Defined in:
- lib/tumbler/runner.rb
Instance Attribute Summary collapse
-
#noop ⇒ Object
Returns the value of attribute noop.
Instance Method Summary collapse
Instance Attribute Details
#noop ⇒ Object
Returns the value of attribute noop.
4 5 6 |
# File 'lib/tumbler/runner.rb', line 4 def noop @noop end |
Instance Method Details
#dry(message) ⇒ Object
11 12 13 |
# File 'lib/tumbler/runner.rb', line 11 def dry() puts end |
#sh(cmd) ⇒ Object
6 7 8 9 |
# File 'lib/tumbler/runner.rb', line 6 def sh(cmd) output, code = sh_with_code(cmd) code == 0 ? output : raise(output) end |
#sh_with_code(cmd) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tumbler/runner.rb', line 15 def sh_with_code(cmd) if noop dry("Running `#{cmd}'") ['' , 0] else output = '' Dir.chdir(base) { output = `#{cmd}` } [output, $?] end end |