Class: Heroku::Command::Config

Inherits:
BaseWithApp show all
Defined in:
lib/heroku/commands/config.rb

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?

Constructor Details

This class inherits a constructor from Heroku::Command::BaseWithApp

Instance Method Details

#addObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/heroku/commands/config.rb', line 9

def add
	unless args.size > 0 and args.all? { |a| a.include?('=') }
		raise CommandFailed, "Usage: heroku config:add <key>=<value> [<key2>=<value2> ...]"
	end

	vars = args.inject({}) do |vars, arg|
		key, value = arg.split('=', 2)
		vars[key] = value
		vars
	end

	display "Adding config vars:"
	display_vars(vars, :indent => 2)

	display "Restarting app...", false
	heroku.add_config_vars(app, vars)
	display "done."
end

#clearObject



35
36
37
38
39
# File 'lib/heroku/commands/config.rb', line 35

def clear
	display "Clearing all config vars and restarting app...", false
	heroku.clear_config_vars(app)
	display "done."
end

#indexObject



3
4
5
6
7
# File 'lib/heroku/commands/config.rb', line 3

def index
	long = args.delete('--long')
	vars = heroku.config_vars(app)
	display_vars(vars, :long => long)
end

#removeObject Also known as: rm



28
29
30
31
32
# File 'lib/heroku/commands/config.rb', line 28

def remove
	display "Removing #{args.first} and restarting app...", false
	heroku.remove_config_var(app, args.first)
	display "done."
end