shrine 0.9.0 → 1.0.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.
Potentially problematic release.
This version of shrine might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +70 -59
- data/doc/carrierwave.md +436 -0
- data/doc/direct_s3.md +20 -1
- data/doc/paperclip.md +308 -0
- data/doc/regenerating_versions.md +76 -11
- data/lib/shrine.rb +42 -46
- data/lib/shrine/plugins/activerecord.rb +12 -6
- data/lib/shrine/plugins/background_helpers.rb +5 -5
- data/lib/shrine/plugins/default_storage.rb +1 -1
- data/lib/shrine/plugins/default_url_options.rb +31 -0
- data/lib/shrine/plugins/determine_mime_type.rb +13 -3
- data/lib/shrine/plugins/direct_upload.rb +55 -106
- data/lib/shrine/plugins/hooks.rb +33 -11
- data/lib/shrine/plugins/keep_files.rb +4 -19
- data/lib/shrine/plugins/logging.rb +16 -11
- data/lib/shrine/plugins/migration_helpers.rb +4 -4
- data/lib/shrine/plugins/module_include.rb +46 -0
- data/lib/shrine/plugins/moving.rb +0 -11
- data/lib/shrine/plugins/multi_delete.rb +3 -12
- data/lib/shrine/plugins/parsed_json.rb +22 -0
- data/lib/shrine/plugins/rack_file.rb +63 -0
- data/lib/shrine/plugins/recache.rb +1 -1
- data/lib/shrine/plugins/restore_cached.rb +1 -2
- data/lib/shrine/plugins/sequel.rb +9 -3
- data/lib/shrine/plugins/validation_helpers.rb +1 -1
- data/lib/shrine/plugins/versions.rb +30 -17
- data/lib/shrine/storage/file_system.rb +62 -17
- data/lib/shrine/storage/linter.rb +8 -3
- data/lib/shrine/storage/s3.rb +84 -20
- data/lib/shrine/version.rb +2 -2
- data/shrine.gemspec +11 -8
- metadata +31 -40
- data/lib/shrine/plugins/delete_invalid.rb +0 -25
@@ -1,25 +0,0 @@
|
|
1
|
-
class Shrine
|
2
|
-
module Plugins
|
3
|
-
# The delete_invalid plugin immediately deletes the assigned attachment if
|
4
|
-
# it failed validation.
|
5
|
-
#
|
6
|
-
# plugin :delete_invalid
|
7
|
-
#
|
8
|
-
# By default an attachment is always cached before it's validated. This
|
9
|
-
# way the attachment will persist when the form is resubmitted, which is
|
10
|
-
# consistent with the other fields in the form. However, if this is a
|
11
|
-
# concern, you can load this plugin.
|
12
|
-
module DeleteInvalid
|
13
|
-
module AttacherMethods
|
14
|
-
# Delete the assigned uploaded file if it was invalid.
|
15
|
-
def validate
|
16
|
-
super
|
17
|
-
ensure
|
18
|
-
delete!(get, phase: :invalid) if !errors.empty?
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
register_plugin(:delete_invalid, DeleteInvalid)
|
24
|
-
end
|
25
|
-
end
|