Skip to content

Commit

Permalink
Bump to 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
janko committed Nov 15, 2019
1 parent 2badc23 commit 66108b0
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## HEAD
## 3.1.0 (2019-11-15) [[release notes]](https://shrinerb.com/docs/release_notes/3.1.0)

* `default_storage` – Coerce storage key to symbol in `Attacher#cache_key` & `Attacher#store_key` (@janko)

Expand Down
73 changes: 73 additions & 0 deletions doc/release_notes/3.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: Shrine 3.1.0
---

## New features

* The `Attacher#create_derivatives` method now accepts a `:storage` option for
specifying the storage to which derivatives should be uploaded.

```rb
# with attachment module
photo.image_derivatives!(storage: :other_store)

# with attacher
attacher.create_derivatives(storage: :other_store)
```

* The `Shrine.calculate_signature` now accepts a `:rewind` boolean option for
choosing whether the IO object should be rewinded after reading. This is
useful if you want to calculate signature from non-rewindable IO objects,
such as `IO.pipe`, `Socket`, non-rewindable `Down::ChunkedIO` etc.

```rb
Shrine.signature(io, rewind: false)
```

## Improvements

* The derivatives processor can now be registered with `Attacher.derivatives`,
which is just an alias for `Attacher.derivatives_processor`.

```rb
class ImageUploader < Shrine
Attacher.derivatives_processor do |original|
# ...
end
end

# can now be written as

class ImageUploader < Shrine
Attacher.derivatives do |original|
# ...
end
end
```

* The `Attacher#cached?` and `Attacher#stored?` methods now work correctly if
temporary/permanent storage identifiers were specified as strings.

* The `store_dimensions` plugin now properly propagates exceptions when loading
the `ruby-vips` gem in `:vips` analyzer.

* The `add_metadata` plugin now respects inheritance again when defining
metadata methods on the `Shrine::UploadedFile` class. In 2.19.0, the
`add_metadata` plugin was changed to define metadata methods on the internal
`FileMethods` plugin module, which is shared across all uploaders. This
change has now been reverted.

## Backwards compatibility

* The `Attacher#cache_key` and `Attacher#store_key` methods now always return
symbol keys, even if the storage key that was specified was a string key.

```rb
attacher = Shrine::Attacher.new(cache: "cache", store: "store")
attacher.cache_key #=> :cache (previously "cache")
attacher.store_key #=> :store (previously "store")
```

* The `add_metadata` plugin now defines metadata methods directly on the
`UploadedFile` class, which means that if you happen to have been overriding
these metadata methods and calling `super`, this won't work anymore.
4 changes: 2 additions & 2 deletions lib/shrine/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def self.version

module VERSION
MAJOR = 3
MINOR = 0
TINY = 1
MINOR = 1
TINY = 0
PRE = nil

STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
Expand Down
3 changes: 3 additions & 0 deletions website/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@
"release_notes/3.0.1": {
"title": "Shrine 3.0.1"
},
"release_notes/3.1.0": {
"title": "Shrine 3.1.0"
},
"retrieving-uploads": {
"title": "Retrieving Uploads"
},
Expand Down
1 change: 1 addition & 0 deletions website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
},
"release_notes": {
"Shrine 3.x": [
"release_notes/3.1.0",
"release_notes/3.0.1",
"release_notes/3.0.0"
],
Expand Down

0 comments on commit 66108b0

Please sign in to comment.