Project

General

Profile

Defect #36287 ยป fix-36287.patch

Mizuki ISHIKAWA, 2021-12-07 02:25

View differences:

lib/redmine/plugin_loader.rb
136 136
      @plugin_directories
137 137
    end
138 138

  
139
    def self.mirror_assets
140
      directories.each(&:mirror_assets)
139
    def self.mirror_assets(name=nil)
140
      if name.present?
141
        directories.find{|d| d.to_s == File.join(directory, name)}.mirror_assets
142
      else
143
        directories.each(&:mirror_assets)
144
      end
141 145
    end
142 146
  end
143 147
end
lib/tasks/redmine.rake
150 150
      name = ENV['NAME']
151 151

  
152 152
      begin
153
        Redmine::Plugin.mirror_assets(name)
153
        Redmine::PluginLoader.mirror_assets(name)
154 154
      rescue Redmine::PluginNotFound
155 155
        abort "Plugin #{name} was not found."
156 156
      end
test/unit/lib/redmine/plugin_loader_test.rb
41 41
    assert File.exist?("#{@klass.public_directory}/foo_plugin/stylesheets/foo.css")
42 42
  end
43 43

  
44
  def test_mirror_assets
45
    Redmine::PluginLoader.mirror_assets
46

  
47
    assert File.exist?("#{@klass.public_directory}/foo_plugin")
48
    assert File.exist?("#{@klass.public_directory}/foo_plugin/stylesheets/foo.css")
49
  end
50

  
51
  def test_mirror_assets_with_plugin_name
52
    Redmine::PluginLoader.mirror_assets('foo_plugin')
53

  
54
    assert File.exist?("#{@klass.public_directory}/foo_plugin")
55
    assert File.exist?("#{@klass.public_directory}/foo_plugin/stylesheets/foo.css")
56
  end
57

  
44 58
  def clear_public
45 59
    FileUtils.rm_rf 'tmp/public'
46 60
  end
    (1-1/1)