class Simplabs::Excellent::Rake::ExcellentTask

A special rake task for Excellent.

Attributes

html[RW]

Specifies whether to output HTML; defaults to false. Assign a file name to output HTML to that file.

name[RW]

The Name of the task, defaults to :excellent.

paths[RW]

The paths to process (specify file names or directories; will recursively process all ruby files if a directory is given).

Public Class Methods

new(name = :excellent) { |self| ... } click to toggle source

Initializes an ExcellentTask with the name name.

# File lib/simplabs/excellent/rake/excellent_task.rb, line 23
def initialize(name = :excellent)
  @name  = name
  @paths = nil || []
  @html  = false
  yield self if block_given?
  define
end

Private Instance Methods

define() click to toggle source
# File lib/simplabs/excellent/rake/excellent_task.rb, line 43
def define
  unless ::Rake.application.last_comment
    desc 'Analyse the code with Excellent'
  end
  task name do
    paths = @paths.join(' ')
    format = @html ? " -o #{@html}" : ''
    system("excellent#{format} #{paths}")
    $stdout.puts("\nWrote Excellent result to #{@html}\n\n") if @html
  end
end