kanban_metrics 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.editorconfig +10 -0
- data/.rspec +1 -0
- data/LICENSE.md +596 -0
- data/README.md +0 -0
- data/bin/kanban_metrics +25 -0
- data/kanban_metrics.gemspec +28 -0
- data/lib/kanban_metrics.rb +13 -0
- data/lib/kanban_metrics/chart_data_helper.rb +11 -0
- data/lib/kanban_metrics/commands/cfd.rb +56 -0
- data/lib/kanban_metrics/commands/cfd_view.rb +11 -0
- data/lib/kanban_metrics/commands/io.rb +43 -0
- data/lib/kanban_metrics/commands/io_view.rb +12 -0
- data/lib/kanban_metrics/commands/leadtime.rb +41 -0
- data/lib/kanban_metrics/commands/leadtime_view.rb +11 -0
- data/lib/kanban_metrics/csv_loader.rb +19 -0
- data/lib/kanban_metrics/date_helper.rb +12 -0
- data/lib/kanban_metrics/version.rb +3 -0
- data/lib/kanban_metrics/work_item.rb +23 -0
- data/spec/acceptance/command_line.feature +119 -0
- data/spec/acceptance/steps/command_line_steps.rb +23 -0
- data/spec/kanban_metrics/chart_data_helper_spec.rb +11 -0
- data/spec/kanban_metrics/commands/cfd_spec.rb +35 -0
- data/spec/kanban_metrics/commands/cfd_view_spec.rb +16 -0
- data/spec/kanban_metrics/commands/io_spec.rb +24 -0
- data/spec/kanban_metrics/commands/io_view_spec.rb +17 -0
- data/spec/kanban_metrics/commands/leadtime_spec.rb +26 -0
- data/spec/kanban_metrics/commands/leadtime_view_spec.rb +16 -0
- data/spec/kanban_metrics/csv_loader_spec.rb +28 -0
- data/spec/kanban_metrics/date_helper_spec.rb +10 -0
- data/spec/kanban_metrics/work_item_spec.rb +20 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/turnip_helper.rb +1 -0
- metadata +163 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module CommandLineSteps
|
4
|
+
step "the line in :filename :line" do |filename, line|
|
5
|
+
File.open(filename, 'a') do |file|
|
6
|
+
file.puts line
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
step "I run the command :command" do |command|
|
11
|
+
@output = exec(command)
|
12
|
+
end
|
13
|
+
|
14
|
+
step "I see :output" do |output|
|
15
|
+
@output.should eql(output.split('\n'))
|
16
|
+
end
|
17
|
+
|
18
|
+
step "I delete :filename" do |filename|
|
19
|
+
FileUtils.rm_f(filename)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
RSpec.configure { |c| c.include CommandLineSteps }
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module KanbanMetrics
|
4
|
+
describe ChartDataHelper do
|
5
|
+
it "should return the same content but ordered by key" do
|
6
|
+
chart_data = {"1" => "1", "3" => "3", "2" => "2"}
|
7
|
+
sorted_chart_data = ChartDataHelper.sort(chart_data)
|
8
|
+
assert_hash_order_matters(sorted_chart_data, {"1" => "1", "2" => "2", "3" => "3"})
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module KanbanMetrics
|
4
|
+
module Commands
|
5
|
+
describe Cfd do
|
6
|
+
before(:each) do
|
7
|
+
@work_item1 = WorkItem.new({:committed => "2013-01-02", :started => "2013-01-02", :finished => "2013-01-04", :delivered => "2013-01-05" })
|
8
|
+
@work_item2 = WorkItem.new({:committed => "2013-01-02", :started => "2013-01-03", :finished => "2013-01-05", :delivered => "2013-01-05" })
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should create chart data for a work item" do
|
12
|
+
chart_data = Cfd.new.execute([@work_item1])
|
13
|
+
assert_hash_order_matters(chart_data, {Date.parse("2013-01-02") => [1,1,0,0], Date.parse("2013-01-04") => [1,1,1,0], Date.parse("2013-01-05") => [1,1,1,1]})
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should create chart data for two work items" do
|
17
|
+
chart_data = Cfd.new.execute([@work_item1, @work_item2])
|
18
|
+
assert_hash_order_matters(chart_data, {Date.parse("2013-01-02") => [2,1,0,0], Date.parse("2013-01-03") => [2,2,0,0], Date.parse("2013-01-04") => [2,2,1,0], Date.parse("2013-01-05") => [2,2,2,2]})
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should create chart data for a shorter range than the work items determine" do
|
22
|
+
chart_data = Cfd.new.execute([@work_item1, @work_item2], Date.parse("2013-01-02"), Date.parse("2013-01-03"))
|
23
|
+
assert_hash_order_matters(chart_data, {Date.parse("2013-01-02") => [2,1,0,0], Date.parse("2013-01-03") => [2,2,0,0]})
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should create chart data for partial data set" do
|
27
|
+
work_item1 = WorkItem.new({:committed => "2013-01-02", :started => "2013-01-02"})
|
28
|
+
work_item2 = WorkItem.new({:committed => "2013-01-02", :started => "2013-01-03", :finished => "2013-01-05" })
|
29
|
+
|
30
|
+
chart_data = Cfd.new.execute([work_item1, work_item2])
|
31
|
+
assert_hash_order_matters(chart_data, {Date.parse("2013-01-02") => [2,1,0,0], Date.parse("2013-01-03") => [2,2,0,0], Date.parse("2013-01-05") => [2,2,1,0]})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module KanbanMetrics
|
4
|
+
module Commands
|
5
|
+
describe CfdView do
|
6
|
+
it "should print out the chart data in csv" do
|
7
|
+
chart_data = {Date.parse("2013-01-01") => [1,0,0,0], Date.parse("2013-01-02") => [1,1,0,0]}
|
8
|
+
|
9
|
+
STDOUT.should_receive(:puts).with("2013-01-01,1,0,0,0")
|
10
|
+
STDOUT.should_receive(:puts).with("2013-01-02,1,1,0,0")
|
11
|
+
|
12
|
+
CfdView.new.render(chart_data)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module KanbanMetrics
|
3
|
+
module Commands
|
4
|
+
describe Io do
|
5
|
+
before(:each) do
|
6
|
+
@work_item1 = WorkItem.new({:started => "2013-01-02", :delivered => "2013-01-05" })
|
7
|
+
@work_item2 = WorkItem.new({:started => "2013-01-02", :delivered => "2013-01-02" })
|
8
|
+
@work_item3 = WorkItem.new({:started => "2013-01-06", :delivered => "2013-01-08" })
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return in and out by week" do
|
12
|
+
work_items = [@work_item1, @work_item2, @work_item3]
|
13
|
+
chart_data = Io.new.execute(work_items)
|
14
|
+
assert_hash_order_matters(chart_data, {"2013-1" => [3,2], "2013-2" => [0,1]})
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return in and out for a time range" do
|
18
|
+
work_items = [@work_item1, @work_item2, @work_item3]
|
19
|
+
chart_data = Io.new.execute(work_items, Date.parse("2013-01-03"), Date.parse("2013-01-04"))
|
20
|
+
assert_hash_order_matters(chart_data, {"2013-1" => [3,2]})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module KanbanMetrics
|
4
|
+
module Commands
|
5
|
+
describe IoView do
|
6
|
+
it "should print out the chart data in csv" do
|
7
|
+
chart_data = {"2013-01" => [1,0], "2013-02" => [1,1]}
|
8
|
+
|
9
|
+
STDOUT.should_receive(:puts).with("week, in, out")
|
10
|
+
STDOUT.should_receive(:puts).with("2013-01,1,0")
|
11
|
+
STDOUT.should_receive(:puts).with("2013-02,1,1")
|
12
|
+
|
13
|
+
IoView.new.render(chart_data)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module KanbanMetrics
|
4
|
+
module Commands
|
5
|
+
describe Leadtime do
|
6
|
+
before(:each) do
|
7
|
+
@work_item1 = WorkItem.new({:committed => "2013-01-02", :delivered => "2013-01-05" })
|
8
|
+
@work_item2 = WorkItem.new({:committed => "2013-01-02", :delivered => "2013-01-02" })
|
9
|
+
@work_item3 = WorkItem.new({:committed => "2013-01-02", :delivered => "2013-01-04" })
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should return distribution" do
|
13
|
+
work_items = [@work_item1, @work_item2, @work_item3]
|
14
|
+
chart_data = Leadtime.new.execute(work_items)
|
15
|
+
assert_hash_order_matters(chart_data, {1=>1, 3 => 2})
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should leave out unfinished items from chart_data" do
|
19
|
+
work_item2 = WorkItem.new({:committed => "2013-01-02" })
|
20
|
+
work_items = [@work_item1, work_item2, @work_item3]
|
21
|
+
chart_data = Leadtime.new.execute(work_items, Date.parse("2013-01-02"), Date.parse("2013-01-05"))
|
22
|
+
assert_hash_order_matters(chart_data, {3 => 2})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module KanbanMetrics
|
4
|
+
module Commands
|
5
|
+
describe LeadtimeView do
|
6
|
+
it "should print out the chart data in csv" do
|
7
|
+
chart_data = {2 => 3, 3 => 4}
|
8
|
+
|
9
|
+
STDOUT.should_receive(:puts).with("2,3")
|
10
|
+
STDOUT.should_receive(:puts).with("3,4")
|
11
|
+
|
12
|
+
LeadtimeView.new.render(chart_data)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module KanbanMetrics
|
4
|
+
describe CsvLoader do
|
5
|
+
it "should load work items from csv file" do
|
6
|
+
filename = "dummy.csv"
|
7
|
+
CSV.stub(:foreach).with(filename, {:force_quotes => true, :headers => true}).and_yield(
|
8
|
+
CSV::Row.new(["id","committed","done", "back count"],[], true)).and_yield(
|
9
|
+
CSV::Row.new(["id","committed","done", "back count"],["2", "2013-01-01", "2013-01-02", "0"], false))
|
10
|
+
|
11
|
+
work_items = CsvLoader.new.load(filename)
|
12
|
+
|
13
|
+
work_items.size.should eql(1)
|
14
|
+
work_items[0].committed.should eql(Date.parse("2013-01-01"))
|
15
|
+
work_items[0].back_count.should eql("0")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should skip empty cells" do
|
19
|
+
filename = "dummy.csv"
|
20
|
+
CSV.stub(:foreach).with(filename, {:force_quotes => true, :headers => true}).and_yield(
|
21
|
+
CSV::Row.new(["id","committed","done", "back count"],[], true)).and_yield(
|
22
|
+
CSV::Row.new(["id","committed","done", "back count"],["2", "", "2013-01-02", "0"], false))
|
23
|
+
|
24
|
+
work_items = CsvLoader.new.load(filename)
|
25
|
+
work_items[0].committed.should be_nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module KanbanMetrics
|
4
|
+
describe DateHelper do
|
5
|
+
it "should return the number of weekdays (no weekends)" do
|
6
|
+
days = DateHelper.weekdays_in_date_range(Date.parse("2013-01-01")..Date.parse("2013-01-08"))
|
7
|
+
days.should eql(6)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module KanbanMetrics
|
4
|
+
describe WorkItem do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@work_item = WorkItem.new({:id => "id", :committed => "2011-05-18", :started => "2011-05-20", :finished => "2011-05-20", :type => "type"})
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#create" do
|
11
|
+
it "should store every detail" do
|
12
|
+
@work_item.id.should eql('id')
|
13
|
+
@work_item.committed.should eql(Date.parse('2011-05-18'))
|
14
|
+
@work_item.started.should eql(Date.parse('2011-05-20'))
|
15
|
+
@work_item.finished.should eql(Date.parse('2011-05-20'))
|
16
|
+
@work_item.type.should eql('type')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'kanban_metrics'
|
2
|
+
require 'rspec'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require "debugger"
|
6
|
+
rescue LoadError
|
7
|
+
# most probably using 1.8
|
8
|
+
require "ruby-debug"
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'open3'
|
12
|
+
def exec(command)
|
13
|
+
stdin, stdout, stderr = Open3.popen3("#{command}")
|
14
|
+
error = stderr.readlines.map {|line| line.chomp}.join("\n")
|
15
|
+
raise error unless error.empty?
|
16
|
+
stdout.readlines.map {|line| line.gsub(/\n/,"")}
|
17
|
+
end
|
18
|
+
|
19
|
+
def assert_hash_order_matters(hash1, hash2)
|
20
|
+
hash1.keys.to_a.flatten.should eql(hash2.keys.to_a.flatten)
|
21
|
+
hash1.should eql(hash2)
|
22
|
+
end
|
23
|
+
|
24
|
+
def fs_test_path
|
25
|
+
"test_data_public"
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir.glob("spec/acceptance/steps/**/*_steps.rb") { |f| load f, true }
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kanban_metrics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Zsolt Fabok
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-09-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.12'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.12'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: turnip
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.1.0
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 10.0.3
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 10.0.3
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: simplecov
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.7.1
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.7.1
|
78
|
+
description: A simple tool for processing data from the Kanban board (in csv) and
|
79
|
+
providing metrics
|
80
|
+
email: me@zsoltfabok.com
|
81
|
+
executables:
|
82
|
+
- kanban_metrics
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- .editorconfig
|
87
|
+
- .rspec
|
88
|
+
- LICENSE.md
|
89
|
+
- README.md
|
90
|
+
- bin/kanban_metrics
|
91
|
+
- kanban_metrics.gemspec
|
92
|
+
- lib/kanban_metrics.rb
|
93
|
+
- lib/kanban_metrics/chart_data_helper.rb
|
94
|
+
- lib/kanban_metrics/commands/cfd.rb
|
95
|
+
- lib/kanban_metrics/commands/cfd_view.rb
|
96
|
+
- lib/kanban_metrics/commands/io.rb
|
97
|
+
- lib/kanban_metrics/commands/io_view.rb
|
98
|
+
- lib/kanban_metrics/commands/leadtime.rb
|
99
|
+
- lib/kanban_metrics/commands/leadtime_view.rb
|
100
|
+
- lib/kanban_metrics/csv_loader.rb
|
101
|
+
- lib/kanban_metrics/date_helper.rb
|
102
|
+
- lib/kanban_metrics/version.rb
|
103
|
+
- lib/kanban_metrics/work_item.rb
|
104
|
+
- spec/acceptance/command_line.feature
|
105
|
+
- spec/acceptance/steps/command_line_steps.rb
|
106
|
+
- spec/kanban_metrics/chart_data_helper_spec.rb
|
107
|
+
- spec/kanban_metrics/commands/cfd_spec.rb
|
108
|
+
- spec/kanban_metrics/commands/cfd_view_spec.rb
|
109
|
+
- spec/kanban_metrics/commands/io_spec.rb
|
110
|
+
- spec/kanban_metrics/commands/io_view_spec.rb
|
111
|
+
- spec/kanban_metrics/commands/leadtime_spec.rb
|
112
|
+
- spec/kanban_metrics/commands/leadtime_view_spec.rb
|
113
|
+
- spec/kanban_metrics/csv_loader_spec.rb
|
114
|
+
- spec/kanban_metrics/date_helper_spec.rb
|
115
|
+
- spec/kanban_metrics/work_item_spec.rb
|
116
|
+
- spec/spec_helper.rb
|
117
|
+
- spec/turnip_helper.rb
|
118
|
+
homepage: https://github.com/ZsoltFabok/kanban_metrics
|
119
|
+
licenses:
|
120
|
+
- GPLv3
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
segments:
|
132
|
+
- 0
|
133
|
+
hash: 2875506641942411674
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
segments:
|
141
|
+
- 0
|
142
|
+
hash: 2875506641942411674
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 1.8.23
|
146
|
+
signing_key:
|
147
|
+
specification_version: 3
|
148
|
+
summary: kanban_metrics-0.1.0
|
149
|
+
test_files:
|
150
|
+
- spec/acceptance/command_line.feature
|
151
|
+
- spec/acceptance/steps/command_line_steps.rb
|
152
|
+
- spec/kanban_metrics/chart_data_helper_spec.rb
|
153
|
+
- spec/kanban_metrics/commands/cfd_spec.rb
|
154
|
+
- spec/kanban_metrics/commands/cfd_view_spec.rb
|
155
|
+
- spec/kanban_metrics/commands/io_spec.rb
|
156
|
+
- spec/kanban_metrics/commands/io_view_spec.rb
|
157
|
+
- spec/kanban_metrics/commands/leadtime_spec.rb
|
158
|
+
- spec/kanban_metrics/commands/leadtime_view_spec.rb
|
159
|
+
- spec/kanban_metrics/csv_loader_spec.rb
|
160
|
+
- spec/kanban_metrics/date_helper_spec.rb
|
161
|
+
- spec/kanban_metrics/work_item_spec.rb
|
162
|
+
- spec/spec_helper.rb
|
163
|
+
- spec/turnip_helper.rb
|