Sha256: ace9c10055145f492f92af06f2c0c7490b23bba7fdc22dc7243dc75e5edca215
Contents?: true
Size: 1.35 KB
Versions: 5
Compression:
Stored size: 1.35 KB
Contents
require_relative 'options' require_relative 'reek_command' require_relative '../configuration/app_configuration' module Reek module CLI # # Represents an instance of a Reek application. # This is the entry point for all invocations of Reek from the # command line. # # @api private class Application STATUS_SUCCESS = 0 STATUS_ERROR = 1 STATUS_SMELLS = 2 def initialize(argv) @status = STATUS_SUCCESS options_parser = Options.new(argv) begin @options = options_parser.parse @command = ReekCommand.new(OptionInterpreter.new(@options)) initialize_configuration rescue OptionParser::InvalidOption, Reek::Configuration::ConfigFileException => error $stderr.puts "Error: #{error}" @status = STATUS_ERROR end end def execute return @status if error_occured? @command.execute self @status end def initialize_configuration Configuration::AppConfiguration.initialize_with @options end def output(text) print text end def report_success @status = STATUS_SUCCESS end def report_smells @status = STATUS_SMELLS end private def error_occured? @status == STATUS_ERROR end end end end
Version data entries
5 entries across 5 versions & 1 rubygems