class Skunk::Cli::Application

Knows how to execute command line commands :reek: InstanceVariableAssumption

Constants

COVERAGE_FILE

Public Class Methods

new(argv) click to toggle source
# File lib/skunk/cli/application.rb, line 19
def initialize(argv)
  @options = Skunk::Cli::Options.new(argv)
end

Public Instance Methods

execute() click to toggle source

:reek: UncommunicativeVariableName

# File lib/skunk/cli/application.rb, line 24
def execute
  warn_coverage_info unless File.exist?(COVERAGE_FILE)

  # :reek:NilCheck
  @parsed_options = @options.parse.to_h
  command = Skunk::Cli::CommandFactory.create(@parsed_options)
  reporter = command.execute

  print(reporter.status_message)
  share_status_message = command.share(reporter)
  print(share_status_message)

  reporter.status
rescue OptionParser::InvalidOption => e
  warn "Error: #{e}"
  STATUS_ERROR
end

Private Instance Methods

print(message) click to toggle source

:reek: NilCheck

warn_coverage_info() click to toggle source
# File lib/skunk/cli/application.rb, line 44
def warn_coverage_info
  warn "warning: Couldn't find coverage info at #{COVERAGE_FILE}."
  warn "warning: Having no coverage metrics will make your SkunkScore worse."
end