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:



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

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.



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

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 ”.



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

def options=(value)
  @options = value
end

#paths=(value) ⇒ Object

Glob pattern to match source files. Defaults to FileList.



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

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.



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

def verbose=(value)
  @verbose = value
end