Sha256: d9551882fc63e59666c8d49ad714ab8c1113429f1526aaf6f7597256a9f1ace5
Contents?: true
Size: 1.48 KB
Versions: 3
Compression:
Stored size: 1.48 KB
Contents
# frozen_string_literal: true require "rake/task.rb" require "rake/early_time" module Rake # 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). # class FileTask < Task # Is this file task needed? Yes if it doesn't exist, or if its time stamp # is out of date. def needed? ! File.exist?(name) || out_of_date?(timestamp) || @application.options.build_all end # Time stamp for file task. def timestamp if File.exist?(name) File.mtime(name.to_s) else Rake::LATE end end private # Are there any prerequisites with a later time than the given time stamp? def out_of_date?(stamp) @prerequisites.any? { |prereq| prereq_task = application[prereq, @scope] if prereq_task.instance_of?(Rake::FileTask) prereq_task.timestamp > stamp || prereq_task.needed? else prereq_task.timestamp > stamp end } end # ---------------------------------------------------------------- # Task class methods. # class << self # 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. def scope_name(scope, task_name) Rake.from_pathname(task_name) end end end end
Version data entries
3 entries across 3 versions & 3 rubygems
Version | Path |
---|---|
dirwatch-0.0.2 | vendor/bundle/ruby/2.3.0/gems/rake-12.1.0/lib/rake/file_task.rb |
tdiary-5.0.6 | vendor/bundle/gems/rake-12.1.0/lib/rake/file_task.rb |
rake-12.1.0 | lib/rake/file_task.rb |