carrierwave_backgrounder 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +10 -1
- data/README.md +0 -14
- data/lib/backgrounder/orm/base.rb +5 -0
- data/lib/backgrounder/support/backends.rb +1 -2
- data/lib/backgrounder/version.rb +1 -1
- data/lib/backgrounder/workers/store_asset.rb +1 -1
- data/lib/carrierwave_backgrounder.rb +2 -2
- data/spec/backgrounder/support/backends_spec.rb +5 -14
- metadata +9 -25
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c43934e88ecb70aea1163a04ba0f67cd71fc5e35
|
4
|
+
data.tar.gz: 05b24076214d28caf49f4e3eb2c4ab959bd2c852
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 65dae9b6c6d8b27b755b5f3df918054fe7b63acf42a2cd9421358659b47b97358d417e4b1c62e1fb9834384f3468a13cb72f13af07063cf4c40afd0937c628ee
|
7
|
+
data.tar.gz: 34f00a5cd35ec4ce23da68ea29f36d8f7037f51ed65f04cbcfb81fd4e9d47e90d20bbc79734a2f81e445b2c15a2adbd6182230d960a5520a46b0d33d63c57871
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
|
2
|
+
## 0.4.0
|
3
|
+
|
4
|
+
### enhancements
|
5
|
+
* [#175] SuckerPunch v1.0 support (no longer support < 1.0). [janko-m]
|
6
|
+
|
7
|
+
### bug fixes
|
8
|
+
* [#176] Check if record exists before running backgrounder [gdott9]
|
9
|
+
* [#169] Correctly remove files on update if marked for deletion [sunny]
|
10
|
+
|
2
11
|
## 0.3.0
|
3
12
|
|
4
13
|
### enhancements
|
5
|
-
* [#123] Fail silently when record not found in worker.
|
14
|
+
* [#123] Fail silently when record not found in worker. [DouweM]
|
6
15
|
|
7
16
|
## 0.2.2
|
8
17
|
|
data/README.md
CHANGED
@@ -55,20 +55,6 @@ CarrierWave::Backgrounder.configure do |c|
|
|
55
55
|
end
|
56
56
|
```
|
57
57
|
|
58
|
-
For SuckerPunch, you have to configure your queue with a specific worker.
|
59
|
-
|
60
|
-
```ruby
|
61
|
-
CarrierWave::Backgrounder.configure do |c|
|
62
|
-
c.backend :sucker_punch, queue: :carrierwave
|
63
|
-
end
|
64
|
-
|
65
|
-
# It is important to configure sucker_punch after carrierwave_backgrounder
|
66
|
-
SuckerPunch.config do
|
67
|
-
queue name: :carrierwave, worker: CarrierWave::Workers::StoreAsset, size: 2
|
68
|
-
end
|
69
|
-
```
|
70
|
-
|
71
|
-
|
72
58
|
In your CarrierWave uploader file:
|
73
59
|
|
74
60
|
```ruby
|
@@ -75,6 +75,11 @@ module CarrierWave
|
|
75
75
|
mod = Module.new
|
76
76
|
include mod
|
77
77
|
mod.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
78
|
+
def remove_#{column}=(value)
|
79
|
+
super
|
80
|
+
self.process_#{column}_upload = true
|
81
|
+
end
|
82
|
+
|
78
83
|
def write_#{column}_identifier
|
79
84
|
super and return if process_#{column}_upload
|
80
85
|
self.#{column}_tmp = _mounter(:#{column}).cache_name if _mounter(:#{column}).cache_name
|
@@ -52,8 +52,7 @@ module CarrierWave
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def enqueue_sucker_punch(worker, *args)
|
55
|
-
|
56
|
-
@sucker_punch_queue.async.perform(*args)
|
55
|
+
worker.new.async.perform(*args)
|
57
56
|
end
|
58
57
|
|
59
58
|
def enqueue_qu(worker, *args)
|
data/lib/backgrounder/version.rb
CHANGED
@@ -8,7 +8,7 @@ module CarrierWave
|
|
8
8
|
def perform(*args)
|
9
9
|
record = super(*args)
|
10
10
|
|
11
|
-
if record.send(:"#{column}_tmp")
|
11
|
+
if record && record.send(:"#{column}_tmp")
|
12
12
|
store_directories(record)
|
13
13
|
record.send :"process_#{column}_upload=", true
|
14
14
|
record.send :"#{column}_tmp=", nil
|
@@ -21,10 +21,10 @@ module CarrierWave
|
|
21
21
|
when :sucker_punch
|
22
22
|
require 'sucker_punch'
|
23
23
|
::CarrierWave::Workers::ProcessAsset.class_eval do
|
24
|
-
include ::SuckerPunch::
|
24
|
+
include ::SuckerPunch::Job
|
25
25
|
end
|
26
26
|
::CarrierWave::Workers::StoreAsset.class_eval do
|
27
|
-
include ::SuckerPunch::
|
27
|
+
include ::SuckerPunch::Job
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -154,24 +154,15 @@ module CarrierWave::Backgrounder
|
|
154
154
|
|
155
155
|
context 'sucker_punch' do
|
156
156
|
let(:args) { [MockWorker, 'FakeClass', 1, :image] }
|
157
|
-
let(:
|
157
|
+
let(:job) { mock('job') }
|
158
158
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
it 'sets the queue to :carrierwave by default' do
|
165
|
-
SuckerPunch::Queue.expects(:[]).with(:carrierwave).returns(mock_sp)
|
159
|
+
it 'invokes a new worker' do
|
160
|
+
MockWorker.expects(:new).returns(worker)
|
161
|
+
worker.expects(:async).returns(job)
|
162
|
+
job.expects(:perform).with('FakeClass', 1, :image)
|
166
163
|
mock_module.backend :sucker_punch
|
167
164
|
mock_module.enqueue_for_backend(*args)
|
168
165
|
end
|
169
|
-
|
170
|
-
it 'sets the queue to backend :queue option' do
|
171
|
-
SuckerPunch::Queue.expects(:[]).with(:awesome_queue).returns(mock_sp)
|
172
|
-
mock_module.backend :sucker_punch, :queue => :awesome_queue
|
173
|
-
mock_module.enqueue_for_backend(*args)
|
174
|
-
end
|
175
166
|
end
|
176
167
|
|
177
168
|
context 'qu' do
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave_backgrounder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Larry Sprock
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: carrierwave
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: mocha
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,17 +55,15 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rake
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
description:
|
@@ -117,33 +108,26 @@ files:
|
|
117
108
|
homepage: https://github.com/lardawge/carrierwave_backgrounder
|
118
109
|
licenses:
|
119
110
|
- MIT
|
111
|
+
metadata: {}
|
120
112
|
post_install_message:
|
121
113
|
rdoc_options: []
|
122
114
|
require_paths:
|
123
115
|
- lib
|
124
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
117
|
requirements:
|
127
|
-
- -
|
118
|
+
- - '>='
|
128
119
|
- !ruby/object:Gem::Version
|
129
120
|
version: '0'
|
130
|
-
segments:
|
131
|
-
- 0
|
132
|
-
hash: 2570599687914796693
|
133
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
-
none: false
|
135
122
|
requirements:
|
136
|
-
- -
|
123
|
+
- - '>='
|
137
124
|
- !ruby/object:Gem::Version
|
138
125
|
version: '0'
|
139
|
-
segments:
|
140
|
-
- 0
|
141
|
-
hash: 2570599687914796693
|
142
126
|
requirements: []
|
143
127
|
rubyforge_project:
|
144
|
-
rubygems_version:
|
128
|
+
rubygems_version: 2.0.6
|
145
129
|
signing_key:
|
146
|
-
specification_version:
|
130
|
+
specification_version: 4
|
147
131
|
summary: Offload CarrierWave's image processing and storage to a background process
|
148
132
|
using Delayed Job, Resque, Sidekiq, Qu, Queue Classic or Girl Friday
|
149
133
|
test_files:
|