Class: Reek::CLI::Application Private

Inherits:
Object
  • Object
show all
Defined in:
lib/reek/cli/application.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents an instance of a Reek application. This is the entry point for all invocations of Reek from the command line.

Constant Summary collapse

STATUS_SUCCESS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

0
STATUS_ERROR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

1
STATUS_SMELLS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

2

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Application

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Application.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/reek/cli/application.rb', line 18

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

Instance Method Details

#executeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
34
35
# File 'lib/reek/cli/application.rb', line 31

def execute
  return @status if error_occured?
  @command.execute self
  @status
end

#initialize_configurationObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
# File 'lib/reek/cli/application.rb', line 37

def initialize_configuration
  Configuration::AppConfiguration.initialize_with @options
end

#output(text) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/reek/cli/application.rb', line 41

def output(text)
  print text
end

#report_smellsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



49
50
51
# File 'lib/reek/cli/application.rb', line 49

def report_smells
  @status = STATUS_SMELLS
end

#report_successObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



45
46
47
# File 'lib/reek/cli/application.rb', line 45

def report_success
  @status = STATUS_SUCCESS
end