lib/quality/rake/task.rb in quality-0.2.6 vs lib/quality/rake/task.rb in quality-0.2.7

- old
+ new

@@ -27,27 +27,24 @@ # # rake quality # class Task < ::Rake::TaskLib - # Name of reek task. - # Defaults to :reek. + # Name of quality task. + # Defaults to :quality. attr_accessor :name - # Array of directories to be added to $LOAD_PATH before running reek. - # Defaults to ['<the absolute path to reek's lib directory>'] - attr_accessor :libs + # Array of strings describing tools to be skipped--e.g., ["cane"] + # + # Defaults to [] + attr_accessor :skip_tools - # Use verbose output. If this is set to true, the task will print - # the reek command to stdout. Defaults to false. - attr_accessor :verbose - # Defines a new task, using the name +name+. def initialize(args = {}) @name = args[:name] @name = 'quality' if @name.nil? - @libs = [File.expand_path(File.dirname(__FILE__) + '/../../../lib')] + @skip_tools = [] if @skip_tools.nil? @config_files = nil @source_files = nil @ruby_opts = [] @reek_opts = '' @fail_on_error = true @@ -67,16 +64,24 @@ task(name) { run_task } self end def run_task - quality_cane - if Gem::Specification.find_all_by_name("reek").any? - quality_reek + tools = ['cane', 'flog', 'flay', 'reek', 'rubocop'] + tools.each do |tool| + installed = Gem::Specification.find_all_by_name(tool).any? + suppressed = @skip_tools.include? tool + + if installed + puts "#{tool} not installed" + elsif suppressed + puts "Suppressing use of #{tool}" + else + method("quality_#{tool}".to_sym).call + end + elsif + puts "" end - quality_flog - quality_flay - quality_rubocop end def ratchet_quality_cmd(cmd, options, &process_output_line)