carrierwave-delay 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/issue_template.md +16 -0
- data/.github/pull_request_template.md +21 -0
- data/.gitignore +13 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +7 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/CONTRIBUTING.md +0 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +156 -0
- data/INSTALL.md +1 -0
- data/LICENSE +21 -0
- data/OWNERS.yaml +1 -0
- data/README.md +135 -0
- data/Rakefile +6 -0
- data/carrierwave-delay.gemspec +25 -0
- data/lib/carrierwave-delay.rb +19 -0
- data/lib/carrierwave-delay/model.rb +40 -0
- data/lib/carrierwave-delay/version.rb +13 -0
- data/lib/carrierwave/delay.rb +21 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 20704d84f0ac32916ff6b65b64b196f8c5f6e9bd
|
4
|
+
data.tar.gz: e95125bc6d08ad9aa4d17d078d2721aecb4fe8ef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 152723909e3dfa2e186e1cbf5383ea467939e5bf637eb43a0fbd6493c6b54b1090f4af5668845b1eacc00ac69018dc94a1e213432ccd92b9ade3e746cb2b82ef
|
7
|
+
data.tar.gz: 46c3ad206ca748bca6fbb8edfd7313488204939073c82f089844f24498e053e3dfee8c5d42ad903c1a5186534db6b3446da4c4546c1dcf0bdd1cc24dbbc0c37b
|
@@ -0,0 +1,16 @@
|
|
1
|
+
### Expected behavior
|
2
|
+
Tell us what should happen
|
3
|
+
|
4
|
+
### Actual behavior
|
5
|
+
Tell us what happens instead
|
6
|
+
|
7
|
+
### Steps to reproduce
|
8
|
+
|
9
|
+
(Guidelines for creating a bug report are [available
|
10
|
+
here](https://github.com/jonhue/carrierwave-delay/wiki/Bug-reports))
|
11
|
+
|
12
|
+
### System configuration
|
13
|
+
|
14
|
+
**Ruby version**:
|
15
|
+
|
16
|
+
**Rails version**:
|
@@ -0,0 +1,21 @@
|
|
1
|
+
### Summary
|
2
|
+
|
3
|
+
Provide a general description of the code changes in your pull
|
4
|
+
request... were there any bugs you had fixed? If so, mention them. If
|
5
|
+
these bugs have open GitHub issues, be sure to tag them here as well,
|
6
|
+
to keep the conversation linked together.
|
7
|
+
|
8
|
+
### Other Information
|
9
|
+
|
10
|
+
If there's anything else that's important and relevant to your pull
|
11
|
+
request, mention that information here. This could include
|
12
|
+
benchmarks, or other information.
|
13
|
+
|
14
|
+
If you are updating any of the CHANGELOG files or are asked to update the
|
15
|
+
CHANGELOG files by reviewers, please add the CHANGELOG entry at the top of the file.
|
16
|
+
|
17
|
+
Finally, if your pull request affects documentation or any non-code
|
18
|
+
changes, guidelines for those changes are [available
|
19
|
+
here](https://github.com/jonhue/carrierwave-delay/wiki/Contributing)
|
20
|
+
|
21
|
+
Thanks for contributing to carrierwave-delay!
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
## Our Standards
|
8
|
+
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
10
|
+
|
11
|
+
* Using welcoming and inclusive language
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
13
|
+
* Gracefully accepting constructive criticism
|
14
|
+
* Focusing on what is best for the community
|
15
|
+
* Showing empathy towards other community members
|
16
|
+
|
17
|
+
Examples of unacceptable behavior by participants include:
|
18
|
+
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21
|
+
* Public or private harassment
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24
|
+
|
25
|
+
## Our Responsibilities
|
26
|
+
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28
|
+
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30
|
+
|
31
|
+
## Scope
|
32
|
+
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34
|
+
|
35
|
+
## Enforcement
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at help@slooob.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38
|
+
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40
|
+
|
41
|
+
## Attribution
|
42
|
+
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44
|
+
|
45
|
+
[homepage]: http://contributor-covenant.org
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
File without changes
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
carrierwave-delay (0.1.0)
|
5
|
+
rails (>= 4.0.0)
|
6
|
+
thor (~> 0.20)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.1.3)
|
12
|
+
actionpack (= 5.1.3)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (~> 0.6.1)
|
15
|
+
actionmailer (5.1.3)
|
16
|
+
actionpack (= 5.1.3)
|
17
|
+
actionview (= 5.1.3)
|
18
|
+
activejob (= 5.1.3)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.1.3)
|
22
|
+
actionview (= 5.1.3)
|
23
|
+
activesupport (= 5.1.3)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (~> 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.1.3)
|
29
|
+
activesupport (= 5.1.3)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.1.3)
|
35
|
+
activesupport (= 5.1.3)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.1.3)
|
38
|
+
activesupport (= 5.1.3)
|
39
|
+
activerecord (5.1.3)
|
40
|
+
activemodel (= 5.1.3)
|
41
|
+
activesupport (= 5.1.3)
|
42
|
+
arel (~> 8.0)
|
43
|
+
activesupport (5.1.3)
|
44
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
+
i18n (~> 0.7)
|
46
|
+
minitest (~> 5.1)
|
47
|
+
tzinfo (~> 1.1)
|
48
|
+
arel (8.0.0)
|
49
|
+
ast (2.3.0)
|
50
|
+
builder (3.2.3)
|
51
|
+
concurrent-ruby (1.0.5)
|
52
|
+
diff-lcs (1.3)
|
53
|
+
erubi (1.6.1)
|
54
|
+
globalid (0.4.0)
|
55
|
+
activesupport (>= 4.2.0)
|
56
|
+
i18n (0.8.6)
|
57
|
+
loofah (2.0.3)
|
58
|
+
nokogiri (>= 1.5.9)
|
59
|
+
mail (2.6.6)
|
60
|
+
mime-types (>= 1.16, < 4)
|
61
|
+
method_source (0.8.2)
|
62
|
+
mime-types (3.1)
|
63
|
+
mime-types-data (~> 3.2015)
|
64
|
+
mime-types-data (3.2016.0521)
|
65
|
+
mini_portile2 (2.2.0)
|
66
|
+
minitest (5.10.3)
|
67
|
+
nio4r (2.1.0)
|
68
|
+
nokogiri (1.8.0)
|
69
|
+
mini_portile2 (~> 2.2.0)
|
70
|
+
nokogiri (1.8.0-x86-mingw32)
|
71
|
+
mini_portile2 (~> 2.2.0)
|
72
|
+
parallel (1.12.0)
|
73
|
+
parser (2.4.0.0)
|
74
|
+
ast (~> 2.2)
|
75
|
+
powerpack (0.1.1)
|
76
|
+
rack (2.0.3)
|
77
|
+
rack-test (0.6.3)
|
78
|
+
rack (>= 1.0)
|
79
|
+
rails (5.1.3)
|
80
|
+
actioncable (= 5.1.3)
|
81
|
+
actionmailer (= 5.1.3)
|
82
|
+
actionpack (= 5.1.3)
|
83
|
+
actionview (= 5.1.3)
|
84
|
+
activejob (= 5.1.3)
|
85
|
+
activemodel (= 5.1.3)
|
86
|
+
activerecord (= 5.1.3)
|
87
|
+
activesupport (= 5.1.3)
|
88
|
+
bundler (>= 1.3.0)
|
89
|
+
railties (= 5.1.3)
|
90
|
+
sprockets-rails (>= 2.0.0)
|
91
|
+
rails-dom-testing (2.0.3)
|
92
|
+
activesupport (>= 4.2.0)
|
93
|
+
nokogiri (>= 1.6)
|
94
|
+
rails-html-sanitizer (1.0.3)
|
95
|
+
loofah (~> 2.0)
|
96
|
+
railties (5.1.3)
|
97
|
+
actionpack (= 5.1.3)
|
98
|
+
activesupport (= 5.1.3)
|
99
|
+
method_source
|
100
|
+
rake (>= 0.8.7)
|
101
|
+
thor (>= 0.18.1, < 2.0)
|
102
|
+
rainbow (2.2.2)
|
103
|
+
rake
|
104
|
+
rake (12.0.0)
|
105
|
+
rspec-core (3.6.0)
|
106
|
+
rspec-support (~> 3.6.0)
|
107
|
+
rspec-expectations (3.6.0)
|
108
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
109
|
+
rspec-support (~> 3.6.0)
|
110
|
+
rspec-mocks (3.6.0)
|
111
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
112
|
+
rspec-support (~> 3.6.0)
|
113
|
+
rspec-rails (3.6.1)
|
114
|
+
actionpack (>= 3.0)
|
115
|
+
activesupport (>= 3.0)
|
116
|
+
railties (>= 3.0)
|
117
|
+
rspec-core (~> 3.6.0)
|
118
|
+
rspec-expectations (~> 3.6.0)
|
119
|
+
rspec-mocks (~> 3.6.0)
|
120
|
+
rspec-support (~> 3.6.0)
|
121
|
+
rspec-support (3.6.0)
|
122
|
+
rubocop (0.49.1)
|
123
|
+
parallel (~> 1.10)
|
124
|
+
parser (>= 2.3.3.1, < 3.0)
|
125
|
+
powerpack (~> 0.1)
|
126
|
+
rainbow (>= 1.99.1, < 3.0)
|
127
|
+
ruby-progressbar (~> 1.7)
|
128
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
129
|
+
ruby-progressbar (1.8.1)
|
130
|
+
sprockets (3.7.1)
|
131
|
+
concurrent-ruby (~> 1.0)
|
132
|
+
rack (> 1, < 3)
|
133
|
+
sprockets-rails (3.2.0)
|
134
|
+
actionpack (>= 4.0)
|
135
|
+
activesupport (>= 4.0)
|
136
|
+
sprockets (>= 3.0.0)
|
137
|
+
thor (0.20.0)
|
138
|
+
thread_safe (0.3.6)
|
139
|
+
tzinfo (1.2.3)
|
140
|
+
thread_safe (~> 0.1)
|
141
|
+
unicode-display_width (1.3.0)
|
142
|
+
websocket-driver (0.6.5)
|
143
|
+
websocket-extensions (>= 0.1.0)
|
144
|
+
websocket-extensions (0.1.2)
|
145
|
+
|
146
|
+
PLATFORMS
|
147
|
+
ruby
|
148
|
+
x86-mingw32
|
149
|
+
|
150
|
+
DEPENDENCIES
|
151
|
+
carrierwave-delay!
|
152
|
+
rspec-rails (~> 3.6)
|
153
|
+
rubocop (~> 0.49)
|
154
|
+
|
155
|
+
BUNDLED WITH
|
156
|
+
1.13.7
|
data/INSTALL.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
**Thank you for installing carrierwave-delay!**
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Slooob
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/OWNERS.yaml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
- jonhue
|
data/README.md
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
# carrierwave-delay - asynchronous processing with CarrierWave
|
2
|
+
|
3
|
+
<img src="https://travis-ci.org/slooob/carrierwave-delay.svg?branch=master" /> [![Gem Version](https://badge.fury.io/rb/carrierwave-delay.svg)](https://badge.fury.io/rb/carrierwave-delay)
|
4
|
+
|
5
|
+
With carrierwave-delay you can offload version processing of your Carrierwave uploaders to Sidekiq and ActiveJob instances.
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
## Table of Contents
|
10
|
+
|
11
|
+
* [Installation](#installation)
|
12
|
+
* [Usage](#usage)
|
13
|
+
* [Configuration](#configuration)
|
14
|
+
* [To Do](#to-do)
|
15
|
+
* [Contributing](#contributing)
|
16
|
+
* [Contributors](#contributors)
|
17
|
+
* [Semantic Versioning](#semantic-versioning)
|
18
|
+
* [License](#license)
|
19
|
+
|
20
|
+
---
|
21
|
+
|
22
|
+
## Installation
|
23
|
+
|
24
|
+
carrierwave-delay works with Rails 4.0 onwards. You can add it to your `Gemfile` with:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'carrierwave-delay'
|
28
|
+
```
|
29
|
+
|
30
|
+
And then execute:
|
31
|
+
|
32
|
+
$ bundle
|
33
|
+
|
34
|
+
Or install it yourself as:
|
35
|
+
|
36
|
+
$ gem install carrierwave-delay
|
37
|
+
|
38
|
+
If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
gem 'carrierwave-delay', github: 'slooob/carrierwave-delay'
|
42
|
+
```
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
|
46
|
+
Start by including `CarrierWave::Delay` in your uploader class and add `is_processing_delayed?` as condition to your defined versions:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
class ImageUploader < CarrierWave::Uploader::Base
|
50
|
+
include CarrierWave::Delay
|
51
|
+
|
52
|
+
version :small, if: :is_processing_delayed? do
|
53
|
+
process resize_to_fill: [50, 50]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
Then, define versions to be processed in your ActiveRecord class:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
class Post < ApplicationRecord
|
62
|
+
mount_uploader :image, ImageUploader
|
63
|
+
mount_uploader :logo, LogoUploader
|
64
|
+
|
65
|
+
carrierwave_delay [:image]
|
66
|
+
end
|
67
|
+
```
|
68
|
+
|
69
|
+
### Configuration
|
70
|
+
|
71
|
+
By adding class methods to your model, you are able to configure **queue** and **priority** of your background tasks:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
class Post < ApplicationRecord
|
75
|
+
mount_uploader :image, ImageUploader
|
76
|
+
mount_uploader :logo, LogoUploader
|
77
|
+
|
78
|
+
carrierwave_delay [:image]
|
79
|
+
|
80
|
+
def self.carrierwave_delay_queue
|
81
|
+
:carrierwave # defaults to `:default`
|
82
|
+
end
|
83
|
+
def self.carrierwave_delay_priority
|
84
|
+
10 # defaults to `20`
|
85
|
+
end
|
86
|
+
end
|
87
|
+
```
|
88
|
+
|
89
|
+
---
|
90
|
+
|
91
|
+
## To Do
|
92
|
+
|
93
|
+
* Leave your suggestions [here](https://github.com/slooob/carrierwave-delay/issues/new)
|
94
|
+
|
95
|
+
---
|
96
|
+
|
97
|
+
## Contributing
|
98
|
+
|
99
|
+
We hope that you will consider contributing to carrierwave-delay. Please read this short overview for some information about how to get started:
|
100
|
+
|
101
|
+
[Learn more about contributing to this repository](https://github.com/slooob/carrierwave-delay/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/slooob/carrierwave-delay/blob/master/CODE_OF_CONDUCT.md)
|
102
|
+
|
103
|
+
### Contributors
|
104
|
+
|
105
|
+
Give the people some :heart: who are working on this project. See them all at:
|
106
|
+
|
107
|
+
https://github.com/slooob/carrierwave-delay/graphs/contributors
|
108
|
+
|
109
|
+
### Semantic Versioning
|
110
|
+
|
111
|
+
carrierwave-delay follows Semantic Versioning 2.0 as defined at http://semver.org.
|
112
|
+
|
113
|
+
## License
|
114
|
+
|
115
|
+
MIT License
|
116
|
+
|
117
|
+
Copyright (c) 2017 Slooob
|
118
|
+
|
119
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
120
|
+
of this software and associated documentation files (the "Software"), to deal
|
121
|
+
in the Software without restriction, including without limitation the rights
|
122
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
123
|
+
copies of the Software, and to permit persons to whom the Software is
|
124
|
+
furnished to do so, subject to the following conditions:
|
125
|
+
|
126
|
+
The above copyright notice and this permission notice shall be included in all
|
127
|
+
copies or substantial portions of the Software.
|
128
|
+
|
129
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
130
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
131
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
132
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
133
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
134
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
135
|
+
SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path(File.join('..', 'lib', 'carrierwave-delay', 'version'), __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'carrierwave-delay'
|
6
|
+
gem.version = CarrierwaveDelay::VERSION
|
7
|
+
gem.platform = Gem::Platform::RUBY
|
8
|
+
gem.summary = 'Asynchronous processing with CarrierWave'
|
9
|
+
gem.description = 'With carrierwave-delay you can offload version processing of your Carrierwave uploaders to Sidekiq and ActiveJob instances.'
|
10
|
+
gem.authors = ['Jonas Hübotter']
|
11
|
+
gem.email = 'developer@slooob.com'
|
12
|
+
gem.homepage = 'https://developer.slooob.com/open-source'
|
13
|
+
gem.license = 'MIT'
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split("\n")
|
16
|
+
gem.require_paths = ['lib']
|
17
|
+
|
18
|
+
gem.post_install_message = IO.read('INSTALL.md')
|
19
|
+
|
20
|
+
gem.required_ruby_version = '>= 2.0'
|
21
|
+
|
22
|
+
|
23
|
+
gem.add_dependency 'rails', '>= 4.0'
|
24
|
+
gem.add_dependency 'carrierwave', '~> 1.2'
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'carrierwave'
|
3
|
+
|
4
|
+
module CarrierwaveDelay
|
5
|
+
|
6
|
+
require 'carrierwave-delay/version'
|
7
|
+
|
8
|
+
class Railtie < Rails::Railtie
|
9
|
+
initializer 'carrierwave-delay.active_record' do
|
10
|
+
ActiveSupport.on_load :active_record do
|
11
|
+
Sidekiq::Extensions.enable_delay! if defined? Sidekiq
|
12
|
+
require 'carrierwave/delay'
|
13
|
+
require 'carrierwave-delay/model'
|
14
|
+
include CarrierWaveDelay::Model
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module CarrierWaveDelay
|
2
|
+
module Model
|
3
|
+
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
cattr_accessor :carrierwave_delay_columns
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
|
12
|
+
def carrierwave_delay columns
|
13
|
+
after_save :carrierwave_delay_process
|
14
|
+
self.carrierwave_delay_columns = columns
|
15
|
+
end
|
16
|
+
|
17
|
+
def carrierwave_delay_queue
|
18
|
+
:default
|
19
|
+
end
|
20
|
+
def carrierwave_delay_priority
|
21
|
+
20
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def recreate_delayed_versions!
|
27
|
+
self.class.carrierwave_delay_columns.each do |column|
|
28
|
+
send(column).is_processing_delayed = true
|
29
|
+
send(column).recreate_versions!
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def carrierwave_delay_process
|
36
|
+
self.delay(queue: self.class.carrierwave_delay_queue, priority: self.class.carrierwave_delay_priority).recreate_delayed_versions!
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module CarrierWave
|
2
|
+
module Delay
|
3
|
+
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def is_processing_delayed? img = nil
|
7
|
+
!! @is_processing_delayed
|
8
|
+
end
|
9
|
+
|
10
|
+
def is_processing_immediate? img = nil
|
11
|
+
! is_processing_delayed?
|
12
|
+
end
|
13
|
+
|
14
|
+
def is_processing_delayed= value
|
15
|
+
@is_processing_delayed = value
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# CarrierWave::Uploader::Versions.send :include, CarrierWave::Uploader::Versions::Delay
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: carrierwave-delay
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonas Hübotter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: carrierwave
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
41
|
+
description: With carrierwave-delay you can offload version processing of your Carrierwave
|
42
|
+
uploaders to Sidekiq and ActiveJob instances.
|
43
|
+
email: developer@slooob.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".github/issue_template.md"
|
49
|
+
- ".github/pull_request_template.md"
|
50
|
+
- ".gitignore"
|
51
|
+
- ".travis.yml"
|
52
|
+
- CHANGELOG.md
|
53
|
+
- CODE_OF_CONDUCT.md
|
54
|
+
- CONTRIBUTING.md
|
55
|
+
- Gemfile
|
56
|
+
- Gemfile.lock
|
57
|
+
- INSTALL.md
|
58
|
+
- LICENSE
|
59
|
+
- OWNERS.yaml
|
60
|
+
- README.md
|
61
|
+
- Rakefile
|
62
|
+
- carrierwave-delay.gemspec
|
63
|
+
- lib/carrierwave-delay.rb
|
64
|
+
- lib/carrierwave-delay/model.rb
|
65
|
+
- lib/carrierwave-delay/version.rb
|
66
|
+
- lib/carrierwave/delay.rb
|
67
|
+
homepage: https://developer.slooob.com/open-source
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message: "**Thank you for installing carrierwave-delay!**\n"
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '2.0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.6.12
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: Asynchronous processing with CarrierWave
|
91
|
+
test_files: []
|