Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Do not add duplicate paths to Cocaine::CommandLine.path for each run.

  • Loading branch information...
commit 06d69afb3a268af1988254b1c48931647f1af659 1 parent 9092f7a
@boone boone authored
Showing with 10 additions and 1 deletion.
  1. +1 −1  lib/paperclip.rb
  2. +9 −0 test/paperclip_test.rb
View
2  lib/paperclip.rb
@@ -93,7 +93,7 @@ def interpolates key, &block
#
def run(cmd, arguments = "", local_options = {})
command_path = options[:command_path]
- Cocaine::CommandLine.path = ( Cocaine::CommandLine.path ? [Cocaine::CommandLine.path, command_path ].flatten : command_path )
+ Cocaine::CommandLine.path = ( Cocaine::CommandLine.path ? [Cocaine::CommandLine.path].flatten | [command_path] : command_path )
local_options = local_options.merge(:logger => logger) if logging? && (options[:log_command] || local_options[:log_command])
Cocaine::CommandLine.new(cmd, arguments, local_options).run
end
View
9 test/paperclip_test.rb
@@ -22,6 +22,15 @@ class PaperclipTest < Test::Unit::TestCase
Paperclip.run("convert", "stuff")
assert_equal [Cocaine::CommandLine.path].flatten.include?("/opt/my_app/bin"), true
end
+
+ should "not duplicate Cocaine::CommandLine.path on multiple runs" do
+ Cocaine::CommandLine.expects(:new).with("convert", "more_stuff", {}).returns(stub(:run))
+ Cocaine::CommandLine.path = nil
+ Paperclip.options[:command_path] = "/opt/my_app/bin"
+ Paperclip.run("convert", "stuff")
+ Paperclip.run("convert", "more_stuff")
+ assert_equal 1, [Cocaine::CommandLine.path].flatten.size
+ end
end
context "Calling Paperclip.run with a logger" do
Please sign in to comment.
Something went wrong with that request. Please try again.