From 3a35ba9f57ed89c168079331bf6fa497b2ff7b06 Mon Sep 17 00:00:00 2001 From: Denis Yagofarov Date: Wed, 14 Sep 2011 12:35:35 +0300 Subject: [PATCH] Save Cocaine::CommandLine.path that already set --- lib/paperclip.rb | 3 ++- test/paperclip_test.rb | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/paperclip.rb b/lib/paperclip.rb index f8dd93ca7..016078a60 100644 --- a/lib/paperclip.rb +++ b/lib/paperclip.rb @@ -97,7 +97,8 @@ def run(cmd, *params) if options[:image_magick_path] Paperclip.log("[DEPRECATION] :image_magick_path is deprecated and will be removed. Use :command_path instead") end - Cocaine::CommandLine.path = options[:command_path] || options[:image_magick_path] + command_path = options[:command_path] || options[:image_magick_path] + Cocaine::CommandLine.path = ( Cocaine::CommandLine.path ? [Cocaine::CommandLine.path, command_path ].flatten : command_path ) Cocaine::CommandLine.new(cmd, *params).run end diff --git a/test/paperclip_test.rb b/test/paperclip_test.rb index 0123c0aad..4d1f3d670 100644 --- a/test/paperclip_test.rb +++ b/test/paperclip_test.rb @@ -6,6 +6,11 @@ class PaperclipTest < Test::Unit::TestCase Cocaine::CommandLine.expects(:new).with("convert", "stuff").returns(stub(:run)) Paperclip.run("convert", "stuff") end + should "save Cocaine::CommandLine.path that set before" do + Cocaine::CommandLine.path = "/opt/my_app/bin" + Paperclip.run("convert", "stuff") + assert_equal [Cocaine::CommandLine.path].flatten.include?("/opt/my_app/bin"), true + end end context "Paperclip.each_instance_with_attachment" do