Class: Rake::EventTask
- Inherits:
-
FileTask
- Object
- FileTask
- Rake::EventTask
- Defined in:
- lib/biorake.rb
Overview
######################################################################### An EventTask is a task that includes time based dependencies with no associated file. Timestamps are contained in the .rake directory. If any of a DataTask’s prerequisites have a timestamp that is later than the represented by this task, then the file must be rebuilt (using the supplied actions).
Class Method Summary collapse
- .clean ⇒ Object
-
.scope_name(scope, task_name) ⇒ Object
Apply the scope to the task name according to the rules for this kind of task.
- .touch(fn) ⇒ Object
Instance Method Summary collapse
- #execute(args = nil) ⇒ Object
-
#needed? ⇒ Boolean
Is this data task needed? Yes if it doesn’t exist, or if its time stamp is out of date.
-
#timestamp ⇒ Object
Time stamp for data task.
Class Method Details
.clean ⇒ Object
59 60 61 |
# File 'lib/biorake.rb', line 59 def clean FileUtils.rm_rf ".rake" end |
.scope_name(scope, task_name) ⇒ Object
Apply the scope to the task name according to the rules for this kind of task. File based tasks ignore the scope when creating the name.
50 51 52 |
# File 'lib/biorake.rb', line 50 def scope_name(scope, task_name) task_name end |
.touch(fn) ⇒ Object
54 55 56 57 |
# File 'lib/biorake.rb', line 54 def touch(fn) FileUtils.mkdir_p ".rake" FileUtils.touch ".rake/#{fn}" end |
Instance Method Details
#execute(args = nil) ⇒ Object
32 33 34 35 36 |
# File 'lib/biorake.rb', line 32 def execute(args=nil) super(args) # And save the timestamp in storage EventTask.touch(name.to_s) end |
#needed? ⇒ Boolean
Is this data task needed? Yes if it doesn’t exist, or if its time stamp is out of date.
17 18 19 20 21 |
# File 'lib/biorake.rb', line 17 def needed? return true if !File.exist?(taskfn) return true if out_of_date?() false end |
#timestamp ⇒ Object
Time stamp for data task.
24 25 26 27 28 29 30 |
# File 'lib/biorake.rb', line 24 def if(File.exist?(taskfn)) File.mtime(taskfn) else Rake::EARLY end end |