Class: Gem::Guardian::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/gem/guardian/cli.rb

Overview

Command-line entry point for gem-guardian.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv, stdout: $stdout, stderr: $stderr, verifier_class: Verifier, lockfile_parser_class: LockfileParser) ⇒ CLI

Returns a new instance of CLI.



14
15
16
17
18
19
20
21
22
# File 'lib/gem/guardian/cli.rb', line 14

def initialize(argv, stdout: $stdout, stderr: $stderr, verifier_class: Verifier,
               lockfile_parser_class: LockfileParser)
  @argv = argv.dup
  @stdout = stdout
  @stderr = stderr
  @verifier_class = verifier_class
  @lockfile_parser_class = lockfile_parser_class
  @result_printer = ResultPrinter.new(stdout:)
end

Class Method Details

.start(argv) ⇒ Object

Starts the CLI with the provided argv.



10
11
12
# File 'lib/gem/guardian/cli.rb', line 10

def self.start(argv)
  new(argv).run
end

Instance Method Details

#runObject

Dispatches the requested subcommand and returns an exit status.



25
26
27
# File 'lib/gem/guardian/cli.rb', line 25

def run
  dispatch(@argv.shift)
end