jobba 1.3.0 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28b15024f2860e2b7cc60d8a70d0f39f1bd9a112
4
- data.tar.gz: e2498a809fd6583a2fa56077c78f2ed04b094a12
3
+ metadata.gz: f4e9d94c44e106165f0d2ac0e0cfc45999e491e9
4
+ data.tar.gz: 6f6d8db0eb8b7cbc17a9825e55b9a35365b8c4a8
5
5
  SHA512:
6
- metadata.gz: 2f49f2e17aa3b5cc43422aabe408a908afcd17d80973d9859ad6144e3949465fbb5a4ef2afca680ae2f0b4f8eb57478aeec296278810e8da5575764dfddf1ef8
7
- data.tar.gz: 04c416209f2864a203e5517da500c8fa1258535757a56d1a17bac38debc4504e54f2888a36c06778741134e10d54d9eba0780ff15018e975235deb290d726888
6
+ metadata.gz: 787771b8aaaf606437ee72425667dce7caa899ef95d965d2703710422bd50274c67a4f40992ae9306da4ead581878fe4380c6e5fb1cb2ae42cedf7d71782106b
7
+ data.tar.gz: 6bb44328f4be0c0230e0760071fa1dd28a15f611c20ffb7724402674e6237d8813ff20b6ddd46d147ac4826242aa9cf0fb40727ec93a323ae72b3d181ffdf53c
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  .byebug*
11
+ .DS_Store
data/README.md CHANGED
@@ -40,20 +40,20 @@ end
40
40
  If you know you need a new `Status`, call `create!`:
41
41
 
42
42
  ```ruby
43
- Jobba::Status.create!
43
+ Jobba.create!
44
44
  ```
45
45
 
46
46
  If you are looking for a status:
47
47
 
48
48
  ```ruby
49
- Jobba::Status.find(id)
49
+ Jobba.find(id)
50
50
  ```
51
51
 
52
52
  which will return `nil` if no such `Status` is found. If you always want a `Status` object back,
53
53
  call:
54
54
 
55
55
  ```ruby
56
- Jobba::Status.find!(id)
56
+ Jobba.find!(id)
57
57
  ```
58
58
 
59
59
  The result of `find!` will start in an `unknown` state if the ID doesn't exist in Redis.
@@ -63,7 +63,7 @@ The result of `find!` will start in an `unknown` state if the ID doesn't exist i
63
63
  ```ruby
64
64
  class MyJob < ::ActiveJob::Base
65
65
  def self.perform_later(an_arg:, another_arg:)
66
- status = Jobba::Status.create!
66
+ status = Jobba.create!
67
67
  args.push(status.id)
68
68
 
69
69
  # In theory we'd mark as queued right after the call to super, but this messes
@@ -77,7 +77,7 @@ class MyJob < ::ActiveJob::Base
77
77
 
78
78
  def perform(*args, &block)
79
79
  # Pop the ID argument added by perform_later and get a Status
80
- status = Jobba::Status.find!(args.pop)
80
+ status = Jobba.find!(args.pop)
81
81
  status.started!
82
82
 
83
83
  # ... do stuff ...
@@ -462,8 +462,3 @@ Travis runs the specs with both `fakeredis` and real Redis.
462
462
  1. Provide job min, max, and average durations.
463
463
  8. Specs that test scale.
464
464
  9. Move redis code in `set_job_args`, `set_job_name`, and `save` into `set` to match rest of code.
465
-
466
-
467
-
468
-
469
-
@@ -1,3 +1,6 @@
1
+ require 'forwardable'
2
+ require 'securerandom'
3
+
1
4
  require "redis"
2
5
  require "redis-namespace"
3
6
 
@@ -14,12 +17,10 @@ require "jobba/query"
14
17
 
15
18
  module Jobba
16
19
 
17
- def self.all
18
- Query.new
19
- end
20
+ class << self
21
+ extend Forwardable
20
22
 
21
- def self.where(*args)
22
- all.where(*args)
23
+ def_delegators Jobba::Status, :all, :where, :create, :create!, :find, :find!
23
24
  end
24
25
 
25
26
  def self.configure
@@ -6,6 +6,14 @@ module Jobba
6
6
 
7
7
  include Jobba::Common
8
8
 
9
+ def self.all
10
+ Query.new
11
+ end
12
+
13
+ def self.where(*args)
14
+ all.where(*args)
15
+ end
16
+
9
17
  def self.create!
10
18
  create(state: State::UNQUEUED)
11
19
  end
@@ -211,7 +219,7 @@ module Jobba
211
219
  @state = attrs[:state] || State::UNKNOWN
212
220
  @progress = attrs[:progress] || 0
213
221
  @errors = attrs[:errors] || []
214
- @data = attrs[:data] || {}
222
+ @data = attrs[:data]
215
223
  @attempt = attrs[:attempt] || 0
216
224
  @job_args = attrs[:job_args] || {}
217
225
  @job_name = attrs[:job_name]
@@ -1,3 +1,3 @@
1
1
  module Jobba
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobba
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis