Shrine v3.0.0 Release Notes

Release Date: 2019-10-14 // about 2 years ago
    • derivation_endpoint โ€“ Pass action: :derivation when uploading derivation results (@janko)

    • core โ€“ Add Shrine::Attachment[] shorthand for Shrine::Attachment.new (@janko)

    • ๐Ÿ›  core โ€“ Add Storage#delete_prefixed method for deleting all files in specified directory (@jrochkind)

    • ๐Ÿ‘• linter โ€“ Return true in Storage::Linter#call so that it can be used with assert (@jrochkind)

    • ๐Ÿ‘• linter โ€“ Allow Storage::Linter to accept a key that will be used for testing nonexistent file (@janko)

    • ๐Ÿ“‡ core โ€“ Infer file extension from filename metadata (@janko)

    • pretty_location โ€“ Add :class_underscore option for underscoring class name (@Uysim)

    • โšก๏ธ Update down dependency to ~> 5.0 (@janko)

    • ๐Ÿ”Œ multi_cache โ€“ Add new plugin for whitelisting additional temporary storages (@janko, @jrochkind)

    • sequel โ€“ Extract callback code into attacher methods that can be overridden (@janko)

    • activerecord โ€“ Extract callback code into attacher methods that can be overridden (@janko)

    • derivation_endpoint โ€“ Stop re-opening File objects returned in derivation result (@janko)

    • derivation_endpoint โ€“ Allow only File or Tempfile object as derivation result (@janko)

    • download_endpoint โ€“ Add Shrine.download_response for calling in controller (@janko)

    • core โ€“ Fetch storage object lazily in Shrine instance (@janko)

    • ๐Ÿ”Œ mirroring โ€“ Add new plugin for replicating uploads and deletes to other storages (@janko)

    • sequel โ€“ Rename :callbacks option to :hooks (@janko)

    • model โ€“ Add Attacher#set_model for setting model without loading attachment (@janko)

    • entity โ€“ Add Attacher#set_entity for setting entity without loading attachment (@janko)

    • entity โ€“ Define #<name>_attacher class method when including Shrine::Attachment (@janko)

    • ๐Ÿ›ฐ derivation_endpoint โ€“ Send only :derivation in the instrumentation event payload (@janko)

    • 0๏ธโƒฃ default_storage โ€“ Add Attacher.default_cache and Attacher.default_store for settings (@janko)

    • ๐Ÿ—„ default_storage โ€“ Deprecate record & name arguments to storage block (@janko)

    • 0๏ธโƒฃ default_storage โ€“ Evaluate storage block in context of Attacher instance (@janko)

    • ๐Ÿ”Œ Unify persistence plugin interface (@janko)

    • upload_options โ€“ Keep Shrine#_upload private (@janko)

    • infer_extension โ€“ Keep Shrine#basic_location private (@janko)

    • model โ€“ Add #<name>_changed? method to attachment module (@janko)

    • ๐Ÿ”Œ Make it easier for plugins to define entity and model attachment methods (@janko)

    • ๐Ÿ”Œ form_assign โ€“ Add new plugin for assigning attachment from form params without a form object (@janko)

    • derivation_endpoint โ€“ Allow passing generic IO objects to Derivation#upload (@janko)

    • derivation_endpoint โ€“ Accept additional uploader options in Derivation#upload (@janko)

    • derivation_endpoint โ€“ Close the uploaded file in Derivation#upload (@janko)

    • core โ€“ Stop rescuing IO#close exceptions in Shrine#upload (@janko)

    • core โ€“ Add :delete option to Shrine#upload for deleting uploaded file (@janko)

    • s3 โ€“ Stop returning :object in Down::ChunkedIO#data in S3#open (@janko)

    • s3 โ€“ Eliminate #head_object request in S3#open (@janko)

    • ๐Ÿšš download_endpoint โ€“ Remove extra Storage#exists? check (@janko)

    • derivation_endpoint โ€“ Add Derivation#opened for retrieving an opened derivation result (@janko)

    • ๐Ÿšš derivation_endpoint โ€“ Remove extra Storage#exists? check when :upload is enabled but not :upload_redirect (@janko)

    • derivation_endpoint - Don't pass source UploadedFile object when :download is false (@janko)

    • ๐Ÿšš derivation_endpoint โ€“ Remove :include_uploaded_file option (@janko)

    • derivation_endpoint โ€“ Evaluate derivation block in context of Shrine::Derivation (@janko)

    • ๐Ÿšš derivation_endpoint โ€“ Remove :download_errors option (@janko)

    • memory โ€“ Raise Shrine::FileNotFound on nonexistent file in Memory#open (@janko)

    • file_system โ€“ Raise Shrine::FileNotFound on nonexistent file in FileSystem#open (@janko)

    • s3 โ€“ Raise Shrine::FileNotFound on nonexistent object in S3#open (@janko)

    • ๐Ÿ‘ป core โ€“ Add Shrine::FileNotFound exception and require storages to raise it on Storage#open (janko)

    • ๐Ÿ“‡ instrumentation โ€“ Remove :metadata from :options in metadata.shrine event (@janko)

    • ๐Ÿ“‡ instrumentation โ€“ Remove :location, :upload_options and :metadata from :options in upload.shrine event (@janko)

    • ๐Ÿ“‡ instrumentation โ€“ Add :metadata to the upload.shrine event (@janko)

    • ๐Ÿ‘ download_endpoint โ€“ Drop support for legacy /:storage/:id URLs (@janko)

    • core โ€“ In UploadedFile#== require files to be of the same class (@janko)

    • core โ€“ Add :close option to Shrine#upload for preventing closing file after upload (@janko)

    • memory โ€“ Add Shrine::Storage::Memory from shrine-memory gem (@janko)

    • default_url_options โ€“ Rename to just url_options (@janko)

    • ๐Ÿ—„ delete_raw โ€“ Deprecate plugin in favour of derivatives (@janko)

    • ๐Ÿ—„ recache โ€“ Deprecate plugin in favour of derivatives (@janko)

    • ๐Ÿ—„ processing โ€“ Deprecate plugin in favour of derivatives (@janko)

    • ๐Ÿ—„ versions โ€“ Deprecate plugin in favour of derivatives (@janko)

    • ๐Ÿ”Œ derivatives โ€“ Add new plugin for storing processed files (@janko)

    • derivation_endpoint โ€“ Allow using symbol and string derivation names interchangeably (@janko)

    • ๐Ÿšš dynamic_storage โ€“ Remove Shrine.dynamic_storages method (@janko)

    • core โ€“ Deep duplicate Shrine.opts on subclassing (@janko)

    • core โ€“ Add Attacher#file! which asserts that a file is attached (@janko)

    • core โ€“ Change Shrine.uploaded_file to raise ArgumentError on invalid input (@janko)

    • ๐Ÿ—„ module_include โ€“ Deprecate plugin over overriding core classes directly (@janko)

    • core โ€“ Add Attacher#cache_key and Attacher#store_key which return storage identifiers (@janko)

    • ๐Ÿ‘• linter โ€“ Call Storage#open with options as second argument (@janko)

    • core โ€“ Allow data hash passed to UploadedFile.new to have symbol keys (@janko)

    • core โ€“ Change how Shrine::UploadedFile sets its state from the given data hash (@janko)

    • ๐Ÿ—„ core โ€“ Deprecate Storage#open not accepting additional options (@janko)

    • ๐Ÿ“‡ refresh_metadata โ€“ Add Attacher#refresh_metadata! method which integrates with model plugin (@janko)

    • instrumentation โ€“ Instrument any Storage#open calls in a new open.shrine event (@janko)

    • restore_cached_data โ€“ Forward options passed to Attacher#attach_cached to metadata extraction (@janko)

    • validation โ€“ Allow skipping validations on attaching by passing validate: false (@janko)

    • validation โ€“ Add :validate option to Attacher#assign or Attacher#attach for passing options to validation block (@janko)

    • ๐Ÿ”Œ validation โ€“ Extract validation functionality into the new plugin (@janko)

    • ๐Ÿ”€ upload_options โ€“ Upload options from the block are now merged with passed options instead of replaced (@janko)

    • upload_endpoint โ€“ Stop passing Rack::Request object to the uploader (@janko)

    • ๐Ÿ”Œ remote_url โ€“ Require custom downloaders to raise Shrine::Plugins::RemoteUrl::DownloadError for conversion into a validation error (@janko)

    • infer_extension โ€“ Fix compatibility with the pretty_location plugin (@janko)

    • ๐Ÿšš presign_endpoint โ€“ Remove deprecated Shrine::Plugins::PresignEndpoint::App constant (@janko)

    • ๐Ÿšš keep_files โ€“ Remove the ability to choose whether to keep only destroyed or only replaced files (@janko)

    • ๐Ÿšš infer_extension โ€“ Remove Shrine#infer_extension method (@janko)

    • default_url_options โ€“ Allow overriding passed URL options by deleting them inside the block (@janko)

    • cached_attachment_data โ€“ Rename Attacher#read_cached to Attacher#cached_data (@janko)

    • sequel โ€“ Add Attacher#atomic_promote and Attacher#atomic_persist (@janko)

    • ๐Ÿšš sequel โ€“ Remove persistence from Attacher#promote (@janko)

    • ๐Ÿšš activerecord โ€“ Remove persistence from Attacher#promote (@janko)

    • ๐Ÿ”Œ atomic_helpers โ€“ Add new plugin with helper methods for atomic promotion and persistence (@janko)

    • backgrounding โ€“ Add Attacher#promote_block & Attacher#destroy_block for overriding class level blocks (@janko)

    • backgrounding โ€“ Add Attacher.promote_block & Attacher.destroy_block on class level (@janko)

    • ๐Ÿšš backgrounding โ€“ Remove overriding Attacher#swap with atomic promotion (@janko)

    • ๐Ÿšš backgrounding โ€“ Remove Attacher.promote, Attacher.delete, Attacher.dump, Attacher#dump, Attacher.load, Attacher.load_record (@janko)

    • model โ€“ Allow disabling caching to temporary storage on assignment (@janko)

    • model โ€“ Add Attacher.from_model, Attacher#write (@janko)

    • ๐Ÿ”Œ model โ€“ Add new plugin for integrating with mutable structs (@janko)

    • entity โ€“ Add Attacher.from_entity, Attacher#reload, Attacher#column_values, Attacher#attribute (@janko)

    • ๐Ÿ”Œ entity โ€“ Add new plugin for integrating with immutable structs (@janko)

    • 0๏ธโƒฃ column โ€“ Allow changing column serializer from default JSON library (@janko)

    • column โ€“ Add Attacher#column_data and Attacher.from_column methods (@janko)

    • ๐Ÿ”Œ column โ€“ Add new plugin for (de)serializing attacher data (@janko)

    • ๐Ÿšš attachment โ€“ Removed any default attachment methods (@janko)

    • core โ€“ Require context hash passed as second argument to Shrine#upload to have symbol keys (@janko)

    • core โ€“ Change Shrine.uploaded_file not to yield files anymore (@janko)

    • core โ€“ Allow Shrine.uploaded_file to accept file data hashes with symbol keys (@janko)

    • ๐Ÿšš core โ€“ Remove Shrine#uploaded?

    • ๐Ÿšš core โ€“ Remove Shrine#delete, Shrine#_delete, Shrine#remove (@janko)

    • ๐Ÿšš core โ€“ Remove Shrine#store, Shrine#_store, Shrine#put, Shrine#copy (@janko)

    • ๐Ÿšš core โ€“ Remove Shrine#processed, Shrine#process (@janko)

    • core โ€“ Don't pass :phase anymore on uploads (@janko)

    • core โ€“ Read attachment from the record attribute only on initialization (@janko)

    • core โ€“ Don't require a temporary storage (@janko)

    • core โ€“ Add Attacher#data and Attacher.from_data for dumping to and loading from a Hash (@janko)

    • ๐Ÿ‘ป core โ€“ Change Attacher#assign to raise exception when non-cached file is assigned (@janko)

    • core โ€“ Enable Attacher#assign to accept cached file data as a Hash (@janko)

    • core โ€“ Add Attacher#file alias for Attacher#get (@janko)

    • core โ€“ Change Attacher#attached? to return whether a file is attached (@janko)

    • core โ€“ Change Attacher#promote to always only save promoted file in memory (@janko)

    • core โ€“ Rename Attacher#replace to Attacher#destroy_previous (@janko)

    • core โ€“ Remove Attacher#_promote and Attacher#_delete, add Attacher#promote_cached and Attacher#destroy_attached (@janko)

    • core โ€“ Rename Attacher#set and Attacher#_set to Attacher#change and Attacher#set (@janko)

    • ๐Ÿšš core โ€“ Remove Attacher#cache! and Attacher#store!, add Attacher#upload (@janko)

    • core โ€“ Rename Attacher#validate_block to Attacher#_validate (@janko)

    • core โ€“ Add Attacher#attach, Attacher#attach_cached, extracted from Attacher#assign (@janko)

    • core โ€“ Remove Attacher#swap, Attacher#update, Attacher#read, Attacher#write, Attacher#data_attribute, Attacher#convert_to_data, Attacher#convert_before_write, and Attacher#convert_after_read (@janko)

    • core โ€“ Change Attacher.new to not accept a model anymore (@janko)

    • ๐Ÿšš delete_promoted โ€“ Remove plugin (@janko)

    • ๐Ÿšš parsed_json โ€“ Remove plugin (@janko)

    • ๐Ÿšš parallelize โ€“ Remove plugin (@janko)

    • ๐Ÿšš hooks โ€“ Remove plugin (@janko)

    • ๐Ÿšš core โ€“ Remove deprecated Shrine::IO_METHODS constant (@janko)

    • ๐Ÿ“‡ s3 โ€“ Replace source object metadata when copying a file from S3 (@janko)

    • core โ€“ Change UploadedFile#storage_key to return a Symbol instead of a String (@janko)

    • infer_extension โ€“ Make :mini_mime the default analyzer (@janko)

    • ๐Ÿ’Ž Bring back Ruby 2.3 support (@janko)

    • versions โ€“ Remove deprecated :version_names, Shrine.version_names and Shrine.version? (@janko)

    • ๐Ÿšš validation_helpers โ€“ Remove support for regexes in MIME type or extension validations (@janko)

    • validation_helpers โ€“ Don't require #width and #height methods to be defined on UploadedFile (@janko)

    • ๐Ÿ“‡ validation_helpers โ€“ Fail dimensions validations when width or height metadata is missing (@janko)

    • ๐Ÿšš upload_endpoint โ€“ Remove deprecated Shrine::Plugins::UploadEndpoint::App constant (@janko)

    • determine_mime_type โ€“ Remove Shrine#mime_type_analyzers method (@janko)

    • ๐Ÿšš store_dimensions โ€“ Remove Shrine#extract_dimensions and Shrine#dimensions_analyzers methods (@janko)

    • ๐Ÿšš rack_file โ€“ Remove deprecated Shrine::Plugins::RackFile::UploadedFile constant (@janko)

    • ๐Ÿ‘ rack_file โ€“ Drop support for passing file hash to Shrine#upload and Shrine#store (@janko)

    • ๐Ÿšš download_endpoint โ€“ Move Shrine::Plugins::DownloadEndpoint::App into Shrine::DownloadEndpoint (@janko)

    • ๐Ÿšš download_endpoint โ€“ Remove deprecated Shrine::DownloadEndpoint constant (@janko)

    • ๐Ÿšš download_endpoint โ€“ Remove deprecated :storages option (@janko)

    • determine_mime_type โ€“ Remove deprecated :default analyzer alias (@janko)

    • ๐Ÿšš default_url โ€“ Remove deprecated block argument when loading the plugin (@janko)

    • ๐Ÿšš data_uri โ€“ Remove deprecated Shrine::Plugins::DataUri::DataFile constant (@janko)

    • ๐Ÿšš data_uri โ€“ Remove deprecated :filename plugin option (@janko)

    • cached_attachment_data โ€“ Remove deprecated model setter (@janko)

    • ๐Ÿšš file_system โ€“ Remove deprecated :older_than option in FileSystem#clear! (@janko)

    • file_system โ€“ Don't accept a block anymore in FileSystem#open (@janko)

    • ๐Ÿšš file_system โ€“ Remove deprecated FileSystem#download method (@janko)

    • ๐Ÿšš file_system โ€“ Make FileSystem#movable? and FileSystem#move methods private (@janko)

    • ๐Ÿšš file_system โ€“ Remove deprecation warning on unrecognized options in FileSystem#upload (@janko)

    • ๐Ÿšš file_system โ€“ Remove deprecated :host option for FileSystem#initialize (@janko)

    • ๐Ÿšš moving โ€“ Remove deprecated plugin (@janko)

    • ๐Ÿšš multi_delete โ€“ Remove deprecated plugin (@janko)

    • ๐Ÿšš direct_upload โ€“ Remove deprecated plugin (@janko)

    • ๐Ÿšš backup โ€“ Remove deprecated plugin (@janko)

    • ๐Ÿšš background_helpers โ€“ Remove deprecated plugin (@janko)

    • ๐Ÿšš migration_helpers โ€“ Remove deprecated plugin (@janko)

    • ๐Ÿšš copy โ€“ Remove deprecated plugin (@janko)

    • ๐Ÿšš logging โ€“ Remove deprecated plugin (@janko)

    • ๐Ÿšš s3 โ€“ Remove deprecated S3#download method (@janko)

    • ๐Ÿšš s3 โ€“ Remove deprecated S3#stream method (@janko)

    • ๐Ÿ‘ presign_endpoint โ€“ Drop support for presign objects that don't respond to #to_h (@janko)

    • s3 โ€“ Return a Hash in S3#presign when method is POST (@janko)

    • ๐Ÿšš s3 โ€“ Remove :download option in S3#url (@janko)

    • ๐Ÿšš s3 โ€“ Remove support for non URI-escaped content disposition values (@janko)

    • ๐Ÿšš s3 โ€“ Remove S3#s3 method (@janko)

    • ๐Ÿšš s3 โ€“ Remove support for specifying :multipart_threshold as an integer (@janko)

    • ๐Ÿšš s3 โ€“ Remove :host option on S3#initialize (@janko)

    • ๐Ÿ‘ s3 โ€“ Drop support for aws-sdk-s3 versions lower than 1.14 (@janko)

    • ๐Ÿ‘ s3 โ€“ Drop support for aws-sdk 2.x (@janko)