carrierwave_backgrounder 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,8 +46,7 @@ module Support
46
46
  worker.instance_variable_set('@queue', queue_options[:queue] || :carrierwave)
47
47
  ::Qu.enqueue worker, class_name, subject_id, mounted_as
48
48
  when :sidekiq
49
- worker.extend ::Sidekiq::Worker
50
- worker.sidekiq_options queue_options[:queue] || :carrierwave
49
+ worker.sidekiq_options queue_options
51
50
  ::Sidekiq::Client.enqueue worker, class_name, subject_id, mounted_as
52
51
  when :qc
53
52
  ::QC.enqueue "#{worker.name}.perform", class_name, subject_id, mounted_as.to_s
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module Backgrounder
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -3,11 +3,17 @@ module CarrierWave
3
3
  module Workers
4
4
 
5
5
  class ProcessAsset < Struct.new(:klass, :id, :column)
6
+
7
+ if defined?(::Sidekiq)
8
+ include ::Sidekiq::Worker
9
+ end
10
+
6
11
  def self.perform(*args)
7
12
  new(*args).perform
8
13
  end
9
14
 
10
- def perform
15
+ def perform(*args)
16
+ set_args(*args) unless args.empty?
11
17
  resource = klass.is_a?(String) ? klass.constantize : klass
12
18
  record = resource.find id
13
19
 
@@ -19,6 +25,11 @@ module CarrierWave
19
25
  end
20
26
  end
21
27
  end
28
+
29
+ def set_args(klass, id, column)
30
+ self.klass, self.id, self.column = klass, id, column
31
+ end
32
+
22
33
  end # ProcessAsset
23
34
 
24
35
  end # Workers
@@ -3,11 +3,18 @@ module CarrierWave
3
3
  module Workers
4
4
 
5
5
  class StoreAsset < Struct.new(:klass, :id, :column)
6
+ if defined?(::Sidekiq)
7
+ include ::Sidekiq::Worker
8
+
9
+ sidekiq_options :queue => @queue
10
+ end
11
+
6
12
  def self.perform(*args)
7
13
  new(*args).perform
8
14
  end
9
15
 
10
- def perform
16
+ def perform(*args)
17
+ set_args(*args) unless args.empty?
11
18
  resource = klass.is_a?(String) ? klass.constantize : klass
12
19
  record = resource.find id
13
20
  if tmp = record.send(:"#{column}_tmp")
@@ -23,6 +30,11 @@ module CarrierWave
23
30
  end
24
31
  end
25
32
  end
33
+
34
+ def set_args(klass, id, column)
35
+ self.klass, self.id, self.column = klass, id, column
36
+ end
37
+
26
38
  end # StoreAsset
27
39
 
28
40
  end # Workers
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave_backgrounder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -120,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: 1110196865602212339
123
+ hash: -4115860577896091097
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  none: false
126
126
  requirements:
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  segments:
131
131
  - 0
132
- hash: 1110196865602212339
132
+ hash: -4115860577896091097
133
133
  requirements: []
134
134
  rubyforge_project: carrierwave_backgrounder
135
135
  rubygems_version: 1.8.24