shrine 3.0.0.rc → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of shrine might be problematic. Click here for more details.

Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -66
  3. data/README.md +39 -1061
  4. data/doc/advantages.md +151 -148
  5. data/doc/attacher.md +12 -30
  6. data/doc/carrierwave.md +150 -115
  7. data/doc/changing_derivatives.md +5 -11
  8. data/doc/changing_location.md +8 -5
  9. data/doc/changing_storage.md +5 -2
  10. data/doc/creating_persistence_plugins.md +9 -6
  11. data/doc/creating_plugins.md +42 -22
  12. data/doc/creating_storages.md +4 -1
  13. data/doc/design.md +7 -5
  14. data/doc/direct_s3.md +9 -4
  15. data/doc/external/articles.md +50 -0
  16. data/doc/external/extensions.md +46 -0
  17. data/doc/external/misc.md +17 -0
  18. data/doc/getting_started.md +1038 -0
  19. data/doc/metadata.md +5 -3
  20. data/doc/multiple_files.md +55 -29
  21. data/doc/paperclip.md +206 -163
  22. data/doc/plugins/activerecord.md +26 -6
  23. data/doc/plugins/add_metadata.md +4 -2
  24. data/doc/plugins/atomic_helpers.md +4 -2
  25. data/doc/plugins/backgrounding.md +83 -44
  26. data/doc/plugins/cached_attachment_data.md +4 -2
  27. data/doc/plugins/column.md +4 -2
  28. data/doc/plugins/data_uri.md +10 -6
  29. data/doc/plugins/default_storage.md +5 -3
  30. data/doc/plugins/default_url.md +4 -2
  31. data/doc/plugins/delete_raw.md +4 -2
  32. data/doc/plugins/derivation_endpoint.md +63 -39
  33. data/doc/plugins/derivatives.md +13 -50
  34. data/doc/plugins/determine_mime_type.md +6 -4
  35. data/doc/plugins/download_endpoint.md +6 -3
  36. data/doc/plugins/dynamic_storage.md +4 -2
  37. data/doc/plugins/entity.md +6 -4
  38. data/doc/plugins/form_assign.md +4 -2
  39. data/doc/plugins/included.md +4 -2
  40. data/doc/plugins/infer_extension.md +6 -4
  41. data/doc/plugins/instrumentation.md +5 -3
  42. data/doc/plugins/keep_files.md +9 -2
  43. data/doc/plugins/metadata_attributes.md +5 -3
  44. data/doc/plugins/mirroring.md +4 -2
  45. data/doc/plugins/model.md +6 -4
  46. data/doc/plugins/module_include.md +4 -2
  47. data/doc/plugins/multi_cache.md +4 -2
  48. data/doc/plugins/persistence.md +5 -3
  49. data/doc/plugins/presign_endpoint.md +6 -2
  50. data/doc/plugins/pretty_location.md +5 -3
  51. data/doc/plugins/processing.md +4 -2
  52. data/doc/plugins/rack_file.md +8 -2
  53. data/doc/plugins/rack_response.md +6 -2
  54. data/doc/plugins/recache.md +4 -2
  55. data/doc/plugins/refresh_metadata.md +5 -3
  56. data/doc/plugins/remote_url.md +26 -5
  57. data/doc/plugins/remove_attachment.md +4 -2
  58. data/doc/plugins/remove_invalid.md +10 -2
  59. data/doc/plugins/restore_cached_data.md +9 -3
  60. data/doc/plugins/sequel.md +26 -6
  61. data/doc/plugins/signature.md +6 -4
  62. data/doc/plugins/store_dimensions.md +6 -4
  63. data/doc/plugins/tempfile.md +4 -2
  64. data/doc/plugins/upload_endpoint.md +6 -2
  65. data/doc/plugins/upload_options.md +6 -4
  66. data/doc/plugins/url_options.md +4 -2
  67. data/doc/plugins/validation.md +7 -3
  68. data/doc/plugins/validation_helpers.md +13 -10
  69. data/doc/plugins/versions.md +4 -8
  70. data/doc/processing.md +27 -9
  71. data/doc/refile.md +119 -127
  72. data/doc/release_notes/1.0.0.md +4 -0
  73. data/doc/release_notes/1.1.0.md +4 -0
  74. data/doc/release_notes/1.2.0.md +4 -0
  75. data/doc/release_notes/1.3.0.md +4 -0
  76. data/doc/release_notes/1.4.0.md +4 -0
  77. data/doc/release_notes/1.4.1.md +4 -0
  78. data/doc/release_notes/1.4.2.md +4 -0
  79. data/doc/release_notes/2.0.0.md +4 -0
  80. data/doc/release_notes/2.0.1.md +4 -0
  81. data/doc/release_notes/2.1.0.md +4 -0
  82. data/doc/release_notes/2.1.1.md +4 -0
  83. data/doc/release_notes/2.10.0.md +4 -0
  84. data/doc/release_notes/2.10.1.md +4 -0
  85. data/doc/release_notes/2.11.0.md +4 -0
  86. data/doc/release_notes/2.12.0.md +4 -0
  87. data/doc/release_notes/2.13.0.md +4 -0
  88. data/doc/release_notes/2.14.0.md +5 -1
  89. data/doc/release_notes/2.15.0.md +10 -6
  90. data/doc/release_notes/2.16.0.md +4 -0
  91. data/doc/release_notes/2.17.0.md +4 -0
  92. data/doc/release_notes/2.18.0.md +4 -0
  93. data/doc/release_notes/2.19.0.md +7 -4
  94. data/doc/release_notes/2.2.0.md +4 -0
  95. data/doc/release_notes/2.3.0.md +4 -0
  96. data/doc/release_notes/2.3.1.md +4 -0
  97. data/doc/release_notes/2.4.0.md +4 -0
  98. data/doc/release_notes/2.4.1.md +4 -0
  99. data/doc/release_notes/2.5.0.md +4 -0
  100. data/doc/release_notes/2.6.0.md +4 -0
  101. data/doc/release_notes/2.6.1.md +4 -0
  102. data/doc/release_notes/2.7.0.md +4 -0
  103. data/doc/release_notes/2.8.0.md +4 -0
  104. data/doc/release_notes/2.9.0.md +4 -0
  105. data/doc/release_notes/3.0.0.md +120 -38
  106. data/doc/retrieving_uploads.md +4 -1
  107. data/doc/securing_uploads.md +4 -1
  108. data/doc/storage/file_system.md +12 -4
  109. data/doc/storage/s3.md +4 -2
  110. data/doc/testing.md +27 -41
  111. data/doc/upgrading_to_3.md +105 -26
  112. data/doc/validation.md +8 -6
  113. data/lib/shrine/attacher.rb +2 -2
  114. data/lib/shrine/attachment.rb +7 -10
  115. data/lib/shrine/plugins/activerecord.rb +10 -10
  116. data/lib/shrine/plugins/add_metadata.rb +1 -3
  117. data/lib/shrine/plugins/atomic_helpers.rb +6 -8
  118. data/lib/shrine/plugins/backgrounding.rb +4 -6
  119. data/lib/shrine/plugins/cached_attachment_data.rb +1 -3
  120. data/lib/shrine/plugins/column.rb +2 -4
  121. data/lib/shrine/plugins/data_uri.rb +1 -3
  122. data/lib/shrine/plugins/default_storage.rb +1 -3
  123. data/lib/shrine/plugins/default_url.rb +1 -3
  124. data/lib/shrine/plugins/delete_raw.rb +1 -3
  125. data/lib/shrine/plugins/derivation_endpoint.rb +3 -4
  126. data/lib/shrine/plugins/derivatives.rb +2 -4
  127. data/lib/shrine/plugins/determine_mime_type.rb +1 -3
  128. data/lib/shrine/plugins/download_endpoint.rb +1 -3
  129. data/lib/shrine/plugins/dynamic_storage.rb +1 -3
  130. data/lib/shrine/plugins/entity.rb +25 -9
  131. data/lib/shrine/plugins/form_assign.rb +1 -3
  132. data/lib/shrine/plugins/included.rb +1 -3
  133. data/lib/shrine/plugins/infer_extension.rb +1 -3
  134. data/lib/shrine/plugins/instrumentation.rb +1 -3
  135. data/lib/shrine/plugins/keep_files.rb +1 -3
  136. data/lib/shrine/plugins/metadata_attributes.rb +1 -3
  137. data/lib/shrine/plugins/mirroring.rb +2 -1
  138. data/lib/shrine/plugins/model.rb +2 -4
  139. data/lib/shrine/plugins/module_include.rb +1 -3
  140. data/lib/shrine/plugins/multi_cache.rb +3 -3
  141. data/lib/shrine/plugins/presign_endpoint.rb +1 -3
  142. data/lib/shrine/plugins/pretty_location.rb +1 -3
  143. data/lib/shrine/plugins/processing.rb +1 -3
  144. data/lib/shrine/plugins/rack_file.rb +1 -3
  145. data/lib/shrine/plugins/rack_response.rb +1 -3
  146. data/lib/shrine/plugins/recache.rb +1 -3
  147. data/lib/shrine/plugins/refresh_metadata.rb +1 -3
  148. data/lib/shrine/plugins/remote_url.rb +1 -3
  149. data/lib/shrine/plugins/remove_attachment.rb +1 -3
  150. data/lib/shrine/plugins/remove_invalid.rb +1 -3
  151. data/lib/shrine/plugins/restore_cached_data.rb +1 -3
  152. data/lib/shrine/plugins/sequel.rb +10 -12
  153. data/lib/shrine/plugins/signature.rb +1 -3
  154. data/lib/shrine/plugins/store_dimensions.rb +1 -3
  155. data/lib/shrine/plugins/tempfile.rb +1 -3
  156. data/lib/shrine/plugins/upload_endpoint.rb +1 -3
  157. data/lib/shrine/plugins/upload_options.rb +1 -3
  158. data/lib/shrine/plugins/url_options.rb +1 -3
  159. data/lib/shrine/plugins/validation.rb +1 -3
  160. data/lib/shrine/plugins/validation_helpers.rb +1 -3
  161. data/lib/shrine/plugins/versions.rb +1 -3
  162. data/lib/shrine/storage/file_system.rb +1 -1
  163. data/lib/shrine/storage/linter.rb +1 -1
  164. data/lib/shrine/storage/memory.rb +2 -1
  165. data/lib/shrine/storage/s3.rb +3 -3
  166. data/lib/shrine/version.rb +1 -1
  167. metadata +8 -4
@@ -1,4 +1,6 @@
1
- # Derivatives
1
+ ---
2
+ title: Derivatives
3
+ ---
2
4
 
3
5
  The derivatives plugin allows storing processed files ("derivatives") alongside
4
6
  the main attached file. The processed file data will be saved together with the
@@ -8,45 +10,6 @@ main attachment data in the same record attribute.
8
10
  Shrine.plugin :derivatives
9
11
  ```
10
12
 
11
- ## Contents
12
-
13
- * [API overview](#api-overview)
14
- * [Creating derivatives](#creating-derivatives)
15
- - [Naming processors](#naming-processors)
16
- - [Derivatives storage](#derivatives-storage)
17
- - [Nesting derivatives](#nesting-derivatives)
18
- * [Retrieving derivatives](#retrieving-derivatives)
19
- * [Derivative URL](#derivative-url)
20
- * [Processing derivatives](#processing-derivatives)
21
- - [Dynamic processing](#dynamic-processing)
22
- - [Source file](#source-file)
23
- * [Adding derivatives](#adding-derivatives)
24
- * [Uploading derivatives](#uploading-derivatives)
25
- - [Uploader options](#uploader-options)
26
- - [File deletion](#file-deletion)
27
- * [Merging derivatives](#merging-derivatives)
28
- - [Setting derivatives](#setting-derivatives)
29
- * [Promoting derivatives](#promoting-derivatives)
30
- * [Removing derivatives](#removing-derivatives)
31
- * [Deleting derivatives](#deleting-derivatives)
32
- * [Miscellaneous](#miscellaneous)
33
- * [Without original](#without-original)
34
- * [Iterating derivatives](#iterating-derivatives)
35
- * [Parsing derivatives](#parsing-derivatives)
36
- * [Instrumentation](#instrumentation)
37
-
38
- ## API overview
39
-
40
- The interface for managing derivatives is implemented on the `Shrine::Attacher`
41
- class, and it's layered in the following way:
42
-
43
- * [`Attacher#create_derivatives`](#creating-derivatives) – processes, uploads and merges derivatives
44
- * [`Attacher#process_derivatives`](#processing-derivatives) – processes derivatives
45
- * [`Attacher#add_derivatives`](#adding-derivatives) – uploads and merges derivatives
46
- * [`Attacher#upload_derivatives`](#uploading-derivatives) – uploads derivatives
47
- * [`Attacher#merge_derivatives`](#merging-derivatives) – merges derivatives
48
- * [`Attacher#set_derivatives`](#setting-derivatives) – overrides derivatives
49
-
50
13
  ## Creating derivatives
51
14
 
52
15
  When you have a file attached, you can generate derivatives from it and save
@@ -164,11 +127,9 @@ class ImageUploader < Shrine
164
127
  end
165
128
  ```
166
129
  ```rb
167
- # ...
168
130
  photo.image_derivatives!(:thumbnails)
169
131
  # or
170
132
  attacher.create_derivatives(:thumbnails)
171
- # ...
172
133
  ```
173
134
 
174
135
  ### Derivatives storage
@@ -681,7 +642,9 @@ attacher.derivatives[:two].exists? #=> false
681
642
 
682
643
  Derivatives are automatically deleted on `Attacher#destroy`.
683
644
 
684
- ## Without original
645
+ ## Miscellaneous
646
+
647
+ ### Without original
685
648
 
686
649
  You can store derivatives even if there is no main attached file:
687
650
 
@@ -701,7 +664,7 @@ However, note that in this case operations such as promotion and deletion will
701
664
  not be automatically triggered in the attachment flow, you'd need to trigger
702
665
  them manually as needed.
703
666
 
704
- ## Iterating derivatives
667
+ ### Iterating derivatives
705
668
 
706
669
  If you want to iterate over a nested hash of derivatives (which can be
707
670
  `Shrine::UploadedFile` objects or raw files), you can use
@@ -727,7 +690,7 @@ end
727
690
  # [:four, 0], #<Shrine::UploadedFile>
728
691
  ```
729
692
 
730
- ## Parsing derivatives
693
+ ### Parsing derivatives
731
694
 
732
695
  If you want to directly parse derivatives data written to a record attribute,
733
696
  you can use `Shrine.derivatives` (counterpart to `Shrine.uploaded_file`):
@@ -773,7 +736,7 @@ following payload:
773
736
 
774
737
  A default log subscriber is added as well which logs these events:
775
738
 
776
- ```
739
+ ```plaintext
777
740
  Derivatives (2133ms) – {:processor=>:thumbnails, :processor_options=>{}, :uploader=>ImageUploader}
778
741
  ```
779
742
 
@@ -784,7 +747,7 @@ plugin :derivatives, log_subscriber: -> (event) {
784
747
  Shrine.logger.info JSON.generate(name: event.name, duration: event.duration, **event.payload)
785
748
  }
786
749
  ```
787
- ```
750
+ ```plaintext
788
751
  {"name":"derivatives","duration":2133,"processor":"thumbnails","processor_options":{},"uploader":"ImageUploader"}
789
752
  ```
790
753
 
@@ -794,6 +757,6 @@ Or disable logging altogether:
794
757
  plugin :derivatives, log_subscriber: nil
795
758
  ```
796
759
 
797
- [default_url]: /doc/plugins/default_url.md#readme
798
- [entity]: /doc/plugins/entity.md#readme
799
- [model]: /doc/plugins/model.md#readme
760
+ [default_url]: https://shrinerb.com/docs/plugins/default_url
761
+ [entity]: https://shrinerb.com/docs/plugins/entity
762
+ [model]: https://shrinerb.com/docs/plugins/model
@@ -1,4 +1,6 @@
1
- # Determine MIME Type
1
+ ---
2
+ title: Determine MIME Type
3
+ ---
2
4
 
3
5
  The [`determine_mime_type`][determine_mime_type] plugin allows you to determine
4
6
  and store the actual MIME type of the file analyzed from file content.
@@ -104,7 +106,7 @@ payload:
104
106
 
105
107
  A default log subscriber is added as well which logs these events:
106
108
 
107
- ```
109
+ ```plaintext
108
110
  MIME Type (33ms) – {:io=>StringIO, :uploader=>Shrine}
109
111
  ```
110
112
 
@@ -115,7 +117,7 @@ plugin :determine_mime_type, log_subscriber: -> (event) {
115
117
  Shrine.logger.info JSON.generate(name: event.name, duration: event.duration, **event.payload)
116
118
  }
117
119
  ```
118
- ```
120
+ ```plaintext
119
121
  {"name":"mime_type","duration":24,"io":"#<StringIO:0x00007fb7c5b08b80>","uploader":"Shrine"}
120
122
  ```
121
123
 
@@ -125,7 +127,7 @@ Or disable logging altogether:
125
127
  plugin :determine_mime_type, log_subscriber: nil
126
128
  ```
127
129
 
128
- [determine_mime_type]: /lib/shrine/plugins/determine_mime_type.rb
130
+ [determine_mime_type]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/determine_mime_type.rb
129
131
  [file]: http://linux.die.net/man/1/file
130
132
  [Windows equivalent]: http://gnuwin32.sourceforge.net/packages/file.htm
131
133
  [ruby-filemagic]: https://github.com/blackwinter/ruby-filemagic
@@ -1,4 +1,6 @@
1
- # Download Endpoint
1
+ ---
2
+ title: Download Endpoint
3
+ ---
2
4
 
3
5
  The [`download_endpoint`][download_endpoint] plugin provides a Rack app for
4
6
  downloading uploaded files from specified storages. This can be useful when
@@ -50,7 +52,8 @@ Rails.application.routes.draw do
50
52
  end
51
53
  ```
52
54
 
53
- *Hint: For shrine versions 2.x -> ensure that you don't include the plugin twice (globally and in your uploader class - see #408)*
55
+ *Hint: For shrine versions 2.x -> ensure that you don't include the plugin
56
+ twice (globally and in your uploader class - see #408)*
54
57
 
55
58
  ## Calling from a controller
56
59
 
@@ -167,4 +170,4 @@ If you want to have more control on download requests, you can use the
167
170
  | `:prefix` | Path prefix prepended to download URLs | `nil` |
168
171
  | `:redirect` | Whether to redirect to uploaded files on the storage | `false` |
169
172
 
170
- [download_endpoint]: /lib/shrine/plugins/download_endpoint.rb
173
+ [download_endpoint]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/download_endpoint.rb
@@ -1,4 +1,6 @@
1
- # Dynamic Storage
1
+ ---
2
+ title: Dynamic Storage
3
+ ---
2
4
 
3
5
  The [`dynamic_storage`][dynamic_storage] plugin allows you to register a
4
6
  storage using a regex, and evaluate the storage class dynamically depending on
@@ -20,4 +22,4 @@ the bucket "foo". The block is yielded an instance of `MatchData`.
20
22
 
21
23
  This can be useful in combination with the `default_storage` plugin.
22
24
 
23
- [dynamic_storage]: /lib/shrine/plugins/dynamic_storage.rb
25
+ [dynamic_storage]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/dynamic_storage.rb
@@ -1,4 +1,6 @@
1
- # Entity
1
+ ---
2
+ title: Entity
3
+ ---
2
4
 
3
5
  The [`entity`][entity] plugin provides integration for handling attachments on
4
6
  immutable structs. It is built on top of the [`column`][column] plugin.
@@ -248,6 +250,6 @@ By default, attachment data is serialized into JSON using the `JSON` standard
248
250
  library. If you want to change how data is serialized, see the
249
251
  [`column`][column serializer] plugin docs.
250
252
 
251
- [column]: /doc/plugins/column.md#readme
252
- [entity]: /lib/shrine/plugins/entity.rb
253
- [column serializer]: /doc/plugins/column.md#serializer
253
+ [entity]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/entity.rb
254
+ [column]: https://shrinerb.com/docs/plugins/column
255
+ [column serializer]: https://shrinerb.com/docs/plugins/column#serializer
@@ -1,4 +1,6 @@
1
- # Form Assign
1
+ ---
2
+ title: Form Assign
3
+ ---
2
4
 
3
5
  The [`form_assign`][form_assign] plugin allows attaching file from form params
4
6
  without a form object.
@@ -50,4 +52,4 @@ attacher.form_assign({ "image" => image, ... }, result: :attributes)
50
52
  #=> { :image_data => '{"id":"...","storage":"...","metadata":"..."}', "title" => "...", "description" => "..." }
51
53
  ```
52
54
 
53
- [form_assign]: /lib/shrine/plugins/form_assign.rb
55
+ [form_assign]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/form_assign.rb
@@ -1,4 +1,6 @@
1
- # Included
1
+ ---
2
+ title: Included
3
+ ---
2
4
 
3
5
  The [`included`][included] plugin allows you to hook up to the `.included` hook
4
6
  of the attachment module, and call additional methods on the model that
@@ -16,4 +18,4 @@ end
16
18
  Photo.include Shrine::Attachment(:image)
17
19
  ```
18
20
 
19
- [included]: /lib/shrine/plugins/included.rb
21
+ [included]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/included.rb
@@ -1,4 +1,6 @@
1
- # Infer Extension
1
+ ---
2
+ title: Infer Extension
3
+ ---
2
4
 
3
5
  The [`infer_extension`][infer_extension] plugin allows deducing the appropriate
4
6
  file extension for the upload location based on the MIME type of the file. This
@@ -68,7 +70,7 @@ payload:
68
70
 
69
71
  A default log subscriber is added as well which logs these events:
70
72
 
71
- ```
73
+ ```plaintext
72
74
  Extension (5ms) – {:mime_type=>"image/jpeg", :uploader=>Shrine}
73
75
  ```
74
76
 
@@ -79,7 +81,7 @@ plugin :infer_extension, log_subscriber: -> (event) {
79
81
  Shrine.logger.info JSON.generate(name: event.name, duration: event.duration, **event.payload)
80
82
  }
81
83
  ```
82
- ```
84
+ ```plaintext
83
85
  {"name":"extension","duration":5,"mime_type":"image/jpeg","uploader":"Shrine"}
84
86
  ```
85
87
 
@@ -89,6 +91,6 @@ Or disable logging altogether:
89
91
  plugin :infer_extension, log_subscriber: nil
90
92
  ```
91
93
 
92
- [infer_extension]: /lib/shrine/plugins/infer_extension.rb
94
+ [infer_extension]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/infer_extension.rb
93
95
  [mime-types]: https://github.com/mime-types/ruby-mime-types
94
96
  [mini_mime]: https://github.com/discourse/mini_mime
@@ -1,4 +1,6 @@
1
- # Instrumentation
1
+ ---
2
+ title: Instrumentation
3
+ ---
2
4
 
3
5
  The [`instrumentation`][instrumentation] plugin publishes events for various
4
6
  operations to a centralized notification component. In addition to that, it
@@ -32,7 +34,7 @@ uploaded_file.exists?
32
34
  uploaded_file.download
33
35
  uploaded_file.delete
34
36
  ```
35
- ```
37
+ ```plaintext
36
38
  Metadata (32ms) – {:storage=>:store, :io=>StringIO, :uploader=>Shrine}
37
39
  Upload (1523ms) – {:storage=>:store, :location=>"ed0e30ddec8b97813f2c1f4cfd1700b4", :io=>StringIO, :upload_options=>{}, :uploader=>Shrine}
38
40
  Exists (755ms) – {:storage=>:store, :location=>"ed0e30ddec8b97813f2c1f4cfd1700b4", :uploader=>Shrine}
@@ -185,6 +187,6 @@ Shrine.subscribe(:my_event) do |event|
185
187
  end
186
188
  ```
187
189
 
188
- [instrumentation]: /lib/shrine/plugins/instrumentation.rb
190
+ [instrumentation]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/instrumentation.rb
189
191
  [ActiveSupport::Notifications]: https://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
190
192
  [dry-monitor]: https://github.com/dry-rb/dry-monitor
@@ -1,4 +1,6 @@
1
- # Keep Files
1
+ ---
2
+ title: Keep Files
3
+ ---
2
4
 
3
5
  The [`keep_files`][keep_files] plugin prevents file deletion when the attacher
4
6
  is about to destroy currently attached or previously attached file. This
@@ -8,5 +10,10 @@ general any scenario where you need to track history.
8
10
  ```rb
9
11
  plugin :keep_files
10
12
  ```
13
+ ```rb
14
+ photo.image #=> #<Shrine::UploadedFile>
15
+ photo.destroy
16
+ photo.image.exists? #=> true
17
+ ```
11
18
 
12
- [keep_files]: /lib/shrine/plugins/keep_files.rb
19
+ [keep_files]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/keep_files.rb
@@ -1,4 +1,6 @@
1
- # Metadata Attributes
1
+ ---
2
+ title: Metadata Attributes
3
+ ---
2
4
 
3
5
  The [`metadata_attributes`][metadata_attributes] plugin allows you to sync
4
6
  attachment metadata to additional record attributes. You can provide a hash of
@@ -57,5 +59,5 @@ photo.original_filename #=> "nature.jpg"
57
59
  Any metadata attributes that were declared but are missing on the record will
58
60
  be skipped.
59
61
 
60
- [metadata_attributes]: /lib/shrine/plugins/metadata_attributes.rb
61
- [entity]: /doc/plugins/entity.md#readme
62
+ [metadata_attributes]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/metadata_attributes.rb
63
+ [entity]: https://shrinerb.com/docs/plugins/entity
@@ -1,4 +1,6 @@
1
- # Mirroring
1
+ ---
2
+ title: Mirroring
3
+ ---
2
4
 
3
5
  The [`mirroring`][mirroring] plugin enables replicating uploads and deletes to
4
6
  other storages. This can be useful for setting up a backup storage, or when
@@ -113,4 +115,4 @@ file.delete # delete from :store
113
115
  file.mirror_delete_background # spawn mirror delete background job
114
116
  ```
115
117
 
116
- [mirroring]: /lib/shrine/plugins/mirroring.rb
118
+ [mirroring]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/mirroring.rb
@@ -1,4 +1,6 @@
1
- # Model
1
+ ---
2
+ title: Model
3
+ ---
2
4
 
3
5
  The [`model`][model] plugin provides integration for handling attachment on
4
6
  mutable structs. It is built on top of the [`entity`][entity] plugin.
@@ -198,6 +200,6 @@ By default, attachment data is serialized into JSON using the `JSON` standard
198
200
  library. If you want to change how data is serialized, see the
199
201
  [`column`][column serializer] plugin docs.
200
202
 
201
- [model]: /lib/shrine/plugins/model.rb
202
- [entity]: /doc/plugins/entity.md#readme
203
- [column serializer]: /doc/plugins/column.md#serializer
203
+ [model]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/model.rb
204
+ [entity]: https://shrinerb.com/docs/plugins/entity
205
+ [column serializer]: https://shrinerb.com/docs/plugins/column#serializer
@@ -1,4 +1,6 @@
1
- # Module Include
1
+ ---
2
+ title: Module Include
3
+ ---
2
4
 
3
5
  The [`module_include`][module_include] plugin allows you to extend Shrine's
4
6
  core classes for the given uploader with modules/methods.
@@ -39,4 +41,4 @@ end
39
41
  The above defines an additional `#<attachment>_size` method on the attachment
40
42
  module, which is what is included in your model.
41
43
 
42
- [module_include]: /lib/shrine/plugins/module_include.rb
44
+ [module_include]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/module_include.rb
@@ -1,4 +1,6 @@
1
- # Multi Cache
1
+ ---
2
+ title: Multi Cache
3
+ ---
2
4
 
3
5
  The [`multi_cache`][multi_cache] plugin allows an attacher to accept files from
4
6
  additional temporary storages.
@@ -19,4 +21,4 @@ photo.image = { "id" => "...", "storage" => "cache_two", "metadata" => { ... } }
19
21
  photo.image.storage_key #=> :cache_two
20
22
  ```
21
23
 
22
- [multi_cache]: /lib/shrine/plugins/multi_cache.rb
24
+ [multi_cache]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/multi_cache.rb
@@ -1,4 +1,6 @@
1
- # Persistence
1
+ ---
2
+ title: Persistence
3
+ ---
2
4
 
3
5
  This is an internal plugin that provides uniform persistence interface across
4
6
  different persistence plugins (e.g. [`activerecord`][activerecord],
@@ -85,5 +87,5 @@ attacher.attach(io)
85
87
  attacher.persist # saves the underlying record
86
88
  ```
87
89
 
88
- [activerecord]: /doc/plugins/activerecord.md#readme
89
- [sequel]: /doc/plugins/sequel.md#readme
90
+ [activerecord]: https://shrinerb.com/docs/plugins/activerecord
91
+ [sequel]: https://shrinerb.com/docs/plugins/sequel
@@ -1,4 +1,6 @@
1
- # Presign Endpoint
1
+ ---
2
+ title: Presign Endpoint
3
+ ---
2
4
 
3
5
  The [`presign_endpoint`][presign_endpoint] plugin provides a Rack endpoint
4
6
  which generates the URL, fields, and headers that can be used to upload files
@@ -11,6 +13,8 @@ more.
11
13
  plugin :presign_endpoint
12
14
  ```
13
15
 
16
+ ## Setup
17
+
14
18
  The plugin adds a `Shrine.presign_endpoint` method which, given a storage
15
19
  identifier, returns a Rack application that accepts GET requests and generates
16
20
  a presign for the specified storage. You can run this Rack application inside
@@ -157,7 +161,7 @@ Shrine.presign_endpoint(:cache, presign_location: "${filename}")
157
161
  Shrine.presign_response(:cache, env, presign_location: "${filename}")
158
162
  ```
159
163
 
160
- [presign_endpoint]: /lib/shrine/plugins/presign_endpoint.rb
164
+ [presign_endpoint]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/presign_endpoint.rb
161
165
  [Uppy]: https://uppy.io
162
166
  [Amazon S3]: https://aws.amazon.com/s3/
163
167
  [Google Cloud Storage]: https://cloud.google.com/storage/
@@ -1,4 +1,6 @@
1
- # Pretty Location
1
+ ---
2
+ title: Pretty Location
3
+ ---
2
4
 
3
5
  The [`pretty_location`][pretty_location] plugin attempts to generate a nicer
4
6
  folder structure for uploaded files.
@@ -13,7 +15,7 @@ generated locations will typically look like this:
13
15
 
14
16
  ```rb
15
17
  "user/564/avatar/thumb-493g82jf23.jpg"
16
- # :model/:id/:attachment/:version-:uid.:extension
18
+ # :model/:id/:attachment/:derivative-:uid.:extension
17
19
  ```
18
20
 
19
21
  By default if a record class is inside a namespace, only the "inner" class name
@@ -62,4 +64,4 @@ def generate_location(io, record: nil, **context)
62
64
  end
63
65
  ```
64
66
 
65
- [pretty_location]: /lib/shrine/plugins/pretty_location.rb
67
+ [pretty_location]: https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/pretty_location.rb