Skip to content

Instantly share code, notes, and snippets.

@brandur brandur/releases.rb
Created Dec 27, 2013

Embed
What would you like to do?
Heroku app releases this year
require "json"
require "time"
#
# usage: releases.rb <app>
#
def get_releases(app)
# use curl for -n
JSON.parse(`curl --silent -n -H "Accept: application/vnd.heroku+json; version=3" -H "Range: seq ..; order=desc, max=1000" https://api.heroku.com/apps/#{app}/releases`)
end
app = ARGV[0] || abort("usage: releases.rb <app>")
data = get_releases(app)
num_releases = data.count { |r|
Time.parse(r["created_at"]).year == Time.now.year
}
puts "#{num_releases} releases in #{Time.now.year}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.