Commit f7aa3206 by Christophe Chong Committed by Tute Costa

De-duplicates cocaine command line path per run

Adds failing spec to command line dup check

[fixes #1670]
[fixes #2169]
parent 4ef27eb8
...@@ -24,7 +24,8 @@ module Paperclip ...@@ -24,7 +24,8 @@ module Paperclip
# #
def run(cmd, arguments = "", interpolation_values = {}, local_options = {}) def run(cmd, arguments = "", interpolation_values = {}, local_options = {})
command_path = options[:command_path] command_path = options[:command_path]
Cocaine::CommandLine.path = [Cocaine::CommandLine.path, command_path].flatten.compact.uniq cocaine_path_array = Cocaine::CommandLine.path.try(:split, Cocaine::OS.path_separator)
Cocaine::CommandLine.path = [cocaine_path_array, command_path].flatten.compact.uniq
if logging? && (options[:log_command] || local_options[:log_command]) if logging? && (options[:log_command] || local_options[:log_command])
local_options = local_options.merge(:logger => logger) local_options = local_options.merge(:logger => logger)
end end
......
...@@ -29,7 +29,9 @@ describe Paperclip do ...@@ -29,7 +29,9 @@ describe Paperclip do
Paperclip.options[:command_path] = "/opt/my_app/bin" Paperclip.options[:command_path] = "/opt/my_app/bin"
Paperclip.run("convert", "stuff") Paperclip.run("convert", "stuff")
Paperclip.run("convert", "more_stuff") Paperclip.run("convert", "more_stuff")
assert_equal 1, [Cocaine::CommandLine.path].flatten.size
cmd_path = Paperclip.options[:command_path]
assert_equal 1, Cocaine::CommandLine.path.scan(cmd_path).count
end end
end end
......
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