kanban 0.5.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/kanban.gemspec +3 -3
- data/lib/kanban.rb +26 -0
- data/spec/kanban_spec.rb +51 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6f0f321b90145bc913fab9ee5b932908d16d2e8
|
4
|
+
data.tar.gz: 8f015ee628cc53a95d702f646a15ec6d7a47188c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f51ccf582a838859c987187938554200e9a5ac471221a9928994cf46e370b8b1174ba4d168831ed6f1b3a55e77aabbf31727419bc1c2b4122830f9af62eb064
|
7
|
+
data.tar.gz: 796f6ca6814a854ac62163a3142daff394bde399b12280594f9cb7d3583f45d443c76f56ba0d17cf8d970142217b29f980da3969097fcbed2a68daef2bdfe9af
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
data/kanban.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: kanban 0.
|
5
|
+
# stub: kanban 0.7.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "kanban"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.7.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Chris Olstrom"]
|
14
|
-
s.date = "2015-05-
|
14
|
+
s.date = "2015-05-30"
|
15
15
|
s.description = "Because your code totally needed an Agile Workflow"
|
16
16
|
s.email = "chris@olstrom.com"
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/kanban.rb
CHANGED
@@ -60,5 +60,31 @@ module Kanban
|
|
60
60
|
def completed?(id)
|
61
61
|
@backend.getbit("#{@queue}:completed", id) == 1
|
62
62
|
end
|
63
|
+
|
64
|
+
def unworkable(id)
|
65
|
+
@backend.setbit("#{@queue}:unworkable", id, 1).zero?
|
66
|
+
end
|
67
|
+
|
68
|
+
def unworkable?(id)
|
69
|
+
@backend.getbit("#{@queue}:unworkable", id) == 1
|
70
|
+
end
|
71
|
+
|
72
|
+
def done?(id)
|
73
|
+
completed?(id) || unworkable?(id)
|
74
|
+
end
|
75
|
+
|
76
|
+
def release(id)
|
77
|
+
expire_claim id
|
78
|
+
@backend.lrem("#{@queue}:doing", 0, id) > 0
|
79
|
+
end
|
80
|
+
|
81
|
+
def expire_claim(id)
|
82
|
+
@backend.expire "#{@item}:#{id}:claimed", 0
|
83
|
+
end
|
84
|
+
|
85
|
+
def requeue(id)
|
86
|
+
release id
|
87
|
+
@backend.lpush("#{@queue}:todo", id) > 0
|
88
|
+
end
|
63
89
|
end
|
64
90
|
end
|
data/spec/kanban_spec.rb
CHANGED
@@ -4,6 +4,8 @@ require 'timeout'
|
|
4
4
|
describe 'Backlog' do
|
5
5
|
before do
|
6
6
|
@backlog = Kanban::Backlog.new backend: Redis.new, namespace: 'kanban:test'
|
7
|
+
task = { 'test' => 'data' }
|
8
|
+
5.times { @backlog.add(task) }
|
7
9
|
end
|
8
10
|
|
9
11
|
after(:all) do
|
@@ -81,15 +83,13 @@ describe 'Backlog' do
|
|
81
83
|
|
82
84
|
it 'should track the claim separately from the queue it is in' do
|
83
85
|
id = @backlog.claim
|
84
|
-
|
85
|
-
expect(redis.exists("#{@backlog.item}:#{id}:claimed")).to be true
|
86
|
+
expect(@backlog.claimed?(id)).to be true
|
86
87
|
end
|
87
88
|
|
88
89
|
it 'should allow claims to expire' do
|
89
90
|
id = @backlog.claim(duration: 1)
|
90
91
|
sleep 1.1
|
91
|
-
|
92
|
-
expect(redis.exists("#{@backlog.item}:#{id}:claimed")).to be false
|
92
|
+
expect(@backlog.claimed?(id)).to be false
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'should block if there are no pending tasks' do
|
@@ -103,8 +103,6 @@ describe 'Backlog' do
|
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'should report if a task is claimed' do
|
106
|
-
task = { 'test' => 'data' }
|
107
|
-
5.times { @backlog.add(task) }
|
108
106
|
id = @backlog.claim
|
109
107
|
expect(@backlog.claimed?(id)).to be true
|
110
108
|
expect(@backlog.claimed?(0)).to be false
|
@@ -125,4 +123,51 @@ describe 'Backlog' do
|
|
125
123
|
@backlog.complete 2
|
126
124
|
expect(@backlog.completed?(2)).to be true
|
127
125
|
end
|
126
|
+
|
127
|
+
it 'should allow indicating a task should not be retried' do
|
128
|
+
expect(@backlog.unworkable(3)).to be true
|
129
|
+
expect(@backlog.unworkable(3)).to be false
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should check if a task is unworkable' do
|
133
|
+
expect(@backlog.unworkable?(4)).to be false
|
134
|
+
@backlog.unworkable 4
|
135
|
+
expect(@backlog.unworkable?(4)).to be true
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'should consider a task that is completed or unworkable to be done' do
|
139
|
+
expect(@backlog.done?(0)).to be false
|
140
|
+
@backlog.complete(5)
|
141
|
+
expect(@backlog.done?(5)).to be true
|
142
|
+
@backlog.unworkable(6)
|
143
|
+
expect(@backlog.done?(6)).to be true
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'should be able to release a task from being in progress' do
|
147
|
+
id = @backlog.claim
|
148
|
+
expect(@backlog.release(id)).to be true
|
149
|
+
expect(@backlog.release(id)).to be false
|
150
|
+
expect(@backlog.doing).to_not include(id)
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'should be able to forcibly expire a claim' do
|
154
|
+
expect(@backlog.expire_claim(0)).to be false
|
155
|
+
id = @backlog.claim
|
156
|
+
expect(@backlog.expire_claim(id)).to be true
|
157
|
+
expect(@backlog.claimed?(id)).to be false
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'should expire any active claims when a task is released' do
|
161
|
+
id = @backlog.claim
|
162
|
+
expect(@backlog.claimed?(id)).to be true
|
163
|
+
@backlog.release(id)
|
164
|
+
expect(@backlog.claimed?(id)).to be false
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'should be able to requeue a task' do
|
168
|
+
id = @backlog.claim
|
169
|
+
expect(@backlog.requeue(id)).to be true
|
170
|
+
expect(@backlog.todo).to include(id)
|
171
|
+
expect(@backlog.doing).to_not include(id)
|
172
|
+
end
|
128
173
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kanban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Olstrom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|