https://github.com/yaauie/cliver
A ruby gem that provides tools for detecting & verifying command-line dependencies
https://github.com/yaauie/cliver
Keywords from Contributors
activerecord
Last synced: about 22 hours ago
JSON representation
Repository metadata
A ruby gem that provides tools for detecting & verifying command-line dependencies
- Host: GitHub
- URL: https://github.com/yaauie/cliver
- Owner: yaauie
- License: mit
- Created: 2013-06-18T00:24:37.000Z (over 12 years ago)
- Default Branch: develop
- Last Pushed: 2021-10-26T08:13:08.000Z (over 4 years ago)
- Last Synced: 2026-02-22T19:54:28.214Z (9 days ago)
- Language: Ruby
- Homepage: http://yaauie.github.io/cliver/
- Size: 705 KB
- Stars: 59
- Watchers: 6
- Forks: 8
- Open Issues: 6
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
README.md
Cliver
Sometimes Ruby apps shell out to command-line executables, but there is no
standard way to ensure those underlying dependencies are met. Users usually
find out via a nasty stack-trace and whatever wasn't captured on stderr, or by
the odd behavior exposed by a version mismatch.
Cliver is a simple gem that provides an easy way to detect and use
command-line dependencies. Under the covers, it uses rubygems/requirements
so it supports the version requirements you're used to providing in your
gemspec.
Usage
Get Out of My Way, CLIVER!
Sometimes even Cliver can't perfectly deduce the version of an executable given
its --version output. If you're getting an exception with a mismatch, supply
the CLIVER_NO_VERIFY environment variable, and it will assume that the first
executable on your path to match the name also matches the version
constraint. Please also create an issue here so I can help you resolve the root
issue.
$ command-that-uses-cliver # raises exception :(
$ export CLIVER_NO_VERIFY=1
$ command-that-uses-cliver # no cliver exception :)
Detect and Detect!
The detect methods search your entire path until they find a matching executable
or run out of places to look.
# no version requirements
Cliver.detect('subl')
# => '/Users/yaauie/.bin/subl'
# one version requirement
Cliver.detect('bzip2', '~> 1.0.6')
# => '/usr/bin/bzip2'
# many version requirements
Cliver.detect('racc', '>= 1.0', '< 1.4.9')
# => '/Users/yaauie/.rbenv/versions/1.9.3-p194/bin/racc'
# dependency not met
Cliver.detect('racc', '~> 10.4.9')
# => nil
# detect! raises Cliver::Dependency::NotMet exceptions when the dependency
# cannot be met.
Cliver.detect!('ruby', '1.8.5')
# Cliver::Dependency::VersionMismatch
# Could not find an executable ruby that matched the
# requirements '1.8.5'. Found versions were {'/usr/bin/ruby'=> '1.8.7'}
Cliver.detect!('asdfasdf')
# Cliver::Dependency::NotFound
# Could not find an executable asdfasdf on your path
Assert
The assert method is useful when you do not have control over how the
dependency is shelled-out to and require that the first matching executable on
your path satisfies your version requirements. It is the equivalent of the
detect! method with strict: true option.
Advanced Usage:
Version Detectors
Some programs don't provide nice 'version 1.2.3' strings in their --version
output; Cliver lets you provide your own version detector with a pattern.
Cliver.assert('python', '~> 1.7',
detector: /(?<=Python )[0-9][.0-9a-z]+/)
Other programs don't provide a standard --version; Cliver::Detector also
allows you to provide your own arg to get the version:
# single-argument command
Cliver.assert('janky', '~> 10.1.alpha',
detector: '--release-version')
# multi-argument command
Cliver.detect('ruby', '~> 1.8.7',
detector: [['-e', 'puts RUBY_VERSION']])
You can use both custom pattern and custom command by supplying an array:
Cliver.assert('janky', '~> 10.1.alpha',
detector: ['--release-version', /.*/])
And even supply multiple arguments in an Array, too:
# multi-argument command
Cliver.detect('ruby', '~> 1.8.7',
detector: ['-e', 'puts RUBY_VERSION'])
Alternatively, you can supply your own detector (anything that responds to
#to_proc) in the options hash or as a block, so long as it returns a
Gem::Version-parsable version number; if it returns nil or false when
version requirements are given, a descriptive ArgumentError is raised.
Cliver.assert('oddball', '~> 10.1.alpha') do |oddball_path|
File.read(File.expand_path('../VERSION', oddball_path)).chomp
end
And since some programs don't always spit out nice semver-friendly version
numbers at all, a filter proc can be supplied to clean it up. Note how the
filter is applied to both your requirements and the executable's output:
Filters
Cliver.assert('built-thing', '~> 2013.4r8273',
filter: proc { |ver| ver.tr('r','.') })
Since Cliver uses Gem::Requirement for version comparrisons, it obeys all
the same rules including pre-release semantics.
Search Path
By default, Cliver uses ENV['PATH'] as its search path, but you can provide
your own. If the asterisk symbol (*) is included in your string, it is
replaced ENV['PATH'].
Cliver.detect('gadget', path: './bins/:*')
# => 'Users/yaauie/src/project-a/bins/gadget'
Supported Platforms
The goal is to have full support for all platforms running ruby >= 1.9.2,
including rubinius and jruby implementations, as well as basic support for
legacy ruby 1.8.7. Windows has support in the codebase,
but is not available as a build target in [travis_ci][].
See Also:
Owner metadata
- Name: Ry Biesemeyer
- Login: yaauie
- Email:
- Kind: user
- Description: Principal Software Engineer at @elastic
- Website: about.me/yaauie
- Location: Seattle, Washington, USA
- Twitter:
- Company: @elastic
- Icon url: https://avatars.githubusercontent.com/u/210924?u=69928ffbd6f1dc20a93ccccb13990dd300ab2b9e&v=4
- Repositories: 183
- Last ynced at: 2024-04-21T03:50:27.425Z
- Profile URL: https://github.com/yaauie
GitHub Events
Total
Last Year
Committers metadata
Last synced: 2 days ago
Total Commits: 105
Total Committers: 5
Avg Commits per committer: 21.0
Development Distribution Score (DDS): 0.038
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Ryan Biesemeyer | r****n@y****m | 101 |
| miyucy | f****k@g****m | 1 |
| SHIBATA Hiroshi | h****t@r****g | 1 |
| Dmitry Vorotilin | d****n@g****m | 1 |
| Martin Vielsmaier | m****r@c****e | 1 |
Committer domains:
- crealytics.de: 1
- ruby-lang.org: 1
- yaauie.com: 1
Issue and Pull Request metadata
Last synced: about 1 month ago
Total issues: 18
Total pull requests: 7
Average time to close issues: 2 months
Average time to close pull requests: 9 months
Total issue authors: 12
Total pull request authors: 6
Average comments per issue: 4.39
Average comments per pull request: 3.29
Merged pull request: 4
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- yaauie (7)
- collinprice (1)
- djungowski (1)
- daintym0sh (1)
- whitequark (1)
- adisciple50 (1)
- rosskevin (1)
- moser (1)
- paulRbr (1)
- elcubo (1)
- luke-hill (1)
- bwhite-mdsol (1)
Top Pull Request Authors
- route (2)
- tahb (1)
- moser (1)
- miyucy (1)
- hsbt (1)
- paulRbr (1)
Top Issue Labels
- enhancement (4)
Top Pull Request Labels
Package metadata
- Total packages: 12
-
Total downloads:
- rubygems: 90,041,923 total
- Total docker downloads: 54,654,622
- Total dependent packages: 39 (may contain duplicates)
- Total dependent repositories: 13,371 (may contain duplicates)
- Total versions: 34
- Total maintainers: 1
gem.coop: cliver
Assertions for command-line dependencies
- Homepage: https://www.github.com/yaauie/cliver
- Documentation: http://www.rubydoc.info/gems/cliver/
- Licenses: MIT
- Latest release: 0.3.2 (published about 12 years ago)
- Last Synced: 2026-03-01T04:07:07.618Z (3 days ago)
- Versions: 12
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 45,024,165 Total
- Docker Downloads: 27,327,311
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.184%
- Downloads: 0.551%
- Maintainers (1)
debian-13: ruby-cliver
- Homepage: https://www.github.com/yaauie/cliver
- Documentation: https://packages.debian.org/trixie/ruby-cliver
- Licenses: mit
- Latest release: 0.3.2-3.1 (published 19 days ago)
- Last Synced: 2026-02-13T13:14:09.388Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.874%
- Stargazers count: 1.616%
- Forks count: 1.879%
rubygems.org: cliver
Assertions for command-line dependencies
- Homepage: https://www.github.com/yaauie/cliver
- Documentation: http://www.rubydoc.info/gems/cliver/
- Licenses: MIT
- Latest release: 0.3.2 (published about 12 years ago)
- Last Synced: 2026-02-27T19:01:53.314Z (4 days ago)
- Versions: 12
- Dependent Packages: 39
- Dependent Repositories: 13,371
- Downloads: 45,017,758 Total
- Docker Downloads: 27,327,311
-
Rankings:
- Dependent repos count: 0.299%
- Downloads: 0.482%
- Dependent packages count: 0.641%
- Docker downloads count: 1.191%
- Average: 3.058%
- Stargazers count: 7.018%
- Forks count: 8.716%
- Maintainers (1)
debian-10: ruby-cliver
- Homepage: https://www.github.com/yaauie/cliver
- Documentation: https://packages.debian.org/buster/ruby-cliver
- Licenses:
- Latest release: 0.3.2-3 (published 20 days ago)
- Last Synced: 2026-02-13T04:19:54.287Z (19 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.04: ruby-cliver
- Homepage: https://www.github.com/yaauie/cliver
- Licenses:
- Latest release: 0.3.2-3.1 (published 21 days ago)
- Last Synced: 2026-02-11T06:36:59.202Z (21 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-20.04: ruby-cliver
- Homepage: https://www.github.com/yaauie/cliver
- Licenses: mit
- Latest release: 0.3.2-3 (published 18 days ago)
- Last Synced: 2026-02-13T07:11:24.695Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.10: ruby-cliver
- Homepage: https://www.github.com/yaauie/cliver
- Licenses:
- Latest release: 0.3.2-3.1 (published 18 days ago)
- Last Synced: 2026-02-13T18:16:37.982Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-11: ruby-cliver
- Homepage: https://www.github.com/yaauie/cliver
- Documentation: https://packages.debian.org/bullseye/ruby-cliver
- Licenses:
- Latest release: 0.3.2-3 (published 21 days ago)
- Last Synced: 2026-02-13T08:19:07.238Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-cliver
- Homepage: https://www.github.com/yaauie/cliver
- Documentation: https://packages.debian.org/bookworm/ruby-cliver
- Licenses:
- Latest release: 0.3.2-3.1 (published 19 days ago)
- Last Synced: 2026-02-12T23:27:14.959Z (19 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- bundler ~> 1.3 development
- rake >= 0 development
- rspec ~> 3.0 development
- rspec-its ~> 1.2 development
- yard >= 0 development
Score: 24.574067839383215