Module: RailsAppcache::ApplicationHelper
- Included in:
- ManifestsController
- 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 6 7 |
# File 'lib/rails_appcache/application_helper.rb', line 3 def appcache_manifest_path(path) return "" unless RailsAppcache.config.perform_caching? "/#{path}-#{appcache_version_string}.appcache" end |
#appcache_version_string ⇒ Object
In development, serve up a new manifest every time In production, serve the current Git revision
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rails_appcache/application_helper.rb', line 11 def appcache_version_string if Rails.env.development? Rails.application.config.assets.version 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
39 40 41 |
# File 'lib/rails_appcache/application_helper.rb', line 39 def asset_cache_path(path) asset_path(path) end |
#javascript_cache_path(*paths) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/rails_appcache/application_helper.rb', line 32 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
25 26 27 28 29 30 |
# File 'lib/rails_appcache/application_helper.rb', line 25 def stylesheet_cache_path(*paths) = stylesheet_link_tag(*paths) .scan(/href="(.*?)"/).map do |match| match[0].html_safe end.join("\n") end |