Simple::Spawn
Simple processes spawner that makes scripting UNIX pipes a breeze.
Most of it was inspired by https://github.com/jstorimer/shirt Thx! :)
Installation
Add this line to your application's Gemfile:
gem 'simple-spawn'
And then execute:
$ bundle
Or install it yourself as:
$ gem install simple-spawn
Usage
It only requires a valid shell
command as a string.
spawn('cat ./stars.txt | grep charlie | sed s/winning/bi-winning/')
Simple::Spawn as a Mixin
The Simple::Spawn
module can also be mixed in to classes and modules
to include the spawn
method in that namespace:
require simple/spawn
class YourScriptClass
include Simple::Spawn
def replace(what, with)
spawn("cat ./stars.txt | grep charlie | sed s/#{what}/#{with}/")
end
end
Supported Ruby Versions
This library aims to support and is tested against the following Ruby implementations:
- Ruby 1.9.2
- Ruby 1.9.3
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
ACKNOWLEDGEMENTS
Copyright (c) by Jose Pablo Barrantes
See the COPYING
file for more information on license and redistribution.