Class: Hubba::ReportTimeline
Instance Method Summary collapse
Methods inherited from Report
Constructor Details
This class inherits a constructor from Hubba::Report
Instance Method Details
#build ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/hubba/reports.rb', line 98 def build ## create a (timeline report) ## note: orgs is orgs+users e.g. geraldb, yorobot etc buf = String.new('') buf << "# #{@stats.repos.size} repos @ #{@stats.orgs.size} orgs\n" buf << "\n" repos = @stats.repos.sort do |l,r| ## note: use reverse sort (right,left) - e.g. most stars first ## r[:stars] <=> l[:stars] ## sort by created_at (use julian days) r.stats.created.jd <=> l.stats.created.jd end ## pp repos last_year = -1 last_month = -1 repos.each_with_index do |repo,i| year = repo.stats.created.year month = repo.stats.created.month if last_year != year buf << "\n## #{year}\n\n" end if last_month != month buf << "\n### #{month}\n\n" end last_year = year last_month = month buf << "- #{repo.stats.created_at.strftime('%Y-%m-%d')} ★#{repo.stats.stars} **#{repo.full_name}** (#{repo.stats.size} kb)\n" end buf end |