manage addon resources
addons:add ADDON
install an addon
# File lib/heroku/command/addons.rb, line 63 def add configure_addon('Adding') do |addon, config| heroku.install_addon(app, addon, config) end end
addons:downgrade ADDON
downgrade an existing addon
# File lib/heroku/command/addons.rb, line 83 def downgrade configure_addon('Downgrading') do |addon, config| heroku.upgrade_addon(app, addon, config) end end
addons
list installed addons
# File lib/heroku/command/addons.rb, line 16 def index installed = heroku.installed_addons(app) if installed.empty? display "No addons installed" else available, pending = installed.partition { |a| a['configured'] } available.map do |a| if a['attachment_name'] a['name'] + ' => ' + a['attachment_name'] else a['name'] end end.sort.each do |addon| display(addon) end unless pending.empty? display "\n--- not configured ---" pending.map { |a| a['name'] }.sort.each do |addon| display addon.ljust(24) + "http://#{heroku.host}/myapps/#{app}/addons/#{addon}" end end end end
addons:list
list all available addons
# File lib/heroku/command/addons.rb, line 46 def list addons = heroku.addons if addons.empty? display "No addons available currently" else partitioned_addons = partition_addons(addons) partitioned_addons.each do |key, addons| partitioned_addons[key] = format_for_display(addons) end display_object(partitioned_addons) end end
addons:open ADDON
open an addon's dashboard in your browser
# File lib/heroku/command/addons.rb, line 111 def open addon = args.shift app_addons = heroku.installed_addons(app).map { |a| a["name"] } matches = app_addons.select { |a| a =~ %r^#{addon}/ } case matches.length when 0 then if heroku.addons.any? {|a| a['name'] =~ %r^#{addon}/ } error "Addon not installed: #{addon}" else error "Unknown addon: #{addon}" end when 1 then addon_to_open = matches.first display "Opening #{addon_to_open} for #{app}..." Launchy.open "https://api.#{heroku.host}/myapps/#{app}/addons/#{addon_to_open}" else error "Ambiguous addon name: #{addon}" end end
addons:remove ADDON
uninstall an addon
# File lib/heroku/command/addons.rb, line 93 def remove return unless confirm_command options[:confirm] ||= app args.each do |name| messages = nil action("Removing #{name} from #{app}") do messages = addon_run { heroku.uninstall_addon(app, name, :confirm => options[:confirm]) } end output messages[:attachment] if messages[:attachment] output messages[:message] end end
addons:upgrade ADDON
upgrade an existing addon
# File lib/heroku/command/addons.rb, line 73 def upgrade configure_addon('Upgrading') do |addon, config| heroku.upgrade_addon(app, addon, config) end end