Browse files

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

  • Loading branch information...
1 parent 00c0daf commit 32b9a28c1f553a5b55df40a9a880bfc2205c12d7 @jyurek jyurek committed Aug 9, 2010
Showing with 10 additions and 10 deletions.
  1. +2 −2 lib/paperclip/thumbnail.rb
  2. +1 −1 lib/paperclip/upfile.rb
  3. +4 −4 test/paperclip_test.rb
  4. +3 −3 test/thumbnail_test.rb
View
4 lib/paperclip/thumbnail.rb
@@ -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
View
2 lib/paperclip/upfile.rb
@@ -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
View
8 test/paperclip_test.rb
@@ -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
View
6 test/thumbnail_test.rb
@@ -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

0 comments on commit 32b9a28

Please sign in to comment.