Actions
Defect #36218
closedPlugin assets are not copied correctly in trunk r21289
Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
Plugin assets were not copied correctly.
If the plugin assets are placed as shown below- plugins/view_customize/assets/
- public/plugin_assets/view_customize/
- public/plugin_assets/
There seems to be a problem with the processing of plugin_loader.rb.
I fixed the following as a test, and it was copied as before.
Index: plugin_loader.rb
===================================================================
--- plugin_loader.rb (revision 21289)
+++ plugin_loader.rb (working copy)
@@ -38,11 +38,12 @@
def mirror_assets
return unless has_assets_dir?
+ plugin_name = 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(PluginLoader.public_directory, File.dirname(source_files.first).gsub(assets_dir, ''))
+ base_target_dir = File.join(PluginLoader.public_directory, plugin_name, File.dirname(source_files.first).gsub(assets_dir, ''))
begin
FileUtils.mkdir_p(base_target_dir)
rescue => e
@@ -52,7 +53,7 @@
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(PluginLoader.public_directory, dir.gsub(assets_dir, ''))
+ target_dir = File.join(PluginLoader.public_directory, plugin_name, dir.gsub(assets_dir, ''))
begin
FileUtils.mkdir_p(target_dir)
rescue => e
@@ -60,7 +61,7 @@
end
end
source_files.each do |file|
- target = File.join(PluginLoader.public_directory, file.gsub(assets_dir, ''))
+ target = File.join(PluginLoader.public_directory, plugin_name, file.gsub(assets_dir, ''))
unless File.exist?(target) && FileUtils.identical?(file, target)
FileUtils.cp(file, target)
end
Related issues
Updated by Marius BĂLTEANU about 3 years ago
- Status changed from New to Confirmed
- Assignee set to Marius BĂLTEANU
- Target version set to 5.0.0
Updated by Marius BĂLTEANU almost 3 years ago
- Related to Feature #32938: Rails 6: Zeitwerk support added
Updated by Marius BĂLTEANU almost 3 years ago
- Related to Feature #29914: Migrate to Rails 6.1 with Zeitwerk autoloading added
Updated by Marius BĂLTEANU almost 3 years ago
- Category set to Code cleanup/refactoring
- Status changed from Confirmed to Closed
- Target version deleted (
5.0.0) - Resolution set to Fixed
Patch committed with a test, thanks for pointing this out.
Updated by Hirokazu Onozato almost 3 years ago
I have confirmed that this has been fixed.
Thank you very much.
Updated by Go MAEDA almost 2 years ago
- Related to Defect #36273: Modifying the source code of a plugin does not reload it after r21295 added
Actions