[DRE-commits] r5393 - in trunk/gemwatch: . public

Antonio Terceiro terceiro-guest at alioth.debian.org
Mon May 24 00:38:19 UTC 2010


Author: terceiro-guest
Date: 2010-05-24 00:38:12 +0000 (Mon, 24 May 2010)
New Revision: 5393

Added:
   trunk/gemwatch/public/.htaccess
Modified:
   trunk/gemwatch/gemwatch.rb
Log:
Cache assets for 1 year



Modified: trunk/gemwatch/gemwatch.rb
===================================================================
--- trunk/gemwatch/gemwatch.rb	2010-05-23 06:22:18 UTC (rev 5392)
+++ trunk/gemwatch/gemwatch.rb	2010-05-24 00:38:12 UTC (rev 5393)
@@ -6,6 +6,7 @@
 require 'open-uri'
 
 DOWNLOAD_BASE = File.join(File.dirname(__FILE__), 'tmp', 'download')
+ASSETS_BASE = File.join(File.dirname(__FILE__), 'public')
 
 module GemWatch
   class << self
@@ -14,7 +15,7 @@
   self.assets_path = ""
   self.prefix = ""
   def asset_url(url)
-    GemWatch.assets_path + url
+    GemWatch.assets_path + url + '?' + File.mtime(ASSETS_BASE + url).to_i.to_s
   end
   def app_url(url)
     GemWatch.prefix + url

Added: trunk/gemwatch/public/.htaccess
===================================================================
--- trunk/gemwatch/public/.htaccess	                        (rev 0)
+++ trunk/gemwatch/public/.htaccess	2010-05-24 00:38:12 UTC (rev 5393)
@@ -0,0 +1,4 @@
+ExpiresActive On
+ExpiresByType application/javascript "access plus 1 year"
+ExpiresByType text/css               "access plus 1 year"
+ExpiresByType image/png              "access plus 1 year"




More information about the Pkg-ruby-extras-commits mailing list