17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/cdn_fu/lister.rb', line 17
def list
file_infos ||= []
asset_root = Config.config.asset_root_dir
asset_root ||= Dir.pwd
@globs.each do |glob|
glob_str = glob[:name]
Dir.glob(File.join(asset_root,glob_str)).each do |file|
fi = FileInfo.new
fi.local_path = File.expand_path(file)
fi.preprocess = glob[:preprocess]
fi.gzip = glob[:gzip]
fi.minify = glob[:minify]
root_sub_path = fi.local_path.gsub(asset_root,'')
glob_sub_path = root_sub_path.gsub(glob_str[0,glob_str.index('*')],'')
fi.remote_path = glob[:path] ? File.join(glob[:path],glob_sub_path) : root_sub_path
file_infos << fi
end
end
@files.each do |file|
fi = FileInfo.new
fi.local_path = File.join(asset_root,file[:name])
fi.gzip = file[:gzip]
fi.minify = file[:minify]
fi.remote_path = file[:path] ? file[:path] : fi.local_path.gsub(Config.config.asset_root_dir,'')
file_infos << fi
end
file_infos
end
|