paperclip-meta 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -8
- data/lib/paperclip-meta/attachment.rb +16 -6
- data/lib/paperclip-meta/version.rb +1 -1
- metadata +37 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83a7b543e2c71c134090200014b76b5e87ee553b
|
4
|
+
data.tar.gz: b0b453d2274dd3925ef748a9fbb7a2cef2b6baf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 757fed3a6f85fe6f40df1cf42abbdc831a3ddd81126512b22a9e2de36f83b376eebfbfe224ddc1877b8c02f0f72266d79fab00e55b76622a71999fd69d6842b8
|
7
|
+
data.tar.gz: 13a55a132372cb2ebdb9061a2f8c1bf74f268d1e9c055eb7a900c245772b811aba41fc37ba064beb147171f08723340e5515ac3252d33d86191f5b7e53917214
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Add width, height, and size to paperclip images.
|
|
7
7
|
|
8
8
|
Paperclip Meta gets image dimensions after `post_process_styles` using paperclip's `Geometry.from_file`.
|
9
9
|
|
10
|
-
Paperclip Meta works with paperclip
|
10
|
+
Paperclip Meta works with paperclip version 4.x.
|
11
11
|
|
12
12
|
### Setup
|
13
13
|
|
@@ -79,13 +79,6 @@ bundle
|
|
79
79
|
rake
|
80
80
|
```
|
81
81
|
|
82
|
-
Test paperclip 3.x:
|
83
|
-
|
84
|
-
```sh
|
85
|
-
BUNDLE_GEMFILE=./spec/gemfiles/Gemfile.paperclip-3 bundle
|
86
|
-
BUNDLE_GEMFILE=./spec/gemfiles/Gemfile.paperclip-3 rake
|
87
|
-
```
|
88
|
-
|
89
82
|
Test paperclip 4.x:
|
90
83
|
|
91
84
|
```sh
|
@@ -3,12 +3,18 @@ module Paperclip
|
|
3
3
|
module Attachment
|
4
4
|
def self.included(base)
|
5
5
|
base.send :include, InstanceMethods
|
6
|
+
base.alias_method_chain :assign_attributes, :meta_data
|
6
7
|
base.alias_method_chain :save, :meta_data
|
7
8
|
base.alias_method_chain :post_process_styles, :meta_data
|
8
9
|
base.alias_method_chain :size, :meta_data
|
9
10
|
end
|
10
11
|
|
11
12
|
module InstanceMethods
|
13
|
+
def assign_attributes_with_meta_data
|
14
|
+
assign_attributes_without_meta_data
|
15
|
+
assign_meta
|
16
|
+
end
|
17
|
+
|
12
18
|
def save_with_meta_data
|
13
19
|
if @queued_for_delete.any? && @queued_for_write.empty?
|
14
20
|
instance_write(:meta, meta_encode({}))
|
@@ -18,12 +24,7 @@ module Paperclip
|
|
18
24
|
|
19
25
|
def post_process_styles_with_meta_data(*styles)
|
20
26
|
post_process_styles_without_meta_data(*styles)
|
21
|
-
|
22
|
-
|
23
|
-
meta = populate_meta(@queued_for_write)
|
24
|
-
return if meta == {}
|
25
|
-
|
26
|
-
write_meta(meta)
|
27
|
+
assign_meta
|
27
28
|
end
|
28
29
|
|
29
30
|
# Use meta info for style if required
|
@@ -51,6 +52,15 @@ module Paperclip
|
|
51
52
|
|
52
53
|
private
|
53
54
|
|
55
|
+
def assign_meta
|
56
|
+
return unless instance.respond_to?(:"#{name}_meta=")
|
57
|
+
|
58
|
+
meta = populate_meta(@queued_for_write)
|
59
|
+
return if meta == {}
|
60
|
+
|
61
|
+
write_meta(meta)
|
62
|
+
end
|
63
|
+
|
54
64
|
def populate_meta(queue)
|
55
65
|
meta = {}
|
56
66
|
queue.each do |style, file|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Bondar
|
@@ -9,28 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: paperclip
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 3.0.2
|
21
|
-
- - "<"
|
18
|
+
- - "~>"
|
22
19
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
20
|
+
version: '4.0'
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
27
24
|
requirements:
|
28
|
-
- - "
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 3.0.2
|
31
|
-
- - "<"
|
25
|
+
- - "~>"
|
32
26
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
27
|
+
version: '4.0'
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: bundler
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,14 +73,14 @@ dependencies:
|
|
79
73
|
requirements:
|
80
74
|
- - ">="
|
81
75
|
- !ruby/object:Gem::Version
|
82
|
-
version: '4.
|
76
|
+
version: '4.2'
|
83
77
|
type: :development
|
84
78
|
prerelease: false
|
85
79
|
version_requirements: !ruby/object:Gem::Requirement
|
86
80
|
requirements:
|
87
81
|
- - ">="
|
88
82
|
- !ruby/object:Gem::Version
|
89
|
-
version: '4.
|
83
|
+
version: '4.2'
|
90
84
|
- !ruby/object:Gem::Dependency
|
91
85
|
name: sqlite3
|
92
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,6 +95,34 @@ dependencies:
|
|
101
95
|
- - ">="
|
102
96
|
- !ruby/object:Gem::Version
|
103
97
|
version: 1.3.10
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: delayed_paperclip
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '2.9'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '2.9'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: activejob
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '4.2'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '4.2'
|
104
126
|
description: Add width, height and size methods to paperclip images
|
105
127
|
email:
|
106
128
|
- y8@ya.ru
|
@@ -135,9 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
157
|
version: '0'
|
136
158
|
requirements: []
|
137
159
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.6.
|
160
|
+
rubygems_version: 2.6.8
|
139
161
|
signing_key:
|
140
162
|
specification_version: 4
|
141
163
|
summary: Add width, height, and size to paperclip images
|
142
164
|
test_files: []
|
143
|
-
has_rdoc:
|