Class: RoodiTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- RoodiTask
- Defined in:
- lib/roodi_task.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#name ⇒ Object
Returns the value of attribute name.
-
#patterns ⇒ Object
Returns the value of attribute patterns.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(name = :roodi, patterns = nil, config = nil) {|_self| ... } ⇒ RoodiTask
constructor
A new instance of RoodiTask.
Constructor Details
#initialize(name = :roodi, patterns = nil, config = nil) {|_self| ... } ⇒ RoodiTask
Returns a new instance of RoodiTask.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/roodi_task.rb', line 7 def initialize name = :roodi, patterns = nil, config = nil @name = name @patterns = patterns || %w(app/**/*.rb lib/**/*.rb spec/**/*.rb test/**/*.rb) @config = config @verbose = Rake.application..trace yield self if block_given? define end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
4 5 6 |
# File 'lib/roodi_task.rb', line 4 def config @config end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/roodi_task.rb', line 2 def name @name end |
#patterns ⇒ Object
Returns the value of attribute patterns.
3 4 5 |
# File 'lib/roodi_task.rb', line 3 def patterns @patterns end |
#verbose ⇒ Object
Returns the value of attribute verbose.
5 6 7 |
# File 'lib/roodi_task.rb', line 5 def verbose @verbose end |
Instance Method Details
#define ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/roodi_task.rb', line 18 def define desc "Check for design issues in: #{patterns.join(', ')}" task name do runner = Roodi::Core::Runner.new runner.config = config if config patterns.each do |pattern| Dir.glob(pattern).each { |file| runner.check_file(file) } end runner.errors.each {|error| puts error} raise "Found #{runner.errors.size} errors." unless runner.errors.empty? end self end |