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

View File

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