git-visualiser 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmQ3NGYzMDhmMTZiYThiMWE0NWQ0ZTliNjRlMDQxZDRjYmQ2OWNhMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzhlNmEyZjVlMzk5M2YwYWUyYWYxODI4YTFlOTI0YTBjNDAyZDYwYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzEyMTlhYWIyYzhlNzU0ZjdmZGE5NjAzYzEyZTliZjg2OGViYTU1MTRmYzU3
|
10
|
+
ODEzNmUzNzAzNWMzZjk3OTljMmRjMTMzZjc3YTE2OTE4Y2Y3YWQ0NzI1NDJj
|
11
|
+
N2NjMGRmZmVkYzQ4N2U5ZjhiOGM4OTgxNjkxZTRlMTViZTRiNTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Mzg3ZjA2MDdiM2EzYjIwODY3MzcxYTJjNTA1OTQzZGZhZDFlOTU3MGQ3MDhl
|
14
|
+
OTFiYWFhYmRhYjY4MDFlM2ZmZjA4N2U3NzU5YzA0NDk3NGZhNDRlZDhmMDg5
|
15
|
+
MjhkYTRmMmY2Nzc3YTAxYTlhYjU3OTU4OWI1OTEzMDc2N2QyZDk=
|
@@ -46,10 +46,9 @@ class GitVisualiser < Sinatra::Base
|
|
46
46
|
get '/author_stats.json' do
|
47
47
|
ref = params[:ref]
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
haml :'/authors_list' if @authors.length > 0
|
49
|
+
authors = Visualisation.branch_author_stats(ref)
|
50
|
+
content_type :json
|
51
|
+
authors.to_json
|
53
52
|
end
|
54
53
|
|
55
54
|
get '/commits.json' do
|
@@ -67,15 +66,7 @@ class GitVisualiser < Sinatra::Base
|
|
67
66
|
content_type :json
|
68
67
|
file_diff_stats.to_json
|
69
68
|
end
|
70
|
-
|
71
|
-
helpers do
|
72
|
-
|
73
|
-
def gravatar_image(email)
|
74
|
-
hash = Digest::MD5.hexdigest(email).to_s
|
75
|
-
"<img src=\"http://www.gravatar.com/avatar/#{hash}?s=48\" />"
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
69
|
+
|
79
70
|
end
|
80
71
|
|
81
72
|
puts "Running GitVisualiser"
|
@@ -411,12 +411,85 @@ class BranchGraph
|
|
411
411
|
@linked_nodes[other_id + ", " + node_id] == 1 ||
|
412
412
|
node_id == other_id
|
413
413
|
|
414
|
+
initAuthorStats: (data) ->
|
415
|
+
margin = {top: 10, right: 20, bottom: 30, left: 25}
|
416
|
+
width = $("#sidebar-branches").width() - 20 - margin.left - margin.right
|
417
|
+
height = 300 - margin.top - margin.bottom
|
418
|
+
|
419
|
+
x = d3.scale.ordinal().rangeRoundBands([0, width], .1)
|
420
|
+
y = d3.scale.linear().rangeRound([height, 0])
|
421
|
+
|
422
|
+
colors = d3.scale.category10()
|
423
|
+
|
424
|
+
xAxis = d3.svg.axis().scale(x).orient("bottom")
|
425
|
+
yAxis = d3.svg.axis()
|
426
|
+
.scale(y)
|
427
|
+
.orient("left")
|
428
|
+
.ticks(4)
|
429
|
+
.tickFormat(d3.format("d"))
|
430
|
+
|
431
|
+
@author_svg = d3.select("#authors-graph-chart")
|
432
|
+
.append("svg")
|
433
|
+
.style("background", d3.rgb("#EFEFEF"))
|
434
|
+
.attr("width", width + margin.left + margin.right)
|
435
|
+
.attr("height", height + margin.top + margin.bottom)
|
436
|
+
.append("g")
|
437
|
+
.attr("transform", "translate(" + margin.left + ", " + margin.top + ")")
|
438
|
+
|
439
|
+
@y = y
|
440
|
+
data.sort (a, b) -> b.commits - a.commits
|
441
|
+
|
442
|
+
y.domain([0, d3.sum data, (d) -> d.commits])
|
443
|
+
y.nice()
|
444
|
+
ypos = 0
|
445
|
+
|
446
|
+
data.forEach((d) ->
|
447
|
+
d.coords = { y0: ypos, y1: ypos += d.commits }
|
448
|
+
d.color = colors(d.commits)
|
449
|
+
)
|
450
|
+
|
451
|
+
@author_svg.append("g")
|
452
|
+
.attr("class", "x axis")
|
453
|
+
.attr("transform", "translate(0, " + height + ")")
|
454
|
+
.call(xAxis)
|
455
|
+
|
456
|
+
@author_svg.append("g")
|
457
|
+
.attr("class", "y axis")
|
458
|
+
.call(yAxis)
|
459
|
+
|
460
|
+
g = @author_svg.selectAll("rect").data(data)
|
461
|
+
.enter()
|
462
|
+
.append("g")
|
463
|
+
g.append("rect")
|
464
|
+
.attr("width", 30)
|
465
|
+
.attr("x", 5)
|
466
|
+
.attr("y", (d) -> height - y(d.coords.y0))
|
467
|
+
.attr("height", (d) -> y(d.coords.y0) - y(d.coords.y1))
|
468
|
+
.attr("fill", (d) -> d.color)
|
469
|
+
g.append("text")
|
470
|
+
.attr("x", 90)
|
471
|
+
.attr("y", (d) -> height - y(d.coords.y0) + 15)
|
472
|
+
.text((d) -> d.name)
|
473
|
+
g.append("text")
|
474
|
+
.attr("x", 90)
|
475
|
+
.attr("y", (d) -> height - y(d.coords.y0) + 30)
|
476
|
+
.text((d) -> "#{d.commits} commits")
|
477
|
+
g.append("svg:image")
|
478
|
+
.attr("xlink:href", (d) -> d.gravatar_url)
|
479
|
+
.attr("x", 40)
|
480
|
+
.attr("y", (d) -> height - y(d.coords.y0))
|
481
|
+
.attr("width", "40")
|
482
|
+
.attr("height", "40")
|
483
|
+
|
414
484
|
getAuthorStats: (branch_name) ->
|
415
|
-
|
416
|
-
|
485
|
+
vis = @
|
486
|
+
$.get "/author_stats.json", {ref: branch_name}, (author_data) ->
|
487
|
+
$("#authors-graph").show()
|
488
|
+
vis.initAuthorStats(author_data)
|
417
489
|
|
418
490
|
clearAuthorStats: ->
|
419
|
-
$("#authors-
|
491
|
+
$("#authors-graph").hide()
|
492
|
+
$("#authors-graph-chart").empty()
|
420
493
|
|
421
494
|
|
422
495
|
|
@@ -29,7 +29,7 @@ body,html { height: 100%; margin: 0px; }
|
|
29
29
|
margin-top: 20px;
|
30
30
|
}
|
31
31
|
|
32
|
-
#authors-
|
32
|
+
#authors-graph {
|
33
33
|
padding: 10px;
|
34
34
|
|
35
35
|
p {
|
@@ -115,6 +115,16 @@ body,html { height: 100%; margin: 0px; }
|
|
115
115
|
img { float: left }
|
116
116
|
}
|
117
117
|
|
118
|
+
#authors-graph {
|
119
|
+
.axis path, .axis line {
|
120
|
+
fill: none;
|
121
|
+
stroke: #000;
|
122
|
+
shape-rendering: crispEdges;
|
123
|
+
}
|
124
|
+
|
125
|
+
.x.axis path { display:none; }
|
126
|
+
}
|
127
|
+
|
118
128
|
svg {
|
119
129
|
background-color: #FFF;
|
120
130
|
cursor: default;
|
@@ -19,7 +19,9 @@
|
|
19
19
|
%input#exclude_commit_input.commit_filters_input{:name => "exclude_commit", :placeholder => "Exclude commit", :type => "text"}
|
20
20
|
%a#apply-filters-btn.btn.btn-large.btn-block.apply-btn{:href => "#"}
|
21
21
|
Apply Filters
|
22
|
-
#authors-
|
22
|
+
#authors-graph{style: "display: none"}
|
23
|
+
%h4 Top Authors By Commits
|
24
|
+
#authors-graph-chart
|
23
25
|
#branches-display
|
24
26
|
#vis-loading
|
25
27
|
%h4 Loading Repository Data...
|
@@ -7,7 +7,6 @@ module Visualisation
|
|
7
7
|
total_additions = total_deletions = 0
|
8
8
|
remotes_arr = Visualisation.remotes
|
9
9
|
Visualisation.branches_with_remotes.each do |branch|
|
10
|
-
puts "#{branch}"
|
11
10
|
diff = Visualisation.branch_diff_size(branch)
|
12
11
|
head_commit = Visualisation.head_commit_sha(branch)
|
13
12
|
merged_with_master = Visualisation.branch_contains_commit("master", head_commit)
|
@@ -68,7 +67,6 @@ module Visualisation
|
|
68
67
|
next if b1 == b2 || b2.split("/").last == b1 ||
|
69
68
|
(merged_branches.has_key?(b2.to_sym) && merged_branches[b2.to_sym].has_key?(b1.to_sym))
|
70
69
|
directions = {}
|
71
|
-
puts "comparing #{b1} with #{b2}"
|
72
70
|
directions.merge!(:left => true) if branch_merged_with_base?(b1, b2, remotes)
|
73
71
|
directions.merge!(:right => true) if right = branch_merged_with_base?(b2, b1, remotes)
|
74
72
|
b1_merges.merge!(b2.to_sym => directions)
|
@@ -153,9 +151,20 @@ module Visualisation
|
|
153
151
|
end
|
154
152
|
|
155
153
|
def self.branch_author_stats(branch)
|
156
|
-
|
154
|
+
authors = []
|
155
|
+
raw_authors = `git log master..#{branch} --pretty=format:%an,%ae \
|
157
156
|
| awk '{ ++c[$0]; } END { for(cc in c) printf "%5d,%s\\n",c[cc],cc; }'\
|
158
|
-
| sort -r`.split(/\n/).each { |c| c.strip! }
|
157
|
+
| sort -r`.split(/\n/).each { |c| c.strip! }.slice(0, 3)
|
158
|
+
raw_authors.each do |author|
|
159
|
+
author = author.split(/,/)
|
160
|
+
authors << {:name => author[1], :commits => author[0], :gravatar_url => gravatar_url(author[2])}
|
161
|
+
end
|
162
|
+
authors
|
163
|
+
end
|
164
|
+
|
165
|
+
def self.gravatar_url(email)
|
166
|
+
hash = Digest::MD5.hexdigest(email).to_s
|
167
|
+
"http://www.gravatar.com/avatar/#{hash}?s=40"
|
159
168
|
end
|
160
169
|
|
161
170
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-visualiser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James McCann
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thin
|
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'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: coffee-script
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|