Module: Cliver
- Extended by:
- Cliver
- Included in:
- Cliver
- Defined in:
- lib/cliver.rb,
lib/cliver/filter.rb,
lib/cliver/version.rb,
lib/cliver/detector.rb,
lib/cliver/dependency.rb
Overview
Cliver is tool for making dependency assertions against command-line executables.
Defined Under Namespace
Modules: Filter Classes: Dependency, Detector
Constant Summary collapse
- VERSION =
Cliver follows SemVer
'0.2.0'
Class Method Summary collapse
-
#initialize(executables, *requirements, options = {}) {|executable_path| ... } ⇒ Dependency
A legacy interface for detect with the option ‘strict: true`, ensures that the first executable on your path matches the requirements.
-
#initialize(executables, *requirements, options = {}) {|executable_path| ... } ⇒ Dependency
A non-raising variant of detect!, simply returns false if dependency cannot be found.
-
#initialize(executables, *requirements, options = {}) {|executable_path| ... } ⇒ Dependency
The primary interface for the Cliver gem allows detection of an executable on your path that matches a version requirement, or raise an appropriate exception to make resolution simple and straight-forward.
Instance Method Summary collapse
-
#dependency_unmet?(*args, &block) ⇒ False, String
Wraps Cliver::assert and returns truthy/false instead of raising.
Class Method Details
#initialize(executables, *requirements, options = {}) {|executable_path| ... } ⇒ Dependency
A legacy interface for detect with the option ‘strict: true`, ensures that the first executable on your path matches the requirements.
42 43 44 45 46 |
# File 'lib/cliver.rb', line 42 def self.assert(*args, &block) = args.last.kind_of?(Hash) ? args.pop : {} args << .merge(:strict => true) Dependency::new(*args, &block).detect! end |
#initialize(executables, *requirements, options = {}) {|executable_path| ... } ⇒ Dependency
A non-raising variant of detect!, simply returns false if dependency cannot be found.
30 31 32 |
# File 'lib/cliver.rb', line 30 def self.detect(*args, &block) Dependency::new(*args, &block).detect end |
#initialize(executables, *requirements, options = {}) {|executable_path| ... } ⇒ Dependency
The primary interface for the Cliver gem allows detection of an executable on your path that matches a version requirement, or raise an appropriate exception to make resolution simple and straight-forward.
19 20 21 |
# File 'lib/cliver.rb', line 19 def self.detect!(*args, &block) Dependency::new(*args, &block).detect! end |
Instance Method Details
#dependency_unmet?(*args, &block) ⇒ False, String
Wraps Cliver::assert and returns truthy/false instead of raising
56 57 58 59 60 61 62 63 |
# File 'lib/cliver.rb', line 56 def dependency_unmet?(*args, &block) Cliver.assert(*args, &block) false rescue Dependency::NotMet => error # Cliver::Assertion::VersionMismatch -> 'Version Mismatch' reason = error.class.name.split(':').last.gsub(/([a-z])([A-Z])/, '\\1 \\2') "#{reason}: #{error.}" end |