Class RoodiTask
In: lib/roodi_task.rb
Parent: Rake::TaskLib

Methods

define   new  

Attributes

config  [RW] 
name  [RW] 
patterns  [RW] 
verbose  [RW] 

Public Class methods

[Source]

# File lib/roodi_task.rb, line 7
  def initialize name = :roodi, patterns = nil, config = nil
    @name      = name
    @patterns  = patterns || %w(app/**/*.rb lib/**/*.rb spec/**/*.rb test/**/*.rb)
    @config    = config
    @verbose   = Rake.application.options.trace

    yield self if block_given?

    define
  end

Public Instance methods

[Source]

# File lib/roodi_task.rb, line 18
  def define
    desc "Check for design issues in: #{patterns.join(', ')}"
    task name do
      runner = Roodi::Core::Runner.new

      runner.config = config if config

      patterns.each do |pattern|
        Dir.glob(pattern).each { |file| runner.check_file(file) }
      end

      runner.errors.each {|error| puts error}

      raise "Found #{runner.errors.size} errors." unless runner.errors.empty?
    end
    self
  end

[Validate]