Class: Quality::Rake::Task
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Quality::Rake::Task
- Includes:
- Tools::Cane, Tools::Flay, Tools::Flog, Tools::Reek, Tools::Rubocop
- Defined in:
- lib/quality/rake/task.rb
Overview
Instance Attribute Summary collapse
-
#output_dir ⇒ Object
writeonly
Relative path to output directory where *_high_water_mark files will be read/written.
-
#quality_name ⇒ Object
Name of quality task.
-
#ratchet_name ⇒ Object
Name of ratchet task.
-
#ruby_dirs ⇒ Object
writeonly
Array of directory names which contain ruby files to analyze.
-
#skip_tools ⇒ Object
Array of strings describing tools to be skipped–e.g., [“cane”].
-
#verbose ⇒ Object
Log command executation.
Instance Method Summary collapse
-
#initialize(args = {}) {|_self| ... } ⇒ Task
constructor
Defines a new task, using the name
name. - #parse_args(args) ⇒ Object
- #parse_task_name_args(args) ⇒ Object
- #parse_unit_test_overrides(args) ⇒ Object
Constructor Details
#initialize(args = {}) {|_self| ... } ⇒ Task
Defines a new task, using the name name.
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/quality/rake/task.rb', line 69 def initialize(args = {}) parse_args(args) @skip_tools = [] @verbose = false @output_dir = 'metrics' yield self if block_given? define end |
Instance Attribute Details
#output_dir=(value) ⇒ Object (writeonly)
Relative path to output directory where *_high_water_mark files will be read/written
Defaults to .
66 67 68 |
# File 'lib/quality/rake/task.rb', line 66 def output_dir=(value) @output_dir = value end |
#quality_name ⇒ Object
Name of quality task. Defaults to :quality.
40 41 42 |
# File 'lib/quality/rake/task.rb', line 40 def quality_name @quality_name end |
#ratchet_name ⇒ Object
Name of ratchet task. Defaults to :ratchet.
44 45 46 |
# File 'lib/quality/rake/task.rb', line 44 def ratchet_name @ratchet_name end |
#ruby_dirs=(value) ⇒ Object
Array of directory names which contain ruby files to analyze.
Defaults to %w(app lib test spec feature), which translates to *.rb in the base directory, as well as those directories.
60 61 62 |
# File 'lib/quality/rake/task.rb', line 60 def ruby_dirs=(value) @ruby_dirs = value end |
#skip_tools ⇒ Object
Array of strings describing tools to be skipped–e.g., [“cane”]
Defaults to []
49 50 51 |
# File 'lib/quality/rake/task.rb', line 49 def skip_tools @skip_tools end |
#verbose ⇒ Object
Log command executation
Defaults to false
54 55 56 |
# File 'lib/quality/rake/task.rb', line 54 def verbose @verbose end |
Instance Method Details
#parse_args(args) ⇒ Object
89 90 91 92 |
# File 'lib/quality/rake/task.rb', line 89 def parse_args(args) parse_task_name_args(args) parse_unit_test_overrides(args) end |
#parse_task_name_args(args) ⇒ Object
83 84 85 86 87 |
# File 'lib/quality/rake/task.rb', line 83 def parse_task_name_args(args) @quality_name = args[:quality_name] || 'quality' @ratchet_name = args[:ratchet_name] || 'ratchet' end |
#parse_unit_test_overrides(args) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/quality/rake/task.rb', line 94 def parse_unit_test_overrides(args) # allow unit tests to override the class that Rake DSL # messages are sent to. @dsl = args[:dsl] || ::Rake::Task # likewise, but for system() @cmd_runner = args[:cmd_runner] || Kernel # likewise, but for File.open() on the count files @count_file = args[:count_file] || File # likewise, but for IO.read()/IO.exist? on the count files @count_io = args[:count_io] || IO # likewise, but for Dir.glob() on target Ruby files @globber = args[:globber] || Dir # likewise, but for checking whether a gem is installed @gem_spec = args[:gem_spec] || Gem::Specification # uses exist?() and open() to write out configuration files # for tools if needed (e.g., .cane file) @configuration_writer = args[:configuration_writer] || File # Class which actually runs the quality check commands @quality_checker_class = args[:quality_checker_class] || Quality::QualityChecker end |