Skip to content

Commit

Permalink
Merge pull request #13 from mroth/annotate
Browse files Browse the repository at this point in the history
fix annotate command
  • Loading branch information
EricR committed Dec 29, 2012
2 parents b8c4e2d + fe1874d commit 6a93868
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/image_sorcery.rb
Expand Up @@ -12,6 +12,7 @@ def manipulate!(args={})
tokens = ["mogrify"]
tokens << convert_to_arguments(args) if args
tokens << " '#{@file}#{"[#{args[:layer].to_s}]" if args[:layer]}'"
tokens << " -annotate #{args[:annotate].to_s}" if args[:annotate]
tokens = convert_to_command(tokens)
success = run(tokens)[1]
success
Expand All @@ -24,6 +25,7 @@ def convert(output, args={})
tokens = ["convert"]
tokens << convert_to_arguments(args) if args
tokens << " '#{@file}#{"[#{args[:layer].to_s}]" if args[:layer]}'"
tokens << " -annotate #{args[:annotate].to_s}" if args[:annotate]
tokens << " #{output}"
tokens = convert_to_command(tokens)
success = run(tokens)[1]
Expand Down Expand Up @@ -82,7 +84,8 @@ def convert_to_command(tokens)
end

def convert_to_arguments(args)
args.reject {|k, v| k == :layer }.map {|k, v| " -#{k} '#{v}'"}
special_args = [:layer, :annotate]
args.reject {|k, v| special_args.include?(k) }.map {|k, v| " -#{k} '#{v}'"}
end

def run(cmds)
Expand Down

0 comments on commit 6a93868

Please sign in to comment.