update changelog generator to match latest

This commit is contained in:
Ryan Graham 2016-05-06 19:26:24 -07:00
parent 7498c59214
commit 33a7eb63ac
No known key found for this signature in database
GPG Key ID: F15A82CDEFD85858
2 changed files with 101 additions and 80 deletions

View File

@ -2,55 +2,53 @@ GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
activesupport (4.2.0)
activesupport (4.2.6)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.6)
addressable (2.4.0)
blankslate (2.1.2.4)
celluloid (0.16.0)
timers (~> 4.0.0)
classifier-reborn (2.0.3)
classifier-reborn (2.0.4)
fast-stemmer (~> 1.0)
coffee-script (2.3.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.0)
coffee-script-source (1.10.0)
colorator (0.1)
ethon (0.7.2)
ethon (0.9.0)
ffi (>= 1.3.0)
execjs (2.2.2)
faraday (0.9.1)
execjs (2.6.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.0.1)
faraday (~> 0.8)
fast-stemmer (1.0.2)
ffi (1.9.6)
ffi (1.9.10)
gemoji (2.1.0)
github-pages (33)
github-pages (39)
RedCloth (= 4.2.9)
github-pages-health-check (~> 0.2)
jekyll (= 2.4.0)
jekyll-coffeescript (= 1.0.1)
jekyll-feed (= 0.3.1)
jekyll-mentions (= 0.2.1)
jekyll-redirect-from (= 0.6.2)
jekyll-sass-converter (= 1.2.0)
jekyll-sitemap (= 0.6.3)
jemoji (= 0.4.0)
jekyll-redirect-from (= 0.8.0)
jekyll-sass-converter (= 1.3.0)
jekyll-sitemap (= 0.8.1)
jemoji (= 0.5.0)
kramdown (= 1.5.0)
liquid (= 2.6.1)
liquid (= 2.6.2)
maruku (= 0.7.0)
mercenary (~> 0.3)
pygments.rb (= 0.6.1)
pygments.rb (= 0.6.3)
rdiscount (= 2.1.7)
redcarpet (= 3.1.2)
redcarpet (= 3.3.2)
terminal-table (~> 1.4)
github-pages-health-check (0.2.1)
github-pages-health-check (0.3.1)
net-dns (~> 0.6)
public_suffix (~> 1.4)
hitimes (1.2.2)
html-pipeline (1.9.0)
activesupport (>= 2)
nokogiri (~> 1.4)
@ -72,64 +70,63 @@ GEM
toml (~> 0.1.0)
jekyll-coffeescript (1.0.1)
coffee-script (~> 2.2)
jekyll-gist (1.1.0)
jekyll-feed (0.3.1)
jekyll-gist (1.4.0)
octokit (~> 4.2)
jekyll-mentions (0.2.1)
html-pipeline (~> 1.9.0)
jekyll (~> 2.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.6.2)
jekyll (~> 2.0)
jekyll-sass-converter (1.2.0)
jekyll-redirect-from (0.8.0)
jekyll (>= 2.0)
jekyll-sass-converter (1.3.0)
sass (~> 3.2)
jekyll-sitemap (0.6.3)
jekyll-watch (1.2.1)
listen (~> 2.7)
jemoji (0.4.0)
jekyll-sitemap (0.8.1)
jekyll-watch (1.4.0)
listen (~> 3.0, < 3.1)
jemoji (0.5.0)
gemoji (~> 2.0)
html-pipeline (~> 1.9)
jekyll (~> 2.0)
json (1.8.2)
jekyll (>= 2.0)
json (1.8.3)
kramdown (1.5.0)
liquid (2.6.1)
listen (2.8.5)
celluloid (>= 0.15.2)
liquid (2.6.2)
listen (3.0.7)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-inotify (>= 0.9.7)
maruku (0.7.0)
mercenary (0.3.5)
mini_portile (0.6.2)
minitest (5.5.1)
mercenary (0.3.6)
mini_portile2 (2.0.0)
minitest (5.8.4)
multipart-post (2.0.0)
net-dns (0.8.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
octokit (3.7.0)
sawyer (~> 0.6.0, >= 0.5.3)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
octokit (4.3.0)
sawyer (~> 0.7.0, >= 0.5.3)
parslet (1.5.0)
blankslate (~> 2.0)
posix-spawn (0.3.9)
public_suffix (1.4.6)
pygments.rb (0.6.1)
posix-spawn (0.3.11)
public_suffix (1.5.3)
pygments.rb (0.6.3)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.2.0)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
rdiscount (2.1.7)
redcarpet (3.1.2)
redcarpet (3.3.2)
safe_yaml (1.0.4)
sass (3.4.10)
sawyer (0.6.0)
addressable (~> 2.3.5)
sass (3.4.22)
sawyer (0.7.0)
addressable (>= 2.3.5, < 2.5)
faraday (~> 0.8, < 0.10)
terminal-table (1.4.5)
thread_safe (0.3.4)
timers (4.0.1)
hitimes
terminal-table (1.5.2)
thread_safe (0.3.5)
toml (0.1.2)
parslet (~> 1.5.0)
typhoeus (0.7.1)
ethon (>= 0.7.1)
typhoeus (1.0.2)
ethon (>= 0.9.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
yajl-ruby (1.2.1)

View File

@ -15,7 +15,7 @@ today = Date.current
last_week = today.last_week
sprints = [
[Date.parse('May 5, 2015'), Date.parse('May 18, 2015'), 70]
[Date.parse('February 9, 2016'), Date.parse('February 22, 2016'), 3]
]
while sprints.last[1] < today do
prev = sprints.last
@ -23,12 +23,12 @@ while sprints.last[1] < today do
end
weeks = sprints.last(4).reverse
token = ENV['GITHUB_TOKEN']
if token.nil? or token.empty?
token = `git config github.token`.strip
gh_token = ENV['GITHUB_TOKEN']
if gh_token.nil? or gh_token.empty?
gh_token = `git config github.token`.strip
end
if token.empty?
if gh_token.empty?
STDERR.puts 'Please visit https://github.com/settings/tokens/new to generate a token'
STDERR.puts "Once you have your token, run 'git config github.token <token>'"
exit 1
@ -64,12 +64,12 @@ stack = Faraday::RackBuilder.new do |builder|
end
#npm = Faraday.new(url: 'https://registry.npmjs.org', builder: stack)
gh = Octokit::Client.new(access_token: token, auto_paginate: true, middleware: stack)
gh = Octokit::Client.new(access_token: gh_token, auto_paginate: true, middleware: stack)
if not gh.user_authenticated?
STDERR.puts "Unauthenticated connection to GitHub, private repos will be invisible"
end
starting = gh.rate_limit!.remaining
gh_starting = gh.rate_limit!.remaining
STDERR.puts "GitHub API: #{gh.rate_limit}"
$commitsToSkip = Hash.new {|h,k| h[k] = []}
@ -78,16 +78,23 @@ def maybe_pr(gh, path, number)
gh.pull_request(path, number) rescue false
end
def tryto(tries=3, dflt=nil)
yield
rescue
retry unless (tries -= 1).zero?
dflt
end
def pp_commit(gh, r, commit)
msg = commit.commit.message.lines.first.strip
if $commitsToSkip[r.full_name].include? commit.sha
nil
elsif msg =~ /\AMerge pull request #(\d+) from/ and pr = maybe_pr(gh, r.full_name, $~[1])
gh.pull_request_commits(r.full_name, pr.number).each do |c|
tryto(2,[]){gh.pull_request_commits(r.full_name, pr.number)}.each do |c|
$commitsToSkip[r.full_name] << c.sha
end
"[PR##{pr.number}](#{pr.html_url}) #{pr.title} ([#{pr.user.login}](#{pr.user.html_url}))"
elsif msg =~ /\Av?\d+\.\d+\.\d+\Z/
elsif msg =~ /\Av?\d+\.\d+\.\d+(:?-[a-z0-9]+)?\Z/
c = commit
gc = commit.commit # lower level git info
author = gc.author.name
@ -122,7 +129,7 @@ def downloads_badge(repo)
"https://npmjs.com/package/#{repo.npm_name}")
end
def pp_week(gh, week, repos)
def pp_week(week, repos)
repos.group_by { |r|
if r.name =~ /connector/
[1, 'Connectors']
@ -142,7 +149,7 @@ def pp_week(gh, week, repos)
c.commit.committer.date <= week[0] or
c.commit.committer.date >= week[1]
}.map {|c|
pp_commit(gh, repo, c)
pp_commit(repo.gh, repo, c)
}.compact
next if commits.empty?
heading = repo.npm_name || repo.name
@ -186,12 +193,21 @@ REPOS = [
'strong-task-emitter',
]
repos = repo_types
.flat_map {|t| gh.org_repos('strongloop', type: t) }
.select { |r| REPOS.any? {|pat| File.fnmatch?(pat, r.name) } }
.map { |r|
def get_repos(gh, orgs, repo_types, weeks)
orgs.flat_map { |o|
repo_types.flat_map { |t|
gh.org_repos(o, type: t)
}
}.select { |r|
REPOS.any? {|pat| File.fnmatch?(pat, r.name) }
}.map { |r|
r.tap { |r|
r.pkg_json_c = gh.contents(r.full_name, path: 'package.json') rescue nil
r.gh = gh
if r.name == 'strongops'
r.pkg_json_c = gh.contents(r.full_name, path: 'agent/package.json') rescue nil
else
r.pkg_json_c = gh.contents(r.full_name, path: 'package.json') rescue nil
end
if r.pkg_json_c and r.pkg_json_c.type == 'file' and r.pkg_json_c.encoding == 'base64'
r.pkg_json = Base64.decode64(r.pkg_json_c.content)
r.pkg = YAML.load(r.pkg_json)
@ -210,11 +226,19 @@ repos = repo_types
r.npm_releases = {}
r.npm_info = {}
end
r.commits = gh.commits_between(r.full_name, weeks.last[0], weeks.first[1]) rescue []
if r.pkg_name == 'strong-agent'
r.commits = gh.commits_between(r.full_name, weeks.last[0], weeks.first[1], path: 'agent')
else
r.commits = gh.commits_between(r.full_name, weeks.last[0], weeks.first[1]) rescue []
end
r.shas = r.commits.map(&:sha)
}
}
STDERR.puts "gathering repos used: #{starting - gh.rate_limit!.remaining} requests (#{gh.rate_limit})"
end
repos = get_repos(gh, ['strongloop'], repo_types, weeks)
STDERR.puts "[GH] gathering repos used: #{gh_starting - gh.rate_limit!.remaining} requests (#{gh.rate_limit})"
weeks = []
dates = [Date.current - 8.weeks, Date.current]
@ -225,19 +249,19 @@ puts 'layout: page'
puts "since: (from #{dates[0]} to #{dates[1]})"
puts '---'
weeks.each do |week|
heading = "Sprint #{week[2]} (#{week[0]} to #{week[1]})"
if week[1].future?
heading << ' so far'
end
puts "## #{heading}\n"
pp_week(gh, week, repos)
STDERR.puts "post pp_week(#{week[0]}) used: #{starting - gh.rate_limit!.remaining} requests (#{gh.rate_limit})"
pp_week(week, repos)
STDERR.puts "[GH] post pp_week(#{week[0]}) used: #{gh_starting - gh.rate_limit!.remaining} requests (#{gh.rate_limit})"
puts '----'
puts
end
pp_week(gh, dates, repos)
STDERR.puts "post pp_week(#{dates[0]}) used: #{starting - gh.rate_limit!.remaining} requests (#{gh.rate_limit})"
pp_week(dates, repos)
STDERR.puts "Used #{starting - gh.rate_limit!.remaining} requests (#{gh.rate_limit})"
STDERR.puts "[GH] Used #{gh_starting - gh.rate_limit!.remaining} requests (#{gh.rate_limit})"