Class Cliver::Detector
In: lib/cliver/detector.rb
Parent: Struct.new(:command_arg, :version_pattern)

Default implementation of the detector needed by Cliver::Assertion, which will take anything that respond_to?(:to_proc)

Methods

Constants

DEFAULT_VERSION_PATTERN = /(version ?)?[0-9][.0-9a-z]+/i.freeze   Default pattern to use when searching {version_command} output
DEFAULT_COMMAND_ARG = '--version'.freeze   Default command argument to use against the executable to get version output

Public Class methods

If detector_argument responds to call, return it; otherwise attempt to create an instance of self.

Forgiving input, allows either argument if only one supplied.

@overload initialize(*command_args)

  @param command_args [Array<String>]

@overload initialize(version_pattern)

  @param version_pattern [Regexp]

@overload initialize(*command_args, version_pattern)

  @param command_args [Array<String>]
  @param version_pattern [Regexp]

Public Instance methods

The argument to pass to the executable to get current version Defaults to {DEFAULT_COMMAND_ARG} @return [String, Array<String>]

@param executable_path [String] - the path to the executable to test @return [String] - should be contain {Gem::Version}-parsable

                   version number.

This is the interface that any detector must have. If not overridden, returns a proc that wraps detect_version @see detect_version @return [Proc] following method signature of {detect_version}

@param executable_path [String] the executable to test @return [Array<String>]

The pattern to match the version in {version_command}’s output. Defaults to {DEFAULT_VERSION_PATTERN} @return [Regexp] - the pattern used against the output

                   of the #version_command, which should
                   contain a {Gem::Version}-parsable substring.

[Validate]