Welcome to ExecuteShell

ExecuteShell provides cross-platform shell command execution. In other words, it lays the smack down like a hungry t-rex in the octagon with a pig.

Getting Started

  1. Install ExecuteShell at the command prompt if you haven’t yet:

    gem install execute_shell
    
  2. Require the gem in your Gemfile:

    gem 'execute_shell', '~> 0.0.5'
    
  3. Require the gem wherever you need to use it:

    require 'execute_shell'
    

Usage

  1. Include the ExecuteShell module in your class or module:

    include ExecuteShell
    
  2. Call a shell command:

    success, output = shell('ls ~')
    

Additional Notes

  • The shell method has a second optional parameter, which is a path. If specified, the working directory will be changed to this path prior to executing the shell command. It will be set back to the original working directory before returning to the calling function.

  • Success will be false under two conditions. One is if there is any output to stderr. The other is if an exception is raised. In either case, the information is returned in the output.

Additional Documentation

rake rdoc:app

License

ExecuteShell is released under the GPLv3 license.