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
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.1.0
3
+ ---
4
+
1
5
  Improvements
2
6
  ============
3
7
 
@@ -47,7 +51,7 @@ end
47
51
 
48
52
  ```rb
49
53
  form_for @photo do |f|
50
- f.hidden_field :image, value: @photo.cached_image_data
54
+ f.hidden_field :image, value: @photo.cached_image_data, id: nil
51
55
  f.file_filed :image
52
56
  end
53
57
  ```
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.1.1
3
+ ---
4
+
1
5
  Regressions
2
6
  ===========
3
7
 
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.10.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * The `:mini_magick` analyzer has been added to the `store_dimensions` plugin,
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.10.1
3
+ ---
4
+
1
5
  ## Regressions
2
6
 
3
7
  * Determining MIME type from file extension (using `:mime_types` or
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.11.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * `Shrine::UploadedFile#stream` has been added for streaming the uploaded
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.12.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * The `Shrine::Attacher#assign_remote_url` method has been added, which acts the
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.13.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * The S3 object URLs can now be signed with a custom signer. This enables
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.14.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * `Shrine::Storage::S3` now accepts a `:client` option for specifying an AWS
@@ -274,5 +278,5 @@
274
278
  `#download_url`). If you've are currently overriding any of these private
275
279
  methods, you'll need to update your code.
276
280
 
277
- [Retrieving Uploads]: /doc/retrieving_uploads.md#readme
281
+ [Retrieving Uploads]: https://shrinerb.com/docs/retrieving-uploads
278
282
  [content_disposition]: https://github.com/shrinerb/content_disposition
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.15.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * The [`derivation_endpoint`][derivation_endpoint] plugin has been added, which
@@ -10,7 +14,7 @@
10
14
  "derivation" blocks, passing any arguments you need for the processing.
11
15
 
12
16
  ```rb
13
- photo.image.derivation_url(:thumbnail, "600", "400")
17
+ photo.image.derivation_url(:thumbnail, 600, 400)
14
18
  #=> "derivations/image/thumbnail/600/400/eyJpZCI6ImZvbyIsInN0b3JhZ2UiOiJzdG9yZSJ9?signature=..."
15
19
  ```
16
20
 
@@ -74,9 +78,9 @@
74
78
  relying on multiple invocations returning the same object, you will need to
75
79
  modify your code.
76
80
 
77
- [derivation_endpoint]: /doc/plugins/derivation_endpoint.md#readme
78
- [CDN host]: /doc/plugins/derivation_endpoint.md#host
79
- [`Content-Type`]: /doc/plugins/derivation_endpoint.md#content-type
80
- [`Content-Disposition`]: /doc/plugins/derivation_endpoint.md#content-disposition
81
- [URL expiration]: /doc/plugins/derivation_endpoint.md#expiration
82
- [uploading]: /doc/plugins/derivation_endpoint.md#uploading
81
+ [derivation_endpoint]: https://shrinerb.com/docs/plugins/derivation_endpoint
82
+ [CDN host]: https://shrinerb.com/docs/plugins/derivation_endpoint#host
83
+ [`Content-Type`]: https://shrinerb.com/docs/plugins/derivation_endpoint#content-type
84
+ [`Content-Disposition`]: https://shrinerb.com/docs/plugins/derivation_endpoint#content-disposition
85
+ [URL expiration]: https://shrinerb.com/docs/plugins/derivation_endpoint#expiration
86
+ [uploading]: https://shrinerb.com/docs/plugins/derivation_endpoint#uploading
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.16.0
3
+ ---
4
+
1
5
  ## New Features
2
6
 
3
7
  * The `:download_options` option has been added to the `download_endpoint`
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.17.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * The `download_endpoint` plugin now accepts ad-hoc options when creating the
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.18.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * Added `Shrine.upload_response` to `upload_endpoint` plugin for handling
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.19.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * A new `instrumentation` plugin has been added. It sends and logs events for
@@ -228,8 +232,8 @@
228
232
  `FileSystem#upload`. This means that the `#move` && `#movable?` methods are
229
233
  not part of the storage abstraction anymore.
230
234
 
231
- * The `backup` plugin has been deprecated over [mirroring uploads] via the
232
- `instrumentation` plugin.
235
+ * The `backup` plugin has been deprecated (a new `mirroring` plugin will get
236
+ added in 3.0).
233
237
 
234
238
  * The `copy` plugin has been deprecated.
235
239
 
@@ -260,4 +264,3 @@
260
264
 
261
265
  [ActiveSupport::Notifications]: https://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
262
266
  [dry-monitor]: https://github.com/dry-rb/dry-monitor
263
- [mirroring uploads]: https://github.com/shrinerb/shrine/wiki/Mirroring-Uploads
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.2.0
3
+ ---
4
+
1
5
  ## New plugins
2
6
 
3
7
  * The processing plugin has been added for declaratively defining processing
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.3.0
3
+ ---
4
+
1
5
  ## New plugins
2
6
 
3
7
  * The `copy` plugin has been added for copying files from one record to
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.3.1
3
+ ---
4
+
1
5
  Regressions
2
6
  ===========
3
7
 
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.4.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * The `default_url_options` plugin accepts a block for dynamically generating
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.4.1
3
+ ---
4
+
1
5
  ## Regressions
2
6
 
3
7
  * Prior to version 2.4.0, the conversion of uploaded file data to JSON was
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.5.0
3
+ ---
4
+
1
5
  ## New features
2
6
 
3
7
  * The `add_metadata` plugin has been extended to enable extracting and saving
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.6.0
3
+ ---
4
+
1
5
  ## New plugins
2
6
 
3
7
  * Added `signature` plugin which allows you to calculate a
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.6.1
3
+ ---
4
+
1
5
  ## Bug fixes
2
6
 
3
7
  * When `download_endpoint` streams file content into the response body, with
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.7.0
3
+ ---
4
+
1
5
  ## New Plugins
2
6
 
3
7
  * The `direct_upload` plugin has been split into `upload_endpoint` and
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.8.0
3
+ ---
4
+
1
5
  ## New Features
2
6
 
3
7
  * The `rack_response` plugin now supports [range requests] via the `:range`
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Shrine 2.9.0
3
+ ---
4
+
1
5
  ## New Plugins
2
6
 
3
7
  * The `infer_extension` plugin has been added, which automatically infers