carrierwave_backgrounder 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +30 -0
- data/README.md +5 -20
- data/lib/backgrounder/orm/activemodel.rb +2 -2
- data/lib/backgrounder/version.rb +1 -1
- data/lib/backgrounder/workers/process_asset.rb +1 -4
- data/lib/backgrounder/workers/store_asset.rb +1 -5
- data/lib/generators/carrierwave_backgrounder/USAGE +8 -0
- data/lib/generators/carrierwave_backgrounder/install_generator.rb +20 -0
- data/lib/generators/carrierwave_backgrounder/templates/config/initializers/carrierwave_backgrounder.rb +8 -0
- metadata +8 -4
data/CHANGELOG.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
## 0.1.2
|
2
|
+
|
3
|
+
### enhancements
|
4
|
+
* Add a rails generator to generate the config file.
|
5
|
+
```bash
|
6
|
+
rails g carrierwave_backgrounder:install
|
7
|
+
```
|
8
|
+
|
9
|
+
### bug fixes
|
10
|
+
* Check [column]_cache to make sure we are processessing when a form fails and [column]_cache is used.
|
11
|
+
|
12
|
+
## 0.1.1
|
13
|
+
|
14
|
+
### enhancements
|
15
|
+
* Allow passing of all options to sidekiq in config file.
|
16
|
+
|
17
|
+
### bug fixes
|
18
|
+
* Revert where sidekiq was broken due to Sidekiq::Worker not properly being included.
|
19
|
+
|
20
|
+
## 0.1.0
|
21
|
+
|
22
|
+
### enhancements
|
23
|
+
* Add support to pass options to backends allowing queue names to be set in the initializer.
|
24
|
+
* Make threadsafe. [gitt]
|
25
|
+
* Add support to immediately process jobs if :immediate is set in config backend. [Antiarchitect]
|
26
|
+
|
27
|
+
### bug fixes
|
28
|
+
* Girl Friday incorrectly referenses class #92
|
29
|
+
* Add documentation for testing with rspec #84.
|
30
|
+
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
I like CarrierWave. That being said, I don't like tying up app instances waiting for images to process.
|
4
4
|
|
5
|
-
This gem addresses that
|
5
|
+
This gem addresses that by offloading processing or storage/processing to a background task.
|
6
6
|
We currently support Delayed Job, Resque, Sidekiq, Girl Friday, Qu, and Queue Classic.
|
7
7
|
|
8
8
|
## Background options
|
@@ -38,27 +38,12 @@ In Rails, add the following your Gemfile:
|
|
38
38
|
gem 'carrierwave_backgrounder'
|
39
39
|
```
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
```ruby
|
46
|
-
CarrierWave::Backgrounder.configure do |c|
|
47
|
-
# :delayed_job, :girl_friday, :sidekiq, :qu, :resque, or :qc
|
48
|
-
c.backend :delayed_job
|
49
|
-
end
|
50
|
-
```
|
51
|
-
|
52
|
-
If you would like to use a custom queue name for Delayed Job, Resque, Girl Friday, Sidekiq and Qu pass in the following option.
|
53
|
-
The queue name will default to carrierwave.
|
54
|
-
|
55
|
-
```ruby
|
56
|
-
CarrierWave::Backgrounder.configure do |c|
|
57
|
-
c.backend :delayed_job, queue: :awesome_queue
|
58
|
-
end
|
41
|
+
Run the generator which will create an initializer in config/initializers.
|
42
|
+
```bash
|
43
|
+
rails g carrierwave_backgrounder:install
|
59
44
|
```
|
60
45
|
|
61
|
-
You can
|
46
|
+
You can pass additional configuration options to Girl Friday and Sidekiq:
|
62
47
|
|
63
48
|
```ruby
|
64
49
|
CarrierWave::Backgrounder.configure do |c|
|
@@ -13,7 +13,7 @@ module CarrierWave
|
|
13
13
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
14
14
|
def trigger_#{column}_background_processing?
|
15
15
|
process_#{column}_upload != true &&
|
16
|
-
(#{column}_changed? || previous_changes.has_key?(:#{column}) || remote_#{column}_url.present?)
|
16
|
+
(#{column}_changed? || previous_changes.has_key?(:#{column}) || remote_#{column}_url.present? || #{column}_cache.present?)
|
17
17
|
end
|
18
18
|
RUBY
|
19
19
|
end
|
@@ -24,7 +24,7 @@ module CarrierWave
|
|
24
24
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
25
25
|
def trigger_#{column}_background_storage?
|
26
26
|
process_#{column}_upload != true &&
|
27
|
-
(#{column}_changed? || previous_changes.has_key?(:#{column}) || remote_#{column}_url.present?)
|
27
|
+
(#{column}_changed? || previous_changes.has_key?(:#{column}) || remote_#{column}_url.present? || #{column}_cache.present?)
|
28
28
|
end
|
29
29
|
RUBY
|
30
30
|
end
|
data/lib/backgrounder/version.rb
CHANGED
@@ -3,11 +3,7 @@ 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
|
6
|
+
include ::Sidekiq::Worker if defined?(::Sidekiq)
|
11
7
|
|
12
8
|
def self.perform(*args)
|
13
9
|
new(*args).perform
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module CarrierwaveBackgrounder
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def copy_config
|
7
|
+
template "config/initializers/carrierwave_backgrounder.rb"
|
8
|
+
end
|
9
|
+
|
10
|
+
def info_config
|
11
|
+
puts <<-EOF
|
12
|
+
|
13
|
+
\e[33mBy default :delayed_job is used as the backend for carrierwave_backgrounder with :carrierwave as the queue name.
|
14
|
+
To change this, edit config/initializers/carrierwave_backgrounder.rb.\e[0m
|
15
|
+
|
16
|
+
EOF
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
CarrierWave::Backgrounder.configure do |c|
|
2
|
+
c.backend :delayed_job, queue: :carrierwave
|
3
|
+
# c.backend :resque, queue: :carrierwave
|
4
|
+
# c.backend :sidekiq, queue: :carrierwave
|
5
|
+
# c.backend :girl_friday, queue: :carrierwave
|
6
|
+
# c.backend :qu, queue: :carrierwave
|
7
|
+
# c.backend :qc
|
8
|
+
end
|
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.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: carrierwave
|
@@ -84,6 +84,7 @@ extra_rdoc_files: []
|
|
84
84
|
files:
|
85
85
|
- .gitignore
|
86
86
|
- .rspec
|
87
|
+
- CHANGELOG.md
|
87
88
|
- Gemfile
|
88
89
|
- README.md
|
89
90
|
- Rakefile
|
@@ -98,6 +99,9 @@ files:
|
|
98
99
|
- lib/backgrounder/workers/process_asset.rb
|
99
100
|
- lib/backgrounder/workers/store_asset.rb
|
100
101
|
- lib/carrierwave_backgrounder.rb
|
102
|
+
- lib/generators/carrierwave_backgrounder/USAGE
|
103
|
+
- lib/generators/carrierwave_backgrounder/install_generator.rb
|
104
|
+
- lib/generators/carrierwave_backgrounder/templates/config/initializers/carrierwave_backgrounder.rb
|
101
105
|
- spec/backgrounder/orm/activemodel_spec.rb
|
102
106
|
- spec/backgrounder/orm/base_spec.rb
|
103
107
|
- spec/backgrounder/support/backends_spec.rb
|
@@ -120,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
124
|
version: '0'
|
121
125
|
segments:
|
122
126
|
- 0
|
123
|
-
hash: -
|
127
|
+
hash: -4429973419830496543
|
124
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
129
|
none: false
|
126
130
|
requirements:
|
@@ -129,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
133
|
version: '0'
|
130
134
|
segments:
|
131
135
|
- 0
|
132
|
-
hash: -
|
136
|
+
hash: -4429973419830496543
|
133
137
|
requirements: []
|
134
138
|
rubyforge_project: carrierwave_backgrounder
|
135
139
|
rubygems_version: 1.8.24
|