active_storage-cloud_transformations 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 999b6700b389e34575d1589e17f93ca717da60b51c19fc2109bc7bbe939dc9d6
4
- data.tar.gz: 1c821ba3db38c88da94bc2d8bc2de496a7b27165caeaa2f0694d1b5a91d37342
3
+ metadata.gz: 0ca4a766a27a3db03e238b9ff7f64a58ee5bacf55bab9bff4ea03b09afd3dfc8
4
+ data.tar.gz: ead7756628869463b88452f4938c9651e8f9a30cd67596e7dcfcfdfce6eace8f
5
5
  SHA512:
6
- metadata.gz: 10b5275b5f20dcad3801f1938359429198aaf856b4a785272cf9534cc03375e4fd23d400481c44278b82182dcc71eaf5600dea1e0ce5d84c1514e6b3cc06fa9c
7
- data.tar.gz: 03a3475f998bde0c4942473d4e24c23c9ba92e092c8fd166dbfa8f08dcce75891019faad5a4efaa7e0a8f9061a1adc2999bda121eb6ffecc80ef876c247b708a
6
+ metadata.gz: f66255e8de41282a371c8dae1af1c3d1b1158578c978930d061509fb1d66da4884e3abef28ce84c5c881ec84dad1897de9532d832c6ce3e3436280b6418bffad
7
+ data.tar.gz: 9c3eccb6e674d346bd69a4ea4d4d4b6e8d37be89511ca431ad1765f938d2a291f494c08f3fa3661b7481aaae4c80ddf6d4115fdeb7cf415622c72410347dd6a6
@@ -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,
@@ -31,6 +32,8 @@ module ActiveStorage
31
32
  run_crucible_job(blob, output_blob, ignore_timeouts: true)
32
33
  end
33
34
 
35
+ public :processed?
36
+
34
37
  private
35
38
 
36
39
  def run_crucible_job input_blob, output_blob, ignore_timeouts: false
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module CloudTransformations
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.2"
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.2
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: 2024-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
- rubygems_version: 3.1.6
76
+ rubygems_version: 3.2.32
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Generate ActiveStorage Variants and Previews via external cloud services,