Class: Juggle::RakeTask

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) {|_self| ... } ⇒ RakeTask

Returns a new instance of RakeTask.

Yields:

  • (_self)

Yield Parameters:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/juggle/rake_task.rb', line 13

def initialize(*args)
  self.name = args.shift || :juggle
  self.root = Dir.pwd
  
  yield self if block_given?
  
  if Kernel.const_defined?('CLOBBER')
    targets.each do |target, path|
      CLOBBER.add path
    end
  end
  
  desc 'Compiles Juggle files' unless ::Rake.application.last_comment
  task name do
    targets.each do |target, path|
      
      Juggle.root = root
      
      Juggle.clear_jugs!
      Juggle.load_jugfile!
      
      File.open(path, 'w') do |file|
        file.write Juggle.jugs[target].compile
      end
    end
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#rootObject

Returns the value of attribute root.



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

def root
  @root
end

#settingsObject

Returns the value of attribute settings.



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

def settings
  @settings
end

#targetsObject

Returns the value of attribute targets.



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

def targets
  @targets
end

Instance Method Details

#pour(targets) ⇒ Object



9
10
11
# File 'lib/juggle/rake_task.rb', line 9

def pour(targets)
  self.targets = targets
end