In Files

Parent

Methods

Class/Module Index [+]

Quicksearch

FlayTask

Attributes

dirs[RW]
name[RW]
threshold[RW]
verbose[RW]

Public Class Methods

new(name = :flay, threshold = 200, dirs = nil) click to toggle source
# File lib/flay_task.rb, line 7
def initialize name = :flay, threshold = 200, dirs = nil
  @name      = name
  @dirs      = dirs || %(app bin lib spec test)
  @threshold = threshold
  @verbose   = Rake.application.options.trace

  yield self if block_given?

  @dirs.reject! { |f| ! File.directory? f }

  define
end

Public Instance Methods

define() click to toggle source
# File lib/flay_task.rb, line 20
def define
  desc "Analyze for code duplication in: #{dirs.join(', ')}"
  task name do
    flay = Flay.new
    flay.process(*Flay.expand_dirs_to_files(dirs))
    flay.report if verbose

    raise "Flay total too high! #{flay.total} > #{threshold}" if
      flay.total > threshold
  end
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.