pairing_matrix 0.1.2 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/lib/pairing_matrix/config/config.rb +12 -2
- data/lib/pairing_matrix/config/config_reader.rb +6 -1
- data/lib/pairing_matrix/github_commit_reader.rb +30 -0
- data/lib/pairing_matrix/server/public/index.html +12 -1
- data/lib/pairing_matrix/server/public/index.js +26 -8
- data/lib/pairing_matrix/server/public/loader.css +99 -0
- data/lib/pairing_matrix/server/public/matrix.js +15 -38
- data/lib/pairing_matrix/server/public/style.css +31 -0
- data/lib/pairing_matrix/server/server.rb +1 -0
- data/lib/pairing_matrix/version.rb +1 -1
- data/pairing_matrix.gemspec +1 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c09a1dee0449065d5c427e2066c56a052545ba24
|
4
|
+
data.tar.gz: eddae5874f7ad684ac3ba3894f4ecc20d77e6643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f2634e24d49c030f730e00d487713d5f5c08f8f16b4a3a8b0f8975eb2413ea8eb98550f9d356d1f3a2c80335a22fdef6fceacf751ab28b4d63c6896ef5bf3f4
|
7
|
+
data.tar.gz: 2391abf8ff0bc0a1fdf780c348b0a5f88565e2cc650078dfed9478d7f08cae8233fa20c8afd2aee1bb9c97aca832f23b2ed3c0286a5d7b90db3355cb27913dee
|
data/Gemfile
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
module PairingMatrix
|
2
2
|
class Config
|
3
|
-
attr_reader :repos, :authors_regex
|
3
|
+
attr_reader :repos, :authors_regex, :github_access_token, :github_repos
|
4
4
|
|
5
|
-
def initialize(repos, authors_regex)
|
5
|
+
def initialize(repos, authors_regex, github_access_token, github_repos)
|
6
6
|
@repos = repos
|
7
7
|
@authors_regex = authors_regex
|
8
|
+
@github_access_token = github_access_token
|
9
|
+
@github_repos = github_repos
|
10
|
+
end
|
11
|
+
|
12
|
+
def fetch_from_github?
|
13
|
+
!@github_repos.nil? && !@github_repos.empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
def has_github_access_token?
|
17
|
+
!@github_access_token.nil? && !@github_access_token.empty?
|
8
18
|
end
|
9
19
|
end
|
10
20
|
end
|
@@ -8,7 +8,12 @@ module PairingMatrix
|
|
8
8
|
|
9
9
|
def config
|
10
10
|
raw_config = YAML::load_file @config_file
|
11
|
-
PairingMatrix::Config.new(
|
11
|
+
PairingMatrix::Config.new(
|
12
|
+
raw_config['repos'],
|
13
|
+
raw_config['authors_regex'],
|
14
|
+
raw_config['github_access_token'],
|
15
|
+
raw_config['github_repos']
|
16
|
+
)
|
12
17
|
end
|
13
18
|
end
|
14
19
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'octokit'
|
2
|
+
|
3
|
+
Octokit.auto_paginate = true
|
4
|
+
|
5
|
+
module PairingMatrix
|
6
|
+
class GithubCommitReader < CommitReader
|
7
|
+
def initialize(config)
|
8
|
+
super(config)
|
9
|
+
@github_client = github_client
|
10
|
+
end
|
11
|
+
|
12
|
+
def read(since)
|
13
|
+
@config.github_repos.map do |repo|
|
14
|
+
puts "Fetching commits since #{since} for #{repo}"
|
15
|
+
commits = @github_client.commits_since(repo, since).map { |commit| commit.commit.message }
|
16
|
+
puts "Total commits: #{commits.size}"
|
17
|
+
commits
|
18
|
+
end.flatten
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def github_client
|
23
|
+
if @config.has_github_access_token?
|
24
|
+
Octokit::Client.new(:access_token => @config.github_access_token)
|
25
|
+
else
|
26
|
+
Octokit::Client.new
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<title>Pairing Matrix</title>
|
5
5
|
<link rel="stylesheet" href="style.css"/>
|
6
|
+
<link rel="stylesheet" href="loader.css"/>
|
6
7
|
|
7
8
|
<script language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.js"></script>
|
8
9
|
<script language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
|
@@ -12,12 +13,22 @@
|
|
12
13
|
</head>
|
13
14
|
|
14
15
|
<body>
|
15
|
-
<div>
|
16
|
+
<div class="visualize_matrix_container">
|
16
17
|
<span>Display data of last</span>
|
17
18
|
<input type="number" id="days" value="10"/>
|
18
19
|
<span>days</span>
|
19
20
|
<button id="visualize">Visualize</button>
|
20
21
|
</div>
|
22
|
+
|
23
|
+
<div class="loaderContainer">
|
24
|
+
<div class="loader">
|
25
|
+
<span class="dot dot_1"></span>
|
26
|
+
<span class="dot dot_2"></span>
|
27
|
+
<span class="dot dot_3"></span>
|
28
|
+
<span class="dot dot_4"></span>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
21
32
|
<div class="viz_container">
|
22
33
|
<svg>
|
23
34
|
<g class="area">
|
@@ -1,15 +1,33 @@
|
|
1
1
|
$(document).ready(function () {
|
2
2
|
var playground = new PlayGround(".area");
|
3
3
|
var renderMatrix = function (days) {
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
hideMatrix();
|
5
|
+
showLoader();
|
6
|
+
$.get('/data/' + days).done(function (data) {
|
7
|
+
playground.load(JSON.parse(data));
|
8
|
+
hideLoader();
|
9
|
+
showMatrix();
|
10
|
+
}).fail(function () {
|
11
|
+
alert('error occurred!');
|
12
|
+
hideLoader();
|
13
|
+
showMatrix();
|
14
|
+
});
|
15
|
+
};
|
16
|
+
|
17
|
+
var hideMatrix = function () {
|
18
|
+
$('.viz_container').hide();
|
19
|
+
};
|
20
|
+
|
21
|
+
var showMatrix = function () {
|
22
|
+
$('.viz_container').show();
|
23
|
+
};
|
24
|
+
|
25
|
+
var hideLoader = function () {
|
26
|
+
$('.loaderContainer').hide();
|
27
|
+
};
|
7
28
|
|
8
|
-
|
9
|
-
|
10
|
-
alert('error occurred!')
|
11
|
-
}
|
12
|
-
})
|
29
|
+
var showLoader = function () {
|
30
|
+
$('.loaderContainer').show();
|
13
31
|
};
|
14
32
|
|
15
33
|
$('#visualize').on('click', function () {
|
@@ -0,0 +1,99 @@
|
|
1
|
+
.loaderContainer {
|
2
|
+
margin-top: 250px;
|
3
|
+
}
|
4
|
+
|
5
|
+
.loader {
|
6
|
+
position: relative;
|
7
|
+
width: 44px;
|
8
|
+
height: 8px;
|
9
|
+
margin: 12px auto;
|
10
|
+
}
|
11
|
+
|
12
|
+
.dot {
|
13
|
+
display: inline-block;
|
14
|
+
width: 8px;
|
15
|
+
height: 8px;
|
16
|
+
border-radius: 4px;
|
17
|
+
background: #ccc;
|
18
|
+
position: absolute;
|
19
|
+
}
|
20
|
+
|
21
|
+
.dot_1 {
|
22
|
+
animation: animateDot1 1.5s linear infinite;
|
23
|
+
left: 12px;
|
24
|
+
background: #e579b8;
|
25
|
+
}
|
26
|
+
|
27
|
+
.dot_2 {
|
28
|
+
animation: animateDot2 1.5s linear infinite;
|
29
|
+
animation-delay: 0.5s;
|
30
|
+
left: 24px;
|
31
|
+
}
|
32
|
+
|
33
|
+
.dot_3 {
|
34
|
+
animation: animateDot3 1.5s linear infinite;
|
35
|
+
left: 12px;
|
36
|
+
}
|
37
|
+
|
38
|
+
.dot_4 {
|
39
|
+
animation: animateDot4 1.5s linear infinite;
|
40
|
+
animation-delay: 0.5s;
|
41
|
+
left: 24px;
|
42
|
+
}
|
43
|
+
|
44
|
+
@keyframes animateDot1 {
|
45
|
+
0% {
|
46
|
+
transform: rotate(0deg) translateX(-12px);
|
47
|
+
}
|
48
|
+
25% {
|
49
|
+
transform: rotate(180deg) translateX(-12px);
|
50
|
+
}
|
51
|
+
75% {
|
52
|
+
transform: rotate(180deg) translateX(-12px);
|
53
|
+
}
|
54
|
+
100% {
|
55
|
+
transform: rotate(360deg) translateX(-12px);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
@keyframes animateDot2 {
|
59
|
+
0% {
|
60
|
+
transform: rotate(0deg) translateX(-12px);
|
61
|
+
}
|
62
|
+
25% {
|
63
|
+
transform: rotate(-180deg) translateX(-12px);
|
64
|
+
}
|
65
|
+
75% {
|
66
|
+
transform: rotate(-180deg) translateX(-12px);
|
67
|
+
}
|
68
|
+
100% {
|
69
|
+
transform: rotate(-360deg) translateX(-12px);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
@keyframes animateDot3 {
|
73
|
+
0% {
|
74
|
+
transform: rotate(0deg) translateX(12px);
|
75
|
+
}
|
76
|
+
25% {
|
77
|
+
transform: rotate(180deg) translateX(12px);
|
78
|
+
}
|
79
|
+
75% {
|
80
|
+
transform: rotate(180deg) translateX(12px);
|
81
|
+
}
|
82
|
+
100% {
|
83
|
+
transform: rotate(360deg) translateX(12px);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
@keyframes animateDot4 {
|
87
|
+
0% {
|
88
|
+
transform: rotate(0deg) translateX(12px);
|
89
|
+
}
|
90
|
+
25% {
|
91
|
+
transform: rotate(-180deg) translateX(12px);
|
92
|
+
}
|
93
|
+
75% {
|
94
|
+
transform: rotate(-180deg) translateX(12px);
|
95
|
+
}
|
96
|
+
100% {
|
97
|
+
transform: rotate(-360deg) translateX(12px);
|
98
|
+
}
|
99
|
+
}
|
@@ -48,12 +48,9 @@ function PlayGround(selector) {
|
|
48
48
|
toCoordinates.x + " " + toCoordinates.y;
|
49
49
|
})
|
50
50
|
.attr("id", function(d) {return d.join('_')})
|
51
|
-
.attr("fill", "none")
|
52
|
-
.attr("stroke", "#DD1031")
|
53
51
|
.attr("stroke-width", function (d) {
|
54
52
|
return playground.connectionScale(d[2])
|
55
53
|
})
|
56
|
-
.attr("stroke-opacity", 0.75)
|
57
54
|
.attr("data-from", function (d) {
|
58
55
|
return d[0]
|
59
56
|
})
|
@@ -83,15 +80,10 @@ function PlayGround(selector) {
|
|
83
80
|
.attr("cy", function (d, i) {
|
84
81
|
return playground.getPlayerCoordinates(i).y
|
85
82
|
})
|
86
|
-
.attr("r", 20)
|
87
83
|
.attr("fill", colors)
|
88
|
-
.attr("fill-opacity", 0.75)
|
89
|
-
.attr("stroke", "#EE1031")
|
90
|
-
.attr("stroke-opacity", 0.75)
|
91
84
|
.attr("stroke-width", function (d) {
|
92
85
|
return playground.connectionScale(playground.getSoloContribution(d))
|
93
86
|
})
|
94
|
-
.attr("z-index", 10)
|
95
87
|
.attr("class", "player")
|
96
88
|
.attr("id", function (d) {
|
97
89
|
return d
|
@@ -118,52 +110,37 @@ function PlayGround(selector) {
|
|
118
110
|
});
|
119
111
|
};
|
120
112
|
|
113
|
+
this.toggleClass = function toggleClass(newClass, pair) {
|
114
|
+
for(ii = 0; ii < 2; ii++) {
|
115
|
+
d3.selectAll($("#" + pair[ii]))
|
116
|
+
.attr("class", newClass)
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
121
120
|
this.mouseOut = function(id) {
|
122
121
|
var connectedPairs = playground.getAllPairsContaining(id);
|
123
122
|
connectedPairs.forEach(function(pair) {
|
124
|
-
|
125
|
-
var secondPerson = pair[1];
|
126
|
-
d3.selectAll($("#" + firstPerson))
|
127
|
-
.style("fill", function(d) {return d.color})
|
128
|
-
.style("stroke", "#EE1031")
|
129
|
-
d3.selectAll($("#" + secondPerson))
|
130
|
-
.style("fill", function(d) {return d.color})
|
131
|
-
.style("stroke", "#EE1031")
|
123
|
+
playground.toggleClass("player", pair);
|
132
124
|
var pairId = pair.join('_');
|
133
125
|
d3.selectAll($("#" + pairId))
|
134
|
-
.
|
135
|
-
.style("stroke",
|
136
|
-
.style("stroke-width", function(d) {return d.color})
|
126
|
+
.attr("class", "connect")
|
127
|
+
.style("stroke-width", function(d) {return playground.connectionScale(d[2])})
|
137
128
|
})
|
138
129
|
d3.selectAll($("#" + id))
|
139
|
-
.
|
140
|
-
.style("stroke", "#EE1031")
|
141
|
-
.attr("stroke-opacity", 0.75)
|
142
|
-
.attr("stroke-width", function (d) {
|
143
|
-
return playground.connectionScale(playground.getSoloContribution(d))
|
144
|
-
});
|
130
|
+
.attr("class", "player")
|
145
131
|
}
|
146
132
|
|
147
133
|
this.mouseOver = function (id) {
|
148
134
|
var connectedPairs = playground.getAllPairsContaining(id);
|
149
135
|
connectedPairs.forEach(function(pair) {
|
150
|
-
|
151
|
-
var secondPerson = pair[1];
|
152
|
-
d3.selectAll($("#" + firstPerson))
|
153
|
-
.style("fill", "red")
|
154
|
-
.style("stroke", "blue");
|
155
|
-
d3.selectAll($("#" + secondPerson))
|
156
|
-
.style("fill", "red")
|
157
|
-
.style("stroke", "blue");
|
136
|
+
playground.toggleClass("playerLarge", pair)
|
158
137
|
var pairId = pair.join('_');
|
159
138
|
d3.selectAll($("#" + pairId))
|
160
|
-
.
|
161
|
-
.style("stroke",
|
162
|
-
.style("stroke-width", "2px")
|
139
|
+
.attr("class", "connectLarge")
|
140
|
+
.style("stroke-width", function(d) {return playground.connectionScale(d[2]) * 3})
|
163
141
|
})
|
164
142
|
d3.selectAll($("#" + id))
|
165
|
-
.
|
166
|
-
.style("stroke", "blue");
|
143
|
+
.attr("class", "playerLarge")
|
167
144
|
};
|
168
145
|
|
169
146
|
this.updateConnectorsPath = function (playerId, newPoint) {
|
@@ -42,6 +42,10 @@ textarea#pairing_text {
|
|
42
42
|
margin-top: 10px;
|
43
43
|
}
|
44
44
|
|
45
|
+
.visualize_matrix_container {
|
46
|
+
text-align: center;
|
47
|
+
}
|
48
|
+
|
45
49
|
.viz_container {
|
46
50
|
text-align: center;
|
47
51
|
}
|
@@ -53,6 +57,21 @@ svg {
|
|
53
57
|
|
54
58
|
.player {
|
55
59
|
cursor: pointer;
|
60
|
+
r: 20px;
|
61
|
+
fill-opacity: 0.75;
|
62
|
+
stroke: #EE1031;
|
63
|
+
stroke-opacity: 0.75;
|
64
|
+
z-index: 10;
|
65
|
+
}
|
66
|
+
|
67
|
+
.playerLarge {
|
68
|
+
cursor: pointer;
|
69
|
+
r: 25px;
|
70
|
+
fill: red;
|
71
|
+
fill-opacity: 0.75;
|
72
|
+
stroke: blue;
|
73
|
+
stroke-opacity: 0.75;
|
74
|
+
z-index: 10;
|
56
75
|
}
|
57
76
|
|
58
77
|
.player_names {
|
@@ -62,4 +81,16 @@ svg {
|
|
62
81
|
.input-container {
|
63
82
|
height: 300px;
|
64
83
|
overflow: scroll;
|
84
|
+
}
|
85
|
+
|
86
|
+
.connect {
|
87
|
+
fill: none;
|
88
|
+
stroke: #DD1031;
|
89
|
+
stroke-opacity: 0.75;
|
90
|
+
}
|
91
|
+
|
92
|
+
.connectLarge {
|
93
|
+
fill: none;
|
94
|
+
stroke: black;
|
95
|
+
stroke-opacity: 0.75;
|
65
96
|
}
|
@@ -9,6 +9,7 @@ module PairingMatrix
|
|
9
9
|
config_reader = PairingMatrix::ConfigReader.new('pairing_matrix.yml')
|
10
10
|
config = config_reader.config
|
11
11
|
commit_reader = PairingMatrix::CommitReader.new(config)
|
12
|
+
commit_reader = PairingMatrix::GithubCommitReader.new(config) if config.fetch_from_github?
|
12
13
|
|
13
14
|
get '/data/:days' do
|
14
15
|
commit_reader.authors_with_commits(params['days'].to_i).to_json
|
data/pairing_matrix.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pairing_matrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: '1.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ajit Singh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.4.8
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: octokit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.6.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.6.2
|
41
55
|
description: Draw pairing matrix from given repos and configurations
|
42
56
|
email:
|
43
57
|
- jeetsingh.ajit@gmail.com
|
@@ -56,8 +70,10 @@ files:
|
|
56
70
|
- lib/pairing_matrix/commit_reader.rb
|
57
71
|
- lib/pairing_matrix/config/config.rb
|
58
72
|
- lib/pairing_matrix/config/config_reader.rb
|
73
|
+
- lib/pairing_matrix/github_commit_reader.rb
|
59
74
|
- lib/pairing_matrix/server/public/index.html
|
60
75
|
- lib/pairing_matrix/server/public/index.js
|
76
|
+
- lib/pairing_matrix/server/public/loader.css
|
61
77
|
- lib/pairing_matrix/server/public/matrix.js
|
62
78
|
- lib/pairing_matrix/server/public/style.css
|
63
79
|
- lib/pairing_matrix/server/server.rb
|