Class: RubyCritic::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/rubycritic/rake_task.rb

Overview

A rake task that runs RubyCritic on a set of source files.

This will create a task that can be run with:

rake rubycritic

Example:

require 'rubycritic/rake_task'

RubyCritic::RakeTask.new do |task|
  task.paths = FileList['lib/**/*.rb', 'spec/**/*.rb']
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :rubycritic) {|_self| ... } ⇒ RakeTask

Returns a new instance of RakeTask.

Yields:

  • (_self)

Yield Parameters:


39
40
41
42
43
44
45
46
47
# File 'lib/rubycritic/rake_task.rb', line 39

def initialize(name = :rubycritic)
  @name    = name
  @paths   = FileList['.']
  @options = ''
  @verbose = false

  yield self if block_given?
  define_task
end

Instance Attribute Details

#name=(value) ⇒ Object

Name of RubyCritic task. Defaults to :rubycritic.


26
27
28
# File 'lib/rubycritic/rake_task.rb', line 26

def name=(value)
  @name = value
end

#options=(value) ⇒ Object

You can pass all the options here in that are shown by “rubycritic -h” except for “-p / –path” since that is set separately. Defaults to ''.


37
38
39
# File 'lib/rubycritic/rake_task.rb', line 37

def options=(value)
  @options = value
end

#paths=(value) ⇒ Object

Glob pattern to match source files. Defaults to FileList.


29
30
31
# File 'lib/rubycritic/rake_task.rb', line 29

def paths=(value)
  @paths = value
end

#verbose=(value) ⇒ Object

Use verbose output. If this is set to true, the task will print the rubycritic command to stdout. Defaults to false.


33
34
35
# File 'lib/rubycritic/rake_task.rb', line 33

def verbose=(value)
  @verbose = value
end