Class: SC::Buildfile::BuildTask

Inherits:
Task
  • Object
show all
Defined in:
lib/sproutcore/buildfile/build_task.rb

Overview

Just like a normal task, but will not run if the destination path already exists and it is newer than the source.

Constant Summary

Constants inherited from Task

Task::IGNORE

Instance Attribute Summary

Attributes inherited from Task

#actions, #application, #comment, #execute_count, #full_comment, #invoke_count, #prerequisites, #scope, #sources, #task_options

Instance Method Summary collapse

Methods inherited from Task

#add_description, #add_options, #arg_description, #arg_names, #clear, #clear_actions, #clear_prerequisites, #dup, #enhance, #execute, #initialize, #inspect, #investigation, #invoke, #invoke_prerequisites, #name, #name_with_args, scope_name, #set_arg_names, #source, #timestamp, #to_s

Methods included from Cloneable

#clone, #dup

Constructor Details

This class inherits a constructor from SC::Buildfile::Task

Instance Method Details

#needed?Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/sproutcore/buildfile/build_task.rb', line 16

def needed?
  return true if DST_PATH.nil? || SRC_PATHS.nil? # just try to build...
  return true if !File.exist?(DST_PATH)
  ret = false
  dst_mtime = File.mtime(DST_PATH)
  SRC_PATHS.each do |path|
    next if path.nil? # skip incase of bad src paths...
    
    timestamp = File.exist?(path) ? File.mtime(path) : EARLY
    ret = ret || (dst_mtime < timestamp)
    break if ret
  end
  return ret 
end