Module: GitAnalysis

Defined in:
lib/git_analysis.rb,
lib/git_analysis/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.count_domainObject

count domain



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/git_analysis.rb', line 10

def self.count_domain()
  repo = load_repo()
  commits = repo.walk(repo.last_commit).to_a
  domain = Array.new
  commits.each do |c|
    domain << c.author[:email].match(/([a-zA-Z0-9\_\-\.]+$)/)
  end
  count = Hash.new(0)
  domain.each do |elem|
    count[elem] += 1
  end
  puts Oj.dump(count, :mode => :compat)
end

.exportObject

export



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/git_analysis.rb', line 25

def self.export()
  repo = load_repo()
  commits = repo.walk(repo.last_commit).to_a
  list = Hash.new
  domain = Array.new
  commits.each do |c|
    log = Hash.new
    log[:sha] = c.oid
    log[:message] = c.message
    log[:time] =  c.time
    log[:name] = c.author[:name]
    log[:email] = c.author[:email]
    log[:domain] = c.author[:email].match(/([a-zA-Z0-9\_\-\.]+$)/)[1]
    list["#{c.oid}"] = log
  end
  puts Oj.dump(list, :mode => :compat)
end