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 +4 -4
- data/.travis.yml +4 -0
- data/lib/backgrounder/version.rb +1 -1
- data/lib/backgrounder/workers/active_job/process_asset.rb +1 -1
- data/lib/backgrounder/workers/active_job/store_asset.rb +1 -1
- data/lib/backgrounder/workers/process_asset.rb +2 -0
- data/lib/backgrounder/workers/store_asset.rb +2 -0
- data/lib/backgrounder/workers.rb +0 -2
- data/lib/carrierwave_backgrounder.rb +13 -0
- data/spec/support/dummy_app/config/environments/test.rb +2 -0
- data/spec/support/dummy_app/config/initializers/carrierwave_backgrounder.rb +3 -2
- data/spec/support/global_macros.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29bf0a9e2454432c72a9799addeb1f6f059fb910766d946bb999d8b616d9d078
|
4
|
+
data.tar.gz: 9ab201113526a8c1cb9529f5361b6023349f7f73959ad13c075c7468d68a86c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7dee9bd5893f749599fb804e40400f7d4b54cba1e0ea295962a9442cfbcb02b1d08fd643096d8d242adc2911e65cfcccb97e4f7ef23922d298cada2a2ec8575
|
7
|
+
data.tar.gz: e9465ab71a2fe0fc263121f9fc0aee60475cfe4a0f0bec2675d9194abceeaa6372272ed9bacf3867a671b7d4169c5bd51ab414897e06173c52f7aa3e67f700d8
|
data/.travis.yml
CHANGED
data/lib/backgrounder/version.rb
CHANGED
data/lib/backgrounder/workers.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
21
|
-
worker.
|
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-
|
11
|
+
date: 2023-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|