Commit 534114b8a75a24a07011858db1f6f6fd66805c6a

Authored by Antonio Terceiro
Committed by Daniela Feitosa
1 parent 1fda9d30

Fix plugin asset caching for Debian package

(i.e. for the case in which public/ is not writable)

(ActionItem2314)

Signed-off-by: Daniela Soares Feitosa <danielafeitosa@colivre.coop.br>
app/views/layouts/application-ng.rhtml
... ... @@ -15,7 +15,7 @@
15 15 <%
16 16 plugins_stylesheets = @plugins.select(&:stylesheet?).map { |plugin| plugin.class.public_path('style.css') }
17 17 %>
18   - <%= stylesheet_link_tag(plugins_stylesheets, :cache => 'cache-plugins-style-' + Digest::MD5.hexdigest(plugins_stylesheets.to_s)) unless plugins_stylesheets.empty? %>
  18 + <%= stylesheet_link_tag(plugins_stylesheets, :cache => 'cache/plugins-' + Digest::MD5.hexdigest(plugins_stylesheets.to_s)) unless plugins_stylesheets.empty? %>
19 19 <%= stylesheet_link_tag theme_stylesheet_path %>
20 20  
21 21 <%# Add custom tags/styles/etc via content_for %>
... ... @@ -24,7 +24,7 @@
24 24 <%
25 25 plugins_javascripts = @plugins.map { |plugin| plugin.js_files.map { |js| plugin.class.public_path(js) } }.flatten
26 26 %>
27   - <%= javascript_include_tag(plugins_javascripts, :cache => 'cache-plugins-js-' + Digest::MD5.hexdigest(plugins_javascripts.to_s)) unless plugins_javascripts.empty? %>
  27 + <%= javascript_include_tag(plugins_javascripts, :cache => 'cache/plugins-' + Digest::MD5.hexdigest(plugins_javascripts.to_s)) unless plugins_javascripts.empty? %>
28 28 <%=
29 29 @plugins.dispatch(:head_ending).collect do |content|
30 30 content.respond_to?(:call) ? content.call : content
... ...
debian/noosfero.links
... ... @@ -13,6 +13,8 @@ var/lib/noosfero-data/cache/cache-chat.js usr/share/noosfero/public/ja
13 13 var/lib/noosfero-data/cache/cache-slideshow.js usr/share/noosfero/public/javascripts/cache-slideshow.js
14 14 var/lib/noosfero-data/cache/cache.css usr/share/noosfero/public/stylesheets/cache.css
15 15 var/lib/noosfero-data/cache/cache-media-listing.css usr/share/noosfero/public/stylesheets/cache-media-listing.css
  16 +var/lib/noosfero-data/cache usr/share/noosfero/public/javascripts/cache
  17 +var/lib/noosfero-data/cache usr/share/noosfero/public/stylesheets/cache
16 18 var/lib/noosfero-data/public/articles usr/share/noosfero/public/articles
17 19 var/lib/noosfero-data/public/image_uploads usr/share/noosfero/public/image_uploads
18 20 var/lib/noosfero-data/public/thumbnails usr/share/noosfero/public/thumbnails
... ...
script/production
... ... @@ -17,12 +17,11 @@ fi
17 17 clear_cache() {
18 18 if test -w ./public; then
19 19 echo "Cleaning cache files"
20   - rm -f ./public/javascripts/cache-*.js
21   - rm -f ./public/stylesheets/cache.css
  20 + rm -rf ./public/javascripts/cache*
  21 + rm -rf ./public/stylesheets/cache*
22 22 elif [ ! -z "$NOOSFERO_DATA_DIR" ] && [ -w "$NOOSFERO_DATA_DIR" ]; then
23 23 echo "Cleaning cache files"
24   - rm -f $NOOSFERO_DATA_DIR/cache/cache-*.js
25   - rm -f $NOOSFERO_DATA_DIR/cache/cache.css
  24 + rm -rf "$NOOSFERO_DATA_DIR"/cache/*
26 25 fi
27 26 }
28 27  
... ...