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
- VERSION =
Cliver follows SemVer
'0.2.1'
Class Method Summary (collapse)
-
- (Dependency) initialize(executables, *requirements, options = {}) {|executable_path| ... }
A legacy interface for detect with the option
strict: true
, ensures that the first executable on your path matches the requirements. -
- (Dependency) initialize(executables, *requirements, options = {}) {|executable_path| ... }
A non-raising variant of detect!, simply returns false if dependency cannot be found.
-
- (Dependency) initialize(executables, *requirements, options = {}) {|executable_path| ... }
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.
-
+ (String) verify!(executable, *requirements, options = {})
Verify an absolute-path to an executable.
Instance Method Summary (collapse)
-
- (False, String) dependency_unmet?(*args, &block)
Wraps Cliver::assert and returns truthy/false instead of raising.
Class Method Details
- (Dependency) initialize(executables, *requirements, options = {}) {|executable_path| ... }
A legacy interface for detect with the option strict: true
, ensures
that the first executable on your path matches the requirements.
45 46 47 48 49 |
# File 'lib/cliver.rb', line 45 def self.assert(*args, &block) = args.last.kind_of?(Hash) ? args.pop : {} args << .merge(:strict => true) Dependency::new(*args, &block).detect! end |
- (Dependency) initialize(executables, *requirements, options = {}) {|executable_path| ... }
A non-raising variant of detect!, simply returns false if dependency cannot be found.
33 34 35 |
# File 'lib/cliver.rb', line 33 def self.detect(*args, &block) Dependency::new(*args, &block).detect end |
- (Dependency) initialize(executables, *requirements, options = {}) {|executable_path| ... }
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.
22 23 24 |
# File 'lib/cliver.rb', line 22 def self.detect!(*args, &block) Dependency::new(*args, &block).detect! end |
+ (String) verify!(executable, *requirements, options = {})
Verify an absolute-path to an executable.
58 59 60 61 62 63 64 |
# File 'lib/cliver.rb', line 58 def self.verify!(executable, *args, &block) unless File.absolute_path?(executable) raise ArgumentError, "executable path must be absolute, " + "got '#{executable.inspect}'." end Dependency::new(executable, *args, &block).detect! end |
Instance Method Details
- (False, String) dependency_unmet?(*args, &block)
Wraps Cliver::assert and returns truthy/false instead of raising
74 75 76 77 78 79 80 81 |
# File 'lib/cliver.rb', line 74 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 |