]> source.dussan.org Git - redmine.git/commitdiff
Fix redmine:plugins:assets rake task fails (#36287, #32938).
authorGo MAEDA <maeda@farend.jp>
Wed, 8 Dec 2021 01:23:51 +0000 (01:23 +0000)
committerGo MAEDA <maeda@farend.jp>
Wed, 8 Dec 2021 01:23:51 +0000 (01:23 +0000)
Patch by Mizuki ISHIKAWA.

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

lib/redmine/plugin_loader.rb
lib/tasks/redmine.rake
test/unit/lib/redmine/plugin_loader_test.rb

index 7b05a8a3d72b7ed1f1bb6ed6e810d97086ea27c1..1d2f2db48dd11f03008e2da4fce2cca3b48af345 100644 (file)
@@ -136,8 +136,12 @@ module Redmine
       @plugin_directories
     end
 
-    def self.mirror_assets
-      directories.each(&:mirror_assets)
+    def self.mirror_assets(name=nil)
+      if name.present?
+        directories.find{|d| d.to_s == File.join(directory, name)}.mirror_assets
+      else
+        directories.each(&:mirror_assets)
+      end
     end
   end
 end
index 2bebaf18cbd69307f12675fb030729fb4785c093..c7c257bfc35c43a977d773cbd7e2d6b1d2797a02 100644 (file)
@@ -150,7 +150,7 @@ DESC
       name = ENV['NAME']
 
       begin
-        Redmine::Plugin.mirror_assets(name)
+        Redmine::PluginLoader.mirror_assets(name)
       rescue Redmine::PluginNotFound
         abort "Plugin #{name} was not found."
       end
index 43d100521aeb54e5dbe3311b150ddadf8dd81576..2b103420eec0f4c3a8aeb4be05f5d33ff0ff8124 100644 (file)
@@ -41,6 +41,20 @@ class Redmine::PluginLoaderTest < ActiveSupport::TestCase
     assert File.exist?("#{@klass.public_directory}/foo_plugin/stylesheets/foo.css")
   end
 
+  def test_mirror_assets
+    Redmine::PluginLoader.mirror_assets
+
+    assert File.exist?("#{@klass.public_directory}/foo_plugin")
+    assert File.exist?("#{@klass.public_directory}/foo_plugin/stylesheets/foo.css")
+  end
+
+  def test_mirror_assets_with_plugin_name
+    Redmine::PluginLoader.mirror_assets('foo_plugin')
+
+    assert File.exist?("#{@klass.public_directory}/foo_plugin")
+    assert File.exist?("#{@klass.public_directory}/foo_plugin/stylesheets/foo.css")
+  end
+
   def clear_public
     FileUtils.rm_rf 'tmp/public'
   end