Skip to content

Instantly share code, notes, and snippets.

@jonmountjoy
Created August 22, 2013 16:14
Show Gist options
  • Save jonmountjoy/6309370 to your computer and use it in GitHub Desktop.
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.
#!/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