background_worker 0.0.5 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +10 -0
- data/CHANGELOG.md +11 -0
- data/README.md +6 -7
- data/background_worker.gemspec +5 -0
- data/lib/background_worker.rb +3 -1
- data/lib/background_worker/version.rb +1 -1
- data/spec/spec_helper.rb +14 -0
- data/spec/support/coverage_loader.rb +4 -0
- data/spec/uid_spec.rb +12 -0
- metadata +83 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afd41f26182ca25b8082e658a1856a93ca76fda5
|
4
|
+
data.tar.gz: e364c11af84478d7efe79eea9a2f1c5570b1f4ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 237df4ae437ac88b1298868d09a6d2cf0b088a324f98356ddfd36af41d714c3b0248d41e825f62301e503c5dcd35414c1ed6edb0d29c1e10cc6b347985244f92
|
7
|
+
data.tar.gz: 1068066f6120602cc08a90379328083721a19bf1c6d0be5d2df83f9fd366abf7e406e82edbcd1cec1059b902e8cee5706f97d4ea0cad7644695bdc8b4aa82274
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
|
5
|
+
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
## 0.1.0
|
9
|
+
### Added
|
10
|
+
- [TT-1392] Changelog file
|
11
|
+
- [TT-2141] Only verify connections for Rails 3
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Start by making a worker class which extends from BackgroundWorker::Base
|
|
21
21
|
Then, when you want to perform a task in the background, use
|
22
22
|
klass#perform_in_background which exists in Base:
|
23
23
|
|
24
|
-
|
24
|
+
worker_id = MyWorker.perform_in_background(:my_task, message: "hello!")
|
25
25
|
|
26
26
|
# Backgrounded
|
27
27
|
|
@@ -38,8 +38,8 @@ This is independent of the status reporting which (currently) always uses Redis.
|
|
38
38
|
|
39
39
|
# Getting the status
|
40
40
|
|
41
|
-
The worker_id you are returned can be used to get the status
|
42
|
-
whether the worker has finished successfully, failed, or in progress:
|
41
|
+
The worker_id you are returned can be used to get the status and
|
42
|
+
whether the worker has finished successfully, failed, or is still in progress:
|
43
43
|
|
44
44
|
state = BackgroundWorker.get_state_of(worker_id)
|
45
45
|
|
@@ -53,12 +53,11 @@ The state is represented by a hash with the following keys:
|
|
53
53
|
data: Arbitrary data returned by worker method on success or report_failed
|
54
54
|
|
55
55
|
If an exception is raised, the worker will call #report_failed with the
|
56
|
-
details. You can provide a callback with #after_exception in the config
|
56
|
+
details. You can provide a callback with #after_exception in the config.
|
57
57
|
|
58
58
|
# INSTALLATION
|
59
59
|
|
60
|
-
|
60
|
+
Add to your Gemfile:
|
61
61
|
|
62
|
-
|
63
|
-
gem 'background_worker'
|
62
|
+
gem 'background_worker'
|
64
63
|
|
data/background_worker.gemspec
CHANGED
@@ -20,7 +20,12 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
+
spec.add_development_dependency 'activesupport'
|
23
24
|
spec.add_development_dependency 'bundler'
|
24
25
|
spec.add_development_dependency 'rake'
|
26
|
+
spec.add_development_dependency 'rspec'
|
27
|
+
spec.add_development_dependency 'coverage-kit'
|
28
|
+
spec.add_development_dependency 'coveralls'
|
29
|
+
spec.add_development_dependency 'simplecov-rcov'
|
25
30
|
spec.add_development_dependency 'rubocop'
|
26
31
|
end
|
data/lib/background_worker.rb
CHANGED
@@ -25,7 +25,9 @@ module BackgroundWorker
|
|
25
25
|
|
26
26
|
def self.verify_active_connections!
|
27
27
|
Rails.cache.reconnect if defined?(Rails)
|
28
|
-
|
28
|
+
if defined?(ActiveRecord) && ActiveRecord::VERSION::MAJOR == 3
|
29
|
+
ActiveRecord::Base.verify_active_connections!
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.after_exception(e)
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper.rb"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
require 'bundler/setup'
|
10
|
+
require 'active_support/core_ext/string/inflections' #underscore
|
11
|
+
|
12
|
+
require 'support/coverage_loader'
|
13
|
+
|
14
|
+
require 'background_worker'
|
data/spec/uid_spec.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BackgroundWorker::Uid do
|
4
|
+
let(:class_name) { 'CopyWorker' }
|
5
|
+
let(:method) { 'make_copy' }
|
6
|
+
let(:uid_object) { BackgroundWorker::Uid.new(class_name, method) }
|
7
|
+
|
8
|
+
context '#generate' do
|
9
|
+
subject(:uid) { uid_object.generate }
|
10
|
+
it { is_expected.to match(/copy_worker:make_copy:[0-9a-f]{16}/) }
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: background_worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Noack
|
@@ -10,8 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: bundler
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,6 +54,62 @@ dependencies:
|
|
40
54
|
- - ">="
|
41
55
|
- !ruby/object:Gem::Version
|
42
56
|
version: '0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rspec
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: coverage-kit
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: coveralls
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: simplecov-rcov
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
43
113
|
- !ruby/object:Gem::Dependency
|
44
114
|
name: rubocop
|
45
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,7 +133,10 @@ executables: []
|
|
63
133
|
extensions: []
|
64
134
|
extra_rdoc_files: []
|
65
135
|
files:
|
136
|
+
- ".gitignore"
|
66
137
|
- ".rubocop.yml"
|
138
|
+
- ".travis.yml"
|
139
|
+
- CHANGELOG.md
|
67
140
|
- Gemfile
|
68
141
|
- LICENSE.txt
|
69
142
|
- README.md
|
@@ -76,6 +149,9 @@ files:
|
|
76
149
|
- lib/background_worker/uid.rb
|
77
150
|
- lib/background_worker/version.rb
|
78
151
|
- lib/background_worker/worker_execution.rb
|
152
|
+
- spec/spec_helper.rb
|
153
|
+
- spec/support/coverage_loader.rb
|
154
|
+
- spec/uid_spec.rb
|
79
155
|
homepage: http://github.com/sealink/background_worker
|
80
156
|
licenses:
|
81
157
|
- MIT
|
@@ -96,8 +172,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
172
|
version: '0'
|
97
173
|
requirements: []
|
98
174
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
175
|
+
rubygems_version: 2.5.2
|
100
176
|
signing_key:
|
101
177
|
specification_version: 4
|
102
178
|
summary: Background worker abstraction with status updates
|
103
|
-
test_files:
|
179
|
+
test_files:
|
180
|
+
- spec/spec_helper.rb
|
181
|
+
- spec/support/coverage_loader.rb
|
182
|
+
- spec/uid_spec.rb
|