Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

hash syntax to run on 1.8.7

  • Loading branch information...
commit e1b938c4c4c701eca4b12b3f6cb7aeedfefa6576 1 parent 1375578
@stanislaw stanislaw authored
View
2  .travis.yml
@@ -2,7 +2,7 @@ language: ruby
rvm:
- 1.8.7
- 1.9.3
-script: "rake"
+script: "bundle exec rspec spec/"
gemfile:
- Gemfile
before_install:
View
4 Gemfile
@@ -3,8 +3,8 @@ gemspec
gem 'rmagick'
gem 'carrierwave'
-gem 'carrierwave-datamapper', require: 'carrierwave/datamapper'
-gem 'ruby-vips', require: 'vips'
+gem 'carrierwave-datamapper', :require => 'carrierwave/datamapper'
+gem 'ruby-vips', :require => 'vips'
gem 'rspec'
View
18 lib/carrierwave/vips.rb
@@ -2,7 +2,7 @@
module CarrierWave
module Vips
-
+
SHARPEN_MASK = begin
conv_mask = [
[ -1, -1, -1 ],
@@ -11,7 +11,7 @@ module Vips
]
::VIPS::Mask.new conv_mask, 16
end
-
+
def self.included(base)
base.send(:extend, ClassMethods)
end
@@ -28,11 +28,11 @@ def resize_to_fit(width, height)
def resize_to_fill(width, height)
process :resize_to_fill => [width, height]
end
-
+
def quality(percent)
process :quality => percent
end
-
+
def convert(extension)
process :convert => extension
end
@@ -83,7 +83,7 @@ def convert(f, opts = {})
@_format = f
@_format_opts = opts
end
-
+
##
# Resize the image to fit within the specified dimensions while retaining
# the original aspect ratio. The image may be shorter or narrower than
@@ -115,9 +115,9 @@ def resize_to_fit(new_width, new_height)
#
def resize_to_fill(new_width, new_height)
manipulate! do |image|
-
+
image = resize_image image, new_width, new_height, :max
-
+
if image.x_size > new_width
top = 0
left = (image.x_size - new_width) / 2
@@ -125,9 +125,9 @@ def resize_to_fill(new_width, new_height)
left = 0
top = (image.y_size - new_height) / 2
end
-
+
image.extract_area(left, top, new_width, new_height)
-
+
end
end
View
8 spec/carrierwave/vips_spec.rb
@@ -20,11 +20,11 @@ class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::Vips
version :big_thumb do
- process resize_to_fill: [800,800]
+ process :resize_to_fill => [800,800]
end
version :thumb do
- process resize_to_fill: [280, 280]
+ process :resize_to_fill => [280, 280]
end
def store_dir
@@ -120,7 +120,7 @@ class Dummy
end
end
- describe '#process!', slow: true do
+ describe '#process!', :slow => true do
it "does not run out of file descriptors on long batch runs" do
2000.times {
instance = create_instance
@@ -129,7 +129,7 @@ class Dummy
}
end
- it "does not run out of file descriptors when used in conjunction with DataMapper", slow: true do
+ it "does not run out of file descriptors when used in conjunction with DataMapper", :slow => true do
2000.times {
dummy = Dummy.new
dummy.image = File.open(file_path('landscape.jpg'))
Please sign in to comment.
Something went wrong with that request. Please try again.