Class: Hubba::ReportUpdates

Inherits:
Report
  • Object
show all
Defined in:
lib/hubba/reports/reports/updates.rb

Instance Method Summary collapse

Methods inherited from Report

#initialize, #save

Constructor Details

This class inherits a constructor from Hubba::Report

Instance Method Details

#buildObject



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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/hubba/reports/reports/updates.rb', line 6

def build

## note: orgs is orgs+users e.g. geraldb, yorobot etc
buf = String.new('')
buf << "# Updates"
buf << " - #{@stats.repos.size} Repos @ #{@stats.orgs.size} Orgs\n"
buf << "\n\n"

repos = @stats.repos.sort do |l,r|
  r.stats.committed.jd <=> l.stats.committed.jd
end

## pp repos


buf << "committed / pushed / updated / created\n\n"

today = Date.today

repos.each_with_index do |repo,i|

  days_ago = today.jd - repo.stats.committed.jd

  diff1 = repo.stats.committed.jd - repo.stats.pushed.jd
  diff2 = repo.stats.committed.jd - repo.stats.updated.jd
  diff3 = repo.stats.pushed.jd    - repo.stats.updated.jd

  buf <<  "- (#{days_ago}d) **#{repo.full_name}** ★#{repo.stats.stars} - "
  buf <<  "#{repo.stats.committed} "
  buf <<  "("
  buf <<  (diff1==0 ? '=' : "#{diff1}d")
  buf <<  "/"
  buf <<  (diff2==0 ? '=' : "#{diff2}d")
  buf <<  ")"
  buf <<  " / "
  buf <<  "#{repo.stats.pushed} "
  buf <<  "("
  buf <<  (diff3==0 ? '=' : "#{diff3}d")
  buf <<  ")"
  buf <<  " / "
  buf <<  "#{repo.stats.updated} / "
  buf <<  "#{repo.stats.created} - "
  buf <<  "#{repo.stats.last_commit_message}"
  buf <<  " (#{repo.stats.size} kb)"
  buf <<  "\n"
end
buf << "<!-- break -->\n"   ## markdown hack: add a list end marker
buf << "\n\n"


buf
end