Class: Gem::Guardian::CLI
- Inherits:
-
Object
- Object
- Gem::Guardian::CLI
- Defined in:
- lib/gem/guardian/cli.rb
Overview
Command-line entry point for gem-guardian. rubocop:disable Metrics/ClassLength, Metrics/ParameterLists
Class Method Summary collapse
-
.start(argv) ⇒ Object
Starts the CLI with the provided argv.
Instance Method Summary collapse
-
#initialize(argv, stdout: $stdout, stderr: $stderr, verifier_class: Verifier, lockfile_parser_class: LockfileParser, provenance_verifier_class: ProvenanceVerifier, report_builder_class: ReportBuilder) ⇒ CLI
constructor
A new instance of CLI.
-
#run ⇒ Object
Dispatches the requested subcommand and returns an exit status.
Constructor Details
#initialize(argv, stdout: $stdout, stderr: $stderr, verifier_class: Verifier, lockfile_parser_class: LockfileParser, provenance_verifier_class: ProvenanceVerifier, report_builder_class: ReportBuilder) ⇒ CLI
Returns a new instance of CLI.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gem/guardian/cli.rb', line 17 def initialize(argv, stdout: $stdout, stderr: $stderr, verifier_class: Verifier, lockfile_parser_class: LockfileParser, provenance_verifier_class: ProvenanceVerifier, report_builder_class: ReportBuilder) @argv = argv.dup @stdout = stdout @stderr = stderr @verifier_class = verifier_class @lockfile_parser_class = lockfile_parser_class @provenance_verifier_class = provenance_verifier_class @report_builder_class = report_builder_class @result_printer = ResultPrinter.new(stdout:) end |
Class Method Details
.start(argv) ⇒ Object
Starts the CLI with the provided argv.
13 14 15 |
# File 'lib/gem/guardian/cli.rb', line 13 def self.start(argv) new(argv).run end |
Instance Method Details
#run ⇒ Object
Dispatches the requested subcommand and returns an exit status.
31 32 33 |
# File 'lib/gem/guardian/cli.rb', line 31 def run dispatch(@argv.shift) end |