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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -66
- data/README.md +39 -1061
- data/doc/advantages.md +151 -148
- data/doc/attacher.md +12 -30
- data/doc/carrierwave.md +150 -115
- data/doc/changing_derivatives.md +5 -11
- data/doc/changing_location.md +8 -5
- data/doc/changing_storage.md +5 -2
- data/doc/creating_persistence_plugins.md +9 -6
- data/doc/creating_plugins.md +42 -22
- data/doc/creating_storages.md +4 -1
- data/doc/design.md +7 -5
- data/doc/direct_s3.md +9 -4
- data/doc/external/articles.md +50 -0
- data/doc/external/extensions.md +46 -0
- data/doc/external/misc.md +17 -0
- data/doc/getting_started.md +1038 -0
- data/doc/metadata.md +5 -3
- data/doc/multiple_files.md +55 -29
- data/doc/paperclip.md +206 -163
- data/doc/plugins/activerecord.md +26 -6
- data/doc/plugins/add_metadata.md +4 -2
- data/doc/plugins/atomic_helpers.md +4 -2
- data/doc/plugins/backgrounding.md +83 -44
- data/doc/plugins/cached_attachment_data.md +4 -2
- data/doc/plugins/column.md +4 -2
- data/doc/plugins/data_uri.md +10 -6
- data/doc/plugins/default_storage.md +5 -3
- data/doc/plugins/default_url.md +4 -2
- data/doc/plugins/delete_raw.md +4 -2
- data/doc/plugins/derivation_endpoint.md +63 -39
- data/doc/plugins/derivatives.md +13 -50
- data/doc/plugins/determine_mime_type.md +6 -4
- data/doc/plugins/download_endpoint.md +6 -3
- data/doc/plugins/dynamic_storage.md +4 -2
- data/doc/plugins/entity.md +6 -4
- data/doc/plugins/form_assign.md +4 -2
- data/doc/plugins/included.md +4 -2
- data/doc/plugins/infer_extension.md +6 -4
- data/doc/plugins/instrumentation.md +5 -3
- data/doc/plugins/keep_files.md +9 -2
- data/doc/plugins/metadata_attributes.md +5 -3
- data/doc/plugins/mirroring.md +4 -2
- data/doc/plugins/model.md +6 -4
- data/doc/plugins/module_include.md +4 -2
- data/doc/plugins/multi_cache.md +4 -2
- data/doc/plugins/persistence.md +5 -3
- data/doc/plugins/presign_endpoint.md +6 -2
- data/doc/plugins/pretty_location.md +5 -3
- data/doc/plugins/processing.md +4 -2
- data/doc/plugins/rack_file.md +8 -2
- data/doc/plugins/rack_response.md +6 -2
- data/doc/plugins/recache.md +4 -2
- data/doc/plugins/refresh_metadata.md +5 -3
- data/doc/plugins/remote_url.md +26 -5
- data/doc/plugins/remove_attachment.md +4 -2
- data/doc/plugins/remove_invalid.md +10 -2
- data/doc/plugins/restore_cached_data.md +9 -3
- data/doc/plugins/sequel.md +26 -6
- data/doc/plugins/signature.md +6 -4
- data/doc/plugins/store_dimensions.md +6 -4
- data/doc/plugins/tempfile.md +4 -2
- data/doc/plugins/upload_endpoint.md +6 -2
- data/doc/plugins/upload_options.md +6 -4
- data/doc/plugins/url_options.md +4 -2
- data/doc/plugins/validation.md +7 -3
- data/doc/plugins/validation_helpers.md +13 -10
- data/doc/plugins/versions.md +4 -8
- data/doc/processing.md +27 -9
- data/doc/refile.md +119 -127
- data/doc/release_notes/1.0.0.md +4 -0
- data/doc/release_notes/1.1.0.md +4 -0
- data/doc/release_notes/1.2.0.md +4 -0
- data/doc/release_notes/1.3.0.md +4 -0
- data/doc/release_notes/1.4.0.md +4 -0
- data/doc/release_notes/1.4.1.md +4 -0
- data/doc/release_notes/1.4.2.md +4 -0
- data/doc/release_notes/2.0.0.md +4 -0
- data/doc/release_notes/2.0.1.md +4 -0
- data/doc/release_notes/2.1.0.md +4 -0
- data/doc/release_notes/2.1.1.md +4 -0
- data/doc/release_notes/2.10.0.md +4 -0
- data/doc/release_notes/2.10.1.md +4 -0
- data/doc/release_notes/2.11.0.md +4 -0
- data/doc/release_notes/2.12.0.md +4 -0
- data/doc/release_notes/2.13.0.md +4 -0
- data/doc/release_notes/2.14.0.md +5 -1
- data/doc/release_notes/2.15.0.md +10 -6
- data/doc/release_notes/2.16.0.md +4 -0
- data/doc/release_notes/2.17.0.md +4 -0
- data/doc/release_notes/2.18.0.md +4 -0
- data/doc/release_notes/2.19.0.md +7 -4
- data/doc/release_notes/2.2.0.md +4 -0
- data/doc/release_notes/2.3.0.md +4 -0
- data/doc/release_notes/2.3.1.md +4 -0
- data/doc/release_notes/2.4.0.md +4 -0
- data/doc/release_notes/2.4.1.md +4 -0
- data/doc/release_notes/2.5.0.md +4 -0
- data/doc/release_notes/2.6.0.md +4 -0
- data/doc/release_notes/2.6.1.md +4 -0
- data/doc/release_notes/2.7.0.md +4 -0
- data/doc/release_notes/2.8.0.md +4 -0
- data/doc/release_notes/2.9.0.md +4 -0
- data/doc/release_notes/3.0.0.md +120 -38
- data/doc/retrieving_uploads.md +4 -1
- data/doc/securing_uploads.md +4 -1
- data/doc/storage/file_system.md +12 -4
- data/doc/storage/s3.md +4 -2
- data/doc/testing.md +27 -41
- data/doc/upgrading_to_3.md +105 -26
- data/doc/validation.md +8 -6
- data/lib/shrine/attacher.rb +2 -2
- data/lib/shrine/attachment.rb +7 -10
- data/lib/shrine/plugins/activerecord.rb +10 -10
- data/lib/shrine/plugins/add_metadata.rb +1 -3
- data/lib/shrine/plugins/atomic_helpers.rb +6 -8
- data/lib/shrine/plugins/backgrounding.rb +4 -6
- data/lib/shrine/plugins/cached_attachment_data.rb +1 -3
- data/lib/shrine/plugins/column.rb +2 -4
- data/lib/shrine/plugins/data_uri.rb +1 -3
- data/lib/shrine/plugins/default_storage.rb +1 -3
- data/lib/shrine/plugins/default_url.rb +1 -3
- data/lib/shrine/plugins/delete_raw.rb +1 -3
- data/lib/shrine/plugins/derivation_endpoint.rb +3 -4
- data/lib/shrine/plugins/derivatives.rb +2 -4
- data/lib/shrine/plugins/determine_mime_type.rb +1 -3
- data/lib/shrine/plugins/download_endpoint.rb +1 -3
- data/lib/shrine/plugins/dynamic_storage.rb +1 -3
- data/lib/shrine/plugins/entity.rb +25 -9
- data/lib/shrine/plugins/form_assign.rb +1 -3
- data/lib/shrine/plugins/included.rb +1 -3
- data/lib/shrine/plugins/infer_extension.rb +1 -3
- data/lib/shrine/plugins/instrumentation.rb +1 -3
- data/lib/shrine/plugins/keep_files.rb +1 -3
- data/lib/shrine/plugins/metadata_attributes.rb +1 -3
- data/lib/shrine/plugins/mirroring.rb +2 -1
- data/lib/shrine/plugins/model.rb +2 -4
- data/lib/shrine/plugins/module_include.rb +1 -3
- data/lib/shrine/plugins/multi_cache.rb +3 -3
- data/lib/shrine/plugins/presign_endpoint.rb +1 -3
- data/lib/shrine/plugins/pretty_location.rb +1 -3
- data/lib/shrine/plugins/processing.rb +1 -3
- data/lib/shrine/plugins/rack_file.rb +1 -3
- data/lib/shrine/plugins/rack_response.rb +1 -3
- data/lib/shrine/plugins/recache.rb +1 -3
- data/lib/shrine/plugins/refresh_metadata.rb +1 -3
- data/lib/shrine/plugins/remote_url.rb +1 -3
- data/lib/shrine/plugins/remove_attachment.rb +1 -3
- data/lib/shrine/plugins/remove_invalid.rb +1 -3
- data/lib/shrine/plugins/restore_cached_data.rb +1 -3
- data/lib/shrine/plugins/sequel.rb +10 -12
- data/lib/shrine/plugins/signature.rb +1 -3
- data/lib/shrine/plugins/store_dimensions.rb +1 -3
- data/lib/shrine/plugins/tempfile.rb +1 -3
- data/lib/shrine/plugins/upload_endpoint.rb +1 -3
- data/lib/shrine/plugins/upload_options.rb +1 -3
- data/lib/shrine/plugins/url_options.rb +1 -3
- data/lib/shrine/plugins/validation.rb +1 -3
- data/lib/shrine/plugins/validation_helpers.rb +1 -3
- data/lib/shrine/plugins/versions.rb +1 -3
- data/lib/shrine/storage/file_system.rb +1 -1
- data/lib/shrine/storage/linter.rb +1 -1
- data/lib/shrine/storage/memory.rb +2 -1
- data/lib/shrine/storage/s3.rb +3 -3
- data/lib/shrine/version.rb +1 -1
- metadata +8 -4
data/lib/shrine/plugins/model.rb
CHANGED
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/model.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/model.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/model
|
8
6
|
module Model
|
9
7
|
def self.load_dependencies(uploader, **)
|
10
8
|
uploader.plugin :entity
|
@@ -61,7 +59,7 @@ class Shrine
|
|
61
59
|
return super unless model?
|
62
60
|
|
63
61
|
if !record.instance_variable_get(:"@#{@name}_attacher") || options.any?
|
64
|
-
attacher =
|
62
|
+
attacher = class_attacher(options)
|
65
63
|
attacher.load_model(record, @name)
|
66
64
|
|
67
65
|
record.instance_variable_set(:"@#{@name}_attacher", attacher)
|
@@ -4,9 +4,7 @@ Shrine.deprecation("The module_include plugin is deprecated and will be removed
|
|
4
4
|
|
5
5
|
class Shrine
|
6
6
|
module Plugins
|
7
|
-
# Documentation
|
8
|
-
#
|
9
|
-
# [doc/plugins/module_include.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/module_include.md
|
7
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/module_include
|
10
8
|
module ModuleInclude
|
11
9
|
module ClassMethods
|
12
10
|
def attachment_module(mod = nil, &block)
|
@@ -1,8 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Shrine
|
2
4
|
module Plugins
|
3
|
-
# Documentation
|
4
|
-
#
|
5
|
-
# [doc/plugins/multi_cache.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/multi_cache.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/multi_cache
|
6
6
|
module MultiCache
|
7
7
|
def self.configure(uploader, **opts)
|
8
8
|
uploader.opts[:multi_cache] ||= {}
|
@@ -6,9 +6,7 @@ require "json"
|
|
6
6
|
|
7
7
|
class Shrine
|
8
8
|
module Plugins
|
9
|
-
# Documentation
|
10
|
-
#
|
11
|
-
# [doc/plugins/presign_endpoint.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/presign_endpoint.md
|
9
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/presign_endpoint
|
12
10
|
module PresignEndpoint
|
13
11
|
def self.configure(uploader, opts = {})
|
14
12
|
uploader.opts[:presign_endpoint] ||= {}
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/pretty_location.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/pretty_location.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/pretty_location
|
8
6
|
module PrettyLocation
|
9
7
|
def self.configure(uploader, **opts)
|
10
8
|
uploader.opts[:pretty_location] ||= { identifier: :id }
|
@@ -4,9 +4,7 @@ Shrine.deprecation("The processing plugin is deprecated and will be removed in S
|
|
4
4
|
|
5
5
|
class Shrine
|
6
6
|
module Plugins
|
7
|
-
# Documentation
|
8
|
-
#
|
9
|
-
# [doc/plugins/processing.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/processing.md
|
7
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/processing
|
10
8
|
module Processing
|
11
9
|
def self.configure(uploader)
|
12
10
|
uploader.opts[:processing] ||= {}
|
@@ -4,9 +4,7 @@ require "forwardable"
|
|
4
4
|
|
5
5
|
class Shrine
|
6
6
|
module Plugins
|
7
|
-
# Documentation
|
8
|
-
#
|
9
|
-
# [doc/plugins/rack_file.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/rack_file.md
|
7
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/rack_file
|
10
8
|
module RackFile
|
11
9
|
module ClassMethods
|
12
10
|
# Accepts a Rack uploaded file hash and wraps it in an IO object.
|
@@ -6,9 +6,7 @@ require "digest"
|
|
6
6
|
|
7
7
|
class Shrine
|
8
8
|
module Plugins
|
9
|
-
# Documentation
|
10
|
-
#
|
11
|
-
# [doc/plugins/rack_response.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/rack_response.md
|
9
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/rack_response
|
12
10
|
module RackResponse
|
13
11
|
module FileMethods
|
14
12
|
# Returns a Rack response triple for the uploaded file.
|
@@ -4,9 +4,7 @@ Shrine.deprecation("The recache plugin is deprecated and will be removed in Shri
|
|
4
4
|
|
5
5
|
class Shrine
|
6
6
|
module Plugins
|
7
|
-
# Documentation
|
8
|
-
#
|
9
|
-
# [doc/plugins/recache.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/recache.md
|
7
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/recache
|
10
8
|
module Recache
|
11
9
|
module AttacherMethods
|
12
10
|
def save
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/refresh_metadata.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/refresh_metadata.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/refresh_metadata
|
8
6
|
module RefreshMetadata
|
9
7
|
module AttacherMethods
|
10
8
|
def refresh_metadata!(**options)
|
@@ -4,9 +4,7 @@ require "down"
|
|
4
4
|
|
5
5
|
class Shrine
|
6
6
|
module Plugins
|
7
|
-
# Documentation
|
8
|
-
#
|
9
|
-
# [doc/plugins/remote_url.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/remote_url.md
|
7
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/remote_url
|
10
8
|
module RemoteUrl
|
11
9
|
class DownloadError < Error; end
|
12
10
|
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/remove_attachment.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/remove_attachment.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/remove_attachment
|
8
6
|
module RemoveAttachment
|
9
7
|
module AttachmentMethods
|
10
8
|
def define_model_methods(name)
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/remove_invalid.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/remove_invalid.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/remove_invalid
|
8
6
|
module RemoveInvalid
|
9
7
|
def self.load_dependencies(uploader)
|
10
8
|
uploader.plugin :validation
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/restore_cached_data.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/restore_cached_data.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/restore_cached_data
|
8
6
|
module RestoreCachedData
|
9
7
|
def self.load_dependencies(uploader)
|
10
8
|
uploader.plugin :refresh_metadata
|
@@ -4,9 +4,7 @@ require "sequel"
|
|
4
4
|
|
5
5
|
class Shrine
|
6
6
|
module Plugins
|
7
|
-
# Documentation
|
8
|
-
#
|
9
|
-
# [doc/plugins/sequel.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/sequel.md
|
7
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/sequel
|
10
8
|
module Sequel
|
11
9
|
def self.load_dependencies(uploader, **)
|
12
10
|
uploader.plugin :model
|
@@ -41,17 +39,23 @@ class Shrine
|
|
41
39
|
if shrine_class.opts[:sequel][:hooks]
|
42
40
|
define_method :before_save do
|
43
41
|
super()
|
44
|
-
send(:"#{name}_attacher").
|
42
|
+
if send(:"#{name}_attacher").changed?
|
43
|
+
send(:"#{name}_attacher").send(:sequel_before_save)
|
44
|
+
end
|
45
45
|
end
|
46
46
|
|
47
47
|
define_method :after_save do
|
48
48
|
super()
|
49
|
-
send(:"#{name}_attacher").
|
49
|
+
if send(:"#{name}_attacher").changed?
|
50
|
+
send(:"#{name}_attacher").send(:sequel_after_save)
|
51
|
+
end
|
50
52
|
end
|
51
53
|
|
52
54
|
define_method :after_destroy do
|
53
55
|
super()
|
54
|
-
send(:"#{name}_attacher").
|
56
|
+
if send(:"#{name}_attacher").attached?
|
57
|
+
send(:"#{name}_attacher").send(:sequel_after_destroy)
|
58
|
+
end
|
55
59
|
end
|
56
60
|
end
|
57
61
|
|
@@ -85,15 +89,11 @@ class Shrine
|
|
85
89
|
|
86
90
|
# Calls Attacher#save. Called before model save.
|
87
91
|
def sequel_before_save
|
88
|
-
return unless changed?
|
89
|
-
|
90
92
|
save
|
91
93
|
end
|
92
94
|
|
93
95
|
# Finalizes attachment and persists changes. Called after model save.
|
94
96
|
def sequel_after_save
|
95
|
-
return unless changed?
|
96
|
-
|
97
97
|
record.db.after_commit do
|
98
98
|
finalize
|
99
99
|
persist
|
@@ -102,8 +102,6 @@ class Shrine
|
|
102
102
|
|
103
103
|
# Deletes attached files. Called after model destroy.
|
104
104
|
def sequel_after_destroy
|
105
|
-
return unless attached?
|
106
|
-
|
107
105
|
record.db.after_commit do
|
108
106
|
destroy_attached
|
109
107
|
end
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/signature.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/signature.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/signature
|
8
6
|
module Signature
|
9
7
|
LOG_SUBSCRIBER = -> (event) do
|
10
8
|
Shrine.logger.info "Signature (#{event.duration}ms) – #{{
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/store_dimensions.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/store_dimensions.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/store_dimensions
|
8
6
|
module StoreDimensions
|
9
7
|
LOG_SUBSCRIBER = -> (event) do
|
10
8
|
Shrine.logger.info "Image Dimensions (#{event.duration}ms) – #{{
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/tempfile.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/tempfile.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/tempfile
|
8
6
|
module Tempfile
|
9
7
|
module ClassMethods
|
10
8
|
def with_file(io)
|
@@ -7,9 +7,7 @@ require "digest"
|
|
7
7
|
|
8
8
|
class Shrine
|
9
9
|
module Plugins
|
10
|
-
# Documentation
|
11
|
-
#
|
12
|
-
# [doc/plugins/upload_endpoint.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/upload_endpoint.md
|
10
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/upload_endpoint
|
13
11
|
module UploadEndpoint
|
14
12
|
def self.load_dependencies(uploader, opts = {})
|
15
13
|
uploader.plugin :rack_file
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/upload_options.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/upload_options.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/upload_options
|
8
6
|
module UploadOptions
|
9
7
|
def self.configure(uploader, options = {})
|
10
8
|
uploader.opts[:upload_options] ||= {}
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/url_options.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/url_options.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/url_options
|
8
6
|
module UrlOptions
|
9
7
|
def self.configure(uploader, **options)
|
10
8
|
uploader.opts[:url_options] ||= {}
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/validation.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/validation.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/validation
|
8
6
|
module Validation
|
9
7
|
module AttacherClassMethods
|
10
8
|
# Block that is executed in context of Shrine::Attacher during
|
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
class Shrine
|
4
4
|
module Plugins
|
5
|
-
# Documentation
|
6
|
-
#
|
7
|
-
# [doc/plugins/validation_helpers.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/validation_helpers.md
|
5
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/validation_helpers
|
8
6
|
module ValidationHelpers
|
9
7
|
DEFAULT_MESSAGES = {
|
10
8
|
max_size: -> (max) { "size must not be greater than #{PRETTY_FILESIZE.call(max)}" },
|
@@ -4,9 +4,7 @@ Shrine.deprecation("The versions plugin is deprecated and will be removed in Shr
|
|
4
4
|
|
5
5
|
class Shrine
|
6
6
|
module Plugins
|
7
|
-
# Documentation
|
8
|
-
#
|
9
|
-
# [doc/plugins/versions.md]: https://github.com/shrinerb/shrine/blob/master/doc/plugins/versions.md
|
7
|
+
# Documentation can be found on https://shrinerb.com/docs/plugins/versions
|
10
8
|
module Versions
|
11
9
|
def self.load_dependencies(uploader, **)
|
12
10
|
uploader.plugin :processing
|
@@ -91,7 +91,7 @@ class Shrine
|
|
91
91
|
|
92
92
|
# Deletes the specified directory on the filesystem.
|
93
93
|
#
|
94
|
-
# file_system.delete_prefixed("somekey/derivatives")
|
94
|
+
# file_system.delete_prefixed("somekey/derivatives/")
|
95
95
|
def delete_prefixed(delete_prefix)
|
96
96
|
FileUtils.rm_rf directory.join(delete_prefix)
|
97
97
|
end
|
@@ -35,7 +35,8 @@ class Shrine
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def delete_prefixed(delete_prefix)
|
38
|
-
|
38
|
+
delete_prefix = delete_prefix.chomp("/") + "/"
|
39
|
+
store.delete_if { |key, _value| key.start_with?(delete_prefix) }
|
39
40
|
end
|
40
41
|
|
41
42
|
def clear!
|
data/lib/shrine/storage/s3.rb
CHANGED
@@ -207,12 +207,12 @@ class Shrine
|
|
207
207
|
|
208
208
|
# Deletes objects at keys starting with the specified prefix.
|
209
209
|
#
|
210
|
-
# s3.delete_prefixed("somekey/derivatives")
|
210
|
+
# s3.delete_prefixed("somekey/derivatives/")
|
211
211
|
def delete_prefixed(delete_prefix)
|
212
212
|
# We need to make sure to combine with storage prefix, and
|
213
213
|
# that it ends in '/' cause S3 can be squirrely about matching interior.
|
214
|
-
|
215
|
-
bucket.objects(prefix:
|
214
|
+
delete_prefix = delete_prefix.chomp("/") + "/"
|
215
|
+
bucket.objects(prefix: [*prefix, delete_prefix].join("/")).batch_delete!
|
216
216
|
end
|
217
217
|
|
218
218
|
# If block is given, deletes all objects from the storage for which the
|
data/lib/shrine/version.rb
CHANGED
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: 3.0.0
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: down
|
@@ -375,6 +375,10 @@ files:
|
|
375
375
|
- doc/creating_storages.md
|
376
376
|
- doc/design.md
|
377
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
|
378
382
|
- doc/metadata.md
|
379
383
|
- doc/multiple_files.md
|
380
384
|
- doc/paperclip.md
|
@@ -550,9 +554,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
550
554
|
version: '2.3'
|
551
555
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
552
556
|
requirements:
|
553
|
-
- - "
|
557
|
+
- - ">="
|
554
558
|
- !ruby/object:Gem::Version
|
555
|
-
version:
|
559
|
+
version: '0'
|
556
560
|
requirements: []
|
557
561
|
rubygems_version: 3.0.3
|
558
562
|
signing_key:
|