sant0sk1-dreamy 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -3
- data/VERSION.yml +1 -1
- data/lib/dreamy/commands/base.rb +1 -1
- data/lib/dreamy/commands/domains.rb +21 -2
- data/lib/dreamy/commands/help.rb +3 -2
- data/lib/dreamy/domain.rb +16 -11
- data/test/domain_test.rb +23 -3
- metadata +2 -2
data/README.md
CHANGED
@@ -33,9 +33,9 @@ Fetch an array of Dreamy::Domain objects:
|
|
33
33
|
Now that you have an array you can have your way with the data:
|
34
34
|
|
35
35
|
account.domains.each do |d|
|
36
|
+
puts d.domain
|
37
|
+
puts d.type
|
36
38
|
puts d.home
|
37
|
-
puts d.user
|
38
|
-
puts d.www_or_not
|
39
39
|
end
|
40
40
|
|
41
41
|
Same goes with Users, DNS records and announcement list subscribers
|
@@ -88,7 +88,8 @@ Run this from the command line to print the usage:
|
|
88
88
|
=== Commands
|
89
89
|
help # show this usage
|
90
90
|
|
91
|
-
domains
|
91
|
+
domains:http # list HTTP domain details
|
92
|
+
domains:mysql # list MySQL domains
|
92
93
|
domains:status # check availability of all domains (pingability)
|
93
94
|
|
94
95
|
dns # list DNS records
|
data/VERSION.yml
CHANGED
data/lib/dreamy/commands/base.rb
CHANGED
@@ -84,7 +84,7 @@ module Dreamy::Command
|
|
84
84
|
if @credentials[0].nil? || @credentials[1].nil?
|
85
85
|
display "\nYou need to set your API credentials. You can do this 2 ways:\n"
|
86
86
|
display "\n1) set environment variables 'DH_USER' and 'DH_KEY'"
|
87
|
-
display "2) create
|
87
|
+
display "2) create ~/.dreamyrc with user on first line and key on second\n\n"
|
88
88
|
exit 1
|
89
89
|
end
|
90
90
|
@credentials
|
@@ -4,9 +4,14 @@ module Dreamy::Command
|
|
4
4
|
class Domains < Base
|
5
5
|
|
6
6
|
def index
|
7
|
-
|
7
|
+
http
|
8
|
+
end
|
9
|
+
|
10
|
+
def http
|
11
|
+
domains = @account.domains.reject { |d| d.type != 'http'}
|
12
|
+
|
8
13
|
if domains.empty?
|
9
|
-
display "No domains on this account"
|
14
|
+
display "No HTTP domains on this account"
|
10
15
|
else
|
11
16
|
domain_table = table do |t|
|
12
17
|
t.headings = 'Domain Name', 'Server', 'Type', 'User', 'WWW or Not'
|
@@ -16,6 +21,20 @@ module Dreamy::Command
|
|
16
21
|
end
|
17
22
|
end
|
18
23
|
|
24
|
+
def mysql
|
25
|
+
domains = @account.domains.reject { |d| d.type != 'mysqldns'}
|
26
|
+
|
27
|
+
if domains.empty?
|
28
|
+
display "No MySQL domains on this account"
|
29
|
+
else
|
30
|
+
domain_table = table do |t|
|
31
|
+
t.headings = 'Domain Name', 'Server'
|
32
|
+
domains.each { |d| t << [d.domain,d.short_home]}
|
33
|
+
end
|
34
|
+
display domain_table
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
19
38
|
def status
|
20
39
|
domains = @account.domains
|
21
40
|
domains.each do |d|
|
data/lib/dreamy/commands/help.rb
CHANGED
@@ -10,13 +10,14 @@ module Dreamy::Command
|
|
10
10
|
=== Commands
|
11
11
|
help # show this usage
|
12
12
|
|
13
|
-
domains
|
13
|
+
domains:http # list HTTP domain details
|
14
|
+
domains:mysql # list MySQL domains
|
14
15
|
domains:status # check availability of all domains (pingability)
|
15
16
|
|
16
17
|
dns # list DNS records
|
17
18
|
dns <name> # list DNS records for <name>
|
18
19
|
|
19
|
-
announce:list <list> #
|
20
|
+
announce:list <list> # list all subscribers to <name> list (eg - 'my_list@example.com')
|
20
21
|
announce:add <list> <email> # add subscriber with <email> to <list>
|
21
22
|
announce:remove <list> <email> # remove subscriber with <email> from <list>
|
22
23
|
|
data/lib/dreamy/domain.rb
CHANGED
@@ -7,22 +7,27 @@ module Dreamy
|
|
7
7
|
|
8
8
|
def self.new_from_xml(xml)
|
9
9
|
d = new
|
10
|
+
|
10
11
|
d.account_id = (xml).at('account_id').innerHTML
|
11
12
|
d.domain = (xml).at('domain').innerHTML
|
12
|
-
d.fastcgi = (xml).at('fastcgi').innerHTML
|
13
13
|
d.home = (xml).at('home').innerHTML
|
14
|
-
d.hosting_type = (xml).at('hosting_type').innerHTML
|
15
|
-
d.outside_url = (xml).at('outside_url').innerHTML
|
16
|
-
d.passenger = (xml).at('passenger').innerHTML
|
17
|
-
d.path = (xml).at('path').innerHTML
|
18
|
-
d.php = (xml).at('php').innerHTML
|
19
|
-
d.php_fcgid = (xml).at('php_fcgid').innerHTML
|
20
|
-
d.security = (xml).at('security').innerHTML
|
21
14
|
d.type = (xml).at('type').innerHTML
|
22
15
|
d.unique_ip = (xml).at('unique_ip').innerHTML
|
23
|
-
|
24
|
-
d.
|
25
|
-
|
16
|
+
|
17
|
+
if d.type == 'http'
|
18
|
+
d.fastcgi = (xml).at('fastcgi').innerHTML
|
19
|
+
d.hosting_type = (xml).at('hosting_type').innerHTML
|
20
|
+
d.outside_url = (xml).at('outside_url').innerHTML
|
21
|
+
d.passenger = (xml).at('passenger').innerHTML
|
22
|
+
d.path = (xml).at('path').innerHTML
|
23
|
+
d.php = (xml).at('php').innerHTML
|
24
|
+
d.php_fcgid = (xml).at('php_fcgid').innerHTML
|
25
|
+
d.security = (xml).at('security').innerHTML
|
26
|
+
d.user = (xml).at('user').innerHTML
|
27
|
+
d.www_or_not = (xml).at('www_or_not').innerHTML
|
28
|
+
d.xcache = (xml).at('xcache').innerHTML
|
29
|
+
end
|
30
|
+
|
26
31
|
d
|
27
32
|
end
|
28
33
|
|
data/test/domain_test.rb
CHANGED
@@ -4,7 +4,7 @@ class DreamyDomainTest < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
context "Creation" do
|
6
6
|
setup do
|
7
|
-
@
|
7
|
+
@domain_xml = <<EOF
|
8
8
|
<data>
|
9
9
|
<account_id>8675309</account_id>
|
10
10
|
<domain>anessalee.net</domain>
|
@@ -24,10 +24,22 @@ class DreamyDomainTest < Test::Unit::TestCase
|
|
24
24
|
<xcache>0</xcache>
|
25
25
|
</data>
|
26
26
|
EOF
|
27
|
-
|
27
|
+
|
28
|
+
@mysql_xml = <<EOF
|
29
|
+
<data>
|
30
|
+
<account_id>8675309</account_id>
|
31
|
+
<domain>mysql.anessalee.net</domain>
|
32
|
+
<home>zechiel.swordfish.Dreamy.com</home>
|
33
|
+
<type>mysqldns</type>
|
34
|
+
<unique_ip></unique_ip>
|
35
|
+
</data>
|
36
|
+
EOF
|
37
|
+
|
38
|
+
@d = Dreamy::Domain.new_from_xml(Hpricot.XML(@domain_xml))
|
39
|
+
@m = Dreamy::Domain.new_from_xml(Hpricot.XML(@mysql_xml))
|
28
40
|
end
|
29
41
|
|
30
|
-
should "assign valid domain from xml" do
|
42
|
+
should "assign valid http domain from xml" do
|
31
43
|
assert_equal "8675309", @d.account_id
|
32
44
|
assert_equal "anessalee.net", @d.domain
|
33
45
|
assert_equal "0", @d.fastcgi
|
@@ -46,6 +58,14 @@ EOF
|
|
46
58
|
assert_equal "0", @d.xcache
|
47
59
|
end
|
48
60
|
|
61
|
+
should "assign valid mysql domain from xml" do
|
62
|
+
assert_equal "8675309", @m.account_id
|
63
|
+
assert_equal "mysql.anessalee.net", @m.domain
|
64
|
+
assert_equal "zechiel.swordfish.Dreamy.com", @m.home
|
65
|
+
assert_equal "mysqldns", @m.type
|
66
|
+
assert_equal "", @m.unique_ip
|
67
|
+
end
|
68
|
+
|
49
69
|
should "return shortened server name if requested" do
|
50
70
|
assert_equal "juniormint", @d.short_home
|
51
71
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sant0sk1-dreamy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerod Santo
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-24 00:00:00 -07:00
|
13
13
|
default_executable: dh
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|