fetlife / Scallop
Licence: mit
Ergonomic shell wrapper for Ruby.
Stars: ✭ 150
Labels
Projects that are alternatives of or similar to Scallop
Counter culture
Turbo-charged counter caches for your Rails app.
Stars: ✭ 1,397 (+831.33%)
Mutual labels: gem
Foot traffic
Pure Ruby DSL for Chrome scripting based on Ferrum. No Selenium required. Works from any script. Simulate web app usage scenarios in production or locally.
Stars: ✭ 123 (-18%)
Mutual labels: gem
Hanuman
A responsive, lightning-fast Jekyll theme built using AMP (Accelerated Mobile Pages) to speed up your blogs and websites.
Stars: ✭ 100 (-33.33%)
Mutual labels: gem
Kovid
A CLI to fetch and compare the 2019 coronavirus pandemic statistics. It also fetches historical data and attempts to draw histograms of it to visualise the rate of infections.
Stars: ✭ 107 (-28.67%)
Mutual labels: gem
Rubicure
All about Japanese battle heroine "Pretty Cure (Precure)"
Stars: ✭ 119 (-20.67%)
Mutual labels: gem
Lol dba
lol_dba is a small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed. Also, it can generate .sql migration scripts.
Stars: ✭ 1,363 (+808.67%)
Mutual labels: gem
Pagerduty
📟 A Ruby gem for talking to the Pagerduty Events API
Stars: ✭ 94 (-37.33%)
Mutual labels: gem
Rubocop Rails config
RuboCop configuration which has the same code style checking as official Ruby on Rails.
Stars: ✭ 106 (-29.33%)
Mutual labels: gem
Wordmove
Multi-stage command line deploy/mirroring and task runner for Wordpress
Stars: ✭ 1,791 (+1094%)
Mutual labels: gem
Rails sortable
Easy drag & drop sorting with persisting the arranged order for rails
Stars: ✭ 127 (-15.33%)
Mutual labels: gem
Scallop
Ergonomic shell wrapper.
Features:
- Easy access to command's output (stdout & stderr)
- Failure handling
- Parameterization
- Measuring execution time
- Built-in string escaping
- No dependencies
Installation
Add this line to your application's Gemfile:
gem 'scallop'
And then execute:
$ bundle
Or install it yourself as:
$ gem install scallop
Usage
To run sudo -u chuck grep -R /home/chuck
result = Scallop.sudo(:chuck).cmd(:grep, '-R', '/home/chuck').run
You can then check whether command succeeded
result.success?
See its output
result.stdout
result.stderr
result.output # STDOUT and STDERR combined
You can also access information about command execution time
result.timing.real # Elapsed real time
result.timing.stime # System CPU time
result.timing.utime # User CPU time
result.timing.total # Total time, that is utime + stime + cutime + cstime
Handling failures with exceptions
If you replace run
with run!
, exception will be raised in case command fails
begin
Scallop.cmd(some_command).run!
rescue Scallop::Errors::CommandFailed => error
# you can access result right on the error itself
error.result.stderr
end
Piping
To run cat /some/file | grep something
command = Scallop.cmd(:cat, '/some/file') | Scallop.cmd(:grep, 'something')
command.run
Parameterization
stored_command = Scallop.cmd(:rm, '-rf', Scallop::Param[:path])
stored_command.set(path: '/foo').run # rm -rf /foo
stored_command.set(path: '/bar').run # rm -rf /bar
You can also check specs for examples.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].