Class: SC::Buildfile::BuildTask

Inherits:
Task 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.

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, indent_logs, #initialize, #inspect, #investigation, #invoke, #invoke_prerequisites, log_indent, #name, #name_with_args, outdent_logs, scope_name, #set_arg_names, #source, #timestamp, #to_s

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