lib/task.rb in distil-0.8.0 vs lib/task.rb in distil-0.8.1
- old
+ new
@@ -1,5 +1,6 @@
+require "#{$script_dir}/filter"
require "#{$script_dir}/source-file"
require "#{$script_dir}/file-set"
require 'set'
require "#{$script_dir}/configurable"
@@ -94,19 +95,23 @@
def find_files
@probed= Set.new
@included_files= []
@files_to_include.each { |i| include_file(i) }
+
+ files= @included_files.map { |f|
+ f.to_s
+ }
end
def products
[]
end
def need_to_build
return @need_to_build if !@need_to_build.nil?
-
+
product_modification_times= products.map { |p|
p=File.expand_path(p)
return (@need_to_build=true) if !File.exists?(p)
File.stat(p).mtime
}
@@ -136,17 +141,17 @@
full_root_path= File.expand_path(remove_prefix||"")
folders= []
assets.each { |a|
- path= a.has_file_path ? a.file_path : a.relative_to_folder(full_root_path)
+ path= a.file_path || a.relative_to_folder(full_root_path)
parts= File.dirname(path).split(File::SEPARATOR)
if ('.'==parts[0])
target_path= File.join(output_folder, path)
FileUtils.rm target_path if File.exists? target_path
- File.symlink a.full_path, target_path
+ File.symlink a.relative_to_folder(output_folder), target_path
next
end
for i in (0..parts.length-1)
f= parts[0..i].join(File::SEPARATOR)
@@ -159,20 +164,22 @@
folders.sort!
folders.each { |f|
# puts "#{File.join(remove_prefix, f)} => #{File.join(output_folder, f)}"
src_folder= remove_prefix ? File.join(remove_prefix, f) : f
+ src_folder= SourceFile.path_relative_to_folder(File.expand_path(src_folder), output_folder)
+
target_folder= File.expand_path(File.join(output_folder, f))
next if File.exists?(target_folder)
- File.symlink File.expand_path(src_folder), target_folder
+ File.symlink src_folder, target_folder
}
# puts "#{task_name}: folder=#{folders.inspect}"
end
def copy_assets
assets.each { |a|
- a.copy_to(output_folder)
+ a.copy_to(output_folder, remove_prefix)
}
end
def build_assets
if ("release"==mode)