Class: Reek::CLI::Application Private
- Inherits:
-
Object
- Object
- Reek::CLI::Application
- 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
- #execute ⇒ Object private
-
#initialize(argv) ⇒ Application
constructor
private
A new instance of Application.
- #initialize_configuration ⇒ Object private
- #output(text) ⇒ Object private
- #report_smells ⇒ Object private
- #report_success ⇒ Object private
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.new(argv) begin @options = .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
#execute ⇒ 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.
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_configuration ⇒ 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.
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_smells ⇒ 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.
49 50 51 |
# File 'lib/reek/cli/application.rb', line 49 def report_smells @status = STATUS_SMELLS end |
#report_success ⇒ 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.
45 46 47 |
# File 'lib/reek/cli/application.rb', line 45 def report_success @status = STATUS_SUCCESS end |