15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/appcache-manifest.rb', line 15
def set_route
Rails.application.routes.draw do
match @@config.manifest_url => Proc.new {
manifest_file = "#{Rails.root.to_s}/public/#{Rails.application.config.assets.prefix}/manifest.yml"
if File.exists?(manifest_file)
manifest = YAML::load(IO.read(manifest_file))
body = ["CACHE MANIFEST"]
body << "# #{@@config.to_json}"
for key,value in manifest
body << Rails.application.config.assets.prefix + "/" + value
end
body << "" << "NETWORK: *"
[200, {"Content-Type" => "text/cache-manifest"}, [body.join("\n")]]
else
[400, {"Content-Type" => "text/html"}, ["File not found"]]
end
}
end
end
|