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:



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

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.



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

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



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

def options=(value)
  @options = value
end

#paths=(value) ⇒ Object

Glob pattern to match source files. Defaults to FileList.



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

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.



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

def verbose=(value)
  @verbose = value
end