Class: Heroku::Command::Addons
Instance Attribute Summary
Attributes inherited from BaseWithApp
#app
Attributes inherited from Base
#args, #autodetected_app
Instance Method Summary
collapse
Methods inherited from BaseWithApp
#initialize
Methods inherited from Base
#app_urls, #ask, #display, #error, #escape, #extract_app, #extract_app_in_dir, #extract_option, #format_date, #git_remotes, #git_url, #heroku, #initialize, #shell, #web_url
Methods included from Helpers
#home_directory, #running_on_a_mac?, #running_on_windows?
Instance Method Details
#add ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/heroku/commands/addons.rb', line 35
def add
addon = args.shift
config = {}
args.each do |arg|
key, value = arg.strip.split('=', 2)
if value.nil?
error("Non-config value \"#{arg}\".\nEverything after the addon name should be a key=value pair")
else
config[key] = value
end
end
display "Adding #{addon} to #{app}... ", false
display addon_run { heroku.install_addon(app, addon, config) }
end
|
#clear ⇒ Object
58
59
60
61
62
63
|
# File 'lib/heroku/commands/addons.rb', line 58
def clear
heroku.installed_addons(app).each do |addon|
display "Removing #{addon['description']} from #{app}... ", false
display addon_run { heroku.uninstall_addon(app, addon['name']) }
end
end
|
#confirm_billing ⇒ Object
65
66
67
|
# File 'lib/heroku/commands/addons.rb', line 65
def confirm_billing
Heroku::Command.run_internal 'account:confirm_billing', []
end
|
#index ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/heroku/commands/addons.rb', line 3
def index
installed = heroku.installed_addons(app)
if installed.empty?
display "No addons installed"
else
available, pending = installed.partition { |a| a['configured'] }
available.map { |a| a['name'] }.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
|
#info ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/heroku/commands/addons.rb', line 21
def info
addons = heroku.addons
if addons.empty?
display "No addons available currently"
else
available, beta = addons.partition { |a| !a['beta'] }
display_addons(available)
if !beta.empty?
display "\n--- beta ---"
display_addons(beta)
end
end
end
|
#remove ⇒ Object
51
52
53
54
55
56
|
# File 'lib/heroku/commands/addons.rb', line 51
def remove
args.each do |name|
display "Removing #{name} from #{app}... ", false
display addon_run { heroku.uninstall_addon(app, name) }
end
end
|