From 031d8c1902c117b4e51f249857f150386caee4ae Mon Sep 17 00:00:00 2001 From: James Adam Date: Fri, 24 Oct 2008 12:20:34 +0100 Subject: [PATCH] Added a fix for absolute paths being created into plugin_assets directory. [#6 state:resolved], [#26 state:resolved] - apologies for the delay, and thanks to Azimux for the patch. --- lib/engines.rb | 2 +- test/unit/assets_test.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/engines.rb b/lib/engines.rb index 47886f5..04c22da 100644 --- a/lib/engines.rb +++ b/lib/engines.rb @@ -144,7 +144,7 @@ def mirror_files_from(source, destination) source_files -= source_dirs unless source_files.empty? - base_target_dir = File.join(destination, File.dirname(source_files.first)) + base_target_dir = File.join(destination, File.dirname(source_files.first).gsub(source, '')) FileUtils.mkdir_p(base_target_dir) end diff --git a/test/unit/assets_test.rb b/test/unit/assets_test.rb index 9cc5d1f..3332c53 100644 --- a/test/unit/assets_test.rb +++ b/test/unit/assets_test.rb @@ -24,6 +24,10 @@ def test_public_files_have_been_copied_from_test_assets_plugin assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'subfolder', 'file_in_subfolder.txt')) end + def test_engines_has_not_created_duplicated_file_structure + assert !File.exists?(File.join(Engines.public_directory, "test_assets", RAILS_ROOT)) + end + def test_public_files_have_been_copied_from_test_assets_with_assets_dir_plugin Engines::Assets.mirror_files_for Engines.plugins[:test_assets_with_assets_directory]