Sha256: 0df79ec2c24852a406a196cedffaae7c21fbc73f04977d9adb199c35c39bf51f

Contents?: true

Size: 893 Bytes

Versions: 3

Compression:

Stored size: 893 Bytes

Contents

require 'reek/cli/options'

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

      def initialize(argv)
        @options = Options.new(argv)
        @status = STATUS_SUCCESS
      end

      def execute
        begin
          cmd = @options.parse
          cmd.execute(self)
        rescue OptionParser::InvalidOption, ConfigFileException => error
          $stderr.puts "Error: #{error}"
          @status = STATUS_ERROR
        end
        @status
      end

      def output(text)
        print text
      end

      def report_success
        @status = STATUS_SUCCESS
      end

      def report_smells
        @status = STATUS_SMELLS
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reek-1.5.1 lib/reek/cli/application.rb
reek-1.5.0 lib/reek/cli/application.rb
reek-1.4.0 lib/reek/cli/application.rb