Class: RoodiTask

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) {|_self| ... } ⇒ RoodiTask

Returns a new instance of RoodiTask.

Yields:

  • (_self)

Yield Parameters:

  • _self (RoodiTask)

    the object that the method was called on


10
11
12
13
14
15
16
17
18
19
# File 'lib/roodi_task.rb', line 10

def initialize(args = {})
  @name = args[:name] || :roodi
  @patterns = args[:patterns] || []
  @config = args[:config]
  @verbose = Rake.application.options.trace

  yield self if block_given?

  define
end

Instance Attribute Details

#configObject

Returns the value of attribute config


7
8
9
# File 'lib/roodi_task.rb', line 7

def config
  @config
end

#nameObject

Returns the value of attribute name


5
6
7
# File 'lib/roodi_task.rb', line 5

def name
  @name
end

#patternsObject

Returns the value of attribute patterns


6
7
8
# File 'lib/roodi_task.rb', line 6

def patterns
  @patterns
end

#verboseObject

Returns the value of attribute verbose


8
9
10
# File 'lib/roodi_task.rb', line 8

def verbose
  @verbose
end

Instance Method Details

#defineObject


21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/roodi_task.rb', line 21

def define
  prevent_multiple_runs!

  desc "Run Roodi against all source files"
  task name do
    runner = Roodi::Core::Runner.new

    runner.config = config if config

    runner.start(@patterns)
  end
  self
end