Class: Quality::Rake::Task
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Quality::Rake::Task
- Defined in:
- lib/quality/rake/task.rb
Overview
A Rake task that run quality tools on a set of source files, and enforce a ratcheting quality level.
Example:
require 'quality/rake/task'
Quality::Rake::Task.new do |t|
end
This will create a task that can be run with:
rake quality
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”].
Instance Method Summary collapse
-
#initialize(args = {}) {|_self| ... } ⇒ Task
constructor
Defines a new task, using the name
name.
Constructor Details
#initialize(args = {}) {|_self| ... } ⇒ Task
Defines a new task, using the name name.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/quality/rake/task.rb', line 53 def initialize(args = {}) @quality_name = args[:quality_name] || 'quality' @ratchet_name = args[:ratchet_name] || 'ratchet' # 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 @skip_tools = [] @output_dir = '.' 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 .
50 51 52 |
# File 'lib/quality/rake/task.rb', line 50 def output_dir=(value) @output_dir = value end |
#quality_name ⇒ Object
Name of quality task. Defaults to :quality.
29 30 31 |
# File 'lib/quality/rake/task.rb', line 29 def quality_name @quality_name end |
#ratchet_name ⇒ Object
Name of ratchet task. Defaults to :ratchet.
33 34 35 |
# File 'lib/quality/rake/task.rb', line 33 def ratchet_name @ratchet_name end |
#ruby_dirs=(value) ⇒ Object
Array of directory names which contain ruby files to analyze.
Defaults to %w(lib test spec feature), which translates to *.rb in the base directory, as well as lib, test, and feature.
44 45 46 |
# File 'lib/quality/rake/task.rb', line 44 def ruby_dirs=(value) @ruby_dirs = value end |
#skip_tools ⇒ Object
Array of strings describing tools to be skipped–e.g., [“cane”]
Defaults to []
38 39 40 |
# File 'lib/quality/rake/task.rb', line 38 def skip_tools @skip_tools end |