Class: Azuki::Command::Domains
- Defined in:
- lib/azuki/command/domains.rb
Overview
manage custom domains
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#add ⇒ Object
domains:add DOMAIN.
-
#clear ⇒ Object
domains:clear.
-
#index ⇒ Object
domains.
-
#remove ⇒ Object
domains:remove DOMAIN.
Methods inherited from Base
#api, #app, #azuki, #initialize, namespace
Methods included from Helpers
#action, #ask, #confirm, #confirm_billing, #confirm_command, #create_git_remote, #deprecate, #display, #display_header, #display_object, #display_row, #display_table, #error, 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?, #home_directory, #hprint, #hputs, included, included_into, #json_decode, #json_encode, #launchy, #line_formatter, #longest, #output_with_bang, #quantify, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #time_ago, #truncate, #with_tty
Constructor Details
This class inherits a constructor from Azuki::Command::Base
Instance Method Details
#add ⇒ Object
domains:add DOMAIN
add a custom domain to an app
Examples:
$ azuki domains:add example.com Adding example.com to example… done
39 40 41 42 43 44 45 46 47 |
# File 'lib/azuki/command/domains.rb', line 39 def add unless domain = shift_argument error("Usage: azuki domains:add DOMAIN\nMust specify DOMAIN to add.") end validate_arguments! action("Adding #{domain} to #{app}") do api.post_domain(app, domain) end end |
#clear ⇒ Object
domains:clear
remove all custom domains from an app
Examples:
$ azuki domains:clear Removing all domain names for example… done
77 78 79 80 81 82 |
# File 'lib/azuki/command/domains.rb', line 77 def clear validate_arguments! action("Removing all domain names from #{app}") do api.delete_domains(app) end end |
#index ⇒ Object
domains
list custom domains for an app
Examples:
$ azuki domains
Domain names for example
example.com
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/azuki/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 |
#remove ⇒ Object
domains:remove DOMAIN
remove a custom domain from an app
Examples:
$ azuki domains:remove example.com Removing example.com from example… done
58 59 60 61 62 63 64 65 66 |
# File 'lib/azuki/command/domains.rb', line 58 def remove unless domain = shift_argument error("Usage: azuki domains:remove DOMAIN\nMust specify DOMAIN to remove.") end validate_arguments! action("Removing #{domain} from #{app}") do api.delete_domain(app, domain) end end |