Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

All tests passing on Windows (if you have 'file.exe' installed).

  • Loading branch information...
commit 32b9a28c1f553a5b55df40a9a880bfc2205c12d7 1 parent 00c0daf
Jon Yurek jyurek authored
4 lib/paperclip/thumbnail.rb
@@ -71,8 +71,8 @@ def make
71 71 def transformation_command
72 72 scale, crop = @current_geometry.transformation_to(@target_geometry, crop?)
73 73 trans = []
74   - trans << "-resize" << "'#{scale}'" unless scale.nil? || scale.empty?
75   - trans << "-crop" << "'#{crop}'" << "+repage" if crop
  74 + trans << "-resize" << %["#{scale}"] unless scale.nil? || scale.empty?
  75 + trans << "-crop" << %["#{crop}"] << "+repage" if crop
76 76 trans
77 77 end
78 78 end
2  lib/paperclip/upfile.rb
@@ -17,7 +17,7 @@ def content_type
17 17 when "csv", "xml", "css" then "text/#{type}"
18 18 else
19 19 # On BSDs, `file` doesn't give a result code of 1 if the file doesn't exist.
20   - content_type = (Paperclip.run("file", "--mime-type :file", :file => self.path).split(':').last.strip rescue "application/x-#{type}")
  20 + content_type = (Paperclip.run("file", "-b --mime-type :file", :file => self.path).split(':').last.strip rescue "application/x-#{type}")
21 21 content_type = "application/x-#{type}" if content_type.match(/\(.*?\)/)
22 22 content_type
23 23 end
8 test/paperclip_test.rb
@@ -11,19 +11,19 @@ class PaperclipTest < Test::Unit::TestCase
11 11 should "execute the right command with :image_magick_path" do
12 12 Paperclip.options[:image_magick_path] = "/usr/bin"
13 13 Paperclip.expects(:log).with(includes('[DEPRECATION]'))
14   - Paperclip.expects(:log).with("/usr/bin/convert 'one.jpg' 'two.jpg'")
15   - Paperclip::CommandLine.expects(:"`").with("/usr/bin/convert 'one.jpg' 'two.jpg'")
  14 + Paperclip.expects(:log).with(regexp_matches(%r{/usr/bin/convert ['"]one.jpg['"] ['"]two.jpg['"]}))
  15 + Paperclip::CommandLine.expects(:"`").with(regexp_matches(%r{/usr/bin/convert ['"]one.jpg['"] ['"]two.jpg['"]}))
16 16 Paperclip.run("convert", ":one :two", :one => "one.jpg", :two => "two.jpg")
17 17 end
18 18
19 19 should "execute the right command with :command_path" do
20 20 Paperclip.options[:command_path] = "/usr/bin"
21   - Paperclip::CommandLine.expects(:"`").with("/usr/bin/convert 'one.jpg' 'two.jpg'")
  21 + Paperclip::CommandLine.expects(:"`").with(regexp_matches(%r{/usr/bin/convert ['"]one.jpg['"] ['"]two.jpg['"]}))
22 22 Paperclip.run("convert", ":one :two", :one => "one.jpg", :two => "two.jpg")
23 23 end
24 24
25 25 should "execute the right command with no path" do
26   - Paperclip::CommandLine.expects(:"`").with("convert 'one.jpg' 'two.jpg'")
  26 + Paperclip::CommandLine.expects(:"`").with(regexp_matches(%r{convert ['"]one.jpg['"] ['"]two.jpg['"]}))
27 27 Paperclip.run("convert", ":one :two", :one => "one.jpg", :two => "two.jpg")
28 28 end
29 29
6 test/thumbnail_test.rb
@@ -92,7 +92,7 @@ class ThumbnailTest < Test::Unit::TestCase
92 92
93 93 should "send the right command to convert when sent #make" do
94 94 Paperclip::CommandLine.expects(:"`").with do |arg|
95   - arg.match %r{convert '#{File.expand_path(@thumb.file.path)}\[0\]' -resize 'x50' -crop '100x50\+114\+0' \+repage '.*?'}
  95 + arg.match %r{convert ["']#{File.expand_path(@thumb.file.path)}\[0\]["'] -resize ["']x50["'] -crop ["']100x50\+114\+0["'] \+repage ["'].*?["']}
96 96 end
97 97 @thumb.make
98 98 end
@@ -116,7 +116,7 @@ class ThumbnailTest < Test::Unit::TestCase
116 116
117 117 should "send the right command to convert when sent #make" do
118 118 Paperclip::CommandLine.expects(:"`").with do |arg|
119   - arg.match %r{convert -strip '#{File.expand_path(@thumb.file.path)}\[0\]' -resize 'x50' -crop '100x50\+114\+0' \+repage '.*?'}
  119 + arg.match %r{convert -strip ["']#{File.expand_path(@thumb.file.path)}\[0\]["'] -resize ["']x50["'] -crop ["']100x50\+114\+0["'] \+repage ["'].*?["']}
120 120 end
121 121 @thumb.make
122 122 end
@@ -154,7 +154,7 @@ class ThumbnailTest < Test::Unit::TestCase
154 154
155 155 should "send the right command to convert when sent #make" do
156 156 Paperclip::CommandLine.expects(:"`").with do |arg|
157   - arg.match %r{convert '#{File.expand_path(@thumb.file.path)}\[0\]' -resize 'x50' -crop '100x50\+114\+0' \+repage -strip -depth 8 '.*?'}
  157 + arg.match %r{convert ["']#{File.expand_path(@thumb.file.path)}\[0\]["'] -resize ["']x50["'] -crop ["']100x50\+114\+0["'] \+repage -strip -depth 8 ["'].*?["']}
158 158 end
159 159 @thumb.make
160 160 end

0 comments on commit 32b9a28

Please sign in to comment.
Something went wrong with that request. Please try again.