dragonfly_libvips 2.3.3 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb5272becaed50d47840beced080aec9e92238493034bc7265507af0acac68cf
4
- data.tar.gz: 6537b77ac0440954d20898c46a289070edf03584b5d5c52693b70ed570883f54
3
+ metadata.gz: c1d8704fd9ff1232cc9c6d7ee96f254823b35b08d47a2f4652ecdd2c871adf30
4
+ data.tar.gz: f901f9e4b8e36147a33fa59745d38d1d64904a7d7d2d3594529e85a0a398b091
5
5
  SHA512:
6
- metadata.gz: c8843482d5eba83f5d86a67db886c4bed0bf978c3bed9d4dd0c36cb9101c6cb471041fe620841e98710e0e6f72815c3f9c9744906e50ff80a6fee0465c3ae25d
7
- data.tar.gz: 97e7e1a1b0384a49bd37a1dc472b6a4270554d383b3eafe868a97f17b8a6801fed8b274c5068cb26c655206118d456124462b7e1d7ceebaaae32e25f83f4d4ef
6
+ metadata.gz: dc289e762b526da8fcf8d16acf8464ce42e55122be0b24a07858127c8ddbbe6b217ba42ecd3dadc4867b2b2c8ab25b7ba1ee34257091ced5f05c9922adc41a99
7
+ data.tar.gz: 52f53405a530bf31cdf196cb647b1cfeba0bff6e4bda7489d751f1e071fed36f7ae87196c19be0d68e0cf7790fd2a5c6f198764502fbb48d66fd670961b9dd80
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.3
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.6.3
data/.travis.yml CHANGED
@@ -6,7 +6,7 @@ script: 'bundle exec rake'
6
6
  sudo: required
7
7
  dist: trusty
8
8
  rvm:
9
- - 2.6.1
9
+ - 2.6.3
10
10
 
11
11
  before_install:
12
12
  - gem update bundler
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.4.0
4
+
5
+ * symbolize `input_options` and `output_options` to avoid argument errors coming from `ruby-vips`
6
+
3
7
  ## 2.3.3
4
8
 
5
9
  * locks `ruby-vips` to `< 2.0.14`
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'dragonfly', '~> 1.0'
22
- spec.add_dependency 'ruby-vips', '~> 2.0', '< 2.0.14'
22
+ spec.add_dependency 'ruby-vips', '~> 2.0', '>= 2.0.16'
23
23
 
24
- spec.add_development_dependency 'bundler', '~> 2.0'
24
+ spec.add_development_dependency 'bundler'#, '~> 2.0'
25
25
  spec.add_development_dependency 'rb-readline'
26
26
  spec.add_development_dependency 'guard'
27
27
  spec.add_development_dependency 'guard-minitest'
@@ -35,4 +35,14 @@ module DragonflyLibvips
35
35
  ]
36
36
 
37
37
  FORMATS_WITHOUT_PROFILE_SUPPORT = %w[bmp dz gif hdr webp heic]
38
+
39
+ private
40
+
41
+ def self.stringify_keys(hash = {})
42
+ hash.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v }
43
+ end
44
+
45
+ def self.symbolize_keys(hash = {})
46
+ hash.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v }
47
+ end
38
48
  end
@@ -14,7 +14,7 @@ module DragonflyLibvips
14
14
  input_options['autorotate'] = true if content.mime_type == 'image/jpeg'
15
15
  input_options['dpi'] = DPI if content.mime_type == 'application/pdf'
16
16
 
17
- img = ::Vips::Image.new_from_file(content.path, input_options)
17
+ img = ::Vips::Image.new_from_file(content.path, DragonflyLibvips.symbolize_keys(input_options))
18
18
 
19
19
  width = img.width
20
20
  height = img.height
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'vips'
2
4
 
3
5
  module DragonflyLibvips
@@ -19,12 +21,12 @@ module DragonflyLibvips
19
21
  return
20
22
  end
21
23
 
22
- options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
24
+ options = DragonflyLibvips.stringify_keys(options)
23
25
 
24
26
  input_options = options.fetch('input_options', {})
25
27
  input_options['access'] ||= 'sequential'
26
28
  if content.mime_type == 'image/jpeg'
27
- input_options['autorotate'] = true unless input_options.has_key?('autorotate')
29
+ input_options['autorotate'] = true unless input_options.key?('autorotate')
28
30
  end
29
31
 
30
32
  output_options = options.fetch('output_options', {})
@@ -36,17 +38,17 @@ module DragonflyLibvips
36
38
  output_options.delete('Q') unless format.to_s =~ /jpg|jpeg/i
37
39
  output_options['format'] ||= format.to_s if format.to_s =~ /gif|bmp/i
38
40
 
39
- img = ::Vips::Image.new_from_file(content.path, input_options)
41
+ img = ::Vips::Image.new_from_file(content.path, DragonflyLibvips.symbolize_keys(input_options))
40
42
 
41
43
  content.update(
42
- img.write_to_buffer(".#{format}", output_options),
44
+ img.write_to_buffer(".#{format}", DragonflyLibvips.symbolize_keys(output_options)),
43
45
  'name' => "temp.#{format}",
44
46
  'format' => format
45
47
  )
46
48
  content.ext = format
47
49
  end
48
50
 
49
- def update_url(url_attributes, format, options = {})
51
+ def update_url(url_attributes, format, _options = {})
50
52
  url_attributes.ext = format.to_s
51
53
  end
52
54
  end
@@ -7,7 +7,7 @@ module DragonflyLibvips
7
7
  raise UnsupportedFormat unless content.ext
8
8
  raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
9
9
 
10
- options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
10
+ options = DragonflyLibvips.stringify_keys(options)
11
11
  format = options.fetch('format', content.ext)
12
12
 
13
13
  input_options = options.fetch('input_options', {})
@@ -26,11 +26,11 @@ module DragonflyLibvips
26
26
  output_options.delete('Q') unless format.to_s =~ /jpg|jpeg/i
27
27
  output_options['format'] ||= format.to_s if format.to_s =~ /gif|bmp/i
28
28
 
29
- img = ::Vips::Image.new_from_file(content.path, input_options)
29
+ img = ::Vips::Image.new_from_file(content.path, DragonflyLibvips.symbolize_keys(input_options))
30
30
  img = img.extract_area(x, y, width, height)
31
31
 
32
32
  content.update(
33
- img.write_to_buffer(".#{format}", output_options),
33
+ img.write_to_buffer(".#{format}", DragonflyLibvips.symbolize_keys(output_options)),
34
34
  'name' => "temp.#{format}",
35
35
  'format' => format
36
36
  )
@@ -7,7 +7,7 @@ module DragonflyLibvips
7
7
  raise UnsupportedFormat unless content.ext
8
8
  raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
9
9
 
10
- options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
10
+ options = DragonflyLibvips.stringify_keys(options)
11
11
  format = options.fetch('format', content.ext)
12
12
 
13
13
  input_options = options.fetch('input_options', {})
@@ -26,11 +26,11 @@ module DragonflyLibvips
26
26
  output_options.delete('Q') unless format.to_s =~ /jpg|jpeg/i
27
27
  output_options['format'] ||= format.to_s if format.to_s =~ /gif|bmp/i
28
28
 
29
- img = ::Vips::Image.new_from_file(content.path, input_options)
29
+ img = ::Vips::Image.new_from_file(content.path, DragonflyLibvips.symbolize_keys(input_options))
30
30
  img = img.rot("d#{rotate}")
31
31
 
32
32
  content.update(
33
- img.write_to_buffer(".#{format}", output_options),
33
+ img.write_to_buffer(".#{format}", DragonflyLibvips.symbolize_keys(output_options)),
34
34
  'name' => "temp.#{format}",
35
35
  'format' => format
36
36
  )
@@ -12,7 +12,7 @@ module DragonflyLibvips
12
12
  raise UnsupportedFormat unless content.ext
13
13
  raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
14
14
 
15
- options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
15
+ options = DragonflyLibvips.stringify_keys(options)
16
16
 
17
17
  filename = content.path
18
18
  format = options.fetch('format', content.ext).to_s
@@ -39,7 +39,7 @@ module DragonflyLibvips
39
39
  output_options['format'] ||= format.to_s if format.to_s =~ /gif|bmp/i
40
40
 
41
41
  input_options = input_options.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v } # symbolize
42
- img = ::Vips::Image.new_from_file(filename, input_options)
42
+ img = ::Vips::Image.new_from_file(filename, DragonflyLibvips.symbolize_keys(input_options))
43
43
 
44
44
  dimensions = case geometry
45
45
  when RESIZE_GEOMETRY then Dimensions.call(geometry, img.width, img.height)
@@ -63,10 +63,10 @@ module DragonflyLibvips
63
63
  filename += "[page=#{input_options[:page]}]" if content.mime_type == 'application/pdf'
64
64
 
65
65
  thumbnail_options = thumbnail_options.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v } # symbolize
66
- thumb = ::Vips::Image.thumbnail(filename, dimensions.width.ceil, thumbnail_options)
66
+ thumb = ::Vips::Image.thumbnail(filename, dimensions.width.ceil, DragonflyLibvips.symbolize_keys(thumbnail_options))
67
67
 
68
68
  content.update(
69
- thumb.write_to_buffer(".#{format}", output_options),
69
+ thumb.write_to_buffer(".#{format}", DragonflyLibvips.symbolize_keys(output_options)),
70
70
  'name' => "temp.#{format}",
71
71
  'format' => format
72
72
  )
@@ -1,3 +1,3 @@
1
1
  module DragonflyLibvips
2
- VERSION = '2.3.3'.freeze
2
+ VERSION = '2.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly_libvips
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.3
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-09 00:00:00.000000000 Z
11
+ date: 2020-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dragonfly
@@ -31,9 +31,9 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.0'
34
- - - "<"
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 2.0.14
36
+ version: 2.0.16
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,23 +41,23 @@ dependencies:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '2.0'
44
- - - "<"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 2.0.14
46
+ version: 2.0.16
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '2.0'
53
+ version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: '2.0'
60
+ version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rb-readline
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +150,8 @@ extensions: []
150
150
  extra_rdoc_files: []
151
151
  files:
152
152
  - ".gitignore"
153
+ - ".ruby-version"
154
+ - ".tool-versions"
153
155
  - ".travis.yml"
154
156
  - CHANGELOG.md
155
157
  - Gemfile