activestorage 6.0.0.beta1 → 6.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activestorage might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +1 -1
- data/app/models/active_storage/blob/representable.rb +5 -5
- data/app/models/active_storage/preview.rb +1 -1
- data/app/models/active_storage/variant.rb +4 -4
- data/app/models/active_storage/variation.rb +1 -1
- data/lib/active_storage.rb +1 -0
- data/lib/active_storage/analyzer/video_analyzer.rb +1 -1
- data/lib/active_storage/gem_version.rb +1 -1
- data/lib/active_storage/previewer/poppler_pdf_previewer.rb +1 -1
- data/lib/active_storage/service/azure_storage_service.rb +2 -2
- data/lib/active_storage/service/mirror_service.rb +1 -1
- data/lib/active_storage/service/s3_service.rb +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f96629f6767ea52979885343979fd801c1eb3231a175ee6aafd081aa4d3f6f6
|
4
|
+
data.tar.gz: 535fe0c4e93eb7f4266ce661cdf314caac79dbc9f1b08ae5e4216fb27e0debe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6c2930506f14d8c07c7a5c8a49e7f2a2423457f5aec1331cc9b4859b642236da1077e6125e7494ea99f05857fa00fe437a1c87196826820d3329cd03fb5e8e2
|
7
|
+
data.tar.gz: '09bd7be737a803842cb5a695c3f80bb31221400d7a6f688b3eadbf7ba5413b4d2b891c2a251f001fe63c131e90a17dcb7f06c17344b69a77e5dc8caee2773df3'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
|
+
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
1
6
|
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
2
7
|
|
8
|
+
* [Rename npm package](https://github.com/rails/rails/pull/34905) from
|
9
|
+
[`activestorage`](https://www.npmjs.com/package/activestorage) to
|
10
|
+
[`@rails/activestorage`](https://www.npmjs.com/package/@rails/activestorage).
|
11
|
+
|
12
|
+
*Javan Makhmali*
|
13
|
+
|
3
14
|
* Replace `config.active_storage.queue` with two options that indicate which
|
4
15
|
queues analysis and purge jobs should use, respectively:
|
5
16
|
|
data/README.md
CHANGED
@@ -101,7 +101,7 @@ Variation of image attachment:
|
|
101
101
|
|
102
102
|
```erb
|
103
103
|
<%# Hitting the variant URL will lazy transform the original blob and then redirect to its new service location %>
|
104
|
-
<%= image_tag user.avatar.variant(
|
104
|
+
<%= image_tag user.avatar.variant(resize_to_limit: [100, 100]) %>
|
105
105
|
```
|
106
106
|
|
107
107
|
## Direct uploads
|
@@ -10,7 +10,7 @@ module ActiveStorage::Blob::Representable
|
|
10
10
|
# Returns an ActiveStorage::Variant instance with the set of +transformations+ provided. This is only relevant for image
|
11
11
|
# files, and it allows any image to be transformed for size, colors, and the like. Example:
|
12
12
|
#
|
13
|
-
# avatar.variant(
|
13
|
+
# avatar.variant(resize_to_limit: [100, 100]).processed.service_url
|
14
14
|
#
|
15
15
|
# This will create and process a variant of the avatar blob that's constrained to a height and width of 100px.
|
16
16
|
# Then it'll upload said variant to the service according to a derivative key of the blob and the transformations.
|
@@ -18,7 +18,7 @@ module ActiveStorage::Blob::Representable
|
|
18
18
|
# Frequently, though, you don't actually want to transform the variant right away. But rather simply refer to a
|
19
19
|
# specific variant that can be created by a controller on-demand. Like so:
|
20
20
|
#
|
21
|
-
# <%= image_tag Current.user.avatar.variant(
|
21
|
+
# <%= image_tag Current.user.avatar.variant(resize_to_limit: [100, 100]) %>
|
22
22
|
#
|
23
23
|
# This will create a URL for that specific blob with that specific variant, which the ActiveStorage::RepresentationsController
|
24
24
|
# can then produce on-demand.
|
@@ -43,13 +43,13 @@ module ActiveStorage::Blob::Representable
|
|
43
43
|
# from a non-image blob. Active Storage comes with built-in previewers for videos and PDF documents. The video previewer
|
44
44
|
# extracts the first frame from a video and the PDF previewer extracts the first page from a PDF document.
|
45
45
|
#
|
46
|
-
# blob.preview(
|
46
|
+
# blob.preview(resize_to_limit: [100, 100]).processed.service_url
|
47
47
|
#
|
48
48
|
# Avoid processing previews synchronously in views. Instead, link to a controller action that processes them on demand.
|
49
49
|
# Active Storage provides one, but you may want to create your own (for example, if you need authentication). Here’s
|
50
50
|
# how to use the built-in version:
|
51
51
|
#
|
52
|
-
# <%= image_tag video.preview(
|
52
|
+
# <%= image_tag video.preview(resize_to_limit: [100, 100]) %>
|
53
53
|
#
|
54
54
|
# This method raises ActiveStorage::UnpreviewableError if no previewer accepts the receiving blob. To determine
|
55
55
|
# whether a blob is accepted by any previewer, call ActiveStorage::Blob#previewable?.
|
@@ -69,7 +69,7 @@ module ActiveStorage::Blob::Representable
|
|
69
69
|
|
70
70
|
# Returns an ActiveStorage::Preview for a previewable blob or an ActiveStorage::Variant for a variable image blob.
|
71
71
|
#
|
72
|
-
# blob.representation(
|
72
|
+
# blob.representation(resize_to_limit: [100, 100]).processed.service_url
|
73
73
|
#
|
74
74
|
# Raises ActiveStorage::UnrepresentableError if the receiving blob is neither variable nor previewable. Call
|
75
75
|
# ActiveStorage::Blob#representable? to determine whether a blob is representable.
|
@@ -38,7 +38,7 @@ class ActiveStorage::Preview
|
|
38
38
|
|
39
39
|
# Processes the preview if it has not been processed yet. Returns the receiving Preview instance for convenience:
|
40
40
|
#
|
41
|
-
# blob.preview(
|
41
|
+
# blob.preview(resize_to_limit: [100, 100]).processed.service_url
|
42
42
|
#
|
43
43
|
# Processing a preview generates an image from its blob and attaches the preview image to the blob. Because the preview
|
44
44
|
# image is stored with the blob, it is only generated once.
|
@@ -27,7 +27,7 @@ require "ostruct"
|
|
27
27
|
# To refer to such a delayed on-demand variant, simply link to the variant through the resolved route provided
|
28
28
|
# by Active Storage like so:
|
29
29
|
#
|
30
|
-
# <%= image_tag Current.user.avatar.variant(
|
30
|
+
# <%= image_tag Current.user.avatar.variant(resize_to_limit: [100, 100]) %>
|
31
31
|
#
|
32
32
|
# This will create a URL for that specific blob with that specific variant, which the ActiveStorage::RepresentationsController
|
33
33
|
# can then produce on-demand.
|
@@ -36,15 +36,15 @@ require "ostruct"
|
|
36
36
|
# has already been processed and uploaded to the service, and, if so, just return that. Otherwise it will perform
|
37
37
|
# the transformations, upload the variant to the service, and return itself again. Example:
|
38
38
|
#
|
39
|
-
# avatar.variant(
|
39
|
+
# avatar.variant(resize_to_limit: [100, 100]).processed.service_url
|
40
40
|
#
|
41
41
|
# This will create and process a variant of the avatar blob that's constrained to a height and width of 100.
|
42
42
|
# Then it'll upload said variant to the service according to a derivative key of the blob and the transformations.
|
43
43
|
#
|
44
44
|
# You can combine any number of ImageMagick/libvips operations into a variant, as well as any macros provided by the
|
45
|
-
# ImageProcessing gem (such as +
|
45
|
+
# ImageProcessing gem (such as +resize_to_limit+):
|
46
46
|
#
|
47
|
-
# avatar.variant(
|
47
|
+
# avatar.variant(resize_to_limit: [800, 800], monochrome: true, rotate: "-90")
|
48
48
|
#
|
49
49
|
# Visit the following links for a list of available ImageProcessing commands and ImageMagick/libvips operations:
|
50
50
|
#
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# In case you do need to use this directly, it's instantiated using a hash of transformations where
|
7
7
|
# the key is the command and the value is the arguments. Example:
|
8
8
|
#
|
9
|
-
# ActiveStorage::Variation.new(
|
9
|
+
# ActiveStorage::Variation.new(resize_to_limit: [100, 100], monochrome: true, trim: true, rotate: "-90")
|
10
10
|
#
|
11
11
|
# The options map directly to {ImageProcessing}[https://github.com/janko-m/image_processing] commands.
|
12
12
|
class ActiveStorage::Variation
|
data/lib/active_storage.rb
CHANGED
@@ -11,7 +11,7 @@ module ActiveStorage
|
|
11
11
|
#
|
12
12
|
# Example:
|
13
13
|
#
|
14
|
-
# ActiveStorage::VideoAnalyzer.new(blob).metadata
|
14
|
+
# ActiveStorage::Analyzer::VideoAnalyzer.new(blob).metadata
|
15
15
|
# # => { width: 640.0, height: 480.0, duration: 5.0, angle: 0, display_aspect_ratio: [4, 3] }
|
16
16
|
#
|
17
17
|
# When a video's angle is 90 or 270 degrees, its width and height are automatically swapped for convenience.
|
@@ -28,7 +28,7 @@ module ActiveStorage
|
|
28
28
|
|
29
29
|
private
|
30
30
|
def draw_first_page_from(file, &block)
|
31
|
-
# use 72 dpi to match thumbnail
|
31
|
+
# use 72 dpi to match thumbnail dimensions of the PDF
|
32
32
|
draw self.class.pdftoppm_path, "-singlefile", "-r", "72", "-png", file.path, &block
|
33
33
|
end
|
34
34
|
end
|
@@ -10,8 +10,8 @@ module ActiveStorage
|
|
10
10
|
class Service::AzureStorageService < Service
|
11
11
|
attr_reader :client, :blobs, :container, :signer
|
12
12
|
|
13
|
-
def initialize(storage_account_name:, storage_access_key:, container
|
14
|
-
@client = Azure::Storage::Client.create(storage_account_name: storage_account_name, storage_access_key: storage_access_key)
|
13
|
+
def initialize(storage_account_name:, storage_access_key:, container:, **options)
|
14
|
+
@client = Azure::Storage::Client.create(storage_account_name: storage_account_name, storage_access_key: storage_access_key, **options)
|
15
15
|
@signer = Azure::Storage::Core::Auth::SharedAccessSignature.new(storage_account_name, storage_access_key)
|
16
16
|
@blobs = client.blob_client
|
17
17
|
@container = container
|
@@ -9,7 +9,7 @@ module ActiveStorage
|
|
9
9
|
class Service::MirrorService < Service
|
10
10
|
attr_reader :primary, :mirrors
|
11
11
|
|
12
|
-
delegate :download, :download_chunk, :exist?, :url, to: :primary
|
12
|
+
delegate :download, :download_chunk, :exist?, :url, :path_for, to: :primary
|
13
13
|
|
14
14
|
# Stitch together from named services.
|
15
15
|
def self.build(primary:, mirrors:, configurator:, **options) #:nodoc:
|
@@ -16,9 +16,9 @@ module ActiveStorage
|
|
16
16
|
@upload_options = upload
|
17
17
|
end
|
18
18
|
|
19
|
-
def upload(key, io, checksum: nil, **)
|
19
|
+
def upload(key, io, checksum: nil, content_type: nil, **)
|
20
20
|
instrument :upload, key: key, checksum: checksum do
|
21
|
-
object_for(key).put(upload_options.merge(body: io, content_md5: checksum))
|
21
|
+
object_for(key).put(upload_options.merge(body: io, content_md5: checksum, content_type: content_type))
|
22
22
|
rescue Aws::S3::Errors::BadDigest
|
23
23
|
raise ActiveStorage::IntegrityError
|
24
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.
|
4
|
+
version: 6.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 6.0.0.
|
19
|
+
version: 6.0.0.beta2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 6.0.0.
|
26
|
+
version: 6.0.0.beta2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 6.0.0.
|
33
|
+
version: 6.0.0.beta2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 6.0.0.
|
40
|
+
version: 6.0.0.beta2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: marcel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,8 +136,8 @@ homepage: http://rubyonrails.org
|
|
136
136
|
licenses:
|
137
137
|
- MIT
|
138
138
|
metadata:
|
139
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.0.0.
|
140
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.0.0.
|
139
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.0.beta2/activestorage
|
140
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.0.beta2/activestorage/CHANGELOG.md
|
141
141
|
post_install_message:
|
142
142
|
rdoc_options: []
|
143
143
|
require_paths:
|