Sha256: 1760be5d2e412118a1267005665878c8c57e6c4f17179ef670f58f8e54a6592f
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 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. # class Application STATUS_SUCCESS = 0 STATUS_ERROR = 1 STATUS_SMELLS = 2 attr_reader :configuration def initialize(argv) @status = STATUS_SUCCESS options_parser = Options.new(argv) begin options = options_parser.parse @command = ReekCommand.new(OptionInterpreter.new(options)) @configuration = Configuration::AppConfiguration.from_path(options.config_file) 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 output(text) print text end def report_success self.status = STATUS_SUCCESS end def report_smells self.status = STATUS_SMELLS end private private_attr_accessor :status private_attr_reader :command def error_occured? status == STATUS_ERROR end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reek-3.4.0 | lib/reek/cli/application.rb |