paperclip-vips 1.0.0 → 1.2.1

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: 83158c22bc04735dc1f466e6abb2ea88fe7b8c21ecf46abc95c22737bcdd90f6
4
- data.tar.gz: a922e67d9223c6097977437754dfc29b0181d3cd9f7587fb86d03e9a3b44538a
3
+ metadata.gz: 3ee434152fdb78f28ebf9c7c284947f5f1ead3341b419b518f3ba546f4c32578
4
+ data.tar.gz: 72a3e1263f7c165ec096cec5111bab762693992507bc769678cd5f1ad7a0e42e
5
5
  SHA512:
6
- metadata.gz: 60b424796be1bd14b8ae5d202d97eac2ae1c80719d5087e06ea1649661aa1c6271a60d728e03b8e0f32c141a7334186dfc6dd088515b849b7775579e498a55e5
7
- data.tar.gz: 3bb6bac77224fc613d5d1e2f026da27d83bbc08b2096c255fad5e03de949fae636e6d1c3a60355e3f28a9d8b6c88bf5a21ee793ef35c99420c82a72dd250bf56
6
+ metadata.gz: 5c505d092254d9dc6ad9170cf7fc1a1b6ed45302e9a6eb77feb7d7be2d1f8950688ea1d1aa86698f0dd392a59e29cb3cc52cf0b299ea0a861195934d2a9daa60
7
+ data.tar.gz: 3ee2067929f1bf42765f52c3e7986254cce4dbe52d83393f7a1743c5589a9854a08970fc12afafb88a50f05e89ba984719098d4455731fcb6356e272c23d3afd
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ .byebug_history
13
+ *.gem
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ ## [1.2.1] - 2022-01-31
2
+
3
+ - Update dev dependencies
4
+
5
+ ## [1.2.0] - 2022-01-31
6
+
7
+ - Update ruby-vips and dependencies
8
+
9
+ ## [1.1.0] - 2019-06-06
10
+
11
+ - Check paperclip filename to get file format
12
+
13
+ ## [1.0.0] - 2019-05-31
14
+
15
+ - Setup the initial project and base components.
data/Gemfile.lock CHANGED
@@ -1,67 +1,75 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paperclip-vips (1.0.0)
5
- paperclip (>= 5.2.1)
6
- ruby-vips (~> 2.0.13)
4
+ paperclip-vips (1.2.1)
5
+ paperclip (>= 5.0.0)
6
+ ruby-vips (~> 2.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (5.2.3)
12
- activesupport (= 5.2.3)
13
- activesupport (5.2.3)
11
+ activemodel (6.1.4.4)
12
+ activesupport (= 6.1.4.4)
13
+ activesupport (6.1.4.4)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
- i18n (>= 0.7, < 2)
16
- minitest (~> 5.1)
17
- tzinfo (~> 1.1)
15
+ i18n (>= 1.6, < 2)
16
+ minitest (>= 5.1)
17
+ tzinfo (~> 2.0)
18
+ zeitwerk (~> 2.3)
19
+ byebug (11.1.3)
18
20
  climate_control (0.2.0)
19
- concurrent-ruby (1.1.5)
20
- diff-lcs (1.3)
21
- ffi (1.11.1)
22
- i18n (1.6.0)
21
+ concurrent-ruby (1.1.9)
22
+ diff-lcs (1.5.0)
23
+ ffi (1.15.5)
24
+ i18n (1.9.1)
23
25
  concurrent-ruby (~> 1.0)
24
- mime-types (3.2.2)
26
+ mime-types (3.4.1)
25
27
  mime-types-data (~> 3.2015)
26
- mime-types-data (3.2019.0331)
27
- mimemagic (0.3.3)
28
- minitest (5.11.3)
28
+ mime-types-data (3.2022.0105)
29
+ mimemagic (0.3.10)
30
+ nokogiri (~> 1)
31
+ rake
32
+ minitest (5.15.0)
33
+ nokogiri (1.12.5)
34
+ racc (~> 1.4)
29
35
  paperclip (6.1.0)
30
36
  activemodel (>= 4.2.0)
31
37
  activesupport (>= 4.2.0)
32
38
  mime-types
33
39
  mimemagic (~> 0.3.0)
34
40
  terrapin (~> 0.6.0)
35
- rake (10.5.0)
36
- rspec (3.8.0)
37
- rspec-core (~> 3.8.0)
38
- rspec-expectations (~> 3.8.0)
39
- rspec-mocks (~> 3.8.0)
40
- rspec-core (3.8.0)
41
- rspec-support (~> 3.8.0)
42
- rspec-expectations (3.8.3)
41
+ racc (1.6.0)
42
+ rake (13.0.6)
43
+ rspec (3.10.0)
44
+ rspec-core (~> 3.10.0)
45
+ rspec-expectations (~> 3.10.0)
46
+ rspec-mocks (~> 3.10.0)
47
+ rspec-core (3.10.2)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-expectations (3.10.2)
43
50
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.8.0)
45
- rspec-mocks (3.8.0)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-mocks (3.10.3)
46
53
  diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.8.0)
48
- rspec-support (3.8.0)
49
- ruby-vips (2.0.13)
50
- ffi (~> 1.9)
54
+ rspec-support (~> 3.10.0)
55
+ rspec-support (3.10.3)
56
+ ruby-vips (2.1.4)
57
+ ffi (~> 1.12)
51
58
  terrapin (0.6.0)
52
59
  climate_control (>= 0.0.3, < 1.0)
53
- thread_safe (0.3.6)
54
- tzinfo (1.2.5)
55
- thread_safe (~> 0.1)
60
+ tzinfo (2.0.4)
61
+ concurrent-ruby (~> 1.0)
62
+ zeitwerk (2.5.4)
56
63
 
57
64
  PLATFORMS
58
65
  ruby
59
66
 
60
67
  DEPENDENCIES
61
68
  bundler (~> 2.0)
69
+ byebug (~> 11.0)
62
70
  paperclip-vips!
63
- rake (~> 10.0)
71
+ rake (~> 13.0)
64
72
  rspec (~> 3.0)
65
73
 
66
74
  BUNDLED WITH
67
- 2.0.1
75
+ 2.0.2
@@ -12,20 +12,12 @@ module Paperclip
12
12
  @current_geometry = options.fetch(:file_geometry_parser, Geometry).from_file(@file)
13
13
  @whiny = options.fetch(:whiny, true)
14
14
 
15
- @current_format = File.extname(@file.path)&.downcase
15
+ @current_format = current_format(file).downcase
16
16
  @format = options[:format] || @current_format
17
17
 
18
18
  @basename = File.basename(@file.path, @current_format)
19
19
  end
20
20
 
21
- def crop
22
- if @should_crop
23
- return @options[:crop] || :centre
24
- end
25
-
26
- nil
27
- end
28
-
29
21
  def make
30
22
  source = @file
31
23
  filename = [@basename, @format ? ".#{@format}" : ""].join
@@ -47,46 +39,65 @@ module Paperclip
47
39
  return destination
48
40
  end
49
41
 
50
- def width
51
- @target_geometry&.width || @current_geometry.width
52
- end
53
-
54
- def height
55
- @target_geometry&.height || @current_geometry.height
56
- end
57
-
58
- def process_convert_options(image)
59
- if image && @options[:convert_options].present?
60
- commands = JSON.parse(@options[:convert_options], symbolize_names: true)
61
- commands.each do |cmd|
62
- image = ::Vips::Operation.call(cmd[:cmd], [image, *cmd[:args]], cmd[:optional] || {})
42
+ private
43
+ def crop
44
+ if @should_crop
45
+ return @options[:crop] || :centre
63
46
  end
47
+
48
+ nil
64
49
  end
65
50
 
66
- return image
67
- end
51
+ def current_format(file)
52
+ extension = File.extname(file.path)
53
+ return extension if extension.present?
68
54
 
69
- def save_thumbnail(thumbnail, path)
70
- case @current_format
71
- when ".jpeg", ".jpg"
72
- save_jpg(thumbnail, path)
73
- when ".gif"
74
- save_gif(thumbnail, path)
75
- when ".png"
76
- save_png(thumbnail, path)
55
+ extension = File.extname(file.original_filename)
56
+ return extension if extension.present?
57
+
58
+ return ""
77
59
  end
78
- end
79
60
 
80
- def save_jpg(thumbnail, path)
81
- thumbnail.jpegsave(path)
82
- end
61
+ def width
62
+ @target_geometry&.width || @current_geometry.width
63
+ end
83
64
 
84
- def save_gif(thumbnail, path)
85
- thumbnail.magicksave(path)
86
- end
65
+ def height
66
+ @target_geometry&.height || @current_geometry.height
67
+ end
68
+
69
+ def process_convert_options(image)
70
+ if image && @options[:convert_options].present?
71
+ commands = JSON.parse(@options[:convert_options], symbolize_names: true)
72
+ commands.each do |cmd|
73
+ image = ::Vips::Operation.call(cmd[:cmd], [image, *cmd[:args]], cmd[:optional] || {})
74
+ end
75
+ end
87
76
 
88
- def save_png(thumbnail, path)
89
- thumbnail.pngsave(path)
90
- end
77
+ return image
78
+ end
79
+
80
+ def save_thumbnail(thumbnail, path)
81
+ case @current_format
82
+ when ".jpeg", ".jpg"
83
+ save_jpg(thumbnail, path)
84
+ when ".gif"
85
+ save_gif(thumbnail, path)
86
+ when ".png"
87
+ save_png(thumbnail, path)
88
+ end
89
+ end
90
+
91
+ def save_jpg(thumbnail, path)
92
+ thumbnail.jpegsave(path)
93
+ end
94
+
95
+ def save_gif(thumbnail, path)
96
+ thumbnail.magicksave(path)
97
+ end
98
+
99
+ def save_png(thumbnail, path)
100
+ thumbnail.pngsave(path)
101
+ end
91
102
  end
92
103
  end
@@ -1,3 +1,3 @@
1
1
  module PaperclipVips
2
- VERSION = "1.0.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -22,10 +22,11 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_runtime_dependency 'paperclip', '>= 5.2.1'
26
- spec.add_runtime_dependency "ruby-vips", "~> 2.0.13"
25
+ spec.add_runtime_dependency 'paperclip', ">= 5.0.0"
26
+ spec.add_runtime_dependency "ruby-vips", "~> 2.1"
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 2.0"
29
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rake", "~> 13.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
+ spec.add_development_dependency "byebug", "~> 11.0"
31
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-vips
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Greeff
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-31 00:00:00.000000000 Z
11
+ date: 2022-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paperclip
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.1
19
+ version: 5.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.1
26
+ version: 5.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-vips
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.13
33
+ version: '2.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.13
40
+ version: '2.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '13.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +80,21 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
- description:
83
+ - !ruby/object:Gem::Dependency
84
+ name: byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '11.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '11.0'
97
+ description:
84
98
  email:
85
99
  - ken@kengreeff.com
86
100
  executables: []
@@ -90,6 +104,7 @@ files:
90
104
  - ".gitignore"
91
105
  - ".rspec"
92
106
  - ".travis.yml"
107
+ - CHANGELOG.md
93
108
  - CODE_OF_CONDUCT.md
94
109
  - Gemfile
95
110
  - Gemfile.lock
@@ -106,7 +121,7 @@ homepage: https://github.com/realhub/paperclip-vips
106
121
  licenses:
107
122
  - MIT
108
123
  metadata: {}
109
- post_install_message:
124
+ post_install_message:
110
125
  rdoc_options: []
111
126
  require_paths:
112
127
  - lib
@@ -121,9 +136,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
136
  - !ruby/object:Gem::Version
122
137
  version: '0'
123
138
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.7.6.2
126
- signing_key:
139
+ rubyforge_project:
140
+ rubygems_version: 2.7.10
141
+ signing_key:
127
142
  specification_version: 4
128
143
  summary: Uses Ruby Vips to when creating thumbnails for faster generation.
129
144
  test_files: []