Class: Buildr::ResourcesTask

Inherits:
Rake::Task show all
Defined in:
lib/buildr/core/compile.rb

Overview

The resources task is executed by the compile task to copy resource files over to the target directory. You can enhance this task in the normal way, but mostly you will use the task’s filter.

For example:

resources.filter.using 'Copyright'=>'Acme Inc, 2007'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Rake::Task

#invoke, #invoke_with_call_chain

Constructor Details

#initialize(*args) ⇒ ResourcesTask

:nodoc:



437
438
439
440
441
442
443
444
# File 'lib/buildr/core/compile.rb', line 437

def initialize(*args) #:nodoc:
  super
  @filter = Buildr::Filter.new
  @filter.using Buildr.settings.profile['filter'] if Hash === Buildr.settings.profile['filter']
  enhance do
    target.invoke if target
  end
end

Instance Attribute Details

#filterObject (readonly)

Returns the filter used to copy resources over. See Buildr::Filter.



435
436
437
# File 'lib/buildr/core/compile.rb', line 435

def filter
  @filter
end

Instance Method Details

#exclude(*files) ⇒ Object

:call-seq:

exclude(*files) => self

Excludes the specified files in the filter and returns self.



459
460
461
462
# File 'lib/buildr/core/compile.rb', line 459

def exclude(*files)
  filter.exclude *files
  self
end

#from(*sources) ⇒ Object

:call-seq:

from(*sources) => self

Adds additional directories from which to copy resources.

For example:

resources.from _('src/etc')


471
472
473
474
# File 'lib/buildr/core/compile.rb', line 471

def from(*sources)
  filter.from *sources
  self
end

#include(*files) ⇒ Object

:call-seq:

include(*files) => self

Includes the specified files in the filter and returns self.



450
451
452
453
# File 'lib/buildr/core/compile.rb', line 450

def include(*files)
  filter.include *files
  self
end

#prerequisitesObject

:nodoc:



490
491
492
# File 'lib/buildr/core/compile.rb', line 490

def prerequisites #:nodoc:
  super + filter.sources.flatten
end

#sourcesObject

Returns the list of source directories (each being a file task).



477
478
479
# File 'lib/buildr/core/compile.rb', line 477

def sources
  filter.sources
end

#targetObject

:call-seq:

target => task

Returns the filter’s target directory as a file task.



485
486
487
488
# File 'lib/buildr/core/compile.rb', line 485

def target
  filter.into @project.path_to(:target, @usage, :resources) unless filter.target || sources.empty?
  filter.target
end