graf 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/graf/source.rb +18 -25
- data/lib/graf/version.rb +1 -1
- metadata +8 -2
data/lib/graf/source.rb
CHANGED
@@ -1,39 +1,32 @@
|
|
1
1
|
#encoding: utf-8
|
2
2
|
|
3
3
|
module Graf
|
4
|
-
|
5
4
|
class Source
|
6
|
-
|
7
5
|
class << self
|
8
|
-
|
9
|
-
def count_of_commits(log, author)
|
10
|
-
log.grep(author).size
|
11
|
-
end
|
12
|
-
|
13
6
|
TICK = '▇'
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
log.
|
19
|
-
|
7
|
+
def authors
|
8
|
+
log = `git shortlog -se`
|
9
|
+
log = log.scan(/(\d+)\t(.*)\<(.*)\>/)
|
10
|
+
frequency = {}
|
11
|
+
log.each do |row|
|
12
|
+
count, username, email = *row
|
13
|
+
username.strip!
|
14
|
+
email.strip!
|
15
|
+
frequency[email] ||= {}
|
16
|
+
frequency[email][:count] ||= 0
|
17
|
+
frequency[email][:count] += count.to_i
|
18
|
+
frequency[email][:username] = username
|
20
19
|
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
authors = freq.keys.sort_by do |author|
|
25
|
-
freq[author]
|
20
|
+
max = frequency.map {|v|v.last[:count]}.max
|
21
|
+
authors = frequency.keys.sort_by do |author|
|
22
|
+
frequency[author][:count]
|
26
23
|
end.reverse.map do |author|
|
27
|
-
TICK * (
|
28
|
-
" #{author} (#{
|
29
|
-
(
|
24
|
+
TICK * (frequency[author][:count] * 70 / max) +
|
25
|
+
" #{frequency[author][:username]} (#{frequency[author][:count]} commit" +
|
26
|
+
(frequency[author][:count] == 1 ? ")" : "s)")
|
30
27
|
end
|
31
|
-
|
32
28
|
return authors
|
33
29
|
end
|
34
|
-
|
35
30
|
end
|
36
|
-
|
37
31
|
end
|
38
|
-
|
39
32
|
end
|
data/lib/graf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -76,12 +76,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- - '>='
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
hash: 917165269381293850
|
79
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
83
|
none: false
|
81
84
|
requirements:
|
82
85
|
- - '>='
|
83
86
|
- !ruby/object:Gem::Version
|
84
87
|
version: '0'
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
hash: 917165269381293850
|
85
91
|
requirements: []
|
86
92
|
rubyforge_project:
|
87
93
|
rubygems_version: 1.8.25
|