Class: Heroku::Command::Domains

Inherits:
BaseWithApp show all
Defined in:
lib/heroku/commands/domains.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



14
15
16
17
18
# File 'lib/heroku/commands/domains.rb', line 14

def add
	domain = args.shift.downcase rescue nil
	heroku.add_domain(app, domain)
	display "Added #{domain} as a custom domain name to #{app}.#{heroku.host}"
end

#clearObject



26
27
28
29
# File 'lib/heroku/commands/domains.rb', line 26

def clear
	heroku.remove_domains(app)
	display "Removed all domain names for #{app}.#{heroku.host}"
end

#listObject Also known as: index



3
4
5
6
7
8
9
10
11
# File 'lib/heroku/commands/domains.rb', line 3

def list
	domains = heroku.list_domains(app)
	if domains.empty?
		display "No domain names for #{app}.#{heroku.host}"
	else
		display "Domain names for #{app}.#{heroku.host}:"
		display domains.map { |d| d[:domain] }.join("\n")
	end
end

#removeObject



20
21
22
23
24
# File 'lib/heroku/commands/domains.rb', line 20

def remove
	domain = args.shift.downcase rescue nil
	heroku.remove_domain(app, domain)
	display "Removed #{domain} as a custom domain name to #{app}.#{heroku.host}"
end