mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 19:37:55 +08:00
DEV: clear asset cache when plugins add/remove client.*.yml files (#29468)
Our sprockets-based locale pipeline correctly `depends_on` client.*.yml files which already exist. But sprockets does not provide a way to watch for the creation of new files matching a certain path. This commit works around that limitation by adding the set of client.*.yml files to our global cache-clearing logic
This commit is contained in:
parent
2f334964f2
commit
1706e87e9d
|
@ -23,7 +23,10 @@ def ensure_cache_clean!
|
|||
_all_plugin_directories = Pathname.new(RAILS_ROOT + '/plugins').children.select(&:directory?)
|
||||
core_git_sha = `git rev-parse HEAD`.strip
|
||||
plugins_combined_git_sha = `git ls-files -s plugins | git hash-object --stdin`.strip
|
||||
super_sha = Digest::SHA1.hexdigest(core_git_sha + plugins_combined_git_sha)
|
||||
client_locale_paths_digest =
|
||||
Digest::SHA1.hexdigest(Dir.glob("#{RAILS_ROOT}/plugins/*/config/locales/client.*.yml").join)
|
||||
super_sha =
|
||||
Digest::SHA1.hexdigest(core_git_sha + plugins_combined_git_sha + client_locale_paths_digest)
|
||||
hash_file = "#{RAILS_ROOT}/tmp/plugin-hash"
|
||||
|
||||
old_hash = File.exist?(hash_file) ? File.read(hash_file) : nil
|
||||
|
|
Loading…
Reference in New Issue
Block a user