Base
manage addon resources
addons:add ADDON
install an addon
# File lib/heroku/command/addons.rb, line 71 def add configure_addon('Adding') do |addon, config| heroku.install_addon(app, addon, config) end end
addons:docs ADDON
open an addon’s documentation in your browser
# File lib/heroku/command/addons.rb, line 121 def docs unless addon = shift_argument error("Usage: heroku addons:docs ADDON\nMust specify ADDON to open docs for.") end validate_arguments! addon_names = api.get_addons.body.map {|a| a['name']} addon_types = addon_names.map {|name| name.split(':').first}.uniq name_matches = addon_names.select {|name| name =~ /^#{addon}/} type_matches = addon_types.select {|name| name =~ /^#{addon}/} if name_matches.include?(addon) || type_matches.include?(addon) type_matches = [addon] end case type_matches.length when 0 then error([ "`#{addon}` is not a heroku add-on.", suggestion(addon, addon_names + addon_types), "See `heroku addons:list` for all available addons." ].compact.join("\n")) when 1 addon_type = type_matches.first launchy("Opening #{addon_type} docs", addon_docs_url(addon_type)) else error("Ambiguous addon name: #{addon}\nPerhaps you meant #{name_matches[0...-1].map {|match| "`#{match}`"}.join(', ')} or `#{name_matches.last}`.\n") end end
addons:downgrade ADDON
downgrade an existing addon
# File lib/heroku/command/addons.rb, line 91 def downgrade configure_addon('Downgrading to') 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 validate_arguments! installed = api.get_addons(app).body if installed.empty? display("#{app} has no add-ons.") else available, pending = installed.partition { |a| a['configured'] } unless available.empty? styled_header("#{app} Configured Add-ons") styled_array(available.map do |a| [a['name'], a['attachment_name'] || ''] end) end unless pending.empty? styled_header("#{app} Add-ons to Configure") styled_array(pending.map do |a| [a['name'], app_addon_url(a['name'])] end) end end end
addons:list list all available addons --region REGION # specify a region for addon availability
Example:
$ heroku addons:list --region eu === available adept-scale:battleship, corvette... adminium:enterprise, petproject...
# File lib/heroku/command/addons.rb, line 54 def list addons = heroku.addons(options) 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 156 def open unless addon = shift_argument error("Usage: heroku addons:open ADDON\nMust specify ADDON to open.") end validate_arguments! app_addons = api.get_addons(app).body.map {|a| a['name']} matches = app_addons.select {|a| a =~ /^#{addon}/}.sort case matches.length when 0 then addon_names = api.get_addons.body.map {|a| a['name']} if addon_names.any? {|name| name =~ /^#{addon}/} error("Addon not installed: #{addon}") else error([ "`#{addon}` is not a heroku add-on.", suggestion(addon, addon_names + addon_names.map {|name| name.split(':').first}.uniq), "See `heroku addons:list` for all available addons." ].compact.join("\n")) end when 1 then addon_to_open = matches.first launchy("Opening #{addon_to_open} for #{app}", app_addon_url(addon_to_open)) else error("Ambiguous addon name: #{addon}\nPerhaps you meant #{matches[0...-1].map {|match| "`#{match}`"}.join(', ')} or `#{matches.last}`.\n") end end
addons:remove ADDON1 [ADDON2 …]
uninstall one or more addons
# File lib/heroku/command/addons.rb, line 101 def remove return unless confirm_command args.each do |name| messages = nil if name.start_with? "HEROKU_POSTGRESQL_" name = name.chomp("_URL").freeze end action("Removing #{name} on #{app}") do messages = addon_run { heroku.uninstall_addon(app, name, :confirm => app) } end display(messages[:attachment]) if messages[:attachment] display(messages[:message]) if messages[:message] end end
Generated with the Darkfish Rdoc Generator 2.