pair_see 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +65 -0
- data/LICENSE.txt +21 -0
- data/README.md +106 -0
- data/Rakefile +1 -0
- data/TODO.md +6 -0
- data/bin/console +14 -0
- data/bin/pairsee +36 -0
- data/bin/setup +7 -0
- data/config/sample_config.yml +2 -0
- data/input/sample_input.log +1 -0
- data/lib/pair_see/card.rb +18 -0
- data/lib/pair_see/combo.rb +15 -0
- data/lib/pair_see/date_combo.rb +27 -0
- data/lib/pair_see/log_line.rb +54 -0
- data/lib/pair_see/log_lines.rb +49 -0
- data/lib/pair_see/seer.rb +134 -0
- data/lib/pair_see/version.rb +3 -0
- data/lib/pair_see.rb +1 -0
- data/pair_see.gemspec +31 -0
- data/starterfile.txt +1 -0
- metadata +196 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4468520de0bab522937f9add129ee9fcc5139248
|
4
|
+
data.tar.gz: fc21650e37c36b1c981458e7b9706309bb958fb9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3fc1a18cc03c97cc058020114b6a9e8dfb6a82cc1829726d1f56e750870067a64a198466b7102521a542a6fb8241aaf5e750a5cc4cbc5a49aeadb16b1b809821
|
7
|
+
data.tar.gz: 8b26eacc964788b574231ab8e6be2cc5521a3b38bd3bdb45b3aba484fdac7ecae6a4436a9efd1dde8cd85a83a0da643837cd03378c74c6150f05312325122172
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.1
|
data/.travis.yml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- "2.2.1"
|
4
|
+
script: CODECLIMATE_REPO_TOKEN=cdb26718880608c44fda7463511e0151140ade238d92cb1044892472da13ca48 bundle exec rake rspec
|
5
|
+
# script: CODECLIMATE_REPO_TOKEN=fdf133973df1a994c9201d11cb862686f00341915ba80834f7a6073f71a8a947 bundle exec rake
|
6
|
+
notifications:
|
7
|
+
email: false
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gemspec
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pair_see (0.1.0)
|
5
|
+
git
|
6
|
+
trollop
|
7
|
+
yamler
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
ast (2.0.0)
|
13
|
+
astrolabe (1.3.0)
|
14
|
+
parser (>= 2.2.0.pre.3, < 3.0)
|
15
|
+
codeclimate-test-reporter (0.4.7)
|
16
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
17
|
+
diff-lcs (1.2.5)
|
18
|
+
docile (1.1.5)
|
19
|
+
git (1.2.9.1)
|
20
|
+
multi_json (1.11.0)
|
21
|
+
parser (2.2.0.3)
|
22
|
+
ast (>= 1.1, < 3.0)
|
23
|
+
powerpack (0.1.0)
|
24
|
+
rainbow (2.0.0)
|
25
|
+
rake (10.4.2)
|
26
|
+
rake_commit (1.1.0)
|
27
|
+
rspec (3.2.0)
|
28
|
+
rspec-core (~> 3.2.0)
|
29
|
+
rspec-expectations (~> 3.2.0)
|
30
|
+
rspec-mocks (~> 3.2.0)
|
31
|
+
rspec-core (3.2.1)
|
32
|
+
rspec-support (~> 3.2.0)
|
33
|
+
rspec-expectations (3.2.0)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.2.0)
|
36
|
+
rspec-mocks (3.2.1)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.2.0)
|
39
|
+
rspec-support (3.2.2)
|
40
|
+
rubocop (0.29.1)
|
41
|
+
astrolabe (~> 1.3)
|
42
|
+
parser (>= 2.2.0.1, < 3.0)
|
43
|
+
powerpack (~> 0.1)
|
44
|
+
rainbow (>= 1.99.1, < 3.0)
|
45
|
+
ruby-progressbar (~> 1.4)
|
46
|
+
ruby-progressbar (1.7.1)
|
47
|
+
simplecov (0.9.2)
|
48
|
+
docile (~> 1.1.0)
|
49
|
+
multi_json (~> 1.0)
|
50
|
+
simplecov-html (~> 0.9.0)
|
51
|
+
simplecov-html (0.9.0)
|
52
|
+
trollop (2.1.1)
|
53
|
+
yamler (0.1.0)
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
|
58
|
+
DEPENDENCIES
|
59
|
+
bundler
|
60
|
+
codeclimate-test-reporter
|
61
|
+
pair_see!
|
62
|
+
rake
|
63
|
+
rake_commit
|
64
|
+
rspec
|
65
|
+
rubocop
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 compwron
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
# PairSee
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/github/compwron/pairSee/badges/gpa.svg)](https://codeclimate.com/github/compwron/pairSee)
|
4
|
+
[![Test Coverage](https://codeclimate.com/github/compwron/pairSee/badges/coverage.svg)](https://codeclimate.com/github/compwron/pairSee)
|
5
|
+
[![Build Status](https://travis-ci.org/compwron/pairSee.svg)](https://travis-ci.org/compwron/pairSee)
|
6
|
+
[![Dependency Status](https://gemnasium.com/compwron/pairSee.png)](https://gemnasium.com/compwron/pairSee)
|
7
|
+
|
8
|
+
|
9
|
+
Usage cases:
|
10
|
+
* See commit count for all devs and solo devs (in order by # of commits): $ pairsee --after 2012-10-01
|
11
|
+
* See what cards have been in play and for how long since given date: $ pairsee --cards --after 2012-10-01
|
12
|
+
* See all devs and what cards they have worked on since given date: $ pairsee --after 2013-11-01 -s
|
13
|
+
|
14
|
+
Example usage:
|
15
|
+
```
|
16
|
+
$ pairsee --root ../../my_code --after 2012-07-10 --config ../../foo/config/config.yml
|
17
|
+
$ pairsee --extras --root ../../my_code
|
18
|
+
$ pairsee --latest --after 2012-09-01 # this outputs pairings by most recent by all devs who have committed since given date (purpose of this is to exclude people who are no longer committers)
|
19
|
+
```
|
20
|
+
|
21
|
+
```
|
22
|
+
Options:
|
23
|
+
--root, -r <s>: Folder in which .git folder is (default: .)
|
24
|
+
--config, -c <s>: location of config file, example: ../../config/config.yml (default: bin/pairsee/../../config/config.yml)
|
25
|
+
--after, -a <s>: Date since which you want to get commits, in yyyy-mm-dd format (default: 0-1-1)
|
26
|
+
--extras, -e: See all commits without the name of any dev in them
|
27
|
+
--latest, -l: See dates of most recent commits by pairs
|
28
|
+
--recommended, -o: See active devs who have not paired (and therefore should)
|
29
|
+
--cards, -d: See cards and number of commits on each
|
30
|
+
--cards-per-person, -s: See cards for each dev
|
31
|
+
--help, -h: Show this message
|
32
|
+
```
|
33
|
+
|
34
|
+
to put on path:
|
35
|
+
```
|
36
|
+
cd pairSee
|
37
|
+
ln -s `pwd`/bin/pairsee ~/bin/pairsee
|
38
|
+
```
|
39
|
+
|
40
|
+
Run tests:
|
41
|
+
```
|
42
|
+
rspec
|
43
|
+
# or
|
44
|
+
rake_commit
|
45
|
+
```
|
46
|
+
|
47
|
+
Config file: `config/config.yml`
|
48
|
+
contains names and card prefix, a la
|
49
|
+
```
|
50
|
+
names: Person1 Person2 Person3
|
51
|
+
card_prefix: FOO-
|
52
|
+
```
|
53
|
+
|
54
|
+
So if your commit log looks like
|
55
|
+
```
|
56
|
+
"Bob/Alice [FOO-1] wrote code"
|
57
|
+
"Alice [FOO-1] stuff"
|
58
|
+
"Sarah|Alice [FOO-2] code and stuff"
|
59
|
+
```
|
60
|
+
|
61
|
+
Then your config file will look like:
|
62
|
+
```
|
63
|
+
names: Bob Alice Sarah
|
64
|
+
card_prefix: FOO-
|
65
|
+
```
|
66
|
+
|
67
|
+
To use PairSee with SVN, check out SVN codebase with git like: `git svn clone http://svn.example.com/project`
|
68
|
+
=======
|
69
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pair_see`. To experiment with that code, run `bin/console` for an interactive prompt.
|
70
|
+
|
71
|
+
TODO: Delete this and the text above, and describe your gem
|
72
|
+
>>>>>>> gem framework rename
|
73
|
+
|
74
|
+
## Installation
|
75
|
+
|
76
|
+
Add this line to your application's Gemfile:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
<<<<<<< HEAD
|
80
|
+
gem 'pairSee'
|
81
|
+
=======
|
82
|
+
gem 'pair_see'
|
83
|
+
>>>>>>> gem framework rename
|
84
|
+
```
|
85
|
+
|
86
|
+
And then execute:
|
87
|
+
|
88
|
+
$ bundle
|
89
|
+
|
90
|
+
Or install it yourself as:
|
91
|
+
|
92
|
+
<<<<<<< HEAD
|
93
|
+
$ gem install pairSee
|
94
|
+
=======
|
95
|
+
$ gem install pair_see
|
96
|
+
>>>>>>> gem framework rename
|
97
|
+
|
98
|
+
## Usage
|
99
|
+
|
100
|
+
TODO: Write usage instructions here
|
101
|
+
|
102
|
+
## Development
|
103
|
+
|
104
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
105
|
+
|
106
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/TODO.md
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'pair_see'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start
|
data/bin/pairsee
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/pair_see/seer'
|
4
|
+
require 'trollop'
|
5
|
+
|
6
|
+
opts = Trollop.options do
|
7
|
+
opt :root, 'Folder in which .git folder is', default: '.'
|
8
|
+
opt :config, 'location of config file, example: ../../config/config.yml', default: "#{__FILE__}/../../config/config.yml"
|
9
|
+
opt :after, 'Date since which you want to get commits, in yyyy-mm-dd format', default: '0-1-1'
|
10
|
+
opt :extras, 'See all commits without the name of any dev in them', default: false
|
11
|
+
opt :latest, 'See dates of most recent commits by pairs', default: false
|
12
|
+
opt :recommended, 'See active devs who have not paired (and therefore should)', default: false
|
13
|
+
opt :cards, 'See cards and number of commits on each', default: false
|
14
|
+
opt :cards_per_person, 'See cards for each dev', default: false
|
15
|
+
end
|
16
|
+
|
17
|
+
def run_command(opts)
|
18
|
+
log_lines = LogLines.new(opts[:root], opts[:after])
|
19
|
+
|
20
|
+
pair_see = Seer.new(log_lines, opts[:config])
|
21
|
+
if opts[:extras]
|
22
|
+
pair_see.commits_not_by_known_pair
|
23
|
+
elsif opts[:latest]
|
24
|
+
pair_see.all_most_recent_commits
|
25
|
+
elsif opts[:recommended]
|
26
|
+
pair_see.recommended_pairings
|
27
|
+
elsif opts[:cards]
|
28
|
+
pair_see.pretty_card_data
|
29
|
+
elsif opts[:cards_per_person]
|
30
|
+
pair_see.cards_per_person
|
31
|
+
else
|
32
|
+
pair_see.all_commits
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
puts run_command(opts).join("\n")
|
data/bin/setup
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
r1196 | committerID | 2013-08-20 18:13:44 -0500 (Tue, 20 Aug 2013) | 2 lines [cardNumber] Alice and Bob - commit message
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Card
|
2
|
+
attr_reader :card_name, :number_of_commits
|
3
|
+
|
4
|
+
def initialize(card_name, number_of_commits, first_date, last_date)
|
5
|
+
@card_name = card_name
|
6
|
+
@number_of_commits = number_of_commits
|
7
|
+
@first_date, @last_date = first_date, last_date
|
8
|
+
end
|
9
|
+
|
10
|
+
def duration
|
11
|
+
(@first_date - @last_date).to_i + 1
|
12
|
+
end
|
13
|
+
|
14
|
+
def ==(other)
|
15
|
+
card_name == other.card_name
|
16
|
+
number_of_commits == other.number_of_commits
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class DateCombo
|
2
|
+
attr_reader :date, :devs
|
3
|
+
|
4
|
+
def initialize(date, *devs)
|
5
|
+
@date, @devs = date, devs
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_s
|
9
|
+
if date.nil?
|
10
|
+
"#{devs.join ', '}: not yet"
|
11
|
+
else
|
12
|
+
"#{devs.join ', '}: #{date}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def <=>(other)
|
17
|
+
if date && other.date
|
18
|
+
date <=> other.date
|
19
|
+
elsif date
|
20
|
+
1
|
21
|
+
elsif other.date
|
22
|
+
-1
|
23
|
+
else
|
24
|
+
0
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'time'
|
2
|
+
class LogLine
|
3
|
+
attr_reader :line
|
4
|
+
|
5
|
+
def initialize(line)
|
6
|
+
@line = line
|
7
|
+
end
|
8
|
+
|
9
|
+
def authored_by?(*people)
|
10
|
+
people.empty? ? false : people.all? do |person|
|
11
|
+
/(^|\s+|\W)#{person}(\s+|$|\W)/i =~ line
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def contains_card?(card_prefix)
|
16
|
+
line.match(card_prefix)
|
17
|
+
end
|
18
|
+
|
19
|
+
def contains_card_name?(card_name)
|
20
|
+
git_regex = /#{card_name}[\]\s\[,:]/
|
21
|
+
git_matcher = line.match(git_regex)
|
22
|
+
!git_matcher.nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
def card_name(card_prefix)
|
26
|
+
regex = /(#{card_prefix}\d+)/
|
27
|
+
matcher = line.match(regex)
|
28
|
+
matcher.nil? ? nil : (line.match regex)[1]
|
29
|
+
end
|
30
|
+
|
31
|
+
def card_number(card_prefix)
|
32
|
+
card_num = card_name(card_prefix)
|
33
|
+
card_num ? card_num.gsub(card_prefix, '') : nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def merge_commit?
|
37
|
+
line.match('Merge remote-tracking branch') || line.match('Merge branch')
|
38
|
+
end
|
39
|
+
|
40
|
+
def date
|
41
|
+
regex = /(\d{4}-\d{2}-\d{2})/
|
42
|
+
matcher = line.match(regex)
|
43
|
+
part_to_parse = matcher.nil? ? '' : (line.match regex)[1]
|
44
|
+
Date.parse(part_to_parse)
|
45
|
+
end
|
46
|
+
|
47
|
+
def not_by_pair?(devs)
|
48
|
+
devs.any? { |dev| authored_by?(dev) || merge_commit? }
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_s
|
52
|
+
line
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative 'log_line'
|
2
|
+
require 'git'
|
3
|
+
|
4
|
+
class LogLines
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
def initialize(git_home, date_string)
|
8
|
+
@lines = _lines_from(git_home, date_string)
|
9
|
+
end
|
10
|
+
|
11
|
+
def _lines_from(git_home, date_string)
|
12
|
+
g = Git.open(git_home)
|
13
|
+
g.log.since(date_string).map do |l|
|
14
|
+
LogLine.new("#{l.date} #{l.message}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def each(&block)
|
19
|
+
lines.each &block
|
20
|
+
end
|
21
|
+
|
22
|
+
def last
|
23
|
+
lines.last
|
24
|
+
end
|
25
|
+
|
26
|
+
def active?(dev)
|
27
|
+
any? do |log_line|
|
28
|
+
log_line.authored_by?(dev)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def commits_for_pair(person1, person2)
|
33
|
+
select { |log_line| log_line.authored_by?(person1, person2) }
|
34
|
+
end
|
35
|
+
|
36
|
+
def commits_not_by_known_pair(devs)
|
37
|
+
reject { |log_line| log_line.not_by_pair? devs }
|
38
|
+
end
|
39
|
+
|
40
|
+
def solo_commits(devs, dev)
|
41
|
+
select do |log_line|
|
42
|
+
log_line.authored_by?(dev) && (devs - [dev]).none? { |d| log_line.authored_by?(d) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
attr_reader :lines
|
49
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
class Seer
|
2
|
+
require 'yamler'
|
3
|
+
require_relative 'combo'
|
4
|
+
require_relative 'date_combo'
|
5
|
+
require_relative 'log_lines'
|
6
|
+
require_relative 'card'
|
7
|
+
|
8
|
+
attr_reader :log_lines, :devs, :dev_pairs, :card_prefix
|
9
|
+
|
10
|
+
def initialize(log_lines, config_file)
|
11
|
+
@log_lines = log_lines
|
12
|
+
@devs = active_devs(config_file)
|
13
|
+
@dev_pairs = devs.combination(2)
|
14
|
+
@card_prefix = get_card_prefix(config_file)
|
15
|
+
end
|
16
|
+
|
17
|
+
def cards_per_person
|
18
|
+
@devs.map do |dev|
|
19
|
+
{ dev => cards_dev_worked_on(log_lines, dev) }
|
20
|
+
end.inject({}) do |result, element|
|
21
|
+
result.merge(element)
|
22
|
+
end.map do |dev_name, cards_worked|
|
23
|
+
{ dev_name => cards_worked.uniq }
|
24
|
+
end.inject({}) do |result, element|
|
25
|
+
result.merge(element)
|
26
|
+
end.map do|dev, cards|
|
27
|
+
"#{dev}: [#{cards.size} cards] #{cards.sort.join(', ')}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def cards_dev_worked_on(log_lines, dev)
|
32
|
+
log_lines.select do |log_line|
|
33
|
+
log_line.authored_by?(dev)
|
34
|
+
end.map do|log_line|
|
35
|
+
log_line.card_number(@card_prefix)
|
36
|
+
end.compact
|
37
|
+
end
|
38
|
+
|
39
|
+
def pretty_card_data
|
40
|
+
card_data(card_prefix).map do |card|
|
41
|
+
"#{card.card_name} - - - commits: #{card.number_of_commits} - - - duration: #{card.duration} days " unless card.nil?
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def card_data(card_prefix)
|
46
|
+
card_numbers(card_prefix).map do |card_name|
|
47
|
+
commits = commits_on_card(card_name)
|
48
|
+
Card.new(card_name, commits.count, commits.first.date, commits.last.date)
|
49
|
+
end.sort_by(&:duration).reverse
|
50
|
+
end
|
51
|
+
|
52
|
+
def commits_on_card(card_name)
|
53
|
+
log_lines.select { |line| line.contains_card_name?(card_name) }
|
54
|
+
end
|
55
|
+
|
56
|
+
def card_numbers(card_prefix)
|
57
|
+
log_lines.select do |line|
|
58
|
+
line.contains_card?(card_prefix)
|
59
|
+
end.map do |line|
|
60
|
+
line.card_name(card_prefix)
|
61
|
+
end.uniq.compact
|
62
|
+
end
|
63
|
+
|
64
|
+
def get_card_prefix(config_file)
|
65
|
+
config = YAML.load_file(config_file)
|
66
|
+
config['card_prefix']
|
67
|
+
end
|
68
|
+
|
69
|
+
def active_devs(config_file)
|
70
|
+
config = YAML.load_file(config_file)
|
71
|
+
devs_in_config = config['names'].split(' ')
|
72
|
+
devs_in_config.select do |dev|
|
73
|
+
is_active(dev)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def is_active(dev)
|
78
|
+
log_lines.active? dev
|
79
|
+
end
|
80
|
+
|
81
|
+
def pair_commits
|
82
|
+
dev_pairs.map do |person1, person2|
|
83
|
+
Combo.new(commits_for_pair(person1, person2).count, person1, person2)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def solo_commits
|
88
|
+
devs.map do |dev|
|
89
|
+
Combo.new(log_lines.solo_commits(devs, dev).count, dev)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def all_commits
|
94
|
+
(pair_commits + solo_commits).sort_by(&:count).reject(&:empty?).map(&:to_s)
|
95
|
+
end
|
96
|
+
|
97
|
+
def commits_for_pair(person1, person2)
|
98
|
+
log_lines.commits_for_pair person1, person2
|
99
|
+
end
|
100
|
+
|
101
|
+
def commits_not_by_known_pair
|
102
|
+
log_lines.commits_not_by_known_pair devs
|
103
|
+
end
|
104
|
+
|
105
|
+
def most_recent_commit_date(person1, person2)
|
106
|
+
recent_commit = commits_for_pair(person1, person2).sort_by(&:date).first
|
107
|
+
recent_commit ? recent_commit.date : nil
|
108
|
+
end
|
109
|
+
|
110
|
+
def all_most_recent_commits
|
111
|
+
dev_pairs.map do |person1, person2|
|
112
|
+
DateCombo.new(most_recent_commit_date(person1, person2), person1, person2)
|
113
|
+
end.sort.reverse.map &:to_s
|
114
|
+
end
|
115
|
+
|
116
|
+
def recommended_pairings
|
117
|
+
should_pair = unpaired_in_range
|
118
|
+
should_pair.empty? ? least_recent_pair : should_pair
|
119
|
+
end
|
120
|
+
|
121
|
+
def least_recent_pair
|
122
|
+
devs.select do |dev|
|
123
|
+
log_lines.last.line.match(dev)
|
124
|
+
end.join(', ')
|
125
|
+
end
|
126
|
+
|
127
|
+
def unpaired_in_range
|
128
|
+
dev_pairs.select do |person1, person2|
|
129
|
+
most_recent_commit_date(person1, person2).nil?
|
130
|
+
end.map do |person1, person2|
|
131
|
+
"#{person1}, #{person2}"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
data/lib/pair_see.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'pair_see/version.rb'
|
data/pair_see.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pair_see/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'pair_see'
|
8
|
+
spec.version = PairSee::VERSION
|
9
|
+
spec.authors = ['compwron']
|
10
|
+
spec.email = ['compiledwrong@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'See metrics about pair programming from the commandline'
|
13
|
+
spec.homepage = 'https://github.com/compwron/pairsee'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'yamler'
|
22
|
+
spec.add_dependency 'trollop'
|
23
|
+
spec.add_dependency 'git'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_development_dependency 'rake'
|
27
|
+
spec.add_development_dependency 'rspec'
|
28
|
+
spec.add_development_dependency 'rubocop'
|
29
|
+
spec.add_development_dependency 'rake_commit'
|
30
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
31
|
+
end
|
data/starterfile.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
hi
|
metadata
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pair_see
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- compwron
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: yamler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: trollop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: git
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake_commit
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: codeclimate-test-reporter
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description:
|
140
|
+
email:
|
141
|
+
- compiledwrong@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".ruby-version"
|
149
|
+
- ".travis.yml"
|
150
|
+
- CODE_OF_CONDUCT.md
|
151
|
+
- Gemfile
|
152
|
+
- Gemfile.lock
|
153
|
+
- LICENSE.txt
|
154
|
+
- README.md
|
155
|
+
- Rakefile
|
156
|
+
- TODO.md
|
157
|
+
- bin/console
|
158
|
+
- bin/pairsee
|
159
|
+
- bin/setup
|
160
|
+
- config/sample_config.yml
|
161
|
+
- input/sample_input.log
|
162
|
+
- lib/pair_see.rb
|
163
|
+
- lib/pair_see/card.rb
|
164
|
+
- lib/pair_see/combo.rb
|
165
|
+
- lib/pair_see/date_combo.rb
|
166
|
+
- lib/pair_see/log_line.rb
|
167
|
+
- lib/pair_see/log_lines.rb
|
168
|
+
- lib/pair_see/seer.rb
|
169
|
+
- lib/pair_see/version.rb
|
170
|
+
- pair_see.gemspec
|
171
|
+
- starterfile.txt
|
172
|
+
homepage: https://github.com/compwron/pairsee
|
173
|
+
licenses:
|
174
|
+
- MIT
|
175
|
+
metadata: {}
|
176
|
+
post_install_message:
|
177
|
+
rdoc_options: []
|
178
|
+
require_paths:
|
179
|
+
- lib
|
180
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '0'
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
requirements: []
|
191
|
+
rubyforge_project:
|
192
|
+
rubygems_version: 2.4.5
|
193
|
+
signing_key:
|
194
|
+
specification_version: 4
|
195
|
+
summary: See metrics about pair programming from the commandline
|
196
|
+
test_files: []
|