Class: Rake::FileTask

Inherits:
Task
  • Object
show all
Defined in:
lib/rake.rb

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

Direct Known Subclasses

FileCreationTask

Instance Attribute Summary

Attributes inherited from Task

#application, #comment, #prerequisites, #scope, #sources

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Task

[], #add_comment, clear, create_rule, define_task, #enhance, #execute, #initialize, #investigation, #invoke, #invoke_prerequisites, #name, #source, task_defined?, tasks, #to_s

Constructor Details

This class inherits a constructor from Rake::Task

Class Method Details

.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.



526
527
528
# File 'lib/rake.rb', line 526

def scope_name(scope, task_name)
	task_name
end

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.

Returns:

  • (Boolean)


496
497
498
499
500
# File 'lib/rake.rb', line 496

def needed?
  return true unless File.exist?(name)
  return true if out_of_date?(timestamp)
  false
end

#timestampObject

Time stamp for file task.



503
504
505
506
507
508
509
# File 'lib/rake.rb', line 503

def timestamp
  if File.exist?(name)
	File.mtime(name.to_s)
  else
	Rake::EARLY
  end
end