4
5
6
7
8
9
10
11
12
13
14
15
16
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
47
48
49
50
51
52
53
54
55
|
# File 'lib/view_assets/manager/map.rb', line 4
def draw
map = { :vendor => {}, :lib => {}, :app => {} }
application_manifest = PathInfo.new("#{app_path}/#{asset_path}/application")
app_covered_action = false
if FileTest.exist?("#{application_manifest.abs}.#{ext}")
map[:app][application_manifest.to_s] = finder.retrieve_manifest(application_manifest, { :shallow => true })
app_covered_action = true
end
actions = action_map.retrieve
actions.each do |controller, actions|
controller_manifest = PathInfo.new("#{app_path}/#{asset_path}/#{controller}/#{controller}")
controller_convered_action = false
if FileTest.exist?("#{controller_manifest.abs}.#{ext}")
map[:app][controller_manifest.to_s] = finder.retrieve_manifest(controller_manifest, { :shallow => true, :controller => controller })
controller_convered_action = true
end
actions.each do |action|
action_manifest = "#{app_path}/#{asset_path}/#{controller}/#{action}"
map[:app][action_manifest] = finder.retrieve(controller, action, { :shallow => true, :controller => controller, :action => action })
if controller_convered_action || app_covered_action
map[:app][action_manifest][0] = map[:app][action_manifest][0].basename
end
end
end
Pathname.new("#{root}/#{vendor_path}/#{asset_path}").children.each do |entry|
manifest = PathInfo.new(entry.to_s).rel
map[:vendor][manifest.basename] = finder.retrieve_manifest(manifest.rel, { :shallow => true })
end
Pathname.new("#{root}/#{lib_path}/#{asset_path}").children.each do |entry|
manifest = PathInfo.new(entry.to_s).rel
map[:lib][manifest.basename] = finder.retrieve_manifest(manifest.rel, { :shallow => true })
end
FileUtils.mkdir_p("#{root}/assets")
File.open("#{root}/assets/#{asset_path}_assets.yml", 'w') { |file| file << YAML.dump(map) }
map
end
|