active_storage-cloud_transformations 0.2.0 → 0.2.1

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: 999b6700b389e34575d1589e17f93ca717da60b51c19fc2109bc7bbe939dc9d6
4
- data.tar.gz: 1c821ba3db38c88da94bc2d8bc2de496a7b27165caeaa2f0694d1b5a91d37342
3
+ metadata.gz: 1a286939cfe2d2d95bfe2b467738184670cc41783650e4c477e5e820ae48c128
4
+ data.tar.gz: 48c8773651366e73b47a25b51e29c72252c04cc33e0e3b23e70b87130e0b931a
5
5
  SHA512:
6
- metadata.gz: 10b5275b5f20dcad3801f1938359429198aaf856b4a785272cf9534cc03375e4fd23d400481c44278b82182dcc71eaf5600dea1e0ce5d84c1514e6b3cc06fa9c
7
- data.tar.gz: 03a3475f998bde0c4942473d4e24c23c9ba92e092c8fd166dbfa8f08dcce75891019faad5a4efaa7e0a8f9061a1adc2999bda121eb6ffecc80ef876c247b708a
6
+ metadata.gz: bd3801033c078a674ca3264e048523e046c403981c8b73129ff70e7d2eb4dd3830aac9e6c8a601db1df1c85e8c9f6ac9647595577659a338965a635587da7996
7
+ data.tar.gz: 683f154242fb9390fdf36adaa4875f4e17ff07235cf4d157d49cb1c9ef278dbe8518dc5fdc3cf9545ae2cdbaba718de119aa57858d7cf552aad8737764e25921
@@ -21,7 +21,7 @@ Rails.application.reloader.to_prepare do
21
21
  super()
22
22
  else
23
23
  variation = ActiveStorage::Variation.wrap(transformations)
24
- video? && MimeMagic.by_extension(variation.format).image?
24
+ video? && variation.content_type.starts_with?("image")
25
25
  end
26
26
  end
27
27
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_storage-cloud_transformations (0.2.0)
4
+ active_storage-cloud_transformations (0.2.1)
5
5
  activestorage (>= 6.1)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- active_storage-cloud_transformations (0.2.0)
4
+ active_storage-cloud_transformations (0.2.1)
5
5
  activestorage (>= 6.1)
6
6
 
7
7
  GEM
@@ -22,7 +22,7 @@ module ActiveStorage
22
22
  private
23
23
 
24
24
  def create_blob_preview_image_and_blob_preview_image_variant
25
- preview_image_blob = ActiveStorage::Blob.create_before_direct_upload!({
25
+ preview_image_blob = ActiveStorage::Blob.create_before_direct_upload!(**{
26
26
  filename: "#{blob.filename.base}.#{variation.format}",
27
27
  content_type: variation.content_type,
28
28
  service_name: blob.service_name,
@@ -33,7 +33,7 @@ module ActiveStorage
33
33
 
34
34
  variant_variation = variation.default_to(preview_image_blob.send(:default_variant_transformations))
35
35
  variant_record = blob.preview_image.variant_records.create!(variation_digest: variant_variation.digest)
36
- variant_blob = ActiveStorage::Blob.create_before_direct_upload!({
36
+ variant_blob = ActiveStorage::Blob.create_before_direct_upload!(**{
37
37
  filename: "#{blob.filename.base}.#{variant_variation.format}",
38
38
  content_type: variant_variation.content_type,
39
39
  service_name: blob.service_name,
@@ -6,10 +6,11 @@ module ActiveStorage
6
6
  def process
7
7
  raise ActiveStorage::InvariableError unless blob.image? || blob.video?
8
8
 
9
- ActiveRecord::Base.connected_to(role: ActiveRecord::Base.writing_role) do
9
+ role = ActiveRecord.respond_to?(:writing_role) ? ActiveRecord.writing_role : ActiveRecord::Base.writing_role
10
+ ActiveRecord::Base.connected_to(role: role) do
10
11
  # FIXME #create_or_find_by! runs the block in both cases. bug in rails?
11
12
  blob.variant_records.find_or_create_by!(variation_digest: variation.digest) do |record|
12
- output_blob = ActiveStorage::Blob.create_before_direct_upload!({
13
+ output_blob = ActiveStorage::Blob.create_before_direct_upload!(**{
13
14
  filename: "#{blob.filename.base}.#{variation.format}",
14
15
  content_type: variation.content_type,
15
16
  service_name: blob.service_name,
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module CloudTransformations
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage-cloud_transformations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-06 00:00:00.000000000 Z
11
+ date: 2022-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage