Class: Cuprum::Cli::Commands::Ci::RSpecEachCommand
- Parent Namespace
- Cuprum::Cli::Commands::Ci
- Inherited Classes
- Cuprum::Cli::Command
>
Cuprum::Command
>
Object
- Included Modules
- Cuprum::Cli::Dependencies::StandardIo::Helpers, Cuprum::Cli::Options::Quiet
- Defined In
- lib/cuprum/cli/commands/ci/rspec_each_command.rb
Table Of Contents
Overview
Command for running each RSpec file in its own process.
Back To Top
Constants
FALSY_VALUES
= Set.new(%w[f false n no]).freeze
- Inherited From
- Cuprum::Cli::Dependencies::StandardIo::Helpers
String input values that will be mapped to a boolean false.
= /\A[a-z_]+(:[a-z_]+)*\z/
- Inherited From
- Cuprum::Cli::Metadata
Format used to validate command names.
INTEGER_PATTERN
= /\A-?\d+([\d_,]+\d)?\z/
- Inherited From
- Cuprum::Cli::Dependencies::StandardIo::Helpers
Pattern matching a valid integer input.
TRUTHY_VALUES
= Set.new(%w[t true y yes]).freeze
- Inherited From
- Cuprum::Cli::Dependencies::StandardIo::Helpers
String input values that will be mapped to a boolean true.
Back To Top
Class Methods
.argument(name, default: nil, description: nil, required: false, type: :string, variadic: false, **options) => Object
- Inherited From
- Cuprum::Cli::Command
Defines an argument for the command class.
Parameters
- name (String, Symbol) — the name of the argument.
- default (Object, Proc) — the default value for the argument. If
given and the value of the argument is nil, sets the argument value to
the default value.
- description (String) — a short, human-readable description of the
argument.
- required (true, false) — if true, raises an exception if the
argument is not provided to the command. Defaults to false.
- type (Class, String, Symbol) — the expected type of the argument
value as a Class or class name. If given, raises an exception if the
argument value is not an instance of the type. Defaults to :string.
- variadic (true, false) — if true, the argument is variadic and
represents an array of arguments provided to the command. Defaults to
false.
- options (Hash) — additional options for defining the argument.
Options Hash (options)
- define_method (true, false) — if true, defines a reader
method for the argument. Defaults to false for boolean arguments and
true for all other arguments.
- define_predicate (true, false) — if true, defines a
predicate method for the argument, which returns true if the argument
is not nil and not empty. Defaults to true for boolean arguments and
false for all other arguments.
Raises
- (ArgumentError) — if variadic is true and the command already
defines a variadic argument.
.argument_value(value) => void
- Inherited From
- Cuprum::Cli::Arguments::ClassMethods
Appends a predefined argument value for the command.
Parameters
- value (Object) — the argument value to append.
Returns
.argument_values => Array<Object>
- Inherited From
- Cuprum::Cli::Arguments::ClassMethods
Returns
- (Array<Object>) — predefined argument values for the command.
.arguments() => Array<Cuprum::Cli::Argument>
.arguments(name, default: nil, description: nil, required: false, type: :string, **options) => Object
- Inherited From
- Cuprum::Cli::Arguments::ClassMethods
Overloads
The defined arguments for the command class.
Returns
.arguments(name, default: nil, description: nil, required: false, type: :string, **options) => Object
Defines a variadic argument for the command class.
Parameters
- name (String, Symbol) — the name of the argument.
- default (Object, Proc) — the default value for the argument. If
given and the value of the argument is nil, sets the argument value to
the default value.
- description (String) — a short, human-readable description of the
argument.
- required (true, false) — if true, raises an exception if the
argument is not provided to the command.
- type (Class, String, Symbol) — the expected type of the argument
value as a Class or class name. If given, raises an exception if the
argument value is not an instance of the type. Defaults to :string.
- options (Hash) — additional options for defining the argument.
Options Hash (options)
- define_method (true, false) — if true, defines a reader
method for the argument. Defaults to false for boolean arguments and
true for all other arguments.
- define_predicate (true, false) — if true, defines a
predicate method for the argument, which returns true if the argument
is not nil and not empty. Defaults to true for boolean arguments and
false for all other arguments.
.dependency(dependency_name, **) => Object
- Inherited From
- Cuprum::Cli::Command
Raises
.option(option_name, **) => Object
- Inherited From
- Cuprum::Cli::Command
Raises
.option_value(option, value) => void
- Inherited From
- Cuprum::Cli::Options::ClassMethods
Assigns a predefined option value for the command.
Parameters
- option (String, Symbol) — the option to set.
- value (Object) — the option value to append.
Returns
.option_values => Hash{Symbol => Object}
- Inherited From
- Cuprum::Cli::Options::ClassMethods
Returns
- (Hash{Symbol => Object}) — predefined option values for the command.
- Inherited From
- Cuprum::Cli::Options::ClassMethods
The defined options, including options defined on ancestor classes.
Returns
.resolve_arguments(*values) => Array
- Inherited From
- Cuprum::Cli::Arguments::ClassMethods
Validates the given argument values against the defined class arguments.
Also applies any default values from the defined arguments.
Parameters
- values (Array) — the arguments values to resolve.
Returns
- (Array) — the arguments values with applied defaults.
Raises
.resolve_options(**values) => Hash
- Inherited From
- Cuprum::Cli::Options::ClassMethods
Validates the given option values against the defined class options.
Also applies any default values from the defined options.
Parameters
- values (Hash) — the option values to resolve.
Returns
- (Hash) — the option values with applied defaults.
Raises
Back To Top
Constructor
#initialize(**) => Command
- Inherited From
- Cuprum::Cli::Command
Returns
- (Command) — a new instance of Command
Back To Top
Instance Methods
#ask(prompt = nil, caret: true, format: nil, strip: true, **options) => String, Integer, true, false, nil
- Inherited From
- Cuprum::Cli::Dependencies::StandardIo::Helpers
Requests an input from the input stream.
Parameters
- prompt (String, nil) — the prompt to display to the user, if any.
- options (Hash) — options for requesting the input.
Options Hash (options)
- caret (true, false) — if true, prints a caret "> " to the
output stream after the prompt. Defaults to true when the newline
option is true, otherwise false.
- format (String, Symbol) — the expected format of the
input. Valid values are :string (the default), :boolean, and :integer.
The input string will be transformed into the given format, or an
exception raised if the value cannot be transformed.
- newline (true, false) — if true, a newline will be printed
after the prompt if a prompt is given.
- strip (true, false) — if true, strips the trailing newline
from the input. Defaults to true.
Returns
- (String, Integer, true, false, nil) — the received and formatted
input value, or nil if the input value was empty.
#call(*arguments, **options) => Cuprum::Result
#call(resolved_arguments:, resolved_options:) => Cuprum::Result
- Inherited From
- Cuprum::Cli::Command
Overloads
#call(*arguments, **options) => Cuprum::Result
Resolves the parameters and calls the command.
Parameters
- arguments (Array) — arguments passed to the command.
- options (Hash) — options passed to the command.
Returns
- (Cuprum::Result) — the command result.
Raises
#call(resolved_arguments:, resolved_options:) => Cuprum::Result
Calls the command with the given arguments and options.
This variant assumes that the arguments and options have already been
parsed and validated against the command’s expected parameters.
Parameters
- resolved_arguments (Hash) — the arguments passed to the command,
formatted as an Hash with the matching argument name as key and the
argument value as the corresponding value.
- resolved_options (Hash) — the options passed to the command.
Returns
- (Cuprum::Result) — the command result.
#say(message, newline: true, quiet: false, verbose: false, **options) => nil
- Inherited From
- Cuprum::Cli::Options::Quiet
Prints a message to the output stream.
Parameters
- message (String) — the message to print.
- options (Hash) — options for printing the message.
Options Hash (options)
- newline (true, false) — if true, appends a newline to the
message if the message does not end with a newline. Defaults to true.
- quiet (true, false) — if true, prints the message even if
the command has the :quiet option enabled. Defaults to false. Ignored
if
the command does not support the :quiet option.
- verbose (true, false) — if true, prints the message only
if the command has the :verbose option enabled. Defaults to false.
Ignored if the command does not support the :verbose option.
Returns
#warn(message, **options) => nil
- Inherited From
- Cuprum::Cli::Dependencies::StandardIo::Helpers
Prints a message to the error stream.
Parameters
- message (String) — the message to print.
- options (Hash) — options for printing the message.
Options Hash (options)
- newline (true, false) — if true, appends a newline to the
message if the message does not end with a newline. Defaults to true.
Returns
Back To Top
Back to
Documentation |
Reference
|
Cuprum
|
Cuprum::Cli
|
Cuprum::Cli::Commands
|
Cuprum::Cli::Commands::Ci