Created
August 22, 2013 16:14
-
-
Save jonmountjoy/6309370 to your computer and use it in GitHub Desktop.
Checks all your apps - returns those that have an add-on matching the name in the regular expression.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# gem install 'heroku-api' | |
require 'rubygems' | |
require 'heroku-api' | |
ADDON=/memcache.*/ | |
api_key = `heroku auth:token` | |
heroku = Heroku::API.new(:api_key => api_key) | |
# My apps | |
puts "working" | |
apps = heroku.get_apps.body | |
puts "processing #{apps.size} apps" | |
apps_summary = apps.map do |app| | |
app_name = app['name'] | |
addons = heroku.get_addons(app_name).body | |
filtered = addons.map{|ao| ao['name']}.select{|an| an =~ ADDON} | |
puts "#{app_name} - #{filtered}" if !filtered.empty? | |
end | |
puts "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment