Class: Dreamy::Command::Dns
- Inherits:
-
Base
- Object
- Base
- Dreamy::Command::Dns
show all
- Defined in:
- lib/dreamy/commands/dns.rb
Instance Method Summary
collapse
Methods inherited from Base
#announce_add, #announce_list, #announce_lists, #announce_post, #announce_remove, #dns, #dns_add, #dns_remove, #domains, #initialize, #mail_add_filter, #mail_list_filters, #mail_remove_filter, #mysql_dbs, #mysql_hosts, #mysql_users, #ps, #ps_add, #ps_pending, #ps_reboot!, #ps_reboot_history, #ps_remove, #ps_set, #ps_settings, #ps_size_history, #ps_size_set, #ps_usage, #users
Constructor Details
This class inherits a constructor from Dreamy::Base
Instance Method Details
#add ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/dreamy/commands/dns.rb', line 25
def add
if args.length == 3
record, type, value = args[0], args[1], args[2]
@account.dns_add(record,type,value)
display "Successfully added #{type} record of #{value} to #{record}"
display "Please wait for DNS to propagate"
else
display "Usage: dh dns:add [new record] [type] [value]"
end
end
|
#list ⇒ Object
Also known as:
index
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/dreamy/commands/dns.rb', line 4
def list
dns = @account.dns
if args.length > 0
filter = args.shift.downcase
dns = dns.select { |d| d.zone.match(filter) }
end
if dns.empty?
display "No DNS records for this account or requested zone not found"
else
dns_table = table do |t|
t.headings = 'Record', 'Type', 'Value'
dns.each { |d| t << [d.record,d.type,d.value] if d.type != "TXT" }
end
display "NOTE: TXT records not displayed (too long)"
display dns_table
end
end
|
#remove ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/dreamy/commands/dns.rb', line 36
def remove
if args.length == 3
record, type, value = args[0], args[1], args[2]
@account.dns_remove(record,type,value)
display "Successfully removed #{type} record of #{value} to #{record}"
display "Please wait for DNS to propagate"
else
display "Usage: dh dns:remove [new record] [type] [value]"
end
end
|