lib/review/makerhelper.rb in review-1.1.0 vs lib/review/makerhelper.rb in review-1.2.0
- old
+ new
@@ -32,21 +32,23 @@
Dir.open(from_dir) do |dir|
dir.each do |fname|
next if fname =~ /^\./
if FileTest.directory?("#{from_dir}/#{fname}")
- image_files += copy_images_to_dir("#{from_dir}/#{fname}", "#{to_dir}/#{fname}")
+ image_files += copy_images_to_dir("#{from_dir}/#{fname}", "#{to_dir}/#{fname}", options)
else
Dir.mkdir(to_dir) unless File.exist?(to_dir)
is_converted = false
(options[:convert] || {}).each do |orig_type, conv_type|
next unless /\.#{orig_type}$/ =~ fname
is_converted = system("convert #{from_dir}/#{fname} #{to_dir}/#{fname}.#{conv_type}")
image_files << "#{from_dir}/#{fname}.#{conv_type}"
end
- if !is_converted && fname =~ /\.(png|gif|jpg|jpeg|svg|pdf|eps)$/i
+ exts = options[:exts] || %w(png gif jpg jpeg svg pdf eps)
+ exts_str = exts.join('|')
+ if !is_converted && fname =~ /\.(#{exts_str})$/i
FileUtils.cp "#{from_dir}/#{fname}", to_dir
image_files << "#{from_dir}/#{fname}"
end
end
end