class Rake::Task
Rote
adds the following methods to the Rake::Task
class.
Public Class Methods
memoize(args, &block)
click to toggle source
Memoize the result of the block with respect to the file-based dependencies. Specify a description and dependencies like a Task:
Rake::Task.memoize :task_name => [fn1,fn2] { ... }
If the cached result is up-to-date with respect to the dependencies then the block will not be executed. Instead, the result will be unmarshalled from disk.
# File lib/rote/cache.rb 97 def self.memoize(args, &block) 98 task_name, deps = resolve_args(args) 99 fn = File.join(Rake.cache_dir, MD5.new(deps.inspect).to_s + "." + task_name) 100 Rake.register_dependency(deps) 101 102 result = nil 103 # This file task isn't ever used other than manually below with t.invoke 104 t = file fn => deps do 105 result = block.call 106 mkdir_p Rake.cache_dir unless File.exists?(Rake.cache_dir) 107 File.open(fn,"w") { |fp| Marshal.dump(result,fp) } 108 end 109 if t.needed? then 110 t.invoke 111 result 112 else 113 Marshal.load(File.read(fn)) 114 end 115 end
Public Instance Methods
execute(args)
click to toggle source
Execute the task, setting the executed flag. Used by the monitor
task.
# File lib/rote/rotetasks.rb 350 def execute(args) 351 @executed = true 352 pre_rote_execute 353 end
Also aliased as: pre_rote_execute
executed?()
click to toggle source
Determine whether this task has been executed in this cycle. Used by the monitor
task.
# File lib/rote/rotetasks.rb 343 def executed? 344 @executed 345 end
reset()
click to toggle source
Reset the executed and invoked flags on this task. Used by the monitor
task.
# File lib/rote/rotetasks.rb 336 def reset 337 @already_invoked = false 338 @executed = false 339 end