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
Actions