dalliance 0.6.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +107 -0
- data/Appraisals +8 -4
- data/Gemfile +1 -1
- data/README.rdoc +13 -1
- data/config/locales/en.yml +2 -0
- data/dalliance.gemspec +4 -4
- data/gemfiles/rails_5.0.gemfile +1 -1
- data/gemfiles/rails_5.0.gemfile.lock +107 -80
- data/gemfiles/rails_5.1.gemfile +1 -1
- data/gemfiles/rails_5.1.gemfile.lock +72 -45
- data/gemfiles/rails_5.2.gemfile +1 -1
- data/gemfiles/rails_5.2.gemfile.lock +111 -84
- data/gemfiles/{rails_4.2.gemfile → rails_6.0.gemfile} +2 -2
- data/gemfiles/rails_6.0.gemfile.lock +225 -0
- data/gemfiles/rails_6.1.gemfile +12 -0
- data/gemfiles/rails_6.1.gemfile.lock +233 -0
- data/lib/dalliance.rb +129 -26
- data/lib/dalliance/engine.rb +1 -1
- data/lib/dalliance/progress_meter.rb +5 -5
- data/lib/dalliance/version.rb +1 -1
- data/lib/dalliance/workers/delayed_job.rb +28 -9
- data/lib/dalliance/workers/resque.rb +51 -9
- data/spec/dalliance/asynchronous_delayed_job_spec.rb +42 -0
- data/spec/dalliance/asynchronous_resque_spec.rb +118 -0
- data/spec/dalliance/dalliance_spec.rb +7 -5
- data/spec/dalliance/synchronous_spec.rb +60 -3
- data/spec/spec_helper.rb +2 -0
- data/spec/support/active_record.rb +14 -1
- metadata +57 -12
- data/gemfiles/rails_4.2.gemfile.lock +0 -165
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceb1bcc758ad39970b608af9112dfb735f7408edc7d97caf818654d5fca558db
|
4
|
+
data.tar.gz: eed4e050d077b5cdf74b8d8997e917423229199904740a06028e2d3daca89c66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bbddd1d2685d64b7a2ccd0d5d610f5d7d44d249ef59d0c0d76198e4c0733340dc89dc506b9c084c1f667ec7370830560854575b1dc0079d63a16cc630ba0093
|
7
|
+
data.tar.gz: f60a961960220bfe1973d12a1c4440bd87d1ae6d2cbfd71c57e2308d66e58e0887a5aee8513bde25316bb50765d12dbb4d42105b04d3d8dedab4465e7a63634b
|
@@ -0,0 +1,107 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
defaults: &defaults
|
4
|
+
working_directory: ~/app
|
5
|
+
docker:
|
6
|
+
- image: circleci/ruby:2.6.5
|
7
|
+
- image: redis
|
8
|
+
# - image: circleci/mysql:5.7
|
9
|
+
# environment:
|
10
|
+
# MYSQL_USER: root
|
11
|
+
# MYSQL_PASSWORD: ''
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
build:
|
15
|
+
<<: *defaults
|
16
|
+
parallelism: 1
|
17
|
+
steps:
|
18
|
+
- checkout
|
19
|
+
|
20
|
+
|
21
|
+
- restore_cache:
|
22
|
+
keys:
|
23
|
+
- v2-bundle-{{ checksum "Gemfile.lock" }}
|
24
|
+
- run:
|
25
|
+
name: Bundle install
|
26
|
+
command: bundle check || bundle install --retry=3 --path vendor/bundle
|
27
|
+
- save_cache:
|
28
|
+
key: v2-bundle-{{ checksum "Gemfile.lock" }}
|
29
|
+
paths:
|
30
|
+
- vendor/bundle
|
31
|
+
- persist_to_workspace:
|
32
|
+
root: ~/
|
33
|
+
paths:
|
34
|
+
- app
|
35
|
+
|
36
|
+
test:
|
37
|
+
<<: *defaults
|
38
|
+
parallelism: 1
|
39
|
+
steps:
|
40
|
+
- attach_workspace:
|
41
|
+
at: ~/
|
42
|
+
|
43
|
+
- run: bundle --path vendor/bundle
|
44
|
+
|
45
|
+
# - run:
|
46
|
+
# name: Wait for DB
|
47
|
+
# command: dockerize -wait tcp://localhost:3306 -timeout 1m
|
48
|
+
|
49
|
+
- run:
|
50
|
+
name: Run RSpec tests
|
51
|
+
command: |
|
52
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
53
|
+
echo $TEST_FILES
|
54
|
+
bundle exec rspec --profile 10 \
|
55
|
+
--format RspecJunitFormatter \
|
56
|
+
--out test_results/rspec.xml \
|
57
|
+
--format progress \
|
58
|
+
$TEST_FILES
|
59
|
+
- store_test_results:
|
60
|
+
path: test_results
|
61
|
+
- store_artifacts:
|
62
|
+
path: test_results
|
63
|
+
|
64
|
+
bundler_audit:
|
65
|
+
<<: *defaults
|
66
|
+
parallelism: 1
|
67
|
+
steps:
|
68
|
+
- attach_workspace:
|
69
|
+
at: ~/
|
70
|
+
- run: bundle --path vendor/bundle
|
71
|
+
- run:
|
72
|
+
name: Run bundler-audit
|
73
|
+
command: |
|
74
|
+
if [[ "${CIRCLE_NODE_INDEX}" == 0 ]]
|
75
|
+
then
|
76
|
+
bundle exec bundle-audit update && bundle exec bundle-audit check
|
77
|
+
fi
|
78
|
+
|
79
|
+
rubocop:
|
80
|
+
<<: *defaults
|
81
|
+
parallelism: 1
|
82
|
+
steps:
|
83
|
+
- attach_workspace:
|
84
|
+
at: ~/
|
85
|
+
- run: bundle --path vendor/bundle
|
86
|
+
- run:
|
87
|
+
name: Run rubocop
|
88
|
+
command: |
|
89
|
+
if [[ "${CIRCLE_NODE_INDEX}" == 0 ]]
|
90
|
+
then
|
91
|
+
bundle exec rubocop -D -l
|
92
|
+
fi
|
93
|
+
|
94
|
+
workflows:
|
95
|
+
version: 2
|
96
|
+
continuous_integration:
|
97
|
+
jobs:
|
98
|
+
- build
|
99
|
+
- test:
|
100
|
+
requires:
|
101
|
+
- build
|
102
|
+
- bundler_audit:
|
103
|
+
requires:
|
104
|
+
- build
|
105
|
+
- rubocop:
|
106
|
+
requires:
|
107
|
+
- build
|
data/Appraisals
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
appraise "rails-4.2" do
|
2
|
-
gem "rails", "~> 4.2.0"
|
3
|
-
end
|
4
|
-
|
5
1
|
appraise "rails-5.0" do
|
6
2
|
gem "rails", "~> 5.0.0"
|
7
3
|
end
|
@@ -12,4 +8,12 @@ end
|
|
12
8
|
|
13
9
|
appraise "rails-5.2" do
|
14
10
|
gem "rails", "~> 5.2.2"
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise "rails-6.0" do
|
14
|
+
gem "rails", "~> 6.0.0"
|
15
|
+
end
|
16
|
+
|
17
|
+
appraise "rails-6.1" do
|
18
|
+
gem "rails", "~> 6.1.0"
|
15
19
|
end
|
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -19,7 +19,19 @@ In your model:
|
|
19
19
|
process_method is the name of the method to invoke for background processing
|
20
20
|
to kick it off just call dalliance_background_process
|
21
21
|
|
22
|
-
|
22
|
+
Models can also be re-processed to allow front-end users to reprocess without
|
23
|
+
needing to loop in PMs or developers:
|
24
|
+
|
25
|
+
class Model < ActiveRecord::Base
|
26
|
+
dalliance :process_method,
|
27
|
+
reprocess_method: :reprocessing_method
|
28
|
+
end
|
29
|
+
|
30
|
+
Keep in mind that a record that has not already been completely processed (eg in
|
31
|
+
a state of 'pending' or 'processing') cannot be reprocessed. Attempting to
|
32
|
+
reprocess the record will raise an error.
|
33
|
+
|
34
|
+
== Handle your migrations:
|
23
35
|
|
24
36
|
rails g dalliance:progress_meter
|
25
37
|
|
data/config/locales/en.yml
CHANGED
data/dalliance.gemspec
CHANGED
@@ -11,14 +11,12 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{ Wrapper for an ActiveRecord model with a single ascynhronous method }
|
12
12
|
s.description = %q{ Background processing for ActiveRecord using a 'delayable' worker and a state_machine }
|
13
13
|
|
14
|
-
s.rubyforge_project = "dalliance"
|
15
|
-
|
16
14
|
s.files = `git ls-files`.split("\n")
|
17
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
17
|
s.require_paths = ["lib"]
|
20
18
|
|
21
|
-
s.add_dependency('rails', '>=
|
19
|
+
s.add_dependency('rails', '>= 5.0', "< 6.2")
|
22
20
|
|
23
21
|
s.add_dependency('state_machine')
|
24
22
|
|
@@ -26,6 +24,8 @@ Gem::Specification.new do |s|
|
|
26
24
|
s.add_development_dependency('delayed_job', '>= 3.0.0')
|
27
25
|
s.add_development_dependency('delayed_job_active_record')
|
28
26
|
s.add_development_dependency('sqlite3')
|
29
|
-
|
30
27
|
s.add_development_dependency('resque')
|
28
|
+
s.add_development_dependency('bundler-audit')
|
29
|
+
s.add_development_dependency('rubocop', '~> 0.78')
|
30
|
+
s.add_development_dependency('rspec_junit_formatter')
|
31
31
|
end
|
data/gemfiles/rails_5.0.gemfile
CHANGED
@@ -1,48 +1,48 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
dalliance (0.
|
5
|
-
rails (>=
|
4
|
+
dalliance (0.8.1)
|
5
|
+
rails (>= 5.0, < 6.2)
|
6
6
|
state_machine
|
7
7
|
|
8
8
|
GEM
|
9
|
-
remote:
|
9
|
+
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (5.0.
|
12
|
-
actionpack (= 5.0.
|
13
|
-
nio4r (
|
11
|
+
actioncable (5.0.7.2)
|
12
|
+
actionpack (= 5.0.7.2)
|
13
|
+
nio4r (>= 1.2, < 3.0)
|
14
14
|
websocket-driver (~> 0.6.1)
|
15
|
-
actionmailer (5.0.
|
16
|
-
actionpack (= 5.0.
|
17
|
-
actionview (= 5.0.
|
18
|
-
activejob (= 5.0.
|
15
|
+
actionmailer (5.0.7.2)
|
16
|
+
actionpack (= 5.0.7.2)
|
17
|
+
actionview (= 5.0.7.2)
|
18
|
+
activejob (= 5.0.7.2)
|
19
19
|
mail (~> 2.5, >= 2.5.4)
|
20
20
|
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (5.0.
|
22
|
-
actionview (= 5.0.
|
23
|
-
activesupport (= 5.0.
|
21
|
+
actionpack (5.0.7.2)
|
22
|
+
actionview (= 5.0.7.2)
|
23
|
+
activesupport (= 5.0.7.2)
|
24
24
|
rack (~> 2.0)
|
25
25
|
rack-test (~> 0.6.3)
|
26
26
|
rails-dom-testing (~> 2.0)
|
27
27
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
-
actionview (5.0.
|
29
|
-
activesupport (= 5.0.
|
28
|
+
actionview (5.0.7.2)
|
29
|
+
activesupport (= 5.0.7.2)
|
30
30
|
builder (~> 3.1)
|
31
31
|
erubis (~> 2.7.0)
|
32
32
|
rails-dom-testing (~> 2.0)
|
33
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
34
|
-
activejob (5.0.
|
35
|
-
activesupport (= 5.0.
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.0.7.2)
|
35
|
+
activesupport (= 5.0.7.2)
|
36
36
|
globalid (>= 0.3.6)
|
37
|
-
activemodel (5.0.
|
38
|
-
activesupport (= 5.0.
|
39
|
-
activerecord (5.0.
|
40
|
-
activemodel (= 5.0.
|
41
|
-
activesupport (= 5.0.
|
37
|
+
activemodel (5.0.7.2)
|
38
|
+
activesupport (= 5.0.7.2)
|
39
|
+
activerecord (5.0.7.2)
|
40
|
+
activemodel (= 5.0.7.2)
|
41
|
+
activesupport (= 5.0.7.2)
|
42
42
|
arel (~> 7.0)
|
43
|
-
activesupport (5.0.
|
43
|
+
activesupport (5.0.7.2)
|
44
44
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
-
i18n (
|
45
|
+
i18n (>= 0.7, < 2)
|
46
46
|
minitest (~> 5.1)
|
47
47
|
tzinfo (~> 1.1)
|
48
48
|
appraisal (2.2.0)
|
@@ -50,67 +50,77 @@ GEM
|
|
50
50
|
rake
|
51
51
|
thor (>= 0.14.0)
|
52
52
|
arel (7.1.4)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
53
|
+
ast (2.4.0)
|
54
|
+
builder (3.2.4)
|
55
|
+
bundler-audit (0.6.1)
|
56
|
+
bundler (>= 1.2.0, < 3)
|
57
|
+
thor (~> 0.18)
|
58
|
+
byebug (11.1.1)
|
59
|
+
concurrent-ruby (1.1.6)
|
60
|
+
crass (1.0.6)
|
61
|
+
delayed_job (4.1.8)
|
62
|
+
activesupport (>= 3.0, < 6.1)
|
63
|
+
delayed_job_active_record (4.1.4)
|
64
|
+
activerecord (>= 3.0, < 6.1)
|
61
65
|
delayed_job (>= 3.0, < 5)
|
62
66
|
diff-lcs (1.3)
|
63
67
|
erubis (2.7.0)
|
64
68
|
globalid (0.4.2)
|
65
69
|
activesupport (>= 4.2.0)
|
66
|
-
i18n (
|
70
|
+
i18n (1.8.2)
|
67
71
|
concurrent-ruby (~> 1.0)
|
68
|
-
|
72
|
+
jaro_winkler (1.5.4)
|
73
|
+
loofah (2.4.0)
|
69
74
|
crass (~> 1.0.2)
|
70
75
|
nokogiri (>= 1.5.9)
|
71
76
|
mail (2.7.1)
|
72
77
|
mini_mime (>= 0.1.1)
|
73
78
|
method_source (0.9.2)
|
74
|
-
mini_mime (1.0.
|
79
|
+
mini_mime (1.0.2)
|
75
80
|
mini_portile2 (2.4.0)
|
76
|
-
minitest (5.
|
81
|
+
minitest (5.14.0)
|
77
82
|
mono_logger (1.1.0)
|
78
|
-
multi_json (1.
|
79
|
-
mustermann (1.
|
80
|
-
|
81
|
-
|
83
|
+
multi_json (1.14.1)
|
84
|
+
mustermann (1.1.1)
|
85
|
+
ruby2_keywords (~> 0.0.1)
|
86
|
+
nio4r (2.5.2)
|
87
|
+
nokogiri (1.10.8)
|
82
88
|
mini_portile2 (~> 2.4.0)
|
83
|
-
|
84
|
-
|
89
|
+
parallel (1.19.1)
|
90
|
+
parser (2.7.0.3)
|
91
|
+
ast (~> 2.4.0)
|
92
|
+
rack (2.2.2)
|
93
|
+
rack-protection (2.0.8.1)
|
85
94
|
rack
|
86
95
|
rack-test (0.6.3)
|
87
96
|
rack (>= 1.0)
|
88
|
-
rails (5.0.
|
89
|
-
actioncable (= 5.0.
|
90
|
-
actionmailer (= 5.0.
|
91
|
-
actionpack (= 5.0.
|
92
|
-
actionview (= 5.0.
|
93
|
-
activejob (= 5.0.
|
94
|
-
activemodel (= 5.0.
|
95
|
-
activerecord (= 5.0.
|
96
|
-
activesupport (= 5.0.
|
97
|
-
bundler (>= 1.3.0
|
98
|
-
railties (= 5.0.
|
97
|
+
rails (5.0.7.2)
|
98
|
+
actioncable (= 5.0.7.2)
|
99
|
+
actionmailer (= 5.0.7.2)
|
100
|
+
actionpack (= 5.0.7.2)
|
101
|
+
actionview (= 5.0.7.2)
|
102
|
+
activejob (= 5.0.7.2)
|
103
|
+
activemodel (= 5.0.7.2)
|
104
|
+
activerecord (= 5.0.7.2)
|
105
|
+
activesupport (= 5.0.7.2)
|
106
|
+
bundler (>= 1.3.0)
|
107
|
+
railties (= 5.0.7.2)
|
99
108
|
sprockets-rails (>= 2.0.0)
|
100
109
|
rails-dom-testing (2.0.3)
|
101
110
|
activesupport (>= 4.2.0)
|
102
111
|
nokogiri (>= 1.6)
|
103
|
-
rails-html-sanitizer (1.0
|
104
|
-
loofah (~> 2.
|
105
|
-
railties (5.0.
|
106
|
-
actionpack (= 5.0.
|
107
|
-
activesupport (= 5.0.
|
112
|
+
rails-html-sanitizer (1.3.0)
|
113
|
+
loofah (~> 2.3)
|
114
|
+
railties (5.0.7.2)
|
115
|
+
actionpack (= 5.0.7.2)
|
116
|
+
activesupport (= 5.0.7.2)
|
108
117
|
method_source
|
109
118
|
rake (>= 0.8.7)
|
110
119
|
thor (>= 0.18.1, < 2.0)
|
111
|
-
|
112
|
-
|
113
|
-
redis
|
120
|
+
rainbow (3.0.0)
|
121
|
+
rake (13.0.1)
|
122
|
+
redis (4.1.3)
|
123
|
+
redis-namespace (1.7.0)
|
114
124
|
redis (>= 3.0.4)
|
115
125
|
resque (2.0.0)
|
116
126
|
mono_logger (~> 1.0)
|
@@ -118,49 +128,64 @@ GEM
|
|
118
128
|
redis-namespace (~> 1.6)
|
119
129
|
sinatra (>= 0.9.2)
|
120
130
|
vegas (~> 0.1.2)
|
121
|
-
|
122
|
-
|
123
|
-
rspec-
|
124
|
-
rspec-
|
125
|
-
|
126
|
-
|
127
|
-
|
131
|
+
rexml (3.2.4)
|
132
|
+
rspec (3.9.0)
|
133
|
+
rspec-core (~> 3.9.0)
|
134
|
+
rspec-expectations (~> 3.9.0)
|
135
|
+
rspec-mocks (~> 3.9.0)
|
136
|
+
rspec-core (3.9.1)
|
137
|
+
rspec-support (~> 3.9.1)
|
138
|
+
rspec-expectations (3.9.0)
|
128
139
|
diff-lcs (>= 1.2.0, < 2.0)
|
129
|
-
rspec-support (~> 3.
|
130
|
-
rspec-mocks (3.
|
140
|
+
rspec-support (~> 3.9.0)
|
141
|
+
rspec-mocks (3.9.1)
|
131
142
|
diff-lcs (>= 1.2.0, < 2.0)
|
132
|
-
rspec-support (~> 3.
|
133
|
-
rspec-support (3.
|
134
|
-
|
143
|
+
rspec-support (~> 3.9.0)
|
144
|
+
rspec-support (3.9.2)
|
145
|
+
rspec_junit_formatter (0.4.1)
|
146
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
147
|
+
rubocop (0.80.0)
|
148
|
+
jaro_winkler (~> 1.5.1)
|
149
|
+
parallel (~> 1.10)
|
150
|
+
parser (>= 2.7.0.1)
|
151
|
+
rainbow (>= 2.2.2, < 4.0)
|
152
|
+
rexml
|
153
|
+
ruby-progressbar (~> 1.7)
|
154
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
155
|
+
ruby-progressbar (1.10.1)
|
156
|
+
ruby2_keywords (0.0.2)
|
157
|
+
sinatra (2.0.8.1)
|
135
158
|
mustermann (~> 1.0)
|
136
159
|
rack (~> 2.0)
|
137
|
-
rack-protection (= 2.0.
|
160
|
+
rack-protection (= 2.0.8.1)
|
138
161
|
tilt (~> 2.0)
|
139
|
-
sprockets (
|
162
|
+
sprockets (4.0.0)
|
140
163
|
concurrent-ruby (~> 1.0)
|
141
164
|
rack (> 1, < 3)
|
142
165
|
sprockets-rails (3.2.1)
|
143
166
|
actionpack (>= 4.0)
|
144
167
|
activesupport (>= 4.0)
|
145
168
|
sprockets (>= 3.0.0)
|
146
|
-
sqlite3 (1.
|
169
|
+
sqlite3 (1.4.2)
|
147
170
|
state_machine (1.2.0)
|
148
171
|
thor (0.20.3)
|
149
172
|
thread_safe (0.3.6)
|
150
|
-
tilt (2.0.
|
151
|
-
tzinfo (1.2.
|
173
|
+
tilt (2.0.10)
|
174
|
+
tzinfo (1.2.6)
|
152
175
|
thread_safe (~> 0.1)
|
176
|
+
unicode-display_width (1.6.1)
|
153
177
|
vegas (0.1.11)
|
154
178
|
rack (>= 1.0.0)
|
155
179
|
websocket-driver (0.6.5)
|
156
180
|
websocket-extensions (>= 0.1.0)
|
157
|
-
websocket-extensions (0.1.
|
181
|
+
websocket-extensions (0.1.4)
|
158
182
|
|
159
183
|
PLATFORMS
|
160
184
|
ruby
|
161
185
|
|
162
186
|
DEPENDENCIES
|
163
187
|
appraisal
|
188
|
+
bundler-audit
|
164
189
|
byebug
|
165
190
|
dalliance!
|
166
191
|
delayed_job (>= 3.0.0)
|
@@ -168,6 +193,8 @@ DEPENDENCIES
|
|
168
193
|
rails (~> 5.0.0)
|
169
194
|
resque
|
170
195
|
rspec (>= 3.0.0)
|
196
|
+
rspec_junit_formatter
|
197
|
+
rubocop (~> 0.78)
|
171
198
|
sqlite3
|
172
199
|
|
173
200
|
BUNDLED WITH
|