activestorage-hotcell-client 0.6.0 → 1.1.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a21fe6c54ef5c25546dc062827ed7f1e9756aa874f1ecd462cbe73950c1419ca
|
|
4
|
+
data.tar.gz: e0d3e192e9e55d5ff367889c5e700ffa35a7f3ef1852d0a6e819bb1fa65281ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50cd32b7f2f351a72b7ca7e5b780f309938a516a536277c79959924cce196dddd4c56c0316bc071c6eacbd41562314bbc6974b112932e3e6c1caa29af6f5fe4c
|
|
7
|
+
data.tar.gz: 9b4e7364b4217af51e16204de3c24e7259c98fee2f986d87ebe263858009b2566d90904d56d1a9c35f56d0d6c62b70ee62d5786d9d30c8c1de50ac0bc836c9a1
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "tempfile"
|
|
4
|
+
require "marcel"
|
|
4
5
|
require "active_storage"
|
|
5
6
|
require "active_support/core_ext/class/attribute"
|
|
6
7
|
require "active_support/core_ext/hash/deep_transform_values"
|
|
@@ -33,7 +34,7 @@ module ActiveStorage
|
|
|
33
34
|
output = Tempfile.new([ "hotcell", ".#{format}" ], binmode: true)
|
|
34
35
|
|
|
35
36
|
begin
|
|
36
|
-
convert file, output, format: format
|
|
37
|
+
convert file, output, format: canonical(format), operations: stringified(transformations)
|
|
37
38
|
output.tap(&:rewind)
|
|
38
39
|
rescue StandardError
|
|
39
40
|
output.close!
|
|
@@ -41,6 +42,20 @@ module ActiveStorage
|
|
|
41
42
|
end
|
|
42
43
|
end
|
|
43
44
|
|
|
45
|
+
# Rails names a web image's variant format after its upload's extension, so a JPEG uploaded as
|
|
46
|
+
# `photo.jfif` asks for `jfif`. ImageMagick has no coder for `jfif`, `jif` or `jfi`, and libvips has no
|
|
47
|
+
# saver for the last two (#84). So a web image's format crosses as its content type's canonical
|
|
48
|
+
# extension, the one Rails itself names when the upload's extension does not match.
|
|
49
|
+
def canonical(format)
|
|
50
|
+
content_type = Marcel::MimeType.for(extension: format.to_s)
|
|
51
|
+
|
|
52
|
+
if ActiveStorage.web_image_content_types.include?(content_type)
|
|
53
|
+
Marcel::Magic.new(content_type).extensions.first
|
|
54
|
+
else
|
|
55
|
+
format.to_s
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
44
59
|
# Both handles are reopened by path, narrowly, and that is the protocol rather than fussiness. Rails
|
|
45
60
|
# hands out Tempfiles, which are read-write; an input descriptor must be read-only and an output
|
|
46
61
|
# write-only. An access mode is fixed at open, so a cell handed the wrong one cannot narrow it — it can
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activestorage-hotcell-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Dalessio
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 1.1.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 1.1.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: activestorage
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -77,8 +77,9 @@ licenses:
|
|
|
77
77
|
- MIT
|
|
78
78
|
metadata:
|
|
79
79
|
homepage_uri: https://github.com/basecamp/hotcell
|
|
80
|
-
source_code_uri: https://github.com/basecamp/hotcell/tree/
|
|
81
|
-
changelog_uri: https://github.com/basecamp/hotcell/blob/
|
|
80
|
+
source_code_uri: https://github.com/basecamp/hotcell/tree/v1.1.0/activestorage-hotcell-client
|
|
81
|
+
changelog_uri: https://github.com/basecamp/hotcell/blob/v1.1.0/CHANGELOG.md
|
|
82
|
+
documentation_uri: https://basecamp.github.io/hotcell/
|
|
82
83
|
bug_tracker_uri: https://github.com/basecamp/hotcell/issues
|
|
83
84
|
rubygems_mfa_required: 'true'
|
|
84
85
|
rdoc_options: []
|
|
@@ -95,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
95
96
|
- !ruby/object:Gem::Version
|
|
96
97
|
version: '0'
|
|
97
98
|
requirements: []
|
|
98
|
-
rubygems_version: 4.0.
|
|
99
|
+
rubygems_version: 4.0.16
|
|
99
100
|
specification_version: 4
|
|
100
101
|
summary: Point Active Storage's transformer, analyzer, and previewers at a HotCell.
|
|
101
102
|
test_files: []
|