Class: MTBuild::MTFileTask

Inherits:
Rake::Task
  • Object
show all
Defined in:
lib/mtbuild/mtfile_task.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).

Class Method Summary collapse

Instance Method Summary collapse

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.



45
46
47
# File 'lib/mtbuild/mtfile_task.rb', line 45

def scope_name(scope, task_name)
  task_name
end

Instance Method Details

#force_neededObject



19
20
21
# File 'lib/mtbuild/mtfile_task.rb', line 19

def force_needed()
  @force_needed = true
end

#needed?Boolean

Is this file task needed? Yes if it doesn’t exist, or if its time stamp is out of date.

Returns:

  • (Boolean)


15
16
17
# File 'lib/mtbuild/mtfile_task.rb', line 15

def needed?
  ! File.exist?(name) || out_of_date?(timestamp) || @force_needed
end

#timestampObject

Time stamp for file task.



24
25
26
27
28
29
30
# File 'lib/mtbuild/mtfile_task.rb', line 24

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