]> source.dussan.org Git - redmine.git/commitdiff
Upgrades propshaft to 1.1.0 (#39111).
authorMarius Balteanu <marius.balteanu@zitec.com>
Thu, 31 Oct 2024 08:17:01 +0000 (08:17 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Thu, 31 Oct 2024 08:17:01 +0000 (08:17 +0000)
Patch by Takashi Kato (user:tohosaku).

git-svn-id: https://svn.redmine.org/redmine/trunk@23174 e93f8b46-1217-0410-a6f0-8f06a7374b81

Gemfile
config/initializers/10-patches.rb
lib/redmine/asset_path.rb
test/unit/lib/redmine/asset_path_test.rb

diff --git a/Gemfile b/Gemfile
index 14dabb6264e5d7c9814f8580da905b03dbd25d02..7ccb60b1d22a754001aff50611425c61aaeec1ee 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -14,7 +14,7 @@ gem 'i18n', '~> 1.14.1'
 gem 'rbpdf', '~> 1.21.3'
 gem 'addressable'
 gem 'rubyzip', '~> 2.3.0'
-gem 'propshaft', '~> 0.8.0'
+gem 'propshaft', '~> 1.1.0'
 gem 'rack', '>= 3.1.3'
 
 #  Ruby Standard Gems
index 52e6d2a21aa6972df537d1b5e5ee3aab8432c05f..0cee95cce5a33c49e8d74a766c4c192bbf5234b5 100644 (file)
@@ -132,7 +132,7 @@ module Propshaft
     end
 
     def load_path
-      @load_path ||= Redmine::AssetLoadPath.new(config)
+      @load_path ||= Redmine::AssetLoadPath.new(config, compilers)
     end
   end)
 
index d425d39f04f8858d319211849c8067ce787474e3..4c7959a5873268d14545b990eabd0bceb8c3ec52 100644 (file)
@@ -29,14 +29,14 @@ module Redmine
       @version = Rails.application.config.assets.version
     end
 
-    def update(transition_map:, assets:)
+    def update(transition_map:, assets:, load_path:)
       each_file do |file, intermediate_path, logical_path|
         @transition.add_src  intermediate_path, logical_path
         @transition.add_dest intermediate_path, logical_path
         asset = if file.extname == '.css'
-                  Redmine::Asset.new(file,   logical_path: logical_path, version: version, transition_map: transition_map)
+                  Redmine::Asset.new(file,   logical_path: logical_path, load_path: load_path, transition_map: transition_map)
                 else
-                  Propshaft::Asset.new(file, logical_path: logical_path, version: version)
+                  Propshaft::Asset.new(file, logical_path: logical_path, load_path: load_path)
                 end
         assets[asset.logical_path.to_s] ||= asset
       end
@@ -132,10 +132,10 @@ module Redmine
   class AssetLoadPath < Propshaft::LoadPath
     attr_reader :extension_paths, :default_asset_path, :transition_map
 
-    def initialize(config)
+    def initialize(config, compilers)
       @extension_paths    = config.redmine_extension_paths
       @default_asset_path = config.redmine_default_asset_path
-      super(config.paths, version: config.version)
+      super(config.paths, compilers: compilers, version: config.version)
     end
 
     def asset_files
@@ -156,13 +156,13 @@ module Redmine
       super
       if merge_required
         @transition_map = {}
-        default_asset_path.update(assets: @cached_assets_by_path, transition_map: transition_map)
+        default_asset_path.update(assets: @cached_assets_by_path, transition_map: transition_map, load_path: self)
         extension_paths.each do |asset_path|
           # Support link from extension assets to assets in the application
           default_asset_path.each_file do |file, intermediate_path, logical_path|
             asset_path.instance_eval { @transition.add_dest intermediate_path, logical_path }
           end
-          asset_path.update(assets: @cached_assets_by_path, transition_map: transition_map)
+          asset_path.update(assets: @cached_assets_by_path, transition_map: transition_map, load_path: self)
         end
       end
       @cached_assets_by_path
@@ -189,9 +189,9 @@ module Redmine
   end
 
   class Asset < Propshaft::Asset
-    def initialize(file, logical_path:, version:, transition_map:)
+    def initialize(file, logical_path:, load_path:, transition_map:)
       @transition_map = transition_map
-      super(file, logical_path: logical_path, version: version)
+      super(file, logical_path: logical_path, load_path: load_path)
     end
 
     def content
index a4f12f0e353699a9bce5525c4b813c7375ed28a2..bad93f8b03cdc762c0823cabd53be64d59aa6417 100644 (file)
@@ -26,7 +26,7 @@ class Redmine::AssetPathTest < ActiveSupport::TestCase
     @asset_path = Redmine::AssetPath.new(assets_dir, paths, 'plugin_assets/foo/')
     @assets = {}
     @transition_map = {}
-    @asset_path.update(transition_map: @transition_map, assets: @assets)
+    @asset_path.update(transition_map: @transition_map, assets: @assets, load_path: nil)
   end
 
   test "asset path size" do