bin/image_optim in image_optim-0.5.0 vs bin/image_optim in image_optim-0.5.1
- old
+ new
@@ -53,11 +53,15 @@
end
if ARGV.empty?
abort "specify image paths to optimize\n\n#{option_parser.help}"
else
- io = ImageOptim.new(options)
+ io = begin
+ ImageOptim.new(options)
+ rescue ImageOptim::ConfigurationError, ImageOptim::BinaryNotFoundError => e
+ abort e
+ end
paths = ARGV.reject do |arg|
unless File.file?(arg)
$stderr << "WARN: #{arg} is not a file\n"
end
end
@@ -110,7 +114,9 @@
else
["------ #{Space::EMPTY_SPACE} #{src}", src.size, src.size]
end
end
lines, src_sizes, dst_sizes = results.transpose
- $stdout.puts lines, "Total: #{size_percent(src_sizes.inject(:+), dst_sizes.inject(:+))}\n"
+ if lines
+ $stdout.puts lines, "Total: #{size_percent(src_sizes.inject(:+), dst_sizes.inject(:+))}\n"
+ end
end