pair_see 0.1.4 → 0.1.5
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 +4 -4
- data/.travis.yml +3 -1
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -1
- data/TODO.md +10 -1
- data/bin/pairsee +5 -4
- data/build_and_install.sh +1 -1
- data/config/config.yml.sample +8 -2
- data/lib/pair_see/card.rb +6 -1
- data/lib/pair_see/cards_per_person.rb +11 -13
- data/lib/pair_see/log_line.rb +34 -12
- data/lib/pair_see/log_lines.rb +6 -6
- data/lib/pair_see/person.rb +16 -0
- data/lib/pair_see/seer.rb +28 -31
- data/lib/pair_see/version.rb +1 -1
- data/pair_see.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 395e98d640b7d14ff1c16a02ed3c21ff21823317
|
4
|
+
data.tar.gz: 33ca0a5a3b708ab237cf3c7bf90f16a86457e89d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d047500df1fac79f523fca933d433879dfa174d2de09fbf137ddcc5ce8073310a51e874f42c88026a29ac5f81d3898327d63071e72ceb8166e86cf764ed1759
|
7
|
+
data.tar.gz: 1b818b5f0a1aff57f1c9de4f2cfb7be3eada651693c400b5fc66319ebb7ab37358ddb5e8f3fd974674c823e930cc0f1c5d7c2329a721c325a3ca090cb4cac9b4
|
data/.travis.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
3
|
+
- '2.4.1'
|
4
4
|
addons:
|
5
5
|
code_climate:
|
6
6
|
repo_token: cdb26718880608c44fda7463511e0151140ade238d92cb1044892472da13ca48
|
@@ -10,3 +10,5 @@ notifications:
|
|
10
10
|
before_install:
|
11
11
|
- git config --global user.email 'pairsee-test@example.com'
|
12
12
|
- git config --global user.name 'pairsee-test'
|
13
|
+
after_success:
|
14
|
+
- bundle exec codeclimate-test-reporter
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
data/TODO.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
-
|
1
|
+
- Fix bug in --extras where multi-name users are shown in extras
|
2
2
|
- multiple codebases?
|
3
|
+
- fix bug in "last commit" in -d, dates are not accurate
|
3
4
|
- sort --latest by commit date
|
4
5
|
- multiple card starters
|
5
6
|
|
@@ -11,3 +12,11 @@
|
|
11
12
|
- add COLOR to graph / outputs - use vlad's color library?
|
12
13
|
- sort -s by # cards worked
|
13
14
|
|
15
|
+
- standardize quotes
|
16
|
+
|
17
|
+
Fix this bug:
|
18
|
+
DMM-103 - - - commits: 7 - - - duration: 0 days - - - last commit: 2017-03-07 - - - commits per day: Infinity
|
19
|
+
DMM-17 - - - commits: 71 - - - duration: -1 days - - - last commit: 2017-04-06 - - - commits per day: -71.0
|
20
|
+
DMM-39 - - - commits: 6 - - - duration: -6 days - - - last commit: 2017-04-12 - - - commits per day: -1.0
|
21
|
+
DMM-81 - - - commits: 3 - - - duration: -6 days - - - last commit: 2017-03-08 - - - commits per day: -0.5
|
22
|
+
DMM-136 - - - commits: 33 - - - duration: -33 days - - - last commit: 2017-05-30 - - - commits per day: -1.0
|
data/bin/pairsee
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require_relative '../lib/pair_see/seer'
|
4
|
+
require_relative '../lib/pair_see/person'
|
4
5
|
require 'trollop'
|
6
|
+
require 'pry'
|
5
7
|
|
6
8
|
opts = Trollop.options do
|
7
|
-
opt :root, 'Folder in which .git folder is', default: '.'
|
8
9
|
opt :config, 'location of config file, example: ../../config/config.yml', default: "config/config.yml"
|
9
10
|
opt :after, 'Date since which you want to get commits, in yyyy-mm-dd format', default: '0-1-1'
|
10
11
|
opt :extras, 'See all commits without the name of any dev in them', default: false
|
@@ -18,14 +19,14 @@ def run_command(opts)
|
|
18
19
|
begin
|
19
20
|
config = YAML.load_file(opts[:config])
|
20
21
|
rescue
|
21
|
-
puts "Config file not found at: " + opts[:config] + " See config/config.yml.sample for an example.
|
22
|
+
puts "Config file not found at: " + opts[:config] + " See config/config.yml.sample for an example. \n...exiting"
|
22
23
|
exit
|
23
24
|
end
|
24
25
|
options = {
|
25
|
-
names: config['names'].split(' '),
|
26
|
+
names: config['names'].map {|i| PairSee::Person.new(i.split(' '))}, # todo rename "names" to "people"
|
26
27
|
card_prefix: config['card_prefix'],
|
27
28
|
after_date: opts[:after],
|
28
|
-
|
29
|
+
repo_locations: config['roots']
|
29
30
|
}
|
30
31
|
|
31
32
|
seer = PairSee::Seer.new(options)
|
data/build_and_install.sh
CHANGED
data/config/config.yml.sample
CHANGED
data/lib/pair_see/card.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module PairSee
|
2
2
|
class Card
|
3
|
-
attr_reader :card_name, :number_of_commits
|
3
|
+
attr_reader :card_name, :number_of_commits, :last_date
|
4
4
|
|
5
5
|
def initialize(card_name, number_of_commits, first_date, last_date)
|
6
6
|
@card_name = card_name
|
@@ -16,5 +16,10 @@ module PairSee
|
|
16
16
|
card_name == other.card_name
|
17
17
|
number_of_commits == other.number_of_commits
|
18
18
|
end
|
19
|
+
|
20
|
+
def pretty
|
21
|
+
commits_per_day = ((number_of_commits * 1.0) / duration).round(2)
|
22
|
+
"#{card_name} - - - commits: #{number_of_commits} - - - duration: #{duration} days - - - last commit: #{last_date} - - - commits per day: #{commits_per_day}"
|
23
|
+
end
|
19
24
|
end
|
20
25
|
end
|
@@ -2,10 +2,10 @@ module PairSee
|
|
2
2
|
class CardsPerPerson
|
3
3
|
attr_reader :devs
|
4
4
|
|
5
|
-
def initialize(log_lines,
|
5
|
+
def initialize(log_lines, card_prefix, people)
|
6
6
|
@log_lines = log_lines
|
7
|
-
@
|
8
|
-
@devs = _active(
|
7
|
+
@card_prefix = card_prefix
|
8
|
+
@devs = _active(people)
|
9
9
|
end
|
10
10
|
|
11
11
|
def cards_per_person
|
@@ -17,27 +17,25 @@ module PairSee
|
|
17
17
|
{dev_name => cards_worked.uniq}
|
18
18
|
end.inject({}) do |result, element|
|
19
19
|
result.merge(element)
|
20
|
+
end.sort do |a, b|
|
21
|
+
a[1].size <=> b[1].size
|
20
22
|
end.map do |dev, cards|
|
21
23
|
"#{dev}: [#{cards.size} cards] #{cards.sort.join(', ')}"
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
def _cards_dev_worked_on(log_lines,
|
27
|
+
def _cards_dev_worked_on(log_lines, person)
|
26
28
|
log_lines.select do |log_line|
|
27
|
-
log_line.authored_by?(
|
29
|
+
log_line.authored_by?(person)
|
28
30
|
end.map do |log_line|
|
29
|
-
log_line.card_number(@
|
31
|
+
log_line.card_number(@card_prefix)
|
30
32
|
end.compact
|
31
33
|
end
|
32
34
|
|
33
|
-
def _active(
|
34
|
-
|
35
|
-
|
35
|
+
def _active(people)
|
36
|
+
people.select do |person|
|
37
|
+
@log_lines.active? person
|
36
38
|
end
|
37
39
|
end
|
38
|
-
|
39
|
-
def _is_active?(dev)
|
40
|
-
@log_lines.active? dev
|
41
|
-
end
|
42
40
|
end
|
43
41
|
end
|
data/lib/pair_see/log_line.rb
CHANGED
@@ -8,9 +8,18 @@ module PairSee
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def authored_by?(*people)
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
return false if people.empty?
|
12
|
+
people.map {|person|
|
13
|
+
contains_any_of?(person.names)
|
14
|
+
}.all?
|
15
|
+
end
|
16
|
+
|
17
|
+
def contains_any_of?(names)
|
18
|
+
names.any? {|name| line_contains_name(name)}
|
19
|
+
end
|
20
|
+
|
21
|
+
def line_contains_name(name)
|
22
|
+
/(^|\s+|\W)#{name}(\s+|$|\W)/i =~ line
|
14
23
|
end
|
15
24
|
|
16
25
|
def contains_card?(card_prefix)
|
@@ -23,15 +32,25 @@ module PairSee
|
|
23
32
|
!git_matcher.nil?
|
24
33
|
end
|
25
34
|
|
26
|
-
def card_name(
|
27
|
-
|
28
|
-
|
29
|
-
|
35
|
+
def card_name(card_prefixes)
|
36
|
+
card_prefixes.each {|cp|
|
37
|
+
regex = /(#{cp}\d+)/
|
38
|
+
matcher = line.match(regex)
|
39
|
+
if (!matcher.nil?)
|
40
|
+
return (line.match regex)[1]
|
41
|
+
end
|
42
|
+
}
|
43
|
+
return nil
|
30
44
|
end
|
31
45
|
|
32
|
-
def card_number(
|
33
|
-
|
34
|
-
|
46
|
+
def card_number(card_prefixes)
|
47
|
+
card_prefixes.each {|cp|
|
48
|
+
card_num = card_name([cp])
|
49
|
+
if (card_num)
|
50
|
+
return card_num.gsub(cp, '')
|
51
|
+
end
|
52
|
+
}
|
53
|
+
return nil
|
35
54
|
end
|
36
55
|
|
37
56
|
def merge_commit?
|
@@ -45,8 +64,11 @@ module PairSee
|
|
45
64
|
Date.parse(part_to_parse)
|
46
65
|
end
|
47
66
|
|
48
|
-
def
|
49
|
-
devs.
|
67
|
+
def by_any?(devs)
|
68
|
+
if devs.size == 0
|
69
|
+
return false
|
70
|
+
end
|
71
|
+
devs.any? {|dev| authored_by?(dev)}
|
50
72
|
end
|
51
73
|
|
52
74
|
def to_s
|
data/lib/pair_see/log_lines.rb
CHANGED
@@ -17,23 +17,23 @@ module PairSee
|
|
17
17
|
lines.last
|
18
18
|
end
|
19
19
|
|
20
|
-
def active?(
|
20
|
+
def active?(person)
|
21
21
|
any? do |log_line|
|
22
|
-
log_line.authored_by?(
|
22
|
+
log_line.authored_by?(person)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
def commits_for_pair(person1, person2)
|
27
|
-
select {
|
27
|
+
select {|log_line| log_line.authored_by?(person1, person2)}
|
28
28
|
end
|
29
29
|
|
30
30
|
def commits_not_by_known_pair(devs)
|
31
|
-
reject {
|
31
|
+
reject {|log_line| log_line.by_any? devs}
|
32
32
|
end
|
33
33
|
|
34
|
-
def solo_commits(
|
34
|
+
def solo_commits(people, person)
|
35
35
|
select do |log_line|
|
36
|
-
log_line.authored_by?(
|
36
|
+
log_line.authored_by?(person) && (people - [person]).none? {|single_person| log_line.authored_by?(single_person)}
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
data/lib/pair_see/seer.rb
CHANGED
@@ -8,60 +8,57 @@ module PairSee
|
|
8
8
|
require_relative 'cards_per_person'
|
9
9
|
require_relative 'active_devs'
|
10
10
|
|
11
|
-
attr_reader :log_lines, :devs, :dev_pairs, :
|
11
|
+
attr_reader :log_lines, :devs, :dev_pairs, :card_prefixes
|
12
12
|
@@maximum_commits_to_parse = 9999
|
13
13
|
|
14
14
|
def initialize(options)
|
15
|
-
@log_lines = _lines_from(options[:
|
16
|
-
@sub_seer = CardsPerPerson.new(@log_lines, options)
|
15
|
+
@log_lines = _lines_from(options[:repo_locations], options[:after_date])
|
16
|
+
@sub_seer = CardsPerPerson.new(@log_lines, options[:card_prefix], options[:names])
|
17
17
|
@active_devs = ActiveDevs.new(@log_lines, options).devs
|
18
18
|
@devs = @sub_seer.devs
|
19
|
-
@
|
19
|
+
@card_prefixes = options[:card_prefix]
|
20
20
|
@dev_pairs = devs.combination(2)
|
21
21
|
end
|
22
22
|
|
23
|
-
# seer.commits_not_by_known_pair
|
24
|
-
# seer.all_most_recent_commits
|
25
|
-
# seer.recommended_pairings
|
26
|
-
# seer.pretty_card_data
|
27
|
-
# seer.cards_per_person
|
28
|
-
# seer.all_commits
|
29
|
-
|
30
|
-
|
31
23
|
def cards_per_person
|
32
24
|
@sub_seer.cards_per_person
|
33
25
|
end
|
34
26
|
|
35
|
-
def _lines_from(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
27
|
+
def _lines_from(roots, date_string)
|
28
|
+
lines = []
|
29
|
+
roots.each {|root|
|
30
|
+
g = Git.open(root)
|
31
|
+
lines << g.log(@@maximum_commits_to_parse).since(date_string).map do |l|
|
32
|
+
LogLine.new("#{l.date} #{l.message}")
|
33
|
+
end
|
34
|
+
}
|
35
|
+
LogLines.new(lines.flatten)
|
41
36
|
end
|
42
37
|
|
43
38
|
def pretty_card_data
|
44
|
-
card_data(
|
45
|
-
|
39
|
+
card_data(card_prefixes).map do |card|
|
40
|
+
card.pretty unless card.nil?
|
46
41
|
end
|
47
42
|
end
|
48
43
|
|
49
|
-
def card_data(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
44
|
+
def card_data(card_prefixes)
|
45
|
+
card_prefixes.map do |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
|
50
|
+
end.flatten.sort_by(&:duration).reverse
|
54
51
|
end
|
55
52
|
|
56
53
|
def commits_on_card(card_name)
|
57
|
-
log_lines.select {
|
54
|
+
log_lines.select {|line| line.contains_card_name?(card_name)}
|
58
55
|
end
|
59
56
|
|
60
57
|
def card_numbers(card_prefix)
|
61
58
|
log_lines.select do |line|
|
62
59
|
line.contains_card?(card_prefix)
|
63
60
|
end.map do |line|
|
64
|
-
line.card_name(card_prefix)
|
61
|
+
line.card_name([card_prefix])
|
65
62
|
end.uniq.compact
|
66
63
|
end
|
67
64
|
|
@@ -111,13 +108,13 @@ module PairSee
|
|
111
108
|
|
112
109
|
def recommended_pairings
|
113
110
|
should_pair = unpaired_in_range
|
114
|
-
should_pair.empty? ? least_recent_pair : should_pair
|
111
|
+
should_pair.empty? ? [least_recent_pair] : should_pair
|
115
112
|
end
|
116
113
|
|
117
114
|
def least_recent_pair
|
118
|
-
devs.select do |
|
119
|
-
log_lines.last.line.match(
|
120
|
-
end.join(', ')
|
115
|
+
devs.select do |person|
|
116
|
+
person.names.any? {|name| log_lines.last.line.match(name)}
|
117
|
+
end.map(&:display_name).join(', ')
|
121
118
|
end
|
122
119
|
|
123
120
|
def unpaired_in_range
|
data/lib/pair_see/version.rb
CHANGED
data/pair_see.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
|
17
17
|
gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
18
|
gem.bindir = 'bin'
|
19
|
-
gem.executables = [
|
19
|
+
gem.executables = ['pairsee']
|
20
20
|
gem.require_paths = ['lib']
|
21
21
|
|
22
22
|
gem.add_dependency 'yamler', '~> 0.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pair_see
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- compwron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yamler
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/pair_see/date_combo.rb
|
198
198
|
- lib/pair_see/log_line.rb
|
199
199
|
- lib/pair_see/log_lines.rb
|
200
|
+
- lib/pair_see/person.rb
|
200
201
|
- lib/pair_see/seer.rb
|
201
202
|
- lib/pair_see/version.rb
|
202
203
|
- pair_see.gemspec
|