Created
February 1, 2011 06:11
-
-
Save adamloving/805499 to your computer and use it in GitHub Desktop.
Revisions
-
adamloving revised this gist
Mar 22, 2012 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,4 +28,11 @@ def cache_manifest render :text => @files.join("\n"), :content_type => 'text/cache-manifest', :layout => nil end protected def add_from(loc,match) Dir.glob(File.join(Rails.root,'public',loc, match)) do |file| @files << "#{loc}#{File.basename(file)}" end end end -
adamloving created this gist
Feb 1, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ class InstallerController < ApplicationController # Rails controller action for an HTML5 cache manifest file. # Generates a plain text list of files that changes # when one of the listed files change... # So the client knows when to refresh its cache. def cache_manifest @files = ["CACHE MANIFEST\n"] @files << 'favicon.ico' @files << './client/sencha/ext-touch.js' @files << './client/sencha/resources/css/apple.css' add_from('./client/views/','*.html') add_from('./client/javascripts/','*.js') add_from('./client/stylesheets/','*.css') add_from('./client/images/','*.png') @files << "\nNETWORK:" @files << '*' digest = Digest::SHA1.new @files.each do |f| actual_file = File.join(Rails.root,'public',f) digest << "##{File.mtime(actual_file)}" if File.exist?(actual_file) end @files << "\n# Modification Digest: #{digest.hexdigest}" render :text => @files.join("\n"), :content_type => 'text/cache-manifest', :layout => nil end end