Commit 8e426110 authored by Benjamin Neff's avatar Benjamin Neff

Create asterisk.png without digest after precompile

fixes #7317

closes #7322
parent 612455d4
......@@ -15,6 +15,7 @@
* Fix autosize in modals [#7339](https://github.com/diaspora/diaspora/pull/7339)
* Only display invite link on contacts page if invitations are enabled [#7342](https://github.com/diaspora/diaspora/pull/7342)
* Fix regex for hashtags for some languages [#7350](https://github.com/diaspora/diaspora/pull/7350)
* Create asterisk.png without digest after precompile [#7322](https://github.com/diaspora/diaspora/pull/7322)
## Features
* Add support for [Liberapay](https://liberapay.com) donations [#7290](https://github.com/diaspora/diaspora/pull/7290)
......
......@@ -86,6 +86,9 @@ module Diaspora
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# See lib/tasks/assets.rake: non_digest_assets
config.assets.non_digest_assets = %w(branding/logos/asterisk.png)
# Configure generators values. Many other options are available, be sure to check the documentation.
config.generators do |g|
g.template_engine :haml
......
......@@ -10,9 +10,32 @@ namespace :assets do
BookmarkletRenderer.compile
end
desc "Create non digest assets"
task non_digest_assets: :environment do
logger = ::Logging::Logger["assets:non_digest_assets"]
non_digest_assets = Diaspora::Application.config.assets.non_digest_assets
manifest_path = Dir.glob(File.join(Rails.root, "public/assets/manifest-*.json")).first
JSON.load(File.new(manifest_path))["assets"].each do |logical_path, digested_path|
logical_pathname = Pathname.new(logical_path)
next unless non_digest_assets.any? {|testpath| logical_pathname.fnmatch?(testpath, File::FNM_PATHNAME) }
full_digested_path = File.join(Rails.root, "public/assets", digested_path)
full_non_digested_path = File.join(Rails.root, "public/assets", logical_path)
next unless FileUtils.uptodate?(full_digested_path, [full_non_digested_path])
logger.info "Copying #{full_digested_path} to #{full_non_digested_path}"
FileUtils.copy_file(full_digested_path, full_non_digested_path, true)
end
end
# Augment precompile with error page generation
task :precompile do
Rake::Task['assets:generate_error_pages'].invoke
Rake::Task['assets:uglify_bookmarklet'].invoke
Rake::Task["assets:generate_error_pages"].invoke
Rake::Task["assets:uglify_bookmarklet"].invoke
Rake::Task["assets:non_digest_assets"].invoke
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment