lib/bulldog/processor/image_magick.rb in bulldog-0.0.2 vs lib/bulldog/processor/image_magick.rb in bulldog-0.0.3
- old
+ new
@@ -14,11 +14,11 @@
def initialize(*args)
super
@tree = ArgumentTree.new(styles)
end
- def process(*args, &block)
+ def process
return if styles.empty?
super
run_convert
end
@@ -103,11 +103,11 @@
end
def run_convert
add_final_style_arguments
output = run_convert_command and
- run_convert_callbacks(output)
+ run_convert_callbacks(output)
end
def add_final_style_arguments
styles.each do |style|
@tree.add(style, ['-quality', style[:quality].to_s]) if style[:quality]
@@ -118,10 +118,12 @@
end
end
def run_convert_command
command = [self.class.convert_command, "#{input_file}[0]", *@tree.arguments].flatten
- Bulldog.run(*command)
+ output = Bulldog.run(*command) or
+ record.errors.add name, "convert failed (status #$?)"
+ output
end
def run_convert_callbacks(output)
io = StringIO.new(output)
@tree.each_callback do |styles, callback|