Class: Heroku::Command::Domains

Inherits:
Base
  • Object
show all
Defined in:
lib/heroku/command/domains.rb

Overview

manage custom domains

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#api, #app, #heroku, #initialize, namespace, #org, #org_api

Methods included from Helpers

#action, #app_owner, #ask, #confirm, #confirm_command, #create_git_remote, #debug, #debugging?, #default_org_host, #deprecate, #display, #display_header, #display_object, #display_row, #display_table, #error, #error_log, #error_log_path, error_with_failure, error_with_failure=, extended, extended_into, #fail, #format_bytes, #format_date, #format_error, #format_with_bang, #get_terminal_environment, #git, #has_git?, #has_git_remote?, #has_http_git_entry_in_netrc, #home_directory, #hprint, #hputs, included, included_into, #json_decode, #json_encode, #launchy, #line_formatter, #longest, #org?, #org_host, #output_with_bang, #quantify, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #stderr_print, #stderr_puts, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #time_ago, #truncate, #update_git_remote, #warn_if_using_jruby, #with_tty

Constructor Details

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

Instance Method Details

#addObject

domains:add DOMAIN

add a custom domain to an app

Examples:

$ heroku domains:add example.com Adding example.com to example… done


39
40
41
42
43
44
45
46
47
# File 'lib/heroku/command/domains.rb', line 39

def add
  unless domain = shift_argument
    error("Usage: heroku domains:add DOMAIN\nMust specify DOMAIN to add.")
  end
  validate_arguments!
  action("Adding #{domain} to #{app}") do
    api.post_domain(app, domain)
  end
end

#clearObject

domains:clear

remove all custom domains from an app

Examples:

$ heroku domains:clear Removing all domain names for example… done


77
78
79
80
81
82
# File 'lib/heroku/command/domains.rb', line 77

def clear
  validate_arguments!
  action("Removing all domain names from #{app}") do
    api.delete_domains(app)
  end
end

#indexObject

domains

list custom domains for an app

Examples:

$ heroku domains

Domain names for example

example.com


19
20
21
22
23
24
25
26
27
28
# File 'lib/heroku/command/domains.rb', line 19

def index
  validate_arguments!
  domains = api.get_domains(app).body
  if domains.length > 0
    styled_header("#{app} Domain Names")
    styled_array domains.map {|domain| domain["domain"]}
  else
    display("#{app} has no domain names.")
  end
end

#removeObject

domains:remove DOMAIN

remove a custom domain from an app

Examples:

$ heroku domains:remove example.com Removing example.com from example… done


58
59
60
61
62
63
64
65
66
# File 'lib/heroku/command/domains.rb', line 58

def remove
  unless domain = shift_argument
    error("Usage: heroku domains:remove DOMAIN\nMust specify DOMAIN to remove.")
  end
  validate_arguments!
  action("Removing #{domain} from #{app}") do
    api.delete_domain(app, domain)
  end
end