graf 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +1 -1
- data/bin/graf +2 -1
- data/lib/graf.rb +2 -1
- data/lib/graf/filter.rb +26 -0
- data/lib/graf/source.rb +35 -29
- data/lib/graf/version.rb +1 -1
- metadata +13 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d7748fe57dd64ba90a9aee48dddeddf21a3917c0
|
4
|
+
data.tar.gz: 9edc33d7bd5ab5c67a827549d8fa4843c8d8c341
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7a19d972d16bfe71694c24bf211b47638095f5a3483cb116fcbf61e72a99c1e037a3d55159dcd984bbe8b6f0b6392e20020230faff84345567b431006fcb25d3
|
7
|
+
data.tar.gz: e0a7d1151798fd77c0f1829f0c40e43ca84ce3f3e5eb4c0ff71574323c5cfcb8322aa1f0496c026b05e06145d2e4e530b71178f37c028cc184a5f2b727cccbd8
|
data/README.md
CHANGED
data/bin/graf
CHANGED
data/lib/graf.rb
CHANGED
data/lib/graf/filter.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
3
|
+
module Graf
|
4
|
+
class Filter
|
5
|
+
class << self
|
6
|
+
IS_GIT = 'git rev-parse --is-inside-work-tree'
|
7
|
+
IS_LOG = 'git log'
|
8
|
+
|
9
|
+
def process
|
10
|
+
o, e, s = Open3.capture3(IS_GIT)
|
11
|
+
|
12
|
+
if e.include? 'Not a git repository'
|
13
|
+
return 'Not a git repository (or any of the parent directories)'
|
14
|
+
else
|
15
|
+
o, e, s = Open3.capture3(IS_LOG)
|
16
|
+
|
17
|
+
if e.include? 'bad default revision'
|
18
|
+
return 'This git repository don\'t have any commits yet'
|
19
|
+
else
|
20
|
+
Source.authors()
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/graf/source.rb
CHANGED
@@ -1,33 +1,39 @@
|
|
1
1
|
#encoding: utf-8
|
2
2
|
|
3
3
|
module Graf
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
4
|
+
class Source
|
5
|
+
class << self
|
6
|
+
TICK = '▇'
|
7
|
+
|
8
|
+
def authors
|
9
|
+
log = `git shortlog -se`
|
10
|
+
log = log.scan(/(\d+)\t(.*)\<(.*)\>/)
|
11
|
+
frequency = {}
|
12
|
+
|
13
|
+
log.each do |row|
|
14
|
+
count, username, email = *row
|
15
|
+
username.strip!
|
16
|
+
email.strip!
|
17
|
+
email.gsub!(/(.*)@.*/, '\1')
|
18
|
+
|
19
|
+
frequency[email] ||= {}
|
20
|
+
frequency[email][:count] ||= 0
|
21
|
+
frequency[email][:count] += count.to_i
|
22
|
+
frequency[email][:username] = username
|
23
|
+
end
|
24
|
+
|
25
|
+
max = frequency.map { |v| v.last[:count] }.max
|
26
|
+
|
27
|
+
authors = frequency.keys.sort_by { |author| frequency[author][:count] }
|
28
|
+
.reverse.map do |author|
|
29
|
+
data = TICK * (frequency[author][:count] * 70 / max)
|
30
|
+
data << " #{frequency[author][:username]}"
|
31
|
+
data << " (#{frequency[author][:count]} commit"
|
32
|
+
data << (frequency[author][:count] == 1 ? ")" : "s)")
|
33
|
+
end
|
34
|
+
|
35
|
+
authors
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
33
39
|
end
|
data/lib/graf/version.rb
CHANGED
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Abhishek Das
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description: A simple git log analyzer gem
|
@@ -51,7 +46,7 @@ executables:
|
|
51
46
|
extensions: []
|
52
47
|
extra_rdoc_files: []
|
53
48
|
files:
|
54
|
-
- .gitignore
|
49
|
+
- ".gitignore"
|
55
50
|
- Gemfile
|
56
51
|
- LICENSE.txt
|
57
52
|
- README.md
|
@@ -59,6 +54,7 @@ files:
|
|
59
54
|
- bin/graf
|
60
55
|
- graf.gemspec
|
61
56
|
- lib/graf.rb
|
57
|
+
- lib/graf/filter.rb
|
62
58
|
- lib/graf/source.rb
|
63
59
|
- lib/graf/version.rb
|
64
60
|
- test/lib/graf/version_test.rb
|
@@ -66,27 +62,26 @@ files:
|
|
66
62
|
homepage: https://github.com/abhshkdz/graf
|
67
63
|
licenses:
|
68
64
|
- MIT
|
65
|
+
metadata: {}
|
69
66
|
post_install_message:
|
70
67
|
rdoc_options: []
|
71
68
|
require_paths:
|
72
69
|
- lib
|
73
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
71
|
requirements:
|
76
|
-
- -
|
72
|
+
- - ">="
|
77
73
|
- !ruby/object:Gem::Version
|
78
74
|
version: '0'
|
79
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
76
|
requirements:
|
82
|
-
- -
|
77
|
+
- - ">="
|
83
78
|
- !ruby/object:Gem::Version
|
84
79
|
version: '0'
|
85
80
|
requirements: []
|
86
81
|
rubyforge_project:
|
87
|
-
rubygems_version:
|
82
|
+
rubygems_version: 2.2.2
|
88
83
|
signing_key:
|
89
|
-
specification_version:
|
84
|
+
specification_version: 4
|
90
85
|
summary: A simple git log analyzer gem
|
91
86
|
test_files:
|
92
87
|
- test/lib/graf/version_test.rb
|