tps_reporter 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,3 +1,17 @@
1
+ v0.2.2 - Dec 23, 2012
2
+ ---------------------
3
+
4
+ ### Fixes:
5
+
6
+ * Fixed bug where a parent task is assigned to one sprint, and its children in
7
+ another, points for the sprints aren't reported properly.
8
+
9
+ ### Internals:
10
+
11
+ * Task: implement `Task#to_markdown` for testing.
12
+ * Tests: move fixtures to `test/fixtures/`.
13
+ * Tests: use `assert_equal`.
14
+
1
15
  v0.2.0 - Nov 24, 2012
2
16
  ---------------------
3
17
 
data/README.md CHANGED
@@ -86,3 +86,17 @@ looks like this:
86
86
  ![Comamnd line reporter][cli]
87
87
 
88
88
  [cli]: https://img.skitch.com/20120204-ccb2guerhrjmj3rht3e4ies4ur.png
89
+
90
+ Development notes
91
+ -----------------
92
+
93
+ Releasing the gem:
94
+
95
+ $ vim lib/tps/version.rb # Bump version
96
+ $ git clog # Mini utility to write changelog
97
+ $ vim HISTORY.md # Fix up changelog
98
+ $ git release v0.X.X # github.com/visionmedia/git-extras
99
+
100
+ $ rm *.gem
101
+ $ gem build *.gemspec
102
+ $ gem push *.gem
data/lib/tps/sprint.rb CHANGED
@@ -20,7 +20,7 @@ module TPS
20
20
  end
21
21
 
22
22
  def points
23
- sublist ? sublist.points : 0.0
23
+ sublist ? sublist.points_for(self) : 0.0
24
24
  end
25
25
 
26
26
  def points_done
data/lib/tps/task.rb CHANGED
@@ -93,6 +93,16 @@ module TPS
93
93
  end
94
94
  end
95
95
 
96
+ def points_for(sprint)
97
+ if tasks?
98
+ tasks.inject(0.0) { |pts, task| pts + task.points_for(sprint) }
99
+ elsif sprint? && self.sprint.id == sprint.id
100
+ @points || 1.0
101
+ else
102
+ 0
103
+ end
104
+ end
105
+
96
106
  def points_done
97
107
  points * percent
98
108
  end
@@ -282,6 +292,26 @@ module TPS
282
292
  tpl.evaluate({}, list: self)
283
293
  end
284
294
 
295
+ def inspekt
296
+ [
297
+ root? ? "__Root__" : name,
298
+ ("(%ipt)" % [points]),
299
+ ("- %s" % [sprint.id] if sprint?)
300
+ ].compact.join(" ")
301
+ end
302
+
303
+ # Returns it as a simple markdown string. Great for tests.
304
+ #
305
+ def to_markdown
306
+ str = " - #{inspekt}"
307
+
308
+ if tasks?
309
+ str += "\n" + tasks.map { |t| t.to_markdown.gsub(/^/, " ") }.join("\n")
310
+ end
311
+
312
+ str
313
+ end
314
+
285
315
  private
286
316
 
287
317
  def is_milestone?(str)
data/lib/tps/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module TPS
2
2
  def self.version
3
- "0.2.0"
3
+ "0.2.2"
4
4
  end
5
5
  end
File without changes
@@ -0,0 +1,24 @@
1
+ Sprints:
2
+ s1: One
3
+ s2: Two
4
+ s3: Three
5
+ s4: Four
6
+ s5: Five
7
+
8
+ First release:
9
+ Account management:
10
+ _: [s1]
11
+ Login: [s2]
12
+ Signup: [s2]
13
+ Register: [s2]
14
+ Forgot password:
15
+
16
+ Blogging:
17
+ _: [s3]
18
+ Post creation:
19
+ _: [s4]
20
+ Database models: [s5]
21
+ Publication date: [2.5pts]
22
+
23
+
24
+
File without changes
data/test/sprint_test.rb CHANGED
@@ -1,64 +1,92 @@
1
1
  require File.expand_path('../test_helper', __FILE__)
2
2
 
3
3
  class SprintTest < UnitTest
4
- setup do
5
- @list = TPS::TaskList.new yaml: f('sprints.yml')
6
- @milestone = @list.tasks.first
7
- @s1 = @list.sprints['s1']
8
- @s2 = @list.sprints['s2']
9
- end
4
+ context "Basic sprints" do
5
+ setup do
6
+ @list = TPS::TaskList.new yaml: f('sprints.yml')
7
+ @milestone = @list.tasks.first
8
+ @s1 = @list.sprints['s1']
9
+ @s2 = @list.sprints['s2']
10
+ end
10
11
 
11
- test "Sprints" do
12
- assert @list.sprints.size == 2
13
- assert @s1.name == 'Sprint one'
14
- assert @s2.name == 'Sprint two'
15
- end
12
+ test "Sprints" do
13
+ assert_equal 2, @list.sprints.size
14
+ assert_equal 'Sprint one', @s1.name
15
+ assert_equal 'Sprint two', @s2.name
16
+ end
16
17
 
17
- test "Sprint model attributes" do
18
- sprint = @list.sprints['s1']
19
- assert sprint.name == 'Sprint one'
20
- assert sprint.list == @list
21
- end
18
+ test "Sprint model attributes" do
19
+ sprint = @list.sprints['s1']
20
+ assert_equal 'Sprint one', sprint.name
21
+ assert_equal @list, sprint.list
22
+ end
22
23
 
23
- test "Tasks should be assigned to sprints" do
24
- assert @list['Version 1']['Account']['Login'].sprint == @s1
25
- end
24
+ test "Tasks should be assigned to sprints" do
25
+ assert_equal @s1, @list['Version 1']['Account']['Login'].sprint
26
+ end
26
27
 
27
- test "Task#contains_sprint?" do
28
- assert @list.contains_sprint?(@s1)
29
- assert @list.contains_sprint?(@s2)
30
- end
28
+ test "Task#contains_sprint?" do
29
+ assert @list.contains_sprint?(@s1)
30
+ assert @list.contains_sprint?(@s2)
31
+ end
31
32
 
32
- test "Task#contains_sprint? part 2" do
33
- task = @list['Version 1']['Account']['Login']
34
- assert task.contains_sprint?(@s1)
35
- assert ! task.contains_sprint?(@s2)
36
- end
33
+ test "Task#contains_sprint? part 2" do
34
+ task = @list['Version 1']['Account']['Login']
35
+ assert task.contains_sprint?(@s1)
36
+ assert ! task.contains_sprint?(@s2)
37
+ end
37
38
 
38
- test "Task#filter_by_sprint" do
39
- list = @list.filter_by_sprint(@s1)
40
- assert ! list['Version 1']['Account']['Login'].nil?
41
- assert list['Version 1']['Account']['Signup'].nil?
42
- end
39
+ test "Task#filter_by_sprint" do
40
+ list = @list.filter_by_sprint(@s1)
41
+ assert ! list['Version 1']['Account']['Login'].nil?
42
+ assert list['Version 1']['Account']['Signup'].nil?
43
+ end
43
44
 
44
- test "Sub-tasks of a sprint task" do
45
- list = @list.filter_by_sprint(@s1)
46
- task = list['Version 1']['Comments']['Creating']
47
- assert ! task.nil?
48
- end
45
+ test "Sub-tasks of a sprint task" do
46
+ list = @list.filter_by_sprint(@s1)
47
+ task = list['Version 1']['Comments']['Creating']
48
+ assert ! task.nil?
49
+ end
49
50
 
50
- test "Sprint#index" do
51
- assert @list.sprints['s1'].index == 0
52
- assert @list.sprints['s2'].index == 1
53
- end
51
+ test "Sprint#index" do
52
+ assert_equal 0, @list.sprints['s1'].index
53
+ assert_equal 1, @list.sprints['s2'].index
54
+ end
55
+
56
+ test "Sprint#points" do
57
+ assert_equal 5, @s1.points
58
+ end
54
59
 
55
- test "Sprint#points" do
56
- assert @s1.points == 5
60
+ test "Sprint#points_done" do
61
+ assert_equal 3, @s1.points_done
62
+ end
57
63
  end
58
64
 
59
- test "Sprint#points_done" do
60
- assert @s1.points_done == 3
65
+ context "Sprint points" do
66
+ setup do
67
+ @list = TPS::TaskList.new yaml: f('sprint_points.yml')
68
+ @milestone = @list.tasks.first
69
+ @s = %w[_ s1 s2 s3 s4 s5].map { |id| @list.sprints[id] }
70
+ end
71
+
72
+ test "S1 points" do
73
+ assert_equal 1.0, @s[1].points
74
+ end
75
+
76
+ test "S2 points" do
77
+ assert_equal 3.0, @s[2].points
78
+ end
79
+
80
+ test "S3 points" do
81
+ assert_equal 0.0, @s[3].points
82
+ end
83
+
84
+ test "S4 points" do
85
+ assert_equal 2.5, @s[4].points
86
+ end
87
+
88
+ test "S5 points" do
89
+ assert_equal 1.0, @s[5].points
90
+ end
61
91
  end
62
92
  end
63
-
64
-
data/test/test_helper.rb CHANGED
@@ -8,6 +8,6 @@ class UnitTest < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def fixture_root
11
- File.expand_path('../', __FILE__)
11
+ File.expand_path('../fixtures', __FILE__)
12
12
  end
13
13
  end
data/test/tps_test.rb CHANGED
@@ -8,48 +8,48 @@ class MyTest < UnitTest
8
8
 
9
9
  test "Has tasks" do
10
10
  assert @list.tasks?
11
- assert @list.tasks.size == 2
11
+ assert_equal 2, @list.tasks.size
12
12
  assert @list.tasks.first.tasks.size >= 2
13
13
  end
14
14
 
15
15
  test "Explicit percent" do
16
16
  task = @milestone.tasks[0]
17
17
  assert task.in_progress?
18
- assert task.status == :in_progress
19
- assert task.percent == 0.25
18
+ assert_equal :in_progress, task.status
19
+ assert_equal 0.25, task.percent
20
20
  end
21
21
 
22
22
  test "Overriding percent" do
23
23
  task = @milestone.tasks[2]
24
- assert task.name == "Overridden percent"
24
+ assert_equal "Overridden percent", task.name
25
25
  assert task.in_progress?
26
- assert task.status == :in_progress
27
- assert task.percent == 0.5
26
+ assert_equal :in_progress, task.status
27
+ assert_equal 0.5, task.percent
28
28
  end
29
29
 
30
30
  test "Points" do
31
31
  task = @milestone.tasks[1]
32
- assert task.points == 2.0
32
+ assert_equal 2.0, task.points
33
33
  end
34
34
 
35
35
  test "Explicit points" do
36
36
  task = @milestone.tasks[3]
37
- assert task.points == 15
38
- assert task.percent == 0.75
39
- assert task.points_done == 11.25
37
+ assert_equal 15, task.points
38
+ assert_equal 0.75, task.percent
39
+ assert_equal 11.25, task.points_done
40
40
  end
41
41
 
42
42
  test "Compound points" do
43
43
  task = @milestone.tasks[4]
44
- assert task.points == 6
45
- assert task.percent == 0.50
44
+ assert_equal 6, task.points
45
+ assert_equal 0.50, task.percent
46
46
  end
47
47
 
48
48
  test "Point rescaling" do
49
49
  task = @milestone.tasks[5]
50
- assert task.points == 8
51
- assert task.points_done == 4.0
52
- assert task.percent == 0.5
50
+ assert_equal 8, task.points
51
+ assert_equal 4.0, task.points_done
52
+ assert_equal 0.5, task.percent
53
53
  end
54
54
 
55
55
  test "In progress" do
@@ -76,23 +76,25 @@ class MyTest < UnitTest
76
76
  end
77
77
 
78
78
  test "Lookup" do
79
- assert @list['Milestone 1'] == @milestone
79
+ assert_equal @milestone, @list['Milestone 1']
80
80
  end
81
81
 
82
82
  test "Task#breadcrumbs" do
83
83
  crumbs = @list['Milestone 1']['User login']['Signup'].breadcrumbs
84
- assert crumbs == [
84
+ expected = [
85
85
  @list['Milestone 1'],
86
86
  @list['Milestone 1']['User login'],
87
87
  @list['Milestone 1']['User login']['Signup']
88
88
  ]
89
+ assert_equal expected, crumbs
89
90
  end
90
91
 
91
92
  test "Task#breadcrumbs(false)" do
92
93
  crumbs = @list['Milestone 1']['User login']['Signup'].breadcrumbs(false)
93
- assert crumbs == [
94
+ expected = [
94
95
  @list['Milestone 1'],
95
96
  @list['Milestone 1']['User login']
96
97
  ]
98
+ assert_equal expected, crumbs
97
99
  end
98
100
  end
metadata CHANGED
@@ -1,48 +1,48 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tps_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
4
  prerelease:
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Rico Sta. Cruz
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-24 00:00:00.000000000 Z
12
+ date: 2012-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: tilt
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
15
+ version_requirements: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
20
+ none: false
21
+ name: tilt
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
24
+ requirement: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - ! '>='
28
27
  - !ruby/object:Gem::Version
29
28
  version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: contest
32
- requirement: !ruby/object:Gem::Requirement
33
29
  none: false
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
34
32
  requirements:
35
33
  - - ! '>='
36
34
  - !ruby/object:Gem::Version
37
35
  version: '0'
36
+ none: false
37
+ name: contest
38
38
  type: :development
39
39
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
40
+ requirement: !ruby/object:Gem::Requirement
42
41
  requirements:
43
42
  - - ! '>='
44
43
  - !ruby/object:Gem::Version
45
44
  version: '0'
45
+ none: false
46
46
  description: A YAML-powered, simple command-line task report builder.
47
47
  email:
48
48
  - rico@sinefunc.com
@@ -66,9 +66,10 @@ files:
66
66
  - lib/tps/task.rb
67
67
  - lib/tps/task_list.rb
68
68
  - lib/tps/version.rb
69
- - test/hello.yml
69
+ - test/fixtures/hello.yml
70
+ - test/fixtures/sprint_points.yml
71
+ - test/fixtures/sprints.yml
70
72
  - test/sprint_test.rb
71
- - test/sprints.yml
72
73
  - test/test_helper.rb
73
74
  - test/tps_test.rb
74
75
  - tps_reporter.gemspec
@@ -79,17 +80,17 @@ rdoc_options: []
79
80
  require_paths:
80
81
  - lib
81
82
  required_ruby_version: !ruby/object:Gem::Requirement
82
- none: false
83
83
  requirements:
84
84
  - - ! '>='
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
- required_rubygems_version: !ruby/object:Gem::Requirement
88
87
  none: false
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - ! '>='
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
+ none: false
93
94
  requirements: []
94
95
  rubyforge_project:
95
96
  rubygems_version: 1.8.23