shrine 2.19.3 → 3.6.0

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.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +523 -41
  3. data/LICENSE.txt +1 -1
  4. data/README.md +83 -979
  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 +103 -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 +1156 -0
  20. data/doc/metadata.md +190 -109
  21. data/doc/multiple_files.md +93 -30
  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 +186 -101
  34. data/doc/plugins/derivatives.md +839 -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 +16 -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 +188 -170
  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 +5 -1
  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/release_notes/3.5.0.md +63 -0
  116. data/doc/release_notes/3.6.0.md +23 -0
  117. data/doc/retrieving_uploads.md +5 -2
  118. data/doc/securing_uploads.md +60 -37
  119. data/doc/storage/file_system.md +20 -3
  120. data/doc/storage/memory.md +19 -0
  121. data/doc/storage/s3.md +122 -78
  122. data/doc/testing.md +141 -133
  123. data/doc/upgrading_to_3.md +708 -0
  124. data/doc/validation.md +54 -90
  125. data/lib/shrine/attacher.rb +292 -169
  126. data/lib/shrine/attachment.rb +13 -46
  127. data/lib/shrine/plugins/_persistence.rb +93 -0
  128. data/lib/shrine/plugins/activerecord.rb +77 -34
  129. data/lib/shrine/plugins/add_metadata.rb +25 -17
  130. data/lib/shrine/plugins/atomic_helpers.rb +119 -0
  131. data/lib/shrine/plugins/backgrounding.rb +77 -113
  132. data/lib/shrine/plugins/cached_attachment_data.rb +6 -15
  133. data/lib/shrine/plugins/column.rb +102 -0
  134. data/lib/shrine/plugins/data_uri.rb +38 -36
  135. data/lib/shrine/plugins/default_storage.rb +45 -15
  136. data/lib/shrine/plugins/default_url.rb +12 -24
  137. data/lib/shrine/plugins/default_url_options.rb +3 -30
  138. data/lib/shrine/plugins/delete_raw.rb +10 -16
  139. data/lib/shrine/plugins/derivation_endpoint.rb +130 -171
  140. data/lib/shrine/plugins/derivatives.rb +645 -0
  141. data/lib/shrine/plugins/determine_mime_type.rb +9 -21
  142. data/lib/shrine/plugins/download_endpoint.rb +118 -133
  143. data/lib/shrine/plugins/dynamic_storage.rb +5 -11
  144. data/lib/shrine/plugins/entity.rb +158 -0
  145. data/lib/shrine/plugins/form_assign.rb +108 -0
  146. data/lib/shrine/plugins/included.rb +6 -6
  147. data/lib/shrine/plugins/infer_extension.rb +17 -20
  148. data/lib/shrine/plugins/instrumentation.rb +59 -43
  149. data/lib/shrine/plugins/keep_files.rb +3 -15
  150. data/lib/shrine/plugins/metadata_attributes.rb +28 -19
  151. data/lib/shrine/plugins/mirroring.rb +142 -0
  152. data/lib/shrine/plugins/model.rb +160 -0
  153. data/lib/shrine/plugins/module_include.rb +3 -3
  154. data/lib/shrine/plugins/multi_cache.rb +27 -0
  155. data/lib/shrine/plugins/presign_endpoint.rb +27 -28
  156. data/lib/shrine/plugins/pretty_location.rb +15 -9
  157. data/lib/shrine/plugins/processing.rb +22 -9
  158. data/lib/shrine/plugins/rack_file.rb +2 -42
  159. data/lib/shrine/plugins/rack_response.rb +21 -10
  160. data/lib/shrine/plugins/recache.rb +6 -5
  161. data/lib/shrine/plugins/refresh_metadata.rb +13 -11
  162. data/lib/shrine/plugins/remote_url.rb +49 -49
  163. data/lib/shrine/plugins/remove_attachment.rb +12 -6
  164. data/lib/shrine/plugins/remove_invalid.rb +19 -8
  165. data/lib/shrine/plugins/restore_cached_data.rb +13 -7
  166. data/lib/shrine/plugins/sequel.rb +86 -36
  167. data/lib/shrine/plugins/signature.rb +10 -16
  168. data/lib/shrine/plugins/store_dimensions.rb +35 -40
  169. data/lib/shrine/plugins/tempfile.rb +1 -3
  170. data/lib/shrine/plugins/type_predicates.rb +113 -0
  171. data/lib/shrine/plugins/upload_endpoint.rb +28 -24
  172. data/lib/shrine/plugins/upload_options.rb +14 -15
  173. data/lib/shrine/plugins/url_options.rb +31 -0
  174. data/lib/shrine/plugins/validation.rb +80 -0
  175. data/lib/shrine/plugins/validation_helpers.rb +35 -58
  176. data/lib/shrine/plugins/versions.rb +107 -87
  177. data/lib/shrine/plugins.rb +22 -0
  178. data/lib/shrine/storage/file_system.rb +46 -64
  179. data/lib/shrine/storage/linter.rb +42 -7
  180. data/lib/shrine/storage/memory.rb +49 -0
  181. data/lib/shrine/storage/s3.rb +173 -160
  182. data/lib/shrine/uploaded_file.rb +32 -32
  183. data/lib/shrine/version.rb +3 -3
  184. data/lib/shrine.rb +87 -150
  185. data/shrine.gemspec +11 -12
  186. metadata +92 -82
  187. data/doc/migrating_storage.md +0 -76
  188. data/doc/plugins/backup.md +0 -31
  189. data/doc/plugins/copy.md +0 -24
  190. data/doc/plugins/delete_promoted.md +0 -12
  191. data/doc/plugins/direct_upload.md +0 -172
  192. data/doc/plugins/hooks.md +0 -58
  193. data/doc/plugins/logging.md +0 -42
  194. data/doc/plugins/migration_helpers.md +0 -60
  195. data/doc/plugins/moving.md +0 -19
  196. data/doc/plugins/multi_delete.md +0 -20
  197. data/doc/plugins/parallelize.md +0 -16
  198. data/doc/plugins/parsed_json.md +0 -23
  199. data/doc/regenerating_versions.md +0 -143
  200. data/lib/shrine/plugins/background_helpers.rb +0 -5
  201. data/lib/shrine/plugins/backup.rb +0 -90
  202. data/lib/shrine/plugins/copy.rb +0 -50
  203. data/lib/shrine/plugins/delete_promoted.rb +0 -20
  204. data/lib/shrine/plugins/direct_upload.rb +0 -217
  205. data/lib/shrine/plugins/hooks.rb +0 -90
  206. data/lib/shrine/plugins/logging.rb +0 -142
  207. data/lib/shrine/plugins/migration_helpers.rb +0 -70
  208. data/lib/shrine/plugins/moving.rb +0 -57
  209. data/lib/shrine/plugins/multi_delete.rb +0 -32
  210. data/lib/shrine/plugins/parallelize.rb +0 -78
  211. data/lib/shrine/plugins/parsed_json.rb +0 -29
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.3
4
+ version: 3.6.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: 2019-08-09 00:00:00.000000000 Z
11
+ date: 2024-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.1'
19
+ version: '5.1'
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: '4.1'
26
+ version: '5.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: content_disposition
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,90 +66,68 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.8'
69
- - !ruby/object:Gem::Dependency
70
- name: minitest-hooks
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.3'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.3'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: mocha
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '1.4'
75
+ version: '1.11'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '1.4'
82
+ version: '1.11'
97
83
  - !ruby/object:Gem::Dependency
98
- name: shrine-memory
84
+ name: rack
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - ">="
102
88
  - !ruby/object:Gem::Version
103
- version: 0.2.2
89
+ version: '2'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '4'
104
93
  type: :development
105
94
  prerelease: false
106
95
  version_requirements: !ruby/object:Gem::Requirement
107
96
  requirements:
108
97
  - - ">="
109
98
  - !ruby/object:Gem::Version
110
- version: 0.2.2
111
- - !ruby/object:Gem::Dependency
112
- name: rack
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
99
+ version: '2'
100
+ - - "<"
116
101
  - !ruby/object:Gem::Version
117
- version: '2.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '2.0'
102
+ version: '4'
125
103
  - !ruby/object:Gem::Dependency
126
104
  name: http-form_data
127
105
  requirement: !ruby/object:Gem::Requirement
128
106
  requirements:
129
107
  - - "~>"
130
108
  - !ruby/object:Gem::Version
131
- version: '2.0'
109
+ version: '2.2'
132
110
  type: :development
133
111
  prerelease: false
134
112
  version_requirements: !ruby/object:Gem::Requirement
135
113
  requirements:
136
114
  - - "~>"
137
115
  - !ruby/object:Gem::Version
138
- version: '2.0'
116
+ version: '2.2'
139
117
  - !ruby/object:Gem::Dependency
140
- name: rack-test_app
118
+ name: rack-test
141
119
  requirement: !ruby/object:Gem::Requirement
142
120
  requirements:
143
- - - ">="
121
+ - - "~>"
144
122
  - !ruby/object:Gem::Version
145
- version: '0'
123
+ version: '2.1'
146
124
  type: :development
147
125
  prerelease: false
148
126
  version_requirements: !ruby/object:Gem::Requirement
149
127
  requirements:
150
- - - ">="
128
+ - - "~>"
151
129
  - !ruby/object:Gem::Version
152
- version: '0'
130
+ version: '2.1'
153
131
  - !ruby/object:Gem::Dependency
154
132
  name: mimemagic
155
133
  requirement: !ruby/object:Gem::Requirement
@@ -268,14 +246,14 @@ dependencies:
268
246
  requirements:
269
247
  - - "~>"
270
248
  - !ruby/object:Gem::Version
271
- version: '1.16'
249
+ version: '1.69'
272
250
  type: :development
273
251
  prerelease: false
274
252
  version_requirements: !ruby/object:Gem::Requirement
275
253
  requirements:
276
254
  - - "~>"
277
255
  - !ruby/object:Gem::Version
278
- version: '1.16'
256
+ version: '1.69'
279
257
  - !ruby/object:Gem::Dependency
280
258
  name: aws-sdk-core
281
259
  requirement: !ruby/object:Gem::Requirement
@@ -290,6 +268,20 @@ dependencies:
290
268
  - - "~>"
291
269
  - !ruby/object:Gem::Version
292
270
  version: '3.23'
271
+ - !ruby/object:Gem::Dependency
272
+ name: rexml
273
+ requirement: !ruby/object:Gem::Requirement
274
+ requirements:
275
+ - - ">="
276
+ - !ruby/object:Gem::Version
277
+ version: '0'
278
+ type: :development
279
+ prerelease: false
280
+ version_requirements: !ruby/object:Gem::Requirement
281
+ requirements:
282
+ - - ">="
283
+ - !ruby/object:Gem::Version
284
+ version: '0'
293
285
  - !ruby/object:Gem::Dependency
294
286
  name: dry-monitor
295
287
  requirement: !ruby/object:Gem::Requirement
@@ -310,14 +302,14 @@ dependencies:
310
302
  requirements:
311
303
  - - "~>"
312
304
  - !ruby/object:Gem::Version
313
- version: 5.2.0
305
+ version: '7.0'
314
306
  type: :development
315
307
  prerelease: false
316
308
  version_requirements: !ruby/object:Gem::Requirement
317
309
  requirements:
318
310
  - - "~>"
319
311
  - !ruby/object:Gem::Version
320
- version: 5.2.0
312
+ version: '7.0'
321
313
  - !ruby/object:Gem::Dependency
322
314
  name: sequel
323
315
  requirement: !ruby/object:Gem::Requirement
@@ -338,28 +330,28 @@ dependencies:
338
330
  requirements:
339
331
  - - "~>"
340
332
  - !ruby/object:Gem::Version
341
- version: 5.2.0
333
+ version: '7.0'
342
334
  type: :development
343
335
  prerelease: false
344
336
  version_requirements: !ruby/object:Gem::Requirement
345
337
  requirements:
346
338
  - - "~>"
347
339
  - !ruby/object:Gem::Version
348
- version: 5.2.0
340
+ version: '7.0'
349
341
  - !ruby/object:Gem::Dependency
350
342
  name: sqlite3
351
343
  requirement: !ruby/object:Gem::Requirement
352
344
  requirements:
353
345
  - - "~>"
354
346
  - !ruby/object:Gem::Version
355
- version: 1.3.6
347
+ version: '1.4'
356
348
  type: :development
357
349
  prerelease: false
358
350
  version_requirements: !ruby/object:Gem::Requirement
359
351
  requirements:
360
352
  - - "~>"
361
353
  - !ruby/object:Gem::Version
362
- version: 1.3.6
354
+ version: '1.4'
363
355
  description: |
364
356
  Shrine is a toolkit for file attachments in Ruby applications. It supports
365
357
  uploading, downloading, processing and deleting IO objects, backed by various
@@ -381,45 +373,48 @@ files:
381
373
  - doc/advantages.md
382
374
  - doc/attacher.md
383
375
  - doc/carrierwave.md
376
+ - doc/changing_derivatives.md
384
377
  - doc/changing_location.md
378
+ - doc/changing_storage.md
379
+ - doc/creating_persistence_plugins.md
385
380
  - doc/creating_plugins.md
386
381
  - doc/creating_storages.md
387
382
  - doc/design.md
388
383
  - doc/direct_s3.md
384
+ - doc/external/articles.md
385
+ - doc/external/extensions.md
386
+ - doc/external/misc.md
387
+ - doc/getting_started.md
389
388
  - doc/metadata.md
390
- - doc/migrating_storage.md
391
389
  - doc/multiple_files.md
392
390
  - doc/paperclip.md
393
391
  - doc/plugins/activerecord.md
394
392
  - doc/plugins/add_metadata.md
393
+ - doc/plugins/atomic_helpers.md
395
394
  - doc/plugins/backgrounding.md
396
- - doc/plugins/backup.md
397
395
  - doc/plugins/cached_attachment_data.md
398
- - doc/plugins/copy.md
396
+ - doc/plugins/column.md
399
397
  - doc/plugins/data_uri.md
400
398
  - doc/plugins/default_storage.md
401
399
  - doc/plugins/default_url.md
402
- - doc/plugins/default_url_options.md
403
- - doc/plugins/delete_promoted.md
404
400
  - doc/plugins/delete_raw.md
405
401
  - doc/plugins/derivation_endpoint.md
402
+ - doc/plugins/derivatives.md
406
403
  - doc/plugins/determine_mime_type.md
407
- - doc/plugins/direct_upload.md
408
404
  - doc/plugins/download_endpoint.md
409
405
  - doc/plugins/dynamic_storage.md
410
- - doc/plugins/hooks.md
406
+ - doc/plugins/entity.md
407
+ - doc/plugins/form_assign.md
411
408
  - doc/plugins/included.md
412
409
  - doc/plugins/infer_extension.md
413
410
  - doc/plugins/instrumentation.md
414
411
  - doc/plugins/keep_files.md
415
- - doc/plugins/logging.md
416
412
  - doc/plugins/metadata_attributes.md
417
- - doc/plugins/migration_helpers.md
413
+ - doc/plugins/mirroring.md
414
+ - doc/plugins/model.md
418
415
  - doc/plugins/module_include.md
419
- - doc/plugins/moving.md
420
- - doc/plugins/multi_delete.md
421
- - doc/plugins/parallelize.md
422
- - doc/plugins/parsed_json.md
416
+ - doc/plugins/multi_cache.md
417
+ - doc/plugins/persistence.md
423
418
  - doc/plugins/presign_endpoint.md
424
419
  - doc/plugins/pretty_location.md
425
420
  - doc/plugins/processing.md
@@ -435,13 +430,15 @@ files:
435
430
  - doc/plugins/signature.md
436
431
  - doc/plugins/store_dimensions.md
437
432
  - doc/plugins/tempfile.md
433
+ - doc/plugins/type_predicates.md
438
434
  - doc/plugins/upload_endpoint.md
439
435
  - doc/plugins/upload_options.md
436
+ - doc/plugins/url_options.md
437
+ - doc/plugins/validation.md
440
438
  - doc/plugins/validation_helpers.md
441
439
  - doc/plugins/versions.md
442
440
  - doc/processing.md
443
441
  - doc/refile.md
444
- - doc/regenerating_versions.md
445
442
  - doc/release_notes/1.0.0.md
446
443
  - doc/release_notes/1.1.0.md
447
444
  - doc/release_notes/1.2.0.md
@@ -475,48 +472,57 @@ files:
475
472
  - doc/release_notes/2.7.0.md
476
473
  - doc/release_notes/2.8.0.md
477
474
  - doc/release_notes/2.9.0.md
475
+ - doc/release_notes/3.0.0.md
476
+ - doc/release_notes/3.0.1.md
477
+ - doc/release_notes/3.1.0.md
478
+ - doc/release_notes/3.2.0.md
479
+ - doc/release_notes/3.2.1.md
480
+ - doc/release_notes/3.2.2.md
481
+ - doc/release_notes/3.3.0.md
482
+ - doc/release_notes/3.4.0.md
483
+ - doc/release_notes/3.5.0.md
484
+ - doc/release_notes/3.6.0.md
478
485
  - doc/retrieving_uploads.md
479
486
  - doc/securing_uploads.md
480
487
  - doc/storage/file_system.md
488
+ - doc/storage/memory.md
481
489
  - doc/storage/s3.md
482
490
  - doc/testing.md
491
+ - doc/upgrading_to_3.md
483
492
  - doc/validation.md
484
493
  - lib/shrine.rb
485
494
  - lib/shrine/attacher.rb
486
495
  - lib/shrine/attachment.rb
487
496
  - lib/shrine/plugins.rb
497
+ - lib/shrine/plugins/_persistence.rb
488
498
  - lib/shrine/plugins/_urlsafe_serialization.rb
489
499
  - lib/shrine/plugins/activerecord.rb
490
500
  - lib/shrine/plugins/add_metadata.rb
491
- - lib/shrine/plugins/background_helpers.rb
501
+ - lib/shrine/plugins/atomic_helpers.rb
492
502
  - lib/shrine/plugins/backgrounding.rb
493
- - lib/shrine/plugins/backup.rb
494
503
  - lib/shrine/plugins/cached_attachment_data.rb
495
- - lib/shrine/plugins/copy.rb
504
+ - lib/shrine/plugins/column.rb
496
505
  - lib/shrine/plugins/data_uri.rb
497
506
  - lib/shrine/plugins/default_storage.rb
498
507
  - lib/shrine/plugins/default_url.rb
499
508
  - lib/shrine/plugins/default_url_options.rb
500
- - lib/shrine/plugins/delete_promoted.rb
501
509
  - lib/shrine/plugins/delete_raw.rb
502
510
  - lib/shrine/plugins/derivation_endpoint.rb
511
+ - lib/shrine/plugins/derivatives.rb
503
512
  - lib/shrine/plugins/determine_mime_type.rb
504
- - lib/shrine/plugins/direct_upload.rb
505
513
  - lib/shrine/plugins/download_endpoint.rb
506
514
  - lib/shrine/plugins/dynamic_storage.rb
507
- - lib/shrine/plugins/hooks.rb
515
+ - lib/shrine/plugins/entity.rb
516
+ - lib/shrine/plugins/form_assign.rb
508
517
  - lib/shrine/plugins/included.rb
509
518
  - lib/shrine/plugins/infer_extension.rb
510
519
  - lib/shrine/plugins/instrumentation.rb
511
520
  - lib/shrine/plugins/keep_files.rb
512
- - lib/shrine/plugins/logging.rb
513
521
  - lib/shrine/plugins/metadata_attributes.rb
514
- - lib/shrine/plugins/migration_helpers.rb
522
+ - lib/shrine/plugins/mirroring.rb
523
+ - lib/shrine/plugins/model.rb
515
524
  - lib/shrine/plugins/module_include.rb
516
- - lib/shrine/plugins/moving.rb
517
- - lib/shrine/plugins/multi_delete.rb
518
- - lib/shrine/plugins/parallelize.rb
519
- - lib/shrine/plugins/parsed_json.rb
525
+ - lib/shrine/plugins/multi_cache.rb
520
526
  - lib/shrine/plugins/presign_endpoint.rb
521
527
  - lib/shrine/plugins/pretty_location.rb
522
528
  - lib/shrine/plugins/processing.rb
@@ -532,12 +538,16 @@ files:
532
538
  - lib/shrine/plugins/signature.rb
533
539
  - lib/shrine/plugins/store_dimensions.rb
534
540
  - lib/shrine/plugins/tempfile.rb
541
+ - lib/shrine/plugins/type_predicates.rb
535
542
  - lib/shrine/plugins/upload_endpoint.rb
536
543
  - lib/shrine/plugins/upload_options.rb
544
+ - lib/shrine/plugins/url_options.rb
545
+ - lib/shrine/plugins/validation.rb
537
546
  - lib/shrine/plugins/validation_helpers.rb
538
547
  - lib/shrine/plugins/versions.rb
539
548
  - lib/shrine/storage/file_system.rb
540
549
  - lib/shrine/storage/linter.rb
550
+ - lib/shrine/storage/memory.rb
541
551
  - lib/shrine/storage/s3.rb
542
552
  - lib/shrine/uploaded_file.rb
543
553
  - lib/shrine/version.rb
@@ -549,9 +559,9 @@ metadata:
549
559
  bug_tracker_uri: https://github.com/shrinerb/shrine/issues
550
560
  changelog_uri: https://github.com/shrinerb/shrine/blob/master/CHANGELOG.md
551
561
  documentation_uri: https://shrinerb.com
552
- mailing_list_uri: https://groups.google.com/forum/#!forum/ruby-shrine
562
+ mailing_list_uri: https://discourse.shrinerb.com
553
563
  source_code_uri: https://github.com/shrinerb/shrine
554
- post_install_message:
564
+ post_install_message:
555
565
  rdoc_options: []
556
566
  require_paths:
557
567
  - lib
@@ -566,8 +576,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
566
576
  - !ruby/object:Gem::Version
567
577
  version: '0'
568
578
  requirements: []
569
- rubygems_version: 3.0.3
570
- signing_key:
579
+ rubygems_version: 3.5.9
580
+ signing_key:
571
581
  specification_version: 4
572
582
  summary: Toolkit for file attachments in Ruby applications
573
583
  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