Skip to content

Commit

Permalink
"ey-dns domains" lists the registered domains for each DNS provider (…
Browse files Browse the repository at this point in the history
…with a count of records for each)
  • Loading branch information
drnic committed May 24, 2011
1 parent 4c7e1e2 commit 560d864
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
17 changes: 17 additions & 0 deletions features/list_available_domains.feature
@@ -0,0 +1,17 @@
Feature: List available domains
I want to see the available domains I can associate with my AppCloud apps

Scenario: Show domains without any records:
Given I have setup my fog credentials for "DNSimple"
And I have DNS domain "myapp.com" with provider "DNSimple"
And I have DNS domain "myotherapp.com" with provider "DNSimple"
When I run local executable "ey-dns" with arguments "domains"
Then I should see exactly
"""
DNSimple:
myapp.com - 0 records
myotherapp.com - 0 records
"""


19 changes: 18 additions & 1 deletion lib/engineyard-dns/cli.rb
Expand Up @@ -18,7 +18,6 @@ def self.start(*)
super
end


desc "assign DOMAIN [NAME]", "Assign DNS domain/tld (or name.tld) to your AppCloud environment"
method_option :verbose, :aliases => ["-V"], :desc => "Display more output"
method_option :environment, :aliases => ["-e"], :desc => "Environment in which to deploy this application", :type => :string
Expand Down Expand Up @@ -61,6 +60,24 @@ def assign(domain_name, name = "")
# ::DNSimple::Commands::ListRecords.new.execute([domain])
end

desc "domains", "List available domains/zones from your DNS providers"
def domains
dns_provider_names.each do |provider_name|
dns_provider = ::Fog::DNS.new({:provider => provider_name})
domains = dns_provider.zones

if domains.size == 0
say "#{provider_name}: ", :yellow; say "none"
else
say "#{provider_name}:", :green
domains.each do |domain|
records = domain.records.all
say " #{domain.domain} - #{records.size} records"
end
end
end
end

desc "version", "show version information"
def version
require 'engineyard-dns/version'
Expand Down

0 comments on commit 560d864

Please sign in to comment.