Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
View
@@ -71,8 +71,8 @@ def make
def transformation_command
scale, crop = @current_geometry.transformation_to(@target_geometry, crop?)
trans = []
- trans << "-resize" << "'#{scale}'" unless scale.nil? || scale.empty?
- trans << "-crop" << "'#{crop}'" << "+repage" if crop
+ trans << "-resize" << %["#{scale}"] unless scale.nil? || scale.empty?
+ trans << "-crop" << %["#{crop}"] << "+repage" if crop
trans
end
end
2  lib/paperclip/upfile.rb
View
@@ -17,7 +17,7 @@ def content_type
when "csv", "xml", "css" then "text/#{type}"
else
# On BSDs, `file` doesn't give a result code of 1 if the file doesn't exist.
- content_type = (Paperclip.run("file", "--mime-type :file", :file => self.path).split(':').last.strip rescue "application/x-#{type}")
+ content_type = (Paperclip.run("file", "-b --mime-type :file", :file => self.path).split(':').last.strip rescue "application/x-#{type}")
content_type = "application/x-#{type}" if content_type.match(/\(.*?\)/)
content_type
end
8 test/paperclip_test.rb
View
@@ -11,19 +11,19 @@ class PaperclipTest < Test::Unit::TestCase
should "execute the right command with :image_magick_path" do
Paperclip.options[:image_magick_path] = "/usr/bin"
Paperclip.expects(:log).with(includes('[DEPRECATION]'))
- Paperclip.expects(:log).with("/usr/bin/convert 'one.jpg' 'two.jpg'")
- Paperclip::CommandLine.expects(:"`").with("/usr/bin/convert 'one.jpg' 'two.jpg'")
+ Paperclip.expects(:log).with(regexp_matches(%r{/usr/bin/convert ['"]one.jpg['"] ['"]two.jpg['"]}))
+ Paperclip::CommandLine.expects(:"`").with(regexp_matches(%r{/usr/bin/convert ['"]one.jpg['"] ['"]two.jpg['"]}))
Paperclip.run("convert", ":one :two", :one => "one.jpg", :two => "two.jpg")
end
should "execute the right command with :command_path" do
Paperclip.options[:command_path] = "/usr/bin"
- Paperclip::CommandLine.expects(:"`").with("/usr/bin/convert 'one.jpg' 'two.jpg'")
+ Paperclip::CommandLine.expects(:"`").with(regexp_matches(%r{/usr/bin/convert ['"]one.jpg['"] ['"]two.jpg['"]}))
Paperclip.run("convert", ":one :two", :one => "one.jpg", :two => "two.jpg")
end
should "execute the right command with no path" do
- Paperclip::CommandLine.expects(:"`").with("convert 'one.jpg' 'two.jpg'")
+ Paperclip::CommandLine.expects(:"`").with(regexp_matches(%r{convert ['"]one.jpg['"] ['"]two.jpg['"]}))
Paperclip.run("convert", ":one :two", :one => "one.jpg", :two => "two.jpg")
end
6 test/thumbnail_test.rb
View
@@ -92,7 +92,7 @@ class ThumbnailTest < Test::Unit::TestCase
should "send the right command to convert when sent #make" do
Paperclip::CommandLine.expects(:"`").with do |arg|
- arg.match %r{convert '#{File.expand_path(@thumb.file.path)}\[0\]' -resize 'x50' -crop '100x50\+114\+0' \+repage '.*?'}
+ arg.match %r{convert ["']#{File.expand_path(@thumb.file.path)}\[0\]["'] -resize ["']x50["'] -crop ["']100x50\+114\+0["'] \+repage ["'].*?["']}
end
@thumb.make
end
@@ -116,7 +116,7 @@ class ThumbnailTest < Test::Unit::TestCase
should "send the right command to convert when sent #make" do
Paperclip::CommandLine.expects(:"`").with do |arg|
- arg.match %r{convert -strip '#{File.expand_path(@thumb.file.path)}\[0\]' -resize 'x50' -crop '100x50\+114\+0' \+repage '.*?'}
+ arg.match %r{convert -strip ["']#{File.expand_path(@thumb.file.path)}\[0\]["'] -resize ["']x50["'] -crop ["']100x50\+114\+0["'] \+repage ["'].*?["']}
end
@thumb.make
end
@@ -154,7 +154,7 @@ class ThumbnailTest < Test::Unit::TestCase
should "send the right command to convert when sent #make" do
Paperclip::CommandLine.expects(:"`").with do |arg|
- arg.match %r{convert '#{File.expand_path(@thumb.file.path)}\[0\]' -resize 'x50' -crop '100x50\+114\+0' \+repage -strip -depth 8 '.*?'}
+ arg.match %r{convert ["']#{File.expand_path(@thumb.file.path)}\[0\]["'] -resize ["']x50["'] -crop ["']100x50\+114\+0["'] \+repage -strip -depth 8 ["'].*?["']}
end
@thumb.make
end
Please sign in to comment.
Something went wrong with that request. Please try again.