Class: FileTask
Overview
A FileTask is a task that includes time based dependencies. If any of a FileTask’s prerequisites have a timestamp that is later than the file represented by this task, then the file must be rebuilt (using the supplied actions).
Constant Summary
Constants inherited from Task
Instance Attribute Summary
Attributes inherited from Task
#comment, #prerequisites, #source
Instance Method Summary collapse
-
#needed? ⇒ Boolean
Is this file task needed? Yes if it doesn’t exist, or if its time stamp is out of date.
-
#timestamp ⇒ Object
Time stamp for file task.
Methods inherited from Task
[], #add_comment, clear, create_rule, define_task, #enhance, enhance_with_matching_rule, #execute, #initialize, #invoke, lookup, #name, task_defined?, tasks
Constructor Details
This class inherits a constructor from Task
Instance Method Details
#needed? ⇒ Boolean
Is this file task needed? Yes if it doesn’t exist, or if its time stamp is out of date.
275 276 277 278 279 280 |
# File 'lib/rake.rb', line 275 def needed? return true unless File.exist?(name) latest_prereq = @prerequisites.collect{|n| Task[n].}.max return false if latest_prereq.nil? < latest_prereq end |
#timestamp ⇒ Object
Time stamp for file task.
283 284 285 |
# File 'lib/rake.rb', line 283 def File.mtime(name.to_s) end |