carrierwave_backgrounder 1.0.0.beta → 1.0.0.beta.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: eda9969a160f0cfc9714cb3643586d4e870b84ef63cedbba52272b2e34eef174
4
- data.tar.gz: ba9f80b446ada55016553a08b31b3660d279691d59d1397f975c5a356ad26584
3
+ metadata.gz: 29bf0a9e2454432c72a9799addeb1f6f059fb910766d946bb999d8b616d9d078
4
+ data.tar.gz: 9ab201113526a8c1cb9529f5361b6023349f7f73959ad13c075c7468d68a86c1
5
5
  SHA512:
6
- metadata.gz: 833f6072005f58a56b2d25d7cd19efd8598df6f98f66607212ed1eee7f4df4f6c46432ca8ca65dae34a348f27567007ef7f4e38459bb522bc0fb391495699441
7
- data.tar.gz: 90365ff21d412eeb47da2ce084b93ad4eea0287592d472d326e4dcaabf0a50f0b2ebe9e0b172bb7bec3f57d099e8689d41393a5efa9fc0b2d5cae0902b2493f1
6
+ metadata.gz: f7dee9bd5893f749599fb804e40400f7d4b54cba1e0ea295962a9442cfbcb02b1d08fd643096d8d242adc2911e65cfcccb97e4f7ef23922d298cada2a2ec8575
7
+ data.tar.gz: e9465ab71a2fe0fc263121f9fc0aee60475cfe4a0f0bec2675d9194abceeaa6372272ed9bacf3867a671b7d4169c5bd51ab414897e06173c52f7aa3e67f700d8
data/.travis.yml CHANGED
@@ -7,6 +7,10 @@ rvm:
7
7
  - 3.2
8
8
  - ruby-head
9
9
 
10
+ env:
11
+ - QUEUE_ADAPTER='sidekiq'
12
+ - QUEUE_ADAPTER='active_job'
13
+
10
14
  before_install:
11
15
  - yes | gem update --system --force
12
16
  - gem install bundler
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module Backgrounder
3
- VERSION = "1.0.0.beta"
3
+ VERSION = "1.0.0.beta.2"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require active_job
2
+ require 'backgrounder/workers/process_asset_mixin'
3
3
 
4
4
  module CarrierWave
5
5
  module Workers
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require active_job
2
+ require 'backgrounder/workers/store_asset_mixin'
3
3
 
4
4
  module CarrierWave
5
5
  module Workers
@@ -1,4 +1,6 @@
1
1
  # encoding: utf-8
2
+ require 'backgrounder/workers/process_asset_mixin'
3
+
2
4
  module CarrierWave
3
5
  module Workers
4
6
 
@@ -1,4 +1,6 @@
1
1
  # encoding: utf-8
2
+ require 'backgrounder/workers/store_asset_mixin'
3
+
2
4
  module CarrierWave
3
5
  module Workers
4
6
 
@@ -1,6 +1,4 @@
1
1
  require 'backgrounder/workers/base'
2
2
  require 'backgrounder/workers/class_methods'
3
- require 'backgrounder/workers/process_asset_mixin'
4
- require 'backgrounder/workers/store_asset_mixin'
5
3
  require 'backgrounder/workers/process_asset'
6
4
  require 'backgrounder/workers/store_asset'
@@ -18,6 +18,19 @@ module CarrierWave
18
18
  case backend
19
19
  when :active_job
20
20
  @worker_klass = "CarrierWave::Workers::ActiveJob"
21
+
22
+ require 'active_job'
23
+ require 'backgrounder/workers/active_job/process_asset'
24
+ require 'backgrounder/workers/active_job/store_asset'
25
+
26
+ queue_name = queue_options['queue'] || 'carrierwave'
27
+
28
+ ::CarrierWave::Workers::ActiveJob::ProcessAsset.class_eval do
29
+ queue_as queue_name
30
+ end
31
+ ::CarrierWave::Workers::ActiveJob::StoreAsset.class_eval do
32
+ queue_as queue_name
33
+ end
21
34
  when :sidekiq
22
35
  @worker_klass = "CarrierWave::Workers"
23
36
 
@@ -53,6 +53,8 @@ Rails.application.configure do
53
53
  # Tell Active Support which deprecation messages to disallow.
54
54
  config.active_support.disallowed_deprecation_warnings = []
55
55
 
56
+ config.active_job.queue_adapter = :sidekiq
57
+
56
58
  # Raises error for missing translations.
57
59
  # config.i18n.raise_on_missing_translations = true
58
60
 
@@ -1,4 +1,5 @@
1
+ queue_adapter = ENV['QUEUE_ADAPTER'] || :active_job
1
2
  CarrierWave::Backgrounder.configure do |c|
2
- # c.backend :active_job, queue: :carrierwave
3
- c.backend :sidekiq, queue: :carrierwave
3
+ c.backend queue_adapter.to_sym, queue: :carrierwave
4
+ # c.backend :sidekiq, queue: :carrierwave
4
5
  end
@@ -17,7 +17,13 @@ module GlobalMacros
17
17
 
18
18
  def process_latest_sidekiq_job
19
19
  job = Sidekiq::Queues["carrierwave"].pop
20
- worker = job['class'].constantize.new(*job['args'])
21
- worker.perform
20
+ worker_class = job['class']
21
+ worker = worker_class.constantize.new
22
+
23
+ if worker_class =~ /JobWrapper/
24
+ worker.perform job['args'].first
25
+ else
26
+ worker.perform(*job['args'])
27
+ end
22
28
  end
23
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave_backgrounder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta
4
+ version: 1.0.0.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Larry Sprock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-13 00:00:00.000000000 Z
11
+ date: 2023-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave