Class: Tailor::CLI
- Inherits:
-
Object
- Object
- Tailor::CLI
- Includes:
- LogSwitch::Mixin
- Defined in:
- lib/tailor/cli.rb,
lib/tailor/cli/options.rb
Overview
The Command-Line Interface worker. Execution from the command line comes through here.
Defined Under Namespace
Classes: Options
Instance Attribute Summary collapse
Class Method Summary collapse
-
.run(args) ⇒ Object
The main method of execution from the command line.
Instance Method Summary collapse
-
#execute! ⇒ Boolean
This checks all of the files detected during the configuration gathering process, then hands results over to the Reporter to be reported.
-
#initialize(args) ⇒ CLI
constructor
A new instance of CLI.
-
#result ⇒ Hash{String => Array}
Critiques all file sets, then returns the problems found as a result.
Constructor Details
#initialize(args) ⇒ CLI
Returns a new instance of CLI.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tailor/cli.rb', line 26 def initialize(args) = Options.parse!(args) @configuration = Configuration.new(args, ) @configuration.load! if .show_config @configuration.show exit end @critic = Critic.new @reporter = Reporter.new(@configuration.formatters) end |
Instance Attribute Details
#configuration ⇒ Tailor::Configuration (readonly)
16 17 18 |
# File 'lib/tailor/cli.rb', line 16 def configuration @configuration end |
Class Method Details
.run(args) ⇒ Object
The main method of execution from the command line.
21 22 23 |
# File 'lib/tailor/cli.rb', line 21 def self.run(args) new(args).execute! end |
Instance Method Details
#execute! ⇒ Boolean
This checks all of the files detected during the configuration gathering process, then hands results over to the Reporter to be reported.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/tailor/cli.rb', line 45 def execute! @critic.critique(@configuration.file_sets) do |problems_for_file, label| @reporter.file_report(problems_for_file, label) end @reporter.summary_report(@critic.problems, output_file: @configuration.output_file) @critic.problem_count(:error) > 0 end |
#result ⇒ Hash{String => Array}
Critiques all file sets, then returns the problems found as a result.
61 62 63 64 |
# File 'lib/tailor/cli.rb', line 61 def result @critic.critique(@configuration.file_sets) @critic.problems end |