Class | Cliver::Dependency |
In: |
lib/cliver/dependency.rb
|
Parent: | Object |
This is how a dependency is specified.
NotMet | = | Class.new(ArgumentError) | An exception class raised when assertion is not met | |
VersionMismatch | = | Class.new(Dependency::NotMet) | An exception that is raised when executable present, but no version that matches the requirements is present. | |
NotFound | = | Class.new(Dependency::NotMet) | An exception that is raised when executable is not present at all. | |
PARSABLE_GEM_VERSION | = | /[0-9]+(.[0-9]+){0,4}(.[a-zA-Z0-9]+)?/.freeze | A pattern for extracting a {Gem::Version}-parsable version |
@overload initialize(executables, *requirements, options = {})
@param executables [String,Array<String>] api-compatible executable names e.g, ['python2','python'] @param requirements [Array<String>, String] splat of strings whose elements follow the pattern [<operator>] <version> Where <operator> is optional (default '='') and in the set '=', '!=', '>', '<', '>=', '<=', or '~>' And <version> is dot-separated integers with optional alphanumeric pre-release suffix. See also {http://docs.rubygems.org/read/chapter/16 Specifying Versions} @param options [Hash<Symbol,Object>] @option options [Cliver::Detector] :detector (Detector.new) @option options [#to_proc, Object] :detector (see Detector::generate) @option options [#to_proc] :filter ({Cliver::Filter::IDENTITY}) @option options [Boolean] :strict (false) true - fail if first match on path fails to meet version requirements. This is used for Cliver::assert. false - continue looking on path until a sufficient version is found. @option options [String] :path ('*') the path on which to search for executables. If an asterisk (`*`) is included in the supplied string, it is replaced with `ENV['PATH']` @yieldparam executable_path [String] (see Detector#detect_version) @yieldreturn [String] containing a version that, once filtered, can be used for comparrison.
One of these things is not like the other ones… Some feature combinations just aren‘t compatible. This method ensures the the features selected for this object are compatible with each-other. @return [void] @raise [ArgumentError] if incompatibility found
Detects an installed version of the executable that matches the requirements. @return [String] path to an executable that meets the requirements @raise [Cliver::Dependency::NotMet] if no match found
Get all the installed versions of the api-compatible executables. If a block is given, it yields once per found executable, lazily. @yieldparam executable_path [String] @yieldparam version [String] @yieldreturn [Boolean] - true if search should stop. @return [Hash<String,String>] executable_path, version