Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Save Cocaine::CommandLine.path that already set
Browse files Browse the repository at this point in the history
  • Loading branch information
denyago authored and sikachu committed Sep 23, 2011
1 parent 825e1f1 commit 3a35ba9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/paperclip.rb
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions test/paperclip_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3a35ba9

Please sign in to comment.