Commit 1738ea1d by Jon Yurek

Allow commandline args like 'xc:black'

parent 91c23385
......@@ -52,7 +52,7 @@ module Paperclip
raise PaperclipCommandLineError,
"Interpolation of #{key} isn't allowed."
end
shell_quote(vars[key.to_sym])
interpolation(vars, key) || match
end
end
......@@ -60,6 +60,12 @@ module Paperclip
%w(expected_outcodes swallow_stderr)
end
def interpolation(vars, key)
if vars.key?(key.to_sym)
shell_quote(vars[key.to_sym])
end
end
def shell_quote(string)
return "" if string.nil? or string.blank?
if self.class.unix?
......
......@@ -6,6 +6,11 @@ class CommandLineTest < Test::Unit::TestCase
File.stubs(:exist?).with("/dev/null").returns(true)
end
should "allow colons in parameters" do
cmd = Paperclip::CommandLine.new("convert", "'a.jpg' -resize 175x220> -size 175x220 xc:black +swap -gravity center -composite 'b.jpg'", :swallow_stderr => false)
assert_equal "convert 'a.jpg' -resize 175x220> -size 175x220 xc:black +swap -gravity center -composite 'b.jpg'", cmd.command
end
should "take a command and parameters and produce a shell command for bash" do
cmd = Paperclip::CommandLine.new("convert", "a.jpg b.png", :swallow_stderr => false)
assert_equal "convert a.jpg b.png", cmd.command
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment