SystemCommand
SystemCommand
allows you to run external process as if they were functions.
Usage
Run gem install system_command
or add gem 'system_command', '~> 2.0'
to your Gemfile.
Example:
git = SystemCommand.new('git')
SystemCommand.verbose = true
git.run('status')
if git.run?('diff', '--exit-code')
branch = git.gets('rev-parse', '--abbrev-ref', 'HEAD')
end
lines = git.lines('shortlog')
git.each_line('shortlog') do |line|
...
end
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rspec
to run the tests.
To install this gem onto your local machine, run rake install
.
To release a new version:
- Switch to the
main
branch. - Bump
lib/system_command/version.rb
, run bundle install
, then commit the result. - Switch to the
v2
branch. - Run
git merge main
- Run
rake release
, which will create/push a git tag and publish the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitLab at https://gitlab.com/coldwater-systems/system_command.