]> source.dussan.org Git - redmine.git/commitdiff
Remove code that is no longer needed as a result of asset pipeline implementation...
authorMarius Balteanu <marius.balteanu@zitec.com>
Thu, 25 Jan 2024 05:40:45 +0000 (05:40 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Thu, 25 Jan 2024 05:40:45 +0000 (05:40 +0000)
Patch by Takashi Kato (@tohosaku).

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

app/controllers/admin_controller.rb
lib/redmine/plugin_loader.rb
test/unit/lib/redmine/plugin_loader_test.rb

index fb7b0de21458ef229e8697ed7bb96eb46c34e392..9bbfc400bfdc2253263836dc480a59e8ef7faa82 100644 (file)
@@ -79,7 +79,6 @@ class AdminController < ApplicationController
     @checklist = [
       [:text_default_administrator_account_changed, User.default_admin_account_changed?],
       [:text_file_repository_writable, File.writable?(Attachment.storage_path)],
-      ["#{l :text_plugin_assets_writable} (./public/plugin_assets)",   File.writable?(Redmine::Plugin.public_directory)],
       [:text_all_migrations_have_been_run, !ActiveRecord::Base.connection.migration_context.needs_migration?],
       [:text_minimagick_available,     Object.const_defined?(:MiniMagick)],
       [:text_convert_available,        Redmine::Thumbnail.convert_available?],
index 9f49208d64137000eec870924f0b6ce6ab7addd1..9323b18a74abae6016409fb549ddbb03e2a18d85 100644 (file)
@@ -35,43 +35,6 @@ module Redmine
       @dir
     end
 
-    def mirror_assets
-      return unless has_assets_dir?
-
-      destination = File.join(PluginLoader.public_directory, File.basename(@dir))
-
-      source_files = Dir["#{assets_dir}/**/*"]
-      source_dirs = source_files.select { |d| File.directory?(d)}
-      source_files -= source_dirs
-      unless source_files.empty?
-        base_target_dir = File.join(destination, File.dirname(source_files.first).gsub(assets_dir, ''))
-        begin
-          FileUtils.mkdir_p(base_target_dir)
-        rescue => e
-          raise "Could not create directory #{base_target_dir}: " + e.message
-        end
-      end
-
-      source_dirs.each do |dir|
-        # strip down these paths so we have simple, relative paths we can
-        # add to the destination
-        target_dir = File.join(destination, dir.gsub(assets_dir, ''))
-        begin
-          FileUtils.mkdir_p(target_dir)
-        rescue => e
-          raise "Could not create directory #{target_dir}: " + e.message
-        end
-      end
-      source_files.each do |file|
-        target = File.join(destination, file.gsub(assets_dir, ''))
-        unless File.exist?(target) && FileUtils.identical?(file, target)
-          FileUtils.cp(file, target)
-        end
-      rescue => e
-        raise "Could not copy #{file} to #{target}: " + e.message
-      end
-    end
-
     def has_assets_dir?
       File.directory?(@assets_dir)
     end
@@ -90,16 +53,6 @@ module Redmine
     cattr_accessor :public_directory
     self.public_directory = Rails.public_path.join('plugin_assets')
 
-    def self.create_assets_reloader
-      plugin_assets_dirs = {}
-      directories.each do |dir|
-        plugin_assets_dirs[dir.assets_dir] = ['*']
-      end
-      ActiveSupport::FileUpdateChecker.new([], plugin_assets_dirs) do
-        mirror_assets
-      end
-    end
-
     def self.load
       setup
       add_autoload_paths
@@ -136,13 +89,5 @@ module Redmine
     def self.directories
       @plugin_directories
     end
-
-    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 ed59433468e307a829ac4cde6066f39fd3936b88..26a0f4b2a0998f3baf402bc1905402357c084e2b 100644 (file)
@@ -25,7 +25,6 @@ class Redmine::PluginLoaderTest < ActiveSupport::TestCase
 
     @klass = Redmine::PluginLoader
     @klass.directory = Rails.root.join('test/fixtures/plugins')
-    @klass.public_directory = Rails.root.join('tmp/public/plugin_assets')
     @klass.load
   end
 
@@ -33,28 +32,6 @@ class Redmine::PluginLoaderTest < ActiveSupport::TestCase
     clear_public
   end
 
-  def test_create_assets_reloader
-    plugin_assets = @klass.create_assets_reloader
-    plugin_assets.execute.inspect
-
-    assert File.exist?("#{@klass.public_directory}/foo_plugin")
-    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