Class: Nautilus::Shell
- Inherits:
-
Object
- Object
- Nautilus::Shell
- Defined in:
- lib/nautilus/shell.rb
Instance Method Summary collapse
- #build_command(command, options = {}) ⇒ Object
- #run(command, options = {}) ⇒ Object
- #sh(command) ⇒ Object
- #windows? ⇒ Boolean
Instance Method Details
#build_command(command, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/nautilus/shell.rb', line 9 def build_command(command, = {}) actual_command = command.kind_of?(Array) ? command.join(" ") : command if [:background] if windows? actual_command = "start /wait /b " + command elsif [:background] actual_command << " &" end end actual_command end |
#run(command, options = {}) ⇒ Object
5 6 7 |
# File 'lib/nautilus/shell.rb', line 5 def run(command, = {}) sh build_command(command, ) end |
#sh(command) ⇒ Object
25 26 27 28 |
# File 'lib/nautilus/shell.rb', line 25 def sh(command) successful = system(command) raise "Error while running >>#{command}<<" unless successful end |
#windows? ⇒ Boolean
21 22 23 |
# File 'lib/nautilus/shell.rb', line 21 def windows? RUBY_PLATFORM =~ /mswin/ end |