Class: Nake::FileTask
- Inherits:
-
AbstractTask
- Object
- AbstractTask
- Nake::FileTask
- Defined in:
- lib/nake/file_task.rb
Instance Attribute Summary
Attributes inherited from AbstractTask
#blocks, #config, #dependencies, #description, #hidden, #name, #original_args
Instance Method Summary collapse
-
#call(args = Array.new, options = Hash.new) ⇒ Object
FileTask can depend on tasks, other file tasks or just files.
Methods inherited from AbstractTask
[], []=, #boot, boot, #boot!, #boot_dependencies, #booted?, #bootloaders, #define, #hidden?, #initialize, new, #reset!, #run, #setup, tasks
Constructor Details
This class inherits a constructor from Nake::AbstractTask
Instance Method Details
#call(args = Array.new, options = Hash.new) ⇒ Object
FileTask can depend on tasks, other file tasks or just files. If a file task depends on a task, this task isn’t supposed to change anything what … … if it’s changing something, make sure the changing task is actually called before the file tasks are executed If the task is changing something so the file will be generated in all cases, you should rather to use normal task If there are some dependencies on files FileTask.new(“www/index.html”) do |task|
task.file_dependencies.push(*FileList["images/**/*"])
task.dependencies.push("www") # www task exist
end
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/nake/file_task.rb', line 19 def call(args = Array.new, = Hash.new) will_run = true unless self.dependencies.empty? info "Invoking file task #{name}" will_run = self.invoke_dependencies(*args, ) end if will_run && ! self.blocks.empty? note "Executing file task #{name} with arguments #{args.inspect} and options #{.inspect}" debug "Config #{self.config.inspect}" self.blocks.each do |block| block.call(self.path, *args, ) end else warn "File task #{name} won't be executed" end end |