carrierwave_backgrounder 1.0.0.beta → 1.0.0

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: 6a99c578fbe6a6a70dc4139f3d09573f21eedd63745ca9f1020639a0b11866b1
4
+ data.tar.gz: 4ca00a0ca9da687600ecbd15422a6cd205592cb4f65e98a91b021ce41e352e81
5
5
  SHA512:
6
- metadata.gz: 833f6072005f58a56b2d25d7cd19efd8598df6f98f66607212ed1eee7f4df4f6c46432ca8ca65dae34a348f27567007ef7f4e38459bb522bc0fb391495699441
7
- data.tar.gz: 90365ff21d412eeb47da2ce084b93ad4eea0287592d472d326e4dcaabf0a50f0b2ebe9e0b172bb7bec3f57d099e8689d41393a5efa9fc0b2d5cae0902b2493f1
6
+ metadata.gz: d6ef9643b504bff575e97ef7cce7e8d3609efa1315fe77f46f3b6581602e69df8a55696ed3bef03b67cccc9701b55d9e8f74f1cfdec06f3acf6327b6d5670c3d
7
+ data.tar.gz: b30c5829139120d51681bf9d36503f365e6c273c1c0af73bca63b885fffbbe61bfdc2c777a147b541e3d73d5e45dcb704dd7f3dd4e758c68891022a7acc0e486
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
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.0.0-beta.2
2
+
3
+ ### enhancements
4
+ * Now fully testing using different queue_adapters in CI
5
+
6
+ ### bugfixes
7
+ * Fix issue loading active_job
8
+
1
9
  ## 1.0.0-beta
2
10
 
3
11
  ### enhancements
@@ -9,9 +17,8 @@
9
17
  * Fix issue where a new job would be queued when a upload was removed
10
18
 
11
19
  ### breaking changes
12
- * Remove support for Rails prior to after_commit
20
+ * Remove support for after_save in favor of after_commit
13
21
  * Remove support for queueing systems other than ActiveJob and Sidekiq.
14
- This will simplify support and offload the heavy lifting to ActiveJob
15
22
 
16
23
  ## 0.4.3
17
24
 
data/README.md CHANGED
@@ -161,7 +161,7 @@ Each method, #store_in_background and #process_in_background has there own worke
161
161
 
162
162
  class User < ActiveRecord::Base
163
163
  mount_uploader :avatar, AvatarUploader
164
- process_in_background, :avatar, MyParanoidWorker
164
+ process_in_background :avatar, MyParanoidWorker
165
165
  end
166
166
 
167
167
  class MyParanoidWorker < ::CarrierWave::Workers::ProcessAsset
@@ -180,7 +180,7 @@ end
180
180
 
181
181
  class User < ActiveRecord::Base
182
182
  mount_uploader :avatar, AvatarUploader
183
- process_in_background, :avatar, MyActiveJobWorker
183
+ process_in_background :avatar, MyActiveJobWorker
184
184
  end
185
185
 
186
186
  class MyActiveJobWorker < ::CarrierWave::Workers::ActiveJob::StoreAsset
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module Backgrounder
3
- VERSION = "1.0.0.beta"
3
+ VERSION = "1.0.0"
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
@@ -32,10 +32,6 @@ module CarrierWave
32
32
  def constantized_resource
33
33
  klass.is_a?(String) ? klass.constantize : klass
34
34
  end
35
-
36
- def when_not_ready
37
- end
38
-
39
35
  end # Base
40
36
 
41
37
  end # 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
@@ -16,8 +16,6 @@ module GlobalMacros
16
16
  end
17
17
 
18
18
  def process_latest_sidekiq_job
19
- job = Sidekiq::Queues["carrierwave"].pop
20
- worker = job['class'].constantize.new(*job['args'])
21
- worker.perform
19
+ Sidekiq::Job.drain_all
22
20
  end
23
21
  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
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-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave
@@ -248,9 +248,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  requirements:
251
- - - ">"
251
+ - - ">="
252
252
  - !ruby/object:Gem::Version
253
- version: 1.3.1
253
+ version: '0'
254
254
  requirements: []
255
255
  rubygems_version: 3.2.3
256
256
  signing_key: