Sha256: 854558635749fdcab6997394dd2380c301fa5f8d03202600277d167a50367d27

Contents?: true

Size: 1.28 KB

Versions: 215

Compression:

Stored size: 1.28 KB

Contents

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)
    end

    # Time stamp for file task.
    def timestamp
      if File.exist?(name)
        File.mtime(name.to_s)
      else
        Rake::EARLY
      end
    end

    private

    # Are there any prerequisites with a later time than the given time stamp?
    def out_of_date?(stamp)
      @prerequisites.any? { |n| application[n, @scope].timestamp > stamp}
    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)
        task_name
      end
    end
  end
end

Version data entries

215 entries across 169 versions & 43 rubygems

Version Path
vagrant-actionio-0.0.9 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
torquebox-console-0.2.4 vendor/bundle/jruby/1.9/gems/rake-10.0.3/lib/rake/file_task.rb
torquebox-console-0.2.4 vendor/bundle/ruby/1.8/gems/rake-10.0.3/lib/rake/file_task.rb
torquebox-console-0.2.3 vendor/bundle/jruby/1.9/gems/rake-10.0.3/lib/rake/file_task.rb
active_mailer-0.0.5 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_task.rb
active_mailer-0.0.4 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_task.rb
active_mailer-0.0.3 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_task.rb
remq-0.0.4 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
remq-0.0.3 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/rake-10.0.3/lib/rake/file_task.rb
graphael-on-rails-0.5.1 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
graphael-on-rails-0.0.1 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
challah-0.9.1.beta.3 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
devise_sociable-0.1.0 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
simple-client-0.0.3 vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/file_task.rb
backbone-queryparams-rails-0.0.1 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
railscast-assets-0.0.2 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
railscast-assets-0.0.2 vendor/bundle/gems/backbone-forms-on-rails-0.10.0/vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
backbone-forms-on-rails-0.10.0 vendor/bundle/gems/backbone-forms-on-rails-0.10.0/vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb
backbone-forms-on-rails-0.10.0 vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb