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
Defined Under Namespace
Classes: LockfileDataView
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.
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/gem/guardian/cli.rb', line 73 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.
69 70 71 |
# File 'lib/gem/guardian/cli.rb', line 69 def self.start(argv) new(argv).run end |
Instance Method Details
#run ⇒ Object
Dispatches the requested subcommand and returns an exit status.
87 88 89 |
# File 'lib/gem/guardian/cli.rb', line 87 def run dispatch(@argv.shift) end |