class Nautilus::Shell

Public Instance Methods

build_command(command, options = {}) click to toggle source
# File lib/nautilus/shell.rb, line 9
def build_command(command, options = {})
  actual_command = command.kind_of?(Array) ? command.join(" ") : command
  if options[:background]
    if windows?
      actual_command = "start /wait /b " + command
    elsif options[:background]
      actual_command << " &"
    end
  end      
  actual_command
end
run(command, options = {}) click to toggle source
# File lib/nautilus/shell.rb, line 5
def run(command, options = {})
  sh build_command(command, options)
end
sh(command) click to toggle source
# File lib/nautilus/shell.rb, line 25
def sh(command)
  successful = system(command)
  raise "Error while running >>#{command}<<" unless successful
end
windows?() click to toggle source
# File lib/nautilus/shell.rb, line 21
def windows?
  RUBY_PLATFORM =~ /mswin/
end