shimmer 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.ruby-version +1 -1
- data/Gemfile +1 -2
- data/Gemfile.lock +96 -95
- data/README.md +19 -6
- data/gemfiles/Gemfile-rails-7-0 +0 -1
- data/gemfiles/Gemfile-rails-7-0.lock +95 -94
- data/lib/shimmer/utils/file_proxy.rb +28 -18
- data/lib/shimmer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48d1c88d49cf870d7a44235454ca682ea4b510cf215c8e990c65d4c511cc122c
|
4
|
+
data.tar.gz: 29497228d74e28e72234713c28d72a6a72e08fd6ee133648dc0ba3396be0448c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8a1a0460e3ab70d8857ce5d95f969a316ffcdb783de4c39efd4ea70791be107ebcad9b7b898bb87c5866631ca4098e8b20e872f595611a57c5b7d6f8b785828
|
7
|
+
data.tar.gz: 05c6b79f3fc057af3ae444b914ae5955699d24787608c7658521233f88fcd972546ad0390ede351ed59bd4262d73fd69dfd3e03089b01d4f3dcdf7dca10b429b
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
inherit_from: config/rubocop_base.yml
|
2
2
|
|
3
3
|
AllCops:
|
4
|
+
TargetRubyVersion: 3.1
|
4
5
|
Exclude:
|
5
6
|
- "bin/**/*"
|
6
7
|
- "spec/rails_app/bin/**/*"
|
@@ -14,3 +15,6 @@ Rails/ApplicationController:
|
|
14
15
|
# Allow jobs created in this library to inherit directly from ActiveJob::Base.
|
15
16
|
Rails/ApplicationJob:
|
16
17
|
Enabled: false
|
18
|
+
|
19
|
+
Style/HashSyntax:
|
20
|
+
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.6
|
data/Gemfile
CHANGED
@@ -7,7 +7,7 @@ gemspec
|
|
7
7
|
|
8
8
|
gem "rails"
|
9
9
|
gem "propshaft"
|
10
|
-
gem "sqlite3"
|
10
|
+
gem "sqlite3", "~> 1.6"
|
11
11
|
gem "puma"
|
12
12
|
gem "jsbundling-rails"
|
13
13
|
gem "turbo-rails"
|
@@ -20,7 +20,6 @@ gem "slim-rails"
|
|
20
20
|
gem "awesome_print"
|
21
21
|
gem "dotenv-rails"
|
22
22
|
gem "image_processing"
|
23
|
-
gem "mini_magick"
|
24
23
|
|
25
24
|
group :development, :test do
|
26
25
|
gem "debug", platforms: [:mri, :mingw, :x64_mingw]
|
data/Gemfile.lock
CHANGED
@@ -6,67 +6,67 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actioncable (7.0.4
|
10
|
-
actionpack (= 7.0.4
|
11
|
-
activesupport (= 7.0.4
|
9
|
+
actioncable (7.0.8.4)
|
10
|
+
actionpack (= 7.0.8.4)
|
11
|
+
activesupport (= 7.0.8.4)
|
12
12
|
nio4r (~> 2.0)
|
13
13
|
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailbox (7.0.4
|
15
|
-
actionpack (= 7.0.4
|
16
|
-
activejob (= 7.0.4
|
17
|
-
activerecord (= 7.0.4
|
18
|
-
activestorage (= 7.0.4
|
19
|
-
activesupport (= 7.0.4
|
14
|
+
actionmailbox (7.0.8.4)
|
15
|
+
actionpack (= 7.0.8.4)
|
16
|
+
activejob (= 7.0.8.4)
|
17
|
+
activerecord (= 7.0.8.4)
|
18
|
+
activestorage (= 7.0.8.4)
|
19
|
+
activesupport (= 7.0.8.4)
|
20
20
|
mail (>= 2.7.1)
|
21
21
|
net-imap
|
22
22
|
net-pop
|
23
23
|
net-smtp
|
24
|
-
actionmailer (7.0.4
|
25
|
-
actionpack (= 7.0.4
|
26
|
-
actionview (= 7.0.4
|
27
|
-
activejob (= 7.0.4
|
28
|
-
activesupport (= 7.0.4
|
24
|
+
actionmailer (7.0.8.4)
|
25
|
+
actionpack (= 7.0.8.4)
|
26
|
+
actionview (= 7.0.8.4)
|
27
|
+
activejob (= 7.0.8.4)
|
28
|
+
activesupport (= 7.0.8.4)
|
29
29
|
mail (~> 2.5, >= 2.5.4)
|
30
30
|
net-imap
|
31
31
|
net-pop
|
32
32
|
net-smtp
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
|
-
actionpack (7.0.4
|
35
|
-
actionview (= 7.0.4
|
36
|
-
activesupport (= 7.0.4
|
37
|
-
rack (~> 2.0, >= 2.2.
|
34
|
+
actionpack (7.0.8.4)
|
35
|
+
actionview (= 7.0.8.4)
|
36
|
+
activesupport (= 7.0.8.4)
|
37
|
+
rack (~> 2.0, >= 2.2.4)
|
38
38
|
rack-test (>= 0.6.3)
|
39
39
|
rails-dom-testing (~> 2.0)
|
40
40
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
41
|
-
actiontext (7.0.4
|
42
|
-
actionpack (= 7.0.4
|
43
|
-
activerecord (= 7.0.4
|
44
|
-
activestorage (= 7.0.4
|
45
|
-
activesupport (= 7.0.4
|
41
|
+
actiontext (7.0.8.4)
|
42
|
+
actionpack (= 7.0.8.4)
|
43
|
+
activerecord (= 7.0.8.4)
|
44
|
+
activestorage (= 7.0.8.4)
|
45
|
+
activesupport (= 7.0.8.4)
|
46
46
|
globalid (>= 0.6.0)
|
47
47
|
nokogiri (>= 1.8.5)
|
48
|
-
actionview (7.0.4
|
49
|
-
activesupport (= 7.0.4
|
48
|
+
actionview (7.0.8.4)
|
49
|
+
activesupport (= 7.0.8.4)
|
50
50
|
builder (~> 3.1)
|
51
51
|
erubi (~> 1.4)
|
52
52
|
rails-dom-testing (~> 2.0)
|
53
53
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
54
|
-
activejob (7.0.4
|
55
|
-
activesupport (= 7.0.4
|
54
|
+
activejob (7.0.8.4)
|
55
|
+
activesupport (= 7.0.8.4)
|
56
56
|
globalid (>= 0.3.6)
|
57
|
-
activemodel (7.0.4
|
58
|
-
activesupport (= 7.0.4
|
59
|
-
activerecord (7.0.4
|
60
|
-
activemodel (= 7.0.4
|
61
|
-
activesupport (= 7.0.4
|
62
|
-
activestorage (7.0.4
|
63
|
-
actionpack (= 7.0.4
|
64
|
-
activejob (= 7.0.4
|
65
|
-
activerecord (= 7.0.4
|
66
|
-
activesupport (= 7.0.4
|
57
|
+
activemodel (7.0.8.4)
|
58
|
+
activesupport (= 7.0.8.4)
|
59
|
+
activerecord (7.0.8.4)
|
60
|
+
activemodel (= 7.0.8.4)
|
61
|
+
activesupport (= 7.0.8.4)
|
62
|
+
activestorage (7.0.8.4)
|
63
|
+
actionpack (= 7.0.8.4)
|
64
|
+
activejob (= 7.0.8.4)
|
65
|
+
activerecord (= 7.0.8.4)
|
66
|
+
activesupport (= 7.0.8.4)
|
67
67
|
marcel (~> 1.0)
|
68
68
|
mini_mime (>= 1.1.0)
|
69
|
-
activesupport (7.0.4
|
69
|
+
activesupport (7.0.8.4)
|
70
70
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
71
71
|
i18n (>= 1.6, < 2)
|
72
72
|
minitest (>= 5.1)
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
bindex (0.8.1)
|
82
82
|
bootsnap (1.16.0)
|
83
83
|
msgpack (~> 1.2)
|
84
|
-
builder (3.
|
84
|
+
builder (3.3.0)
|
85
85
|
byebug (11.1.3)
|
86
86
|
capybara (3.38.0)
|
87
87
|
addressable
|
@@ -93,14 +93,14 @@ GEM
|
|
93
93
|
regexp_parser (>= 1.5, < 3.0)
|
94
94
|
xpath (~> 3.2)
|
95
95
|
coderay (1.1.3)
|
96
|
-
concurrent-ruby (1.
|
96
|
+
concurrent-ruby (1.3.3)
|
97
97
|
crass (1.0.6)
|
98
98
|
cssbundling-rails (1.1.2)
|
99
99
|
railties (>= 6.0.0)
|
100
100
|
cuprite (0.14.3)
|
101
101
|
capybara (~> 3.0)
|
102
102
|
ferrum (~> 0.13.0)
|
103
|
-
date (3.3.
|
103
|
+
date (3.3.4)
|
104
104
|
debug (1.7.1)
|
105
105
|
irb (>= 1.5.0)
|
106
106
|
reline (>= 0.3.1)
|
@@ -109,7 +109,7 @@ GEM
|
|
109
109
|
dotenv-rails (2.8.1)
|
110
110
|
dotenv (= 2.8.1)
|
111
111
|
railties (>= 3.2)
|
112
|
-
erubi (1.
|
112
|
+
erubi (1.13.0)
|
113
113
|
ferrum (0.13)
|
114
114
|
addressable (~> 2.5)
|
115
115
|
concurrent-ruby (~> 1.1)
|
@@ -117,8 +117,8 @@ GEM
|
|
117
117
|
websocket-driver (>= 0.6, < 0.8)
|
118
118
|
ffi (1.15.5)
|
119
119
|
formatador (1.1.0)
|
120
|
-
globalid (1.1
|
121
|
-
activesupport (>=
|
120
|
+
globalid (1.2.1)
|
121
|
+
activesupport (>= 6.1)
|
122
122
|
guard (2.18.0)
|
123
123
|
formatador (>= 0.2.4)
|
124
124
|
listen (>= 2.7, < 4.0)
|
@@ -133,7 +133,7 @@ GEM
|
|
133
133
|
guard (~> 2.1)
|
134
134
|
guard-compat (~> 1.1)
|
135
135
|
rspec (>= 2.99.0, < 4.0)
|
136
|
-
i18n (1.
|
136
|
+
i18n (1.14.5)
|
137
137
|
concurrent-ruby (~> 1.0)
|
138
138
|
image_processing (1.12.2)
|
139
139
|
mini_magick (>= 4.9.5, < 5)
|
@@ -152,42 +152,42 @@ GEM
|
|
152
152
|
listen (3.8.0)
|
153
153
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
154
154
|
rb-inotify (~> 0.9, >= 0.9.10)
|
155
|
-
loofah (2.
|
155
|
+
loofah (2.22.0)
|
156
156
|
crass (~> 1.0.2)
|
157
|
-
nokogiri (>= 1.
|
157
|
+
nokogiri (>= 1.12.0)
|
158
158
|
lumberjack (1.2.8)
|
159
159
|
mail (2.8.1)
|
160
160
|
mini_mime (>= 0.1.1)
|
161
161
|
net-imap
|
162
162
|
net-pop
|
163
163
|
net-smtp
|
164
|
-
marcel (1.0.
|
164
|
+
marcel (1.0.4)
|
165
165
|
matrix (0.4.2)
|
166
|
-
method_source (1.
|
166
|
+
method_source (1.1.0)
|
167
167
|
mini_magick (4.12.0)
|
168
|
-
mini_mime (1.1.
|
169
|
-
mini_portile2 (2.8.
|
170
|
-
minitest (5.
|
168
|
+
mini_mime (1.1.5)
|
169
|
+
mini_portile2 (2.8.7)
|
170
|
+
minitest (5.24.1)
|
171
171
|
msgpack (1.6.0)
|
172
172
|
nenv (0.3.0)
|
173
|
-
net-imap (0.
|
173
|
+
net-imap (0.4.14)
|
174
174
|
date
|
175
175
|
net-protocol
|
176
176
|
net-pop (0.1.2)
|
177
177
|
net-protocol
|
178
|
-
net-protocol (0.2.
|
178
|
+
net-protocol (0.2.2)
|
179
179
|
timeout
|
180
|
-
net-smtp (0.
|
180
|
+
net-smtp (0.5.0)
|
181
181
|
net-protocol
|
182
|
-
nio4r (2.
|
183
|
-
nokogiri (1.
|
184
|
-
mini_portile2 (~> 2.8.
|
182
|
+
nio4r (2.7.3)
|
183
|
+
nokogiri (1.16.6)
|
184
|
+
mini_portile2 (~> 2.8.2)
|
185
185
|
racc (~> 1.4)
|
186
|
-
nokogiri (1.
|
186
|
+
nokogiri (1.16.6-arm64-darwin)
|
187
187
|
racc (~> 1.4)
|
188
|
-
nokogiri (1.
|
188
|
+
nokogiri (1.16.6-x86_64-darwin)
|
189
189
|
racc (~> 1.4)
|
190
|
-
nokogiri (1.
|
190
|
+
nokogiri (1.16.6-x86_64-linux)
|
191
191
|
racc (~> 1.4)
|
192
192
|
notiffany (0.1.3)
|
193
193
|
nenv (~> 0.1)
|
@@ -214,41 +214,43 @@ GEM
|
|
214
214
|
public_suffix (5.0.1)
|
215
215
|
puma (6.0.2)
|
216
216
|
nio4r (~> 2.0)
|
217
|
-
racc (1.
|
218
|
-
rack (2.2.
|
219
|
-
rack-test (2.0
|
217
|
+
racc (1.8.0)
|
218
|
+
rack (2.2.9)
|
219
|
+
rack-test (2.1.0)
|
220
220
|
rack (>= 1.3)
|
221
221
|
rack_session_access (0.2.0)
|
222
222
|
builder (>= 2.0.0)
|
223
223
|
rack (>= 1.0.0)
|
224
|
-
rails (7.0.4
|
225
|
-
actioncable (= 7.0.4
|
226
|
-
actionmailbox (= 7.0.4
|
227
|
-
actionmailer (= 7.0.4
|
228
|
-
actionpack (= 7.0.4
|
229
|
-
actiontext (= 7.0.4
|
230
|
-
actionview (= 7.0.4
|
231
|
-
activejob (= 7.0.4
|
232
|
-
activemodel (= 7.0.4
|
233
|
-
activerecord (= 7.0.4
|
234
|
-
activestorage (= 7.0.4
|
235
|
-
activesupport (= 7.0.4
|
224
|
+
rails (7.0.8.4)
|
225
|
+
actioncable (= 7.0.8.4)
|
226
|
+
actionmailbox (= 7.0.8.4)
|
227
|
+
actionmailer (= 7.0.8.4)
|
228
|
+
actionpack (= 7.0.8.4)
|
229
|
+
actiontext (= 7.0.8.4)
|
230
|
+
actionview (= 7.0.8.4)
|
231
|
+
activejob (= 7.0.8.4)
|
232
|
+
activemodel (= 7.0.8.4)
|
233
|
+
activerecord (= 7.0.8.4)
|
234
|
+
activestorage (= 7.0.8.4)
|
235
|
+
activesupport (= 7.0.8.4)
|
236
236
|
bundler (>= 1.15.0)
|
237
|
-
railties (= 7.0.4
|
238
|
-
rails-dom-testing (2.0
|
239
|
-
activesupport (>=
|
237
|
+
railties (= 7.0.8.4)
|
238
|
+
rails-dom-testing (2.2.0)
|
239
|
+
activesupport (>= 5.0.0)
|
240
|
+
minitest
|
240
241
|
nokogiri (>= 1.6)
|
241
|
-
rails-html-sanitizer (1.
|
242
|
-
loofah (~> 2.
|
243
|
-
|
244
|
-
|
245
|
-
|
242
|
+
rails-html-sanitizer (1.6.0)
|
243
|
+
loofah (~> 2.21)
|
244
|
+
nokogiri (~> 1.14)
|
245
|
+
railties (7.0.8.4)
|
246
|
+
actionpack (= 7.0.8.4)
|
247
|
+
activesupport (= 7.0.8.4)
|
246
248
|
method_source
|
247
249
|
rake (>= 12.2)
|
248
250
|
thor (~> 1.0)
|
249
251
|
zeitwerk (~> 2.5)
|
250
252
|
rainbow (3.1.1)
|
251
|
-
rake (13.
|
253
|
+
rake (13.2.1)
|
252
254
|
rb-fsevent (0.11.2)
|
253
255
|
rb-inotify (0.10.1)
|
254
256
|
ffi (~> 1.0)
|
@@ -316,11 +318,11 @@ GEM
|
|
316
318
|
actionpack (>= 3.1)
|
317
319
|
railties (>= 3.1)
|
318
320
|
slim (>= 3.0, < 5.0)
|
319
|
-
sqlite3 (1.
|
321
|
+
sqlite3 (1.7.3)
|
320
322
|
mini_portile2 (~> 2.8.0)
|
321
|
-
sqlite3 (1.
|
322
|
-
sqlite3 (1.
|
323
|
-
sqlite3 (1.
|
323
|
+
sqlite3 (1.7.3-arm64-darwin)
|
324
|
+
sqlite3 (1.7.3-x86_64-darwin)
|
325
|
+
sqlite3 (1.7.3-x86_64-linux)
|
324
326
|
standard (1.28.0)
|
325
327
|
language_server-protocol (~> 3.17.0.2)
|
326
328
|
lint_roller (~> 1.0)
|
@@ -335,9 +337,9 @@ GEM
|
|
335
337
|
stimulus-rails (1.2.1)
|
336
338
|
railties (>= 6.0.0)
|
337
339
|
temple (0.8.2)
|
338
|
-
thor (1.
|
340
|
+
thor (1.3.1)
|
339
341
|
tilt (2.0.11)
|
340
|
-
timeout (0.
|
342
|
+
timeout (0.4.1)
|
341
343
|
turbo-rails (1.3.3)
|
342
344
|
actionpack (>= 6.0.0)
|
343
345
|
activejob (>= 6.0.0)
|
@@ -351,13 +353,13 @@ GEM
|
|
351
353
|
bindex (>= 0.4.0)
|
352
354
|
railties (>= 6.0.0)
|
353
355
|
webrick (1.8.1)
|
354
|
-
websocket-driver (0.7.
|
356
|
+
websocket-driver (0.7.6)
|
355
357
|
websocket-extensions (>= 0.1.0)
|
356
358
|
websocket-extensions (0.1.5)
|
357
359
|
xpath (3.2.0)
|
358
360
|
nokogiri (~> 1.8)
|
359
361
|
yard (0.9.26)
|
360
|
-
zeitwerk (2.6.
|
362
|
+
zeitwerk (2.6.16)
|
361
363
|
|
362
364
|
PLATFORMS
|
363
365
|
arm64-darwin-22
|
@@ -380,7 +382,6 @@ DEPENDENCIES
|
|
380
382
|
image_processing
|
381
383
|
jbuilder
|
382
384
|
jsbundling-rails
|
383
|
-
mini_magick
|
384
385
|
propshaft
|
385
386
|
pry
|
386
387
|
pry-byebug
|
@@ -399,7 +400,7 @@ DEPENDENCIES
|
|
399
400
|
rubocop-rspec
|
400
401
|
shimmer!
|
401
402
|
slim-rails
|
402
|
-
sqlite3
|
403
|
+
sqlite3 (~> 1.6)
|
403
404
|
standard
|
404
405
|
stimulus-rails
|
405
406
|
turbo-rails
|
data/README.md
CHANGED
@@ -138,14 +138,29 @@ Then, if there are specific cops you want to use in the specific project you are
|
|
138
138
|
|
139
139
|
### Static File Serving
|
140
140
|
|
141
|
-
`ActiveStorage` is great, but serving of files, especially behind a CDN, can be complicated to get right.
|
141
|
+
`ActiveStorage` is great, but serving of files, especially behind a CDN, can be complicated to get right. Shimmer has your back.
|
142
|
+
|
143
|
+
It overrides `image_tag` and automatically resizes your image and creates a static, cacheable URL.
|
142
144
|
|
143
145
|
```ruby
|
144
146
|
# use an image tag
|
145
|
-
image_tag
|
147
|
+
image_tag(user.avatar, width: 300, height: 400)
|
148
|
+
image_tag(user.avatar, width: 300) # This will keep the aspect ratio and infer height
|
149
|
+
```
|
150
|
+
|
151
|
+
If you need more control, you can also use `image_file_path` and `image_file_url` directly. They have a similar interface, but only return the path/URL.
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
image_file_path(user.avatar, width: 300, height: 400)
|
155
|
+
image_file_url(user.avatar, width: 300, height: 400)
|
146
156
|
```
|
147
157
|
|
148
|
-
|
158
|
+
Shimmer will only ever scale your images down, not up.
|
159
|
+
|
160
|
+
The URL of the image will point to the Rails app, where it will be generated on the fly. You should cache these routes with a CDN like Cloudflare.
|
161
|
+
|
162
|
+
This is in contrast to ActiveStorage variants, where the transformation happens when the URL for the image is built. This can slow down rendering or even prevent HTML to be generated if just one image can't be resized. With Shimmer, only the broken image will be broken.
|
163
|
+
|
149
164
|
|
150
165
|
### Modals
|
151
166
|
|
@@ -356,9 +371,7 @@ This library is tested using _RSpec_.
|
|
356
371
|
bin/rspec
|
357
372
|
```
|
358
373
|
|
359
|
-
A
|
360
|
-
application can be started in development mode for "playing around" with _Shimmer_ during its development and add
|
361
|
-
more system tests. The `bin/dev` script starts that demo application.
|
374
|
+
A system test suite is included and is performed against a demo Rails application located in in `spec/rails_app`. This application can be started in development mode for "playing around" with Shimmer during its development and add more system tests. The `bin/dev` script starts that demo application.
|
362
375
|
|
363
376
|
The first time, you want to initialize the database and seed it some data.
|
364
377
|
|
data/gemfiles/Gemfile-rails-7-0
CHANGED
@@ -6,67 +6,67 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actioncable (7.0.4
|
10
|
-
actionpack (= 7.0.4
|
11
|
-
activesupport (= 7.0.4
|
9
|
+
actioncable (7.0.8.4)
|
10
|
+
actionpack (= 7.0.8.4)
|
11
|
+
activesupport (= 7.0.8.4)
|
12
12
|
nio4r (~> 2.0)
|
13
13
|
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailbox (7.0.4
|
15
|
-
actionpack (= 7.0.4
|
16
|
-
activejob (= 7.0.4
|
17
|
-
activerecord (= 7.0.4
|
18
|
-
activestorage (= 7.0.4
|
19
|
-
activesupport (= 7.0.4
|
14
|
+
actionmailbox (7.0.8.4)
|
15
|
+
actionpack (= 7.0.8.4)
|
16
|
+
activejob (= 7.0.8.4)
|
17
|
+
activerecord (= 7.0.8.4)
|
18
|
+
activestorage (= 7.0.8.4)
|
19
|
+
activesupport (= 7.0.8.4)
|
20
20
|
mail (>= 2.7.1)
|
21
21
|
net-imap
|
22
22
|
net-pop
|
23
23
|
net-smtp
|
24
|
-
actionmailer (7.0.4
|
25
|
-
actionpack (= 7.0.4
|
26
|
-
actionview (= 7.0.4
|
27
|
-
activejob (= 7.0.4
|
28
|
-
activesupport (= 7.0.4
|
24
|
+
actionmailer (7.0.8.4)
|
25
|
+
actionpack (= 7.0.8.4)
|
26
|
+
actionview (= 7.0.8.4)
|
27
|
+
activejob (= 7.0.8.4)
|
28
|
+
activesupport (= 7.0.8.4)
|
29
29
|
mail (~> 2.5, >= 2.5.4)
|
30
30
|
net-imap
|
31
31
|
net-pop
|
32
32
|
net-smtp
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
|
-
actionpack (7.0.4
|
35
|
-
actionview (= 7.0.4
|
36
|
-
activesupport (= 7.0.4
|
37
|
-
rack (~> 2.0, >= 2.2.
|
34
|
+
actionpack (7.0.8.4)
|
35
|
+
actionview (= 7.0.8.4)
|
36
|
+
activesupport (= 7.0.8.4)
|
37
|
+
rack (~> 2.0, >= 2.2.4)
|
38
38
|
rack-test (>= 0.6.3)
|
39
39
|
rails-dom-testing (~> 2.0)
|
40
40
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
41
|
-
actiontext (7.0.4
|
42
|
-
actionpack (= 7.0.4
|
43
|
-
activerecord (= 7.0.4
|
44
|
-
activestorage (= 7.0.4
|
45
|
-
activesupport (= 7.0.4
|
41
|
+
actiontext (7.0.8.4)
|
42
|
+
actionpack (= 7.0.8.4)
|
43
|
+
activerecord (= 7.0.8.4)
|
44
|
+
activestorage (= 7.0.8.4)
|
45
|
+
activesupport (= 7.0.8.4)
|
46
46
|
globalid (>= 0.6.0)
|
47
47
|
nokogiri (>= 1.8.5)
|
48
|
-
actionview (7.0.4
|
49
|
-
activesupport (= 7.0.4
|
48
|
+
actionview (7.0.8.4)
|
49
|
+
activesupport (= 7.0.8.4)
|
50
50
|
builder (~> 3.1)
|
51
51
|
erubi (~> 1.4)
|
52
52
|
rails-dom-testing (~> 2.0)
|
53
53
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
54
|
-
activejob (7.0.4
|
55
|
-
activesupport (= 7.0.4
|
54
|
+
activejob (7.0.8.4)
|
55
|
+
activesupport (= 7.0.8.4)
|
56
56
|
globalid (>= 0.3.6)
|
57
|
-
activemodel (7.0.4
|
58
|
-
activesupport (= 7.0.4
|
59
|
-
activerecord (7.0.4
|
60
|
-
activemodel (= 7.0.4
|
61
|
-
activesupport (= 7.0.4
|
62
|
-
activestorage (7.0.4
|
63
|
-
actionpack (= 7.0.4
|
64
|
-
activejob (= 7.0.4
|
65
|
-
activerecord (= 7.0.4
|
66
|
-
activesupport (= 7.0.4
|
57
|
+
activemodel (7.0.8.4)
|
58
|
+
activesupport (= 7.0.8.4)
|
59
|
+
activerecord (7.0.8.4)
|
60
|
+
activemodel (= 7.0.8.4)
|
61
|
+
activesupport (= 7.0.8.4)
|
62
|
+
activestorage (7.0.8.4)
|
63
|
+
actionpack (= 7.0.8.4)
|
64
|
+
activejob (= 7.0.8.4)
|
65
|
+
activerecord (= 7.0.8.4)
|
66
|
+
activesupport (= 7.0.8.4)
|
67
67
|
marcel (~> 1.0)
|
68
68
|
mini_mime (>= 1.1.0)
|
69
|
-
activesupport (7.0.4
|
69
|
+
activesupport (7.0.8.4)
|
70
70
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
71
71
|
i18n (>= 1.6, < 2)
|
72
72
|
minitest (>= 5.1)
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
bindex (0.8.1)
|
82
82
|
bootsnap (1.16.0)
|
83
83
|
msgpack (~> 1.2)
|
84
|
-
builder (3.
|
84
|
+
builder (3.3.0)
|
85
85
|
byebug (11.1.3)
|
86
86
|
capybara (3.38.0)
|
87
87
|
addressable
|
@@ -93,14 +93,14 @@ GEM
|
|
93
93
|
regexp_parser (>= 1.5, < 3.0)
|
94
94
|
xpath (~> 3.2)
|
95
95
|
coderay (1.1.3)
|
96
|
-
concurrent-ruby (1.
|
96
|
+
concurrent-ruby (1.3.3)
|
97
97
|
crass (1.0.6)
|
98
98
|
cssbundling-rails (1.1.2)
|
99
99
|
railties (>= 6.0.0)
|
100
100
|
cuprite (0.14.3)
|
101
101
|
capybara (~> 3.0)
|
102
102
|
ferrum (~> 0.13.0)
|
103
|
-
date (3.3.
|
103
|
+
date (3.3.4)
|
104
104
|
debug (1.7.1)
|
105
105
|
irb (>= 1.5.0)
|
106
106
|
reline (>= 0.3.1)
|
@@ -109,7 +109,7 @@ GEM
|
|
109
109
|
dotenv-rails (2.8.1)
|
110
110
|
dotenv (= 2.8.1)
|
111
111
|
railties (>= 3.2)
|
112
|
-
erubi (1.
|
112
|
+
erubi (1.13.0)
|
113
113
|
ferrum (0.13)
|
114
114
|
addressable (~> 2.5)
|
115
115
|
concurrent-ruby (~> 1.1)
|
@@ -117,8 +117,8 @@ GEM
|
|
117
117
|
websocket-driver (>= 0.6, < 0.8)
|
118
118
|
ffi (1.15.5)
|
119
119
|
formatador (1.1.0)
|
120
|
-
globalid (1.1
|
121
|
-
activesupport (>=
|
120
|
+
globalid (1.2.1)
|
121
|
+
activesupport (>= 6.1)
|
122
122
|
guard (2.18.0)
|
123
123
|
formatador (>= 0.2.4)
|
124
124
|
listen (>= 2.7, < 4.0)
|
@@ -133,7 +133,7 @@ GEM
|
|
133
133
|
guard (~> 2.1)
|
134
134
|
guard-compat (~> 1.1)
|
135
135
|
rspec (>= 2.99.0, < 4.0)
|
136
|
-
i18n (1.
|
136
|
+
i18n (1.14.5)
|
137
137
|
concurrent-ruby (~> 1.0)
|
138
138
|
image_processing (1.12.2)
|
139
139
|
mini_magick (>= 4.9.5, < 5)
|
@@ -152,42 +152,42 @@ GEM
|
|
152
152
|
listen (3.8.0)
|
153
153
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
154
154
|
rb-inotify (~> 0.9, >= 0.9.10)
|
155
|
-
loofah (2.
|
155
|
+
loofah (2.22.0)
|
156
156
|
crass (~> 1.0.2)
|
157
|
-
nokogiri (>= 1.
|
157
|
+
nokogiri (>= 1.12.0)
|
158
158
|
lumberjack (1.2.8)
|
159
159
|
mail (2.8.1)
|
160
160
|
mini_mime (>= 0.1.1)
|
161
161
|
net-imap
|
162
162
|
net-pop
|
163
163
|
net-smtp
|
164
|
-
marcel (1.0.
|
164
|
+
marcel (1.0.4)
|
165
165
|
matrix (0.4.2)
|
166
|
-
method_source (1.
|
166
|
+
method_source (1.1.0)
|
167
167
|
mini_magick (4.12.0)
|
168
|
-
mini_mime (1.1.
|
169
|
-
mini_portile2 (2.8.
|
170
|
-
minitest (5.
|
168
|
+
mini_mime (1.1.5)
|
169
|
+
mini_portile2 (2.8.7)
|
170
|
+
minitest (5.24.1)
|
171
171
|
msgpack (1.6.0)
|
172
172
|
nenv (0.3.0)
|
173
|
-
net-imap (0.
|
173
|
+
net-imap (0.4.14)
|
174
174
|
date
|
175
175
|
net-protocol
|
176
176
|
net-pop (0.1.2)
|
177
177
|
net-protocol
|
178
|
-
net-protocol (0.2.
|
178
|
+
net-protocol (0.2.2)
|
179
179
|
timeout
|
180
|
-
net-smtp (0.
|
180
|
+
net-smtp (0.5.0)
|
181
181
|
net-protocol
|
182
|
-
nio4r (2.
|
183
|
-
nokogiri (1.
|
184
|
-
mini_portile2 (~> 2.8.
|
182
|
+
nio4r (2.7.3)
|
183
|
+
nokogiri (1.16.6)
|
184
|
+
mini_portile2 (~> 2.8.2)
|
185
185
|
racc (~> 1.4)
|
186
|
-
nokogiri (1.
|
186
|
+
nokogiri (1.16.6-arm64-darwin)
|
187
187
|
racc (~> 1.4)
|
188
|
-
nokogiri (1.
|
188
|
+
nokogiri (1.16.6-x86_64-darwin)
|
189
189
|
racc (~> 1.4)
|
190
|
-
nokogiri (1.
|
190
|
+
nokogiri (1.16.6-x86_64-linux)
|
191
191
|
racc (~> 1.4)
|
192
192
|
notiffany (0.1.3)
|
193
193
|
nenv (~> 0.1)
|
@@ -214,41 +214,43 @@ GEM
|
|
214
214
|
public_suffix (5.0.1)
|
215
215
|
puma (6.0.2)
|
216
216
|
nio4r (~> 2.0)
|
217
|
-
racc (1.
|
218
|
-
rack (2.2.
|
219
|
-
rack-test (2.0
|
217
|
+
racc (1.8.0)
|
218
|
+
rack (2.2.9)
|
219
|
+
rack-test (2.1.0)
|
220
220
|
rack (>= 1.3)
|
221
221
|
rack_session_access (0.2.0)
|
222
222
|
builder (>= 2.0.0)
|
223
223
|
rack (>= 1.0.0)
|
224
|
-
rails (7.0.4
|
225
|
-
actioncable (= 7.0.4
|
226
|
-
actionmailbox (= 7.0.4
|
227
|
-
actionmailer (= 7.0.4
|
228
|
-
actionpack (= 7.0.4
|
229
|
-
actiontext (= 7.0.4
|
230
|
-
actionview (= 7.0.4
|
231
|
-
activejob (= 7.0.4
|
232
|
-
activemodel (= 7.0.4
|
233
|
-
activerecord (= 7.0.4
|
234
|
-
activestorage (= 7.0.4
|
235
|
-
activesupport (= 7.0.4
|
224
|
+
rails (7.0.8.4)
|
225
|
+
actioncable (= 7.0.8.4)
|
226
|
+
actionmailbox (= 7.0.8.4)
|
227
|
+
actionmailer (= 7.0.8.4)
|
228
|
+
actionpack (= 7.0.8.4)
|
229
|
+
actiontext (= 7.0.8.4)
|
230
|
+
actionview (= 7.0.8.4)
|
231
|
+
activejob (= 7.0.8.4)
|
232
|
+
activemodel (= 7.0.8.4)
|
233
|
+
activerecord (= 7.0.8.4)
|
234
|
+
activestorage (= 7.0.8.4)
|
235
|
+
activesupport (= 7.0.8.4)
|
236
236
|
bundler (>= 1.15.0)
|
237
|
-
railties (= 7.0.4
|
238
|
-
rails-dom-testing (2.0
|
239
|
-
activesupport (>=
|
237
|
+
railties (= 7.0.8.4)
|
238
|
+
rails-dom-testing (2.2.0)
|
239
|
+
activesupport (>= 5.0.0)
|
240
|
+
minitest
|
240
241
|
nokogiri (>= 1.6)
|
241
|
-
rails-html-sanitizer (1.
|
242
|
-
loofah (~> 2.
|
243
|
-
|
244
|
-
|
245
|
-
|
242
|
+
rails-html-sanitizer (1.6.0)
|
243
|
+
loofah (~> 2.21)
|
244
|
+
nokogiri (~> 1.14)
|
245
|
+
railties (7.0.8.4)
|
246
|
+
actionpack (= 7.0.8.4)
|
247
|
+
activesupport (= 7.0.8.4)
|
246
248
|
method_source
|
247
249
|
rake (>= 12.2)
|
248
250
|
thor (~> 1.0)
|
249
251
|
zeitwerk (~> 2.5)
|
250
252
|
rainbow (3.1.1)
|
251
|
-
rake (13.
|
253
|
+
rake (13.2.1)
|
252
254
|
rb-fsevent (0.11.2)
|
253
255
|
rb-inotify (0.10.1)
|
254
256
|
ffi (~> 1.0)
|
@@ -316,11 +318,11 @@ GEM
|
|
316
318
|
actionpack (>= 3.1)
|
317
319
|
railties (>= 3.1)
|
318
320
|
slim (>= 3.0, < 5.0)
|
319
|
-
sqlite3 (1.
|
321
|
+
sqlite3 (1.7.3)
|
320
322
|
mini_portile2 (~> 2.8.0)
|
321
|
-
sqlite3 (1.
|
322
|
-
sqlite3 (1.
|
323
|
-
sqlite3 (1.
|
323
|
+
sqlite3 (1.7.3-arm64-darwin)
|
324
|
+
sqlite3 (1.7.3-x86_64-darwin)
|
325
|
+
sqlite3 (1.7.3-x86_64-linux)
|
324
326
|
standard (1.28.0)
|
325
327
|
language_server-protocol (~> 3.17.0.2)
|
326
328
|
lint_roller (~> 1.0)
|
@@ -335,9 +337,9 @@ GEM
|
|
335
337
|
stimulus-rails (1.2.1)
|
336
338
|
railties (>= 6.0.0)
|
337
339
|
temple (0.8.2)
|
338
|
-
thor (1.
|
340
|
+
thor (1.3.1)
|
339
341
|
tilt (2.0.11)
|
340
|
-
timeout (0.
|
342
|
+
timeout (0.4.1)
|
341
343
|
turbo-rails (1.3.3)
|
342
344
|
actionpack (>= 6.0.0)
|
343
345
|
activejob (>= 6.0.0)
|
@@ -351,13 +353,13 @@ GEM
|
|
351
353
|
bindex (>= 0.4.0)
|
352
354
|
railties (>= 6.0.0)
|
353
355
|
webrick (1.8.1)
|
354
|
-
websocket-driver (0.7.
|
356
|
+
websocket-driver (0.7.6)
|
355
357
|
websocket-extensions (>= 0.1.0)
|
356
358
|
websocket-extensions (0.1.5)
|
357
359
|
xpath (3.2.0)
|
358
360
|
nokogiri (~> 1.8)
|
359
361
|
yard (0.9.26)
|
360
|
-
zeitwerk (2.6.
|
362
|
+
zeitwerk (2.6.16)
|
361
363
|
|
362
364
|
PLATFORMS
|
363
365
|
arm64-darwin-22
|
@@ -380,7 +382,6 @@ DEPENDENCIES
|
|
380
382
|
image_processing
|
381
383
|
jbuilder
|
382
384
|
jsbundling-rails
|
383
|
-
mini_magick
|
384
385
|
propshaft
|
385
386
|
pry
|
386
387
|
pry-byebug
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Shimmer
|
4
4
|
class FileProxy
|
5
|
-
attr_reader :blob_id
|
5
|
+
attr_reader :blob_id
|
6
6
|
|
7
7
|
delegate :message_verifier, to: :class
|
8
8
|
delegate :content_type, :filename, to: :blob
|
@@ -10,28 +10,38 @@ module Shimmer
|
|
10
10
|
class << self
|
11
11
|
def restore(id)
|
12
12
|
blob_id, resize = message_verifier.verified(id)
|
13
|
-
new blob_id: blob_id, resize: resize
|
14
|
-
end
|
15
|
-
end
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
"#{width}x#{height}>"
|
22
|
-
else
|
23
|
-
"#{width}x>"
|
14
|
+
if resize.is_a?(String)
|
15
|
+
width, height = legacy_resize_string_to_tuple(resize)
|
16
|
+
elsif resize.is_a?(Array)
|
17
|
+
width, height = resize
|
24
18
|
end
|
19
|
+
|
20
|
+
new(blob_id: blob_id, width: width, height: height)
|
21
|
+
end
|
22
|
+
|
23
|
+
# In the past, we generated the IDs with ImageMagick style "200x200>" strings. We don't do that anymore, but to prevent all old URLs breaking and caches invalidating at once, we grandfather these URLs in.
|
24
|
+
def legacy_resize_string_to_tuple(resize)
|
25
|
+
return if resize.blank?
|
26
|
+
|
27
|
+
matches = resize.match(/(?<width>\d*)x(?<height>\d*)/)
|
28
|
+
|
29
|
+
[
|
30
|
+
matches[:width].presence&.to_i,
|
31
|
+
matches[:height].presence&.to_i
|
32
|
+
]
|
25
33
|
end
|
26
|
-
@resize = resize
|
27
|
-
end
|
28
34
|
|
29
|
-
class << self
|
30
35
|
def message_verifier
|
31
36
|
@message_verifier ||= ApplicationRecord.signed_id_verifier
|
32
37
|
end
|
33
38
|
end
|
34
39
|
|
40
|
+
def initialize(blob_id:, width: nil, height: nil)
|
41
|
+
@blob_id = blob_id
|
42
|
+
@resize = [width&.to_i, height&.to_i] if width || height
|
43
|
+
end
|
44
|
+
|
35
45
|
def path
|
36
46
|
Rails.application.routes.url_helpers.file_path(id, locale: nil)
|
37
47
|
end
|
@@ -44,12 +54,12 @@ module Shimmer
|
|
44
54
|
@blob ||= ActiveStorage::Blob.find(blob_id)
|
45
55
|
end
|
46
56
|
|
47
|
-
def resizeable
|
48
|
-
resize.present? && blob.content_type.exclude?("svg")
|
57
|
+
def resizeable?
|
58
|
+
@resize.present? && blob.content_type.exclude?("svg")
|
49
59
|
end
|
50
60
|
|
51
61
|
def variant
|
52
|
-
@variant ||= resizeable ? blob.representation(
|
62
|
+
@variant ||= resizeable? ? blob.representation(resize_to_limit: @resize).processed : blob
|
53
63
|
end
|
54
64
|
|
55
65
|
def file
|
@@ -59,7 +69,7 @@ module Shimmer
|
|
59
69
|
private
|
60
70
|
|
61
71
|
def id
|
62
|
-
@id ||= message_verifier.generate([blob_id, resize])
|
72
|
+
@id ||= message_verifier.generate([blob_id, @resize])
|
63
73
|
end
|
64
74
|
end
|
65
75
|
end
|
data/lib/shimmer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Ravens
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.3.27
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Shimmer brings all the bells and whistles of a hotwired application, right
|