Module: RailsAppcache::ApplicationHelper
- Defined in:
- lib/rails_appcache/application_helper.rb
Instance Method Summary collapse
- #appcache_manifest_path(path) ⇒ Object
-
#appcache_version_string ⇒ Object
In development, serve up a new manifest every time In production, serve the current Git revision.
- #asset_cache_path(path) ⇒ Object
- #javascript_cache_path(*paths) ⇒ Object
- #stylesheet_cache_path(*paths) ⇒ Object
Instance Method Details
#appcache_manifest_path(path) ⇒ Object
3 4 5 |
# File 'lib/rails_appcache/application_helper.rb', line 3 def appcache_manifest_path(path) "/#{path}.appcache" end |
#appcache_version_string ⇒ Object
In development, serve up a new manifest every time In production, serve the current Git revision
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rails_appcache/application_helper.rb', line 9 def appcache_version_string if Rails.env.development? Time.now.to_i.to_s else # Use the REVISION file left in root from capistrano if File.exists?(Rails.root.join('REVISION')) File.read(Rails.root.join('REVISION')) else `git rev-parse HEAD` end end end |
#asset_cache_path(path) ⇒ Object
36 37 38 |
# File 'lib/rails_appcache/application_helper.rb', line 36 def asset_cache_path(path) asset_path(path) end |
#javascript_cache_path(*paths) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/rails_appcache/application_helper.rb', line 29 def javascript_cache_path(*paths) = javascript_include_tag(*paths) .scan(/src="(.*?)"/).map do |match| match[0].html_safe end.join("\n") end |
#stylesheet_cache_path(*paths) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/rails_appcache/application_helper.rb', line 22 def stylesheet_cache_path(*paths) = stylesheet_link_tag(*paths) .scan(/href="(.*?)"/).map do |match| match[0].html_safe end.join("\n") end |