gitalytics 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gitalytics +8 -0
- data/lib/gitalytics.rb +38 -0
- metadata +47 -0
data/bin/gitalytics
ADDED
data/lib/gitalytics.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
class Gitalytics
|
2
|
+
def log_to_hash
|
3
|
+
docs = []
|
4
|
+
cmd = "git log --pretty='%cn|%cd|%s'"
|
5
|
+
res = `#{cmd}`
|
6
|
+
|
7
|
+
res.each_line do |line|
|
8
|
+
parts = line.split('|')
|
9
|
+
docs << {:username => parts[0], :date => Date.parse(parts[1]), :subject => parts[2]}
|
10
|
+
end
|
11
|
+
|
12
|
+
return {
|
13
|
+
:users => docs.map{|r| r[:username]}.uniq,
|
14
|
+
:dates => docs.map{|r| r[:date]}.uniq,
|
15
|
+
:records => docs
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def output_summary_report(res)
|
20
|
+
# Report how many commits over time
|
21
|
+
res[:users].each do |user|
|
22
|
+
dates_for_user = res[:records].select{|r| r[:username] == user}.map{|r| r[:date]}
|
23
|
+
commit_count = dates_for_user.count
|
24
|
+
date_count = dates_for_user.uniq.count
|
25
|
+
first_date = dates_for_user.min
|
26
|
+
last_date = dates_for_user.max
|
27
|
+
puts "#{user} has made #{commit_count} commits over the last #{last_date-first_date} days. He did something useful on #{date_count} of those days."
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# class Commit
|
33
|
+
# attr_accesor :author, :message, :date
|
34
|
+
# end
|
35
|
+
|
36
|
+
# class Author
|
37
|
+
# attr_accesor :name, :email
|
38
|
+
# end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitalytics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gonzalo Robaina
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-04 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Get usefull analytics from your git log
|
15
|
+
email: gonzalor@gmail.com
|
16
|
+
executables:
|
17
|
+
- gitalytics
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/gitalytics.rb
|
22
|
+
- bin/gitalytics
|
23
|
+
homepage: http://rubygems.org/gems/gitalytics
|
24
|
+
licenses: []
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 1.8.25
|
44
|
+
signing_key:
|
45
|
+
specification_version: 3
|
46
|
+
summary: Git Analytics
|
47
|
+
test_files: []
|