shrine 2.19.4 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +485 -43
  3. data/LICENSE.txt +1 -1
  4. data/README.md +81 -977
  5. data/doc/advantages.md +231 -204
  6. data/doc/attacher.md +304 -153
  7. data/doc/carrierwave.md +297 -226
  8. data/doc/changing_derivatives.md +308 -0
  9. data/doc/changing_location.md +102 -21
  10. data/doc/changing_storage.md +110 -0
  11. data/doc/creating_persistence_plugins.md +132 -0
  12. data/doc/creating_plugins.md +43 -23
  13. data/doc/creating_storages.md +19 -5
  14. data/doc/design.md +147 -97
  15. data/doc/direct_s3.md +38 -28
  16. data/doc/external/articles.md +63 -0
  17. data/doc/external/extensions.md +53 -0
  18. data/doc/external/misc.md +32 -0
  19. data/doc/getting_started.md +1115 -0
  20. data/doc/metadata.md +190 -109
  21. data/doc/multiple_files.md +62 -34
  22. data/doc/paperclip.md +384 -262
  23. data/doc/plugins/activerecord.md +177 -46
  24. data/doc/plugins/add_metadata.md +139 -38
  25. data/doc/plugins/atomic_helpers.md +217 -0
  26. data/doc/plugins/backgrounding.md +156 -98
  27. data/doc/plugins/cached_attachment_data.md +7 -5
  28. data/doc/plugins/column.md +121 -0
  29. data/doc/plugins/data_uri.md +23 -22
  30. data/doc/plugins/default_storage.md +36 -10
  31. data/doc/plugins/default_url.md +30 -13
  32. data/doc/plugins/delete_raw.md +4 -2
  33. data/doc/plugins/derivation_endpoint.md +162 -101
  34. data/doc/plugins/derivatives.md +829 -0
  35. data/doc/plugins/determine_mime_type.md +4 -2
  36. data/doc/plugins/download_endpoint.md +64 -8
  37. data/doc/plugins/dynamic_storage.md +5 -3
  38. data/doc/plugins/entity.md +263 -0
  39. data/doc/plugins/form_assign.md +55 -0
  40. data/doc/plugins/included.md +31 -8
  41. data/doc/plugins/infer_extension.md +21 -10
  42. data/doc/plugins/instrumentation.md +38 -16
  43. data/doc/plugins/keep_files.md +14 -17
  44. data/doc/plugins/metadata_attributes.md +42 -13
  45. data/doc/plugins/mirroring.md +118 -0
  46. data/doc/plugins/model.md +210 -0
  47. data/doc/plugins/module_include.md +4 -2
  48. data/doc/plugins/multi_cache.md +24 -0
  49. data/doc/plugins/persistence.md +101 -0
  50. data/doc/plugins/presign_endpoint.md +9 -4
  51. data/doc/plugins/pretty_location.md +16 -3
  52. data/doc/plugins/processing.md +4 -2
  53. data/doc/plugins/rack_file.md +8 -2
  54. data/doc/plugins/rack_response.md +6 -2
  55. data/doc/plugins/recache.md +4 -2
  56. data/doc/plugins/refresh_metadata.md +49 -9
  57. data/doc/plugins/remote_url.md +84 -47
  58. data/doc/plugins/remove_attachment.md +27 -6
  59. data/doc/plugins/remove_invalid.md +21 -6
  60. data/doc/plugins/restore_cached_data.md +11 -3
  61. data/doc/plugins/sequel.md +159 -35
  62. data/doc/plugins/signature.md +16 -5
  63. data/doc/plugins/store_dimensions.md +14 -2
  64. data/doc/plugins/tempfile.md +4 -2
  65. data/doc/plugins/type_predicates.md +96 -0
  66. data/doc/plugins/upload_endpoint.md +13 -13
  67. data/doc/plugins/upload_options.md +6 -4
  68. data/doc/plugins/{default_url_options.md → url_options.md} +9 -7
  69. data/doc/plugins/validation.md +97 -0
  70. data/doc/plugins/validation_helpers.md +16 -13
  71. data/doc/plugins/versions.md +15 -19
  72. data/doc/processing.md +438 -221
  73. data/doc/refile.md +185 -167
  74. data/doc/release_notes/1.0.0.md +4 -0
  75. data/doc/release_notes/1.1.0.md +6 -2
  76. data/doc/release_notes/1.2.0.md +4 -0
  77. data/doc/release_notes/1.3.0.md +4 -0
  78. data/doc/release_notes/1.4.0.md +4 -0
  79. data/doc/release_notes/1.4.1.md +4 -0
  80. data/doc/release_notes/1.4.2.md +4 -0
  81. data/doc/release_notes/2.0.0.md +4 -0
  82. data/doc/release_notes/2.0.1.md +4 -0
  83. data/doc/release_notes/2.1.0.md +4 -0
  84. data/doc/release_notes/2.1.1.md +4 -0
  85. data/doc/release_notes/2.10.0.md +4 -0
  86. data/doc/release_notes/2.10.1.md +4 -0
  87. data/doc/release_notes/2.11.0.md +4 -0
  88. data/doc/release_notes/2.12.0.md +4 -0
  89. data/doc/release_notes/2.13.0.md +4 -0
  90. data/doc/release_notes/2.14.0.md +5 -1
  91. data/doc/release_notes/2.15.0.md +11 -7
  92. data/doc/release_notes/2.16.0.md +4 -0
  93. data/doc/release_notes/2.17.0.md +4 -0
  94. data/doc/release_notes/2.18.0.md +4 -0
  95. data/doc/release_notes/2.19.0.md +6 -3
  96. data/doc/release_notes/2.2.0.md +4 -0
  97. data/doc/release_notes/2.3.0.md +4 -0
  98. data/doc/release_notes/2.3.1.md +4 -0
  99. data/doc/release_notes/2.4.0.md +4 -0
  100. data/doc/release_notes/2.4.1.md +4 -0
  101. data/doc/release_notes/2.5.0.md +4 -0
  102. data/doc/release_notes/2.6.0.md +4 -0
  103. data/doc/release_notes/2.6.1.md +4 -0
  104. data/doc/release_notes/2.7.0.md +4 -0
  105. data/doc/release_notes/2.8.0.md +4 -0
  106. data/doc/release_notes/2.9.0.md +4 -0
  107. data/doc/release_notes/3.0.0.md +981 -0
  108. data/doc/release_notes/3.0.1.md +22 -0
  109. data/doc/release_notes/3.1.0.md +73 -0
  110. data/doc/release_notes/3.2.0.md +96 -0
  111. data/doc/release_notes/3.2.1.md +31 -0
  112. data/doc/release_notes/3.2.2.md +14 -0
  113. data/doc/release_notes/3.3.0.md +105 -0
  114. data/doc/release_notes/3.4.0.md +35 -0
  115. data/doc/retrieving_uploads.md +4 -1
  116. data/doc/securing_uploads.md +60 -37
  117. data/doc/storage/file_system.md +20 -3
  118. data/doc/storage/memory.md +19 -0
  119. data/doc/storage/s3.md +117 -83
  120. data/doc/testing.md +124 -144
  121. data/doc/upgrading_to_3.md +710 -0
  122. data/doc/validation.md +54 -90
  123. data/lib/shrine/attacher.rb +287 -171
  124. data/lib/shrine/attachment.rb +13 -46
  125. data/lib/shrine/plugins/_persistence.rb +93 -0
  126. data/lib/shrine/plugins/activerecord.rb +77 -34
  127. data/lib/shrine/plugins/add_metadata.rb +25 -17
  128. data/lib/shrine/plugins/atomic_helpers.rb +119 -0
  129. data/lib/shrine/plugins/backgrounding.rb +77 -113
  130. data/lib/shrine/plugins/cached_attachment_data.rb +6 -15
  131. data/lib/shrine/plugins/column.rb +102 -0
  132. data/lib/shrine/plugins/data_uri.rb +38 -36
  133. data/lib/shrine/plugins/default_storage.rb +45 -15
  134. data/lib/shrine/plugins/default_url.rb +12 -24
  135. data/lib/shrine/plugins/default_url_options.rb +3 -30
  136. data/lib/shrine/plugins/delete_raw.rb +10 -16
  137. data/lib/shrine/plugins/derivation_endpoint.rb +89 -134
  138. data/lib/shrine/plugins/derivatives.rb +637 -0
  139. data/lib/shrine/plugins/determine_mime_type.rb +9 -21
  140. data/lib/shrine/plugins/download_endpoint.rb +109 -133
  141. data/lib/shrine/plugins/dynamic_storage.rb +5 -11
  142. data/lib/shrine/plugins/entity.rb +152 -0
  143. data/lib/shrine/plugins/form_assign.rb +108 -0
  144. data/lib/shrine/plugins/included.rb +6 -6
  145. data/lib/shrine/plugins/infer_extension.rb +13 -20
  146. data/lib/shrine/plugins/instrumentation.rb +54 -42
  147. data/lib/shrine/plugins/keep_files.rb +3 -15
  148. data/lib/shrine/plugins/metadata_attributes.rb +28 -19
  149. data/lib/shrine/plugins/mirroring.rb +142 -0
  150. data/lib/shrine/plugins/model.rb +158 -0
  151. data/lib/shrine/plugins/module_include.rb +3 -3
  152. data/lib/shrine/plugins/multi_cache.rb +27 -0
  153. data/lib/shrine/plugins/presign_endpoint.rb +18 -22
  154. data/lib/shrine/plugins/pretty_location.rb +15 -9
  155. data/lib/shrine/plugins/processing.rb +22 -9
  156. data/lib/shrine/plugins/rack_file.rb +2 -42
  157. data/lib/shrine/plugins/rack_response.rb +15 -10
  158. data/lib/shrine/plugins/recache.rb +6 -5
  159. data/lib/shrine/plugins/refresh_metadata.rb +13 -11
  160. data/lib/shrine/plugins/remote_url.rb +49 -49
  161. data/lib/shrine/plugins/remove_attachment.rb +10 -6
  162. data/lib/shrine/plugins/remove_invalid.rb +19 -8
  163. data/lib/shrine/plugins/restore_cached_data.rb +13 -7
  164. data/lib/shrine/plugins/sequel.rb +86 -36
  165. data/lib/shrine/plugins/signature.rb +10 -16
  166. data/lib/shrine/plugins/store_dimensions.rb +35 -40
  167. data/lib/shrine/plugins/tempfile.rb +1 -3
  168. data/lib/shrine/plugins/type_predicates.rb +113 -0
  169. data/lib/shrine/plugins/upload_endpoint.rb +25 -23
  170. data/lib/shrine/plugins/upload_options.rb +14 -15
  171. data/lib/shrine/plugins/url_options.rb +31 -0
  172. data/lib/shrine/plugins/validation.rb +80 -0
  173. data/lib/shrine/plugins/validation_helpers.rb +34 -57
  174. data/lib/shrine/plugins/versions.rb +107 -87
  175. data/lib/shrine/plugins.rb +22 -0
  176. data/lib/shrine/storage/file_system.rb +46 -64
  177. data/lib/shrine/storage/linter.rb +42 -7
  178. data/lib/shrine/storage/memory.rb +49 -0
  179. data/lib/shrine/storage/s3.rb +154 -158
  180. data/lib/shrine/uploaded_file.rb +28 -30
  181. data/lib/shrine/version.rb +3 -3
  182. data/lib/shrine.rb +86 -149
  183. data/shrine.gemspec +9 -10
  184. metadata +79 -83
  185. data/doc/migrating_storage.md +0 -76
  186. data/doc/plugins/backup.md +0 -31
  187. data/doc/plugins/copy.md +0 -24
  188. data/doc/plugins/delete_promoted.md +0 -12
  189. data/doc/plugins/direct_upload.md +0 -172
  190. data/doc/plugins/hooks.md +0 -58
  191. data/doc/plugins/logging.md +0 -42
  192. data/doc/plugins/migration_helpers.md +0 -60
  193. data/doc/plugins/moving.md +0 -19
  194. data/doc/plugins/multi_delete.md +0 -20
  195. data/doc/plugins/parallelize.md +0 -16
  196. data/doc/plugins/parsed_json.md +0 -23
  197. data/doc/regenerating_versions.md +0 -143
  198. data/lib/shrine/plugins/background_helpers.rb +0 -5
  199. data/lib/shrine/plugins/backup.rb +0 -90
  200. data/lib/shrine/plugins/copy.rb +0 -50
  201. data/lib/shrine/plugins/delete_promoted.rb +0 -20
  202. data/lib/shrine/plugins/direct_upload.rb +0 -217
  203. data/lib/shrine/plugins/hooks.rb +0 -90
  204. data/lib/shrine/plugins/logging.rb +0 -142
  205. data/lib/shrine/plugins/migration_helpers.rb +0 -70
  206. data/lib/shrine/plugins/moving.rb +0 -57
  207. data/lib/shrine/plugins/multi_delete.rb +0 -32
  208. data/lib/shrine/plugins/parallelize.rb +0 -78
  209. data/lib/shrine/plugins/parsed_json.rb +0 -29
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.4
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-16 00:00:00.000000000 Z
11
+ date: 2021-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '4.1'
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: '6'
19
+ version: '5.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '4.1'
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '6'
26
+ version: '5.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: content_disposition
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,48 +66,20 @@ dependencies:
72
66
  - - "~>"
73
67
  - !ruby/object:Gem::Version
74
68
  version: '5.8'
75
- - !ruby/object:Gem::Dependency
76
- name: minitest-hooks
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '1.3'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '1.3'
89
69
  - !ruby/object:Gem::Dependency
90
70
  name: mocha
91
71
  requirement: !ruby/object:Gem::Requirement
92
72
  requirements:
93
73
  - - "~>"
94
74
  - !ruby/object:Gem::Version
95
- version: '1.4'
75
+ version: '1.11'
96
76
  type: :development
97
77
  prerelease: false
98
78
  version_requirements: !ruby/object:Gem::Requirement
99
79
  requirements:
100
80
  - - "~>"
101
81
  - !ruby/object:Gem::Version
102
- version: '1.4'
103
- - !ruby/object:Gem::Dependency
104
- name: shrine-memory
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: 0.2.2
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: 0.2.2
82
+ version: '1.11'
117
83
  - !ruby/object:Gem::Dependency
118
84
  name: rack
119
85
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +100,14 @@ dependencies:
134
100
  requirements:
135
101
  - - "~>"
136
102
  - !ruby/object:Gem::Version
137
- version: '2.0'
103
+ version: '2.2'
138
104
  type: :development
139
105
  prerelease: false
140
106
  version_requirements: !ruby/object:Gem::Requirement
141
107
  requirements:
142
108
  - - "~>"
143
109
  - !ruby/object:Gem::Version
144
- version: '2.0'
110
+ version: '2.2'
145
111
  - !ruby/object:Gem::Dependency
146
112
  name: rack-test_app
147
113
  requirement: !ruby/object:Gem::Requirement
@@ -274,14 +240,14 @@ dependencies:
274
240
  requirements:
275
241
  - - "~>"
276
242
  - !ruby/object:Gem::Version
277
- version: '1.16'
243
+ version: '1.69'
278
244
  type: :development
279
245
  prerelease: false
280
246
  version_requirements: !ruby/object:Gem::Requirement
281
247
  requirements:
282
248
  - - "~>"
283
249
  - !ruby/object:Gem::Version
284
- version: '1.16'
250
+ version: '1.69'
285
251
  - !ruby/object:Gem::Dependency
286
252
  name: aws-sdk-core
287
253
  requirement: !ruby/object:Gem::Requirement
@@ -296,6 +262,20 @@ dependencies:
296
262
  - - "~>"
297
263
  - !ruby/object:Gem::Version
298
264
  version: '3.23'
265
+ - !ruby/object:Gem::Dependency
266
+ name: rexml
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ type: :development
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ version: '0'
299
279
  - !ruby/object:Gem::Dependency
300
280
  name: dry-monitor
301
281
  requirement: !ruby/object:Gem::Requirement
@@ -316,14 +296,14 @@ dependencies:
316
296
  requirements:
317
297
  - - "~>"
318
298
  - !ruby/object:Gem::Version
319
- version: 5.2.0
299
+ version: '6.0'
320
300
  type: :development
321
301
  prerelease: false
322
302
  version_requirements: !ruby/object:Gem::Requirement
323
303
  requirements:
324
304
  - - "~>"
325
305
  - !ruby/object:Gem::Version
326
- version: 5.2.0
306
+ version: '6.0'
327
307
  - !ruby/object:Gem::Dependency
328
308
  name: sequel
329
309
  requirement: !ruby/object:Gem::Requirement
@@ -344,28 +324,28 @@ dependencies:
344
324
  requirements:
345
325
  - - "~>"
346
326
  - !ruby/object:Gem::Version
347
- version: 5.2.0
327
+ version: '6.0'
348
328
  type: :development
349
329
  prerelease: false
350
330
  version_requirements: !ruby/object:Gem::Requirement
351
331
  requirements:
352
332
  - - "~>"
353
333
  - !ruby/object:Gem::Version
354
- version: 5.2.0
334
+ version: '6.0'
355
335
  - !ruby/object:Gem::Dependency
356
336
  name: sqlite3
357
337
  requirement: !ruby/object:Gem::Requirement
358
338
  requirements:
359
339
  - - "~>"
360
340
  - !ruby/object:Gem::Version
361
- version: 1.3.6
341
+ version: '1.4'
362
342
  type: :development
363
343
  prerelease: false
364
344
  version_requirements: !ruby/object:Gem::Requirement
365
345
  requirements:
366
346
  - - "~>"
367
347
  - !ruby/object:Gem::Version
368
- version: 1.3.6
348
+ version: '1.4'
369
349
  description: |
370
350
  Shrine is a toolkit for file attachments in Ruby applications. It supports
371
351
  uploading, downloading, processing and deleting IO objects, backed by various
@@ -387,45 +367,48 @@ files:
387
367
  - doc/advantages.md
388
368
  - doc/attacher.md
389
369
  - doc/carrierwave.md
370
+ - doc/changing_derivatives.md
390
371
  - doc/changing_location.md
372
+ - doc/changing_storage.md
373
+ - doc/creating_persistence_plugins.md
391
374
  - doc/creating_plugins.md
392
375
  - doc/creating_storages.md
393
376
  - doc/design.md
394
377
  - doc/direct_s3.md
378
+ - doc/external/articles.md
379
+ - doc/external/extensions.md
380
+ - doc/external/misc.md
381
+ - doc/getting_started.md
395
382
  - doc/metadata.md
396
- - doc/migrating_storage.md
397
383
  - doc/multiple_files.md
398
384
  - doc/paperclip.md
399
385
  - doc/plugins/activerecord.md
400
386
  - doc/plugins/add_metadata.md
387
+ - doc/plugins/atomic_helpers.md
401
388
  - doc/plugins/backgrounding.md
402
- - doc/plugins/backup.md
403
389
  - doc/plugins/cached_attachment_data.md
404
- - doc/plugins/copy.md
390
+ - doc/plugins/column.md
405
391
  - doc/plugins/data_uri.md
406
392
  - doc/plugins/default_storage.md
407
393
  - doc/plugins/default_url.md
408
- - doc/plugins/default_url_options.md
409
- - doc/plugins/delete_promoted.md
410
394
  - doc/plugins/delete_raw.md
411
395
  - doc/plugins/derivation_endpoint.md
396
+ - doc/plugins/derivatives.md
412
397
  - doc/plugins/determine_mime_type.md
413
- - doc/plugins/direct_upload.md
414
398
  - doc/plugins/download_endpoint.md
415
399
  - doc/plugins/dynamic_storage.md
416
- - doc/plugins/hooks.md
400
+ - doc/plugins/entity.md
401
+ - doc/plugins/form_assign.md
417
402
  - doc/plugins/included.md
418
403
  - doc/plugins/infer_extension.md
419
404
  - doc/plugins/instrumentation.md
420
405
  - doc/plugins/keep_files.md
421
- - doc/plugins/logging.md
422
406
  - doc/plugins/metadata_attributes.md
423
- - doc/plugins/migration_helpers.md
407
+ - doc/plugins/mirroring.md
408
+ - doc/plugins/model.md
424
409
  - doc/plugins/module_include.md
425
- - doc/plugins/moving.md
426
- - doc/plugins/multi_delete.md
427
- - doc/plugins/parallelize.md
428
- - doc/plugins/parsed_json.md
410
+ - doc/plugins/multi_cache.md
411
+ - doc/plugins/persistence.md
429
412
  - doc/plugins/presign_endpoint.md
430
413
  - doc/plugins/pretty_location.md
431
414
  - doc/plugins/processing.md
@@ -441,13 +424,15 @@ files:
441
424
  - doc/plugins/signature.md
442
425
  - doc/plugins/store_dimensions.md
443
426
  - doc/plugins/tempfile.md
427
+ - doc/plugins/type_predicates.md
444
428
  - doc/plugins/upload_endpoint.md
445
429
  - doc/plugins/upload_options.md
430
+ - doc/plugins/url_options.md
431
+ - doc/plugins/validation.md
446
432
  - doc/plugins/validation_helpers.md
447
433
  - doc/plugins/versions.md
448
434
  - doc/processing.md
449
435
  - doc/refile.md
450
- - doc/regenerating_versions.md
451
436
  - doc/release_notes/1.0.0.md
452
437
  - doc/release_notes/1.1.0.md
453
438
  - doc/release_notes/1.2.0.md
@@ -481,48 +466,55 @@ files:
481
466
  - doc/release_notes/2.7.0.md
482
467
  - doc/release_notes/2.8.0.md
483
468
  - doc/release_notes/2.9.0.md
469
+ - doc/release_notes/3.0.0.md
470
+ - doc/release_notes/3.0.1.md
471
+ - doc/release_notes/3.1.0.md
472
+ - doc/release_notes/3.2.0.md
473
+ - doc/release_notes/3.2.1.md
474
+ - doc/release_notes/3.2.2.md
475
+ - doc/release_notes/3.3.0.md
476
+ - doc/release_notes/3.4.0.md
484
477
  - doc/retrieving_uploads.md
485
478
  - doc/securing_uploads.md
486
479
  - doc/storage/file_system.md
480
+ - doc/storage/memory.md
487
481
  - doc/storage/s3.md
488
482
  - doc/testing.md
483
+ - doc/upgrading_to_3.md
489
484
  - doc/validation.md
490
485
  - lib/shrine.rb
491
486
  - lib/shrine/attacher.rb
492
487
  - lib/shrine/attachment.rb
493
488
  - lib/shrine/plugins.rb
489
+ - lib/shrine/plugins/_persistence.rb
494
490
  - lib/shrine/plugins/_urlsafe_serialization.rb
495
491
  - lib/shrine/plugins/activerecord.rb
496
492
  - lib/shrine/plugins/add_metadata.rb
497
- - lib/shrine/plugins/background_helpers.rb
493
+ - lib/shrine/plugins/atomic_helpers.rb
498
494
  - lib/shrine/plugins/backgrounding.rb
499
- - lib/shrine/plugins/backup.rb
500
495
  - lib/shrine/plugins/cached_attachment_data.rb
501
- - lib/shrine/plugins/copy.rb
496
+ - lib/shrine/plugins/column.rb
502
497
  - lib/shrine/plugins/data_uri.rb
503
498
  - lib/shrine/plugins/default_storage.rb
504
499
  - lib/shrine/plugins/default_url.rb
505
500
  - lib/shrine/plugins/default_url_options.rb
506
- - lib/shrine/plugins/delete_promoted.rb
507
501
  - lib/shrine/plugins/delete_raw.rb
508
502
  - lib/shrine/plugins/derivation_endpoint.rb
503
+ - lib/shrine/plugins/derivatives.rb
509
504
  - lib/shrine/plugins/determine_mime_type.rb
510
- - lib/shrine/plugins/direct_upload.rb
511
505
  - lib/shrine/plugins/download_endpoint.rb
512
506
  - lib/shrine/plugins/dynamic_storage.rb
513
- - lib/shrine/plugins/hooks.rb
507
+ - lib/shrine/plugins/entity.rb
508
+ - lib/shrine/plugins/form_assign.rb
514
509
  - lib/shrine/plugins/included.rb
515
510
  - lib/shrine/plugins/infer_extension.rb
516
511
  - lib/shrine/plugins/instrumentation.rb
517
512
  - lib/shrine/plugins/keep_files.rb
518
- - lib/shrine/plugins/logging.rb
519
513
  - lib/shrine/plugins/metadata_attributes.rb
520
- - lib/shrine/plugins/migration_helpers.rb
514
+ - lib/shrine/plugins/mirroring.rb
515
+ - lib/shrine/plugins/model.rb
521
516
  - lib/shrine/plugins/module_include.rb
522
- - lib/shrine/plugins/moving.rb
523
- - lib/shrine/plugins/multi_delete.rb
524
- - lib/shrine/plugins/parallelize.rb
525
- - lib/shrine/plugins/parsed_json.rb
517
+ - lib/shrine/plugins/multi_cache.rb
526
518
  - lib/shrine/plugins/presign_endpoint.rb
527
519
  - lib/shrine/plugins/pretty_location.rb
528
520
  - lib/shrine/plugins/processing.rb
@@ -538,12 +530,16 @@ files:
538
530
  - lib/shrine/plugins/signature.rb
539
531
  - lib/shrine/plugins/store_dimensions.rb
540
532
  - lib/shrine/plugins/tempfile.rb
533
+ - lib/shrine/plugins/type_predicates.rb
541
534
  - lib/shrine/plugins/upload_endpoint.rb
542
535
  - lib/shrine/plugins/upload_options.rb
536
+ - lib/shrine/plugins/url_options.rb
537
+ - lib/shrine/plugins/validation.rb
543
538
  - lib/shrine/plugins/validation_helpers.rb
544
539
  - lib/shrine/plugins/versions.rb
545
540
  - lib/shrine/storage/file_system.rb
546
541
  - lib/shrine/storage/linter.rb
542
+ - lib/shrine/storage/memory.rb
547
543
  - lib/shrine/storage/s3.rb
548
544
  - lib/shrine/uploaded_file.rb
549
545
  - lib/shrine/version.rb
@@ -555,9 +551,9 @@ metadata:
555
551
  bug_tracker_uri: https://github.com/shrinerb/shrine/issues
556
552
  changelog_uri: https://github.com/shrinerb/shrine/blob/master/CHANGELOG.md
557
553
  documentation_uri: https://shrinerb.com
558
- mailing_list_uri: https://groups.google.com/forum/#!forum/ruby-shrine
554
+ mailing_list_uri: https://discourse.shrinerb.com
559
555
  source_code_uri: https://github.com/shrinerb/shrine
560
- post_install_message:
556
+ post_install_message:
561
557
  rdoc_options: []
562
558
  require_paths:
563
559
  - lib
@@ -572,8 +568,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
572
568
  - !ruby/object:Gem::Version
573
569
  version: '0'
574
570
  requirements: []
575
- rubygems_version: 3.1.2
576
- signing_key:
571
+ rubygems_version: 3.2.15
572
+ signing_key:
577
573
  specification_version: 4
578
574
  summary: Toolkit for file attachments in Ruby applications
579
575
  test_files: []
@@ -1,76 +0,0 @@
1
- # Migrating to Different Storage
2
-
3
- While your application is live in production and performing uploads, it may
4
- happen that you decide you want to change your storage (the `:store`). Shrine
5
- by design allows you to do that easily, with zero downtime, by deploying the
6
- change in 2 phases.
7
-
8
- ## Phase 1: Changing the storage
9
-
10
- The first stage, add the desired storage to your registry, and make it your
11
- current store (let's say that you're migrating from FileSystem to S3):
12
-
13
- ```rb
14
- Shrine.storages = {
15
- cache: Shrine::Storage::FileSystem.new("public", prefix: "uploads/cache"),
16
- store: Shrine::Storage::FileSystem.new("public", prefix: "uploads"),
17
- new_store: Shrine::Storage::S3.new(**s3_options),
18
- }
19
-
20
- Shrine.plugin :default_storage, store: :new_store
21
- ```
22
-
23
- This will make already uploaded files stay uploaded on `:store`, and all new
24
- files will be uploaded to `:new_store`.
25
-
26
- ## Phase 2: Copying existing files
27
-
28
- After you've deployed the previous change, it's time to copy all the existing
29
- files to the new storage, and update the records. This is how you can do it
30
- if you're using Sequel:
31
-
32
- ```rb
33
- User.paged_each do |user|
34
- if (attacher = user.avatar_attacher).stored?
35
- uploaded_file = attacher.store!(user.avatar)
36
- attacher.swap(uploaded_file)
37
- end
38
- end
39
-
40
- # Repeat for all other attachments and models
41
- ```
42
-
43
- Now your uploaded files are successfully copied to the new storage, so you
44
- should be able to safely delete the old one.
45
-
46
- ## Phase 3 and 4: Renaming new storage (optional)
47
-
48
- The uploads will now be happening on the right storage, but if you would rather
49
- rename `:new_store` back to `:store`, you can do two more phases. **First** you
50
- need to deploy aliasing `:new_store` to `:store` (and make the default storage
51
- be `:store` again):
52
-
53
- ```rb
54
- Shrine.storages = {
55
- cache: Shrine::Storage::FileSystem.new("public", prefix: "uploads/cache"),
56
- store: Shrine::Storage::S3.new(**s3_options),
57
- }
58
-
59
- Shrine.storages[:new_store] = Shrine.storages[:store]
60
- ```
61
-
62
- **Second**, you should rename the storage names on existing records. With
63
- Sequel it would be something like:
64
-
65
- ```rb
66
- User.paged_each do |user|
67
- if user.avatar_attacher.stored?
68
- user.update(avatar_data: user.avatar_data.gsub('"new_store"', '"store"'))
69
- end
70
- end
71
-
72
- # Repeat for all other attachments and models
73
- ```
74
-
75
- Now everything should be in order and you should be able to remove the
76
- `:new_store` alias.
@@ -1,31 +0,0 @@
1
- # Backup
2
-
3
- The [`backup`][backup] plugin allows you to automatically back up stored files
4
- to an additional storage.
5
-
6
- ```rb
7
- storages[:backup_store] = Shrine::Storage::S3.new(options)
8
- plugin :backup, storage: :backup_store
9
- ```
10
-
11
- After a file is stored, it will be reuploaded from store to the provided backup
12
- storage.
13
-
14
- ```rb
15
- user.update(avatar: file) # uploaded both to :store and :backup_store
16
- ```
17
-
18
- By default whenever stored files are deleted backed up files are deleted as
19
- well, but you can keep files on the "backup" storage by passing `delete:
20
- false`:
21
-
22
- ```rb
23
- plugin :backup, storage: :backup_store, delete: false
24
- ```
25
-
26
- Note that when adding this plugin with already existing stored files, Shrine
27
- won't know whether a stored file is backed up or not, so attempting to delete
28
- the backup could result in an error. To avoid that you can set `delete: false`
29
- until you manually back up the existing stored files.
30
-
31
- [backup]: /lib/shrine/plugins/backup.rb
data/doc/plugins/copy.md DELETED
@@ -1,24 +0,0 @@
1
- # Copy
2
-
3
- The [`copy`][copy] plugin allows copying attachment from one record to another.
4
-
5
- ```rb
6
- plugin :copy
7
- ```
8
-
9
- It adds a `Attacher#copy` method, which accepts another attacher, and copies
10
- the attachment from it:
11
-
12
- ```rb
13
- photo.image_attacher.copy(other_photo.image_attacher)
14
- ```
15
-
16
- This method will automatically be called when the record is duplicated:
17
-
18
- ```rb
19
- duplicated_photo = photo.dup
20
- duplicated_photo.image #=> #<Shrine::UploadedFile>
21
- duplicated_photo.image != photo.image
22
- ```
23
-
24
- [copy]: /lib/shrine/plugins/copy.rb
@@ -1,12 +0,0 @@
1
- # Delete Promoted
2
-
3
- The [`delete_promoted`][delete_promoted] plugin deletes files that have been
4
- promoted, after the record is saved. This means that cached files handled by
5
- the attacher will automatically get deleted once they're uploaded to store.
6
- This also applies to any other uploaded file passed to `Attacher#promote`.
7
-
8
- ```rb
9
- plugin :delete_promoted
10
- ```
11
-
12
- [delete_promoted]: /lib/shrine/plugins/delete_promoted.rb