lib/bower-rails/performer.rb in bower-rails-0.8.2 vs lib/bower-rails/performer.rb in bower-rails-0.8.3
- old
+ new
@@ -164,12 +164,15 @@
main_files = [main_files] unless main_files.is_a?(Array)
# Remove "./" relative path from main file strings
main_files.map! { |file| File.join(component_dir, file.gsub(/^\.\//, '')) }
+ # Make Regexp to handle wildcards
+ main_files.map! { |file| Regexp.new("\\A" + file.gsub(/\*/, '.*') + "\\Z") }
+
# Delete all files that are not in main
Find.find(component_dir).reverse_each do |file_or_dir|
- next if main_files.include?(file_or_dir)
+ next if main_files.any? { |pattern| file_or_dir =~ pattern }
if File.directory?(file_or_dir)
Dir.rmdir(file_or_dir) if (Dir.entries(file_or_dir) - %w[ . .. ]).empty?
else
FileUtils.rm(file_or_dir)
end
\ No newline at end of file