bin/acquia in acquia_toolbelt-1.1.0 vs bin/acquia in acquia_toolbelt-1.2.0
- old
+ new
@@ -3,34 +3,35 @@
require "thor"
require "netrc"
require "highline/import"
require "faraday"
require "json"
+require "rainbow"
class Acquia < Thor
# A no_commands block is designed to show the methods that cannot be invoked
# and as such, do not have a description.
no_commands {
# Internal: Used for outputting a pretty success message.
#
# Returns the coloured and formatted string.
def success(text)
- puts "\e[#32m#{text}\e[0m"
+ puts "#{text}".foreground(:green)
end
# Internal: Used for outputting a pretty error message.
#
# Returns the coloured and formatted string.
def fail(text)
- puts "\e[#31m#{text}\e[0m"
+ puts "#{text}".foreground(:red)
end
# Internal: Used for outputting a pretty info message.
#
# Returns the coloured and formatted string.
def info(text)
- puts "\e[#36m#{text}\e[0m"
+ puts "#{text}".foreground(:cyan)
end
# Internal: Create a request to the Acquia API.
#
# The request generated contains all the correct user authentication and
@@ -371,9 +372,27 @@
end
domains.each do |domain|
say "> #{domain["name"]}"
end
end
+ end
+
+ # Public: Add a domain to an environment.
+ #
+ # Returns a status message on successful addition.
+ desc "add-domain <subscription> <environment> <domain>", "Add a domain to an environment."
+ def add_domain(subscription, environment, domain)
+ add_domain = acquia_api_call "/sites/#{subscription}/envs/#{environment}/domains/#{domain}", "POST"
+ success "Domain #{domain} has been successfully added to #{environment}." if add_domain["id"]
+ end
+
+ # Public: Remove a domain from an environment.
+ #
+ # Returns a status message on successful deletion.
+ desc "delete-domain <subscription> <environment> <domain>", "Delete a domain from an environment."
+ def delete_domain(subscription, environment, domain)
+ delete_domain = acquia_api_call "/sites/#{subscription}/envs/#{environment}/domains/#{domain}", "DELETE"
+ success "Domain #{domain} has been successfully deleted from #{environment}." if delete_domain["id"]
end
# Public: Clear a web cache on a domain.
#
# Send off a DELETE request to clear the web cache for a particular domain or
\ No newline at end of file