lumberg 2.0.0.pre4 → 2.0.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -49
- data/lib/lumberg/cpanel.rb +2 -0
- data/lib/lumberg/cpanel/addon_domain.rb +3 -3
- data/lib/lumberg/cpanel/backups.rb +1 -1
- data/lib/lumberg/cpanel/base.rb +5 -5
- data/lib/lumberg/cpanel/box_trapper.rb +1 -1
- data/lib/lumberg/cpanel/branding.rb +5 -5
- data/lib/lumberg/cpanel/contact.rb +2 -2
- data/lib/lumberg/cpanel/cron.rb +6 -6
- data/lib/lumberg/cpanel/dns_lookup.rb +1 -1
- data/lib/lumberg/cpanel/domain_keys.rb +4 -4
- data/lib/lumberg/cpanel/domain_lookup.rb +4 -4
- data/lib/lumberg/cpanel/email.rb +40 -40
- data/lib/lumberg/cpanel/file_manager.rb +5 -5
- data/lib/lumberg/cpanel/ftp.rb +101 -0
- data/lib/lumberg/cpanel/gpg.rb +4 -4
- data/lib/lumberg/cpanel/locale.rb +1 -1
- data/lib/lumberg/cpanel/mime.rb +2 -2
- data/lib/lumberg/cpanel/mysql.rb +6 -6
- data/lib/lumberg/cpanel/net.rb +2 -2
- data/lib/lumberg/cpanel/park.rb +4 -4
- data/lib/lumberg/cpanel/password.rb +2 -2
- data/lib/lumberg/cpanel/password_strength.rb +63 -0
- data/lib/lumberg/cpanel/random_data.rb +1 -1
- data/lib/lumberg/cpanel/redirect.rb +2 -2
- data/lib/lumberg/cpanel/ssl.rb +23 -23
- data/lib/lumberg/cpanel/sub_domain.rb +4 -4
- data/lib/lumberg/cpanel/support.rb +2 -2
- data/lib/lumberg/cpanel/zone_edit.rb +8 -8
- data/lib/lumberg/format_whm.rb +7 -7
- data/lib/lumberg/version.rb +1 -1
- data/lib/lumberg/whm/account.rb +5 -5
- data/lib/lumberg/whm/cert.rb +1 -1
- data/lib/lumberg/whm/dns.rb +6 -6
- data/lib/lumberg/whm/reseller.rb +5 -5
- data/lib/lumberg/whm/server.rb +26 -26
- data/spec/cpanel/addon_domain_spec.rb +13 -13
- data/spec/cpanel/backups_spec.rb +3 -3
- data/spec/cpanel/base_spec.rb +19 -19
- data/spec/cpanel/box_trapper_spec.rb +3 -3
- data/spec/cpanel/branding_spec.rb +3 -3
- data/spec/cpanel/contact_spec.rb +6 -6
- data/spec/cpanel/cron_spec.rb +51 -51
- data/spec/cpanel/dns_lookup_spec.rb +4 -4
- data/spec/cpanel/domain_keys_spec.rb +3 -3
- data/spec/cpanel/domain_lookup_spec.rb +5 -5
- data/spec/cpanel/email_spec.rb +116 -116
- data/spec/cpanel/file_manager_spec.rb +11 -11
- data/spec/cpanel/ftp_spec.rb +71 -0
- data/spec/cpanel/gpg_spec.rb +3 -3
- data/spec/cpanel/locale_spec.rb +3 -3
- data/spec/cpanel/net_spec.rb +4 -4
- data/spec/cpanel/park_spec.rb +7 -7
- data/spec/cpanel/password_spec.rb +5 -5
- data/spec/cpanel/password_strength_spec.rb +50 -0
- data/spec/cpanel/random_data_spec.rb +4 -4
- data/spec/cpanel/ssl_spec.rb +27 -27
- data/spec/cpanel/sub_domain_spec.rb +8 -8
- data/spec/cpanel/support_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/vcr_cassettes/cpanel/ftp/addftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/delftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml +95 -0
- data/spec/vcr_cassettes/cpanel/ftp/passwd.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/setquota.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/required_strength.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/strength.yml +83 -0
- data/spec/whm/account_spec.rb +69 -69
- data/spec/whm/base_spec.rb +3 -3
- data/spec/whm/cert_spec.rb +24 -24
- data/spec/whm/dns_spec.rb +36 -36
- data/spec/whm/reseller_spec.rb +36 -36
- data/spec/whm/server_spec.rb +22 -22
- data/spec/whm/whm_spec.rb +8 -8
- metadata +29 -2
data/spec/cpanel/backups_spec.rb
CHANGED
@@ -2,12 +2,12 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module Lumberg
|
4
4
|
describe Cpanel::Backups do
|
5
|
-
let(:server) { Whm::Server.new(:
|
5
|
+
let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
|
6
6
|
let(:api_username) { "lumberg" }
|
7
7
|
let(:backups) do
|
8
8
|
described_class.new(
|
9
|
-
:
|
10
|
-
:
|
9
|
+
server: server,
|
10
|
+
api_username: api_username
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
data/spec/cpanel/base_spec.rb
CHANGED
@@ -3,9 +3,9 @@ require "spec_helper"
|
|
3
3
|
module Lumberg
|
4
4
|
describe Cpanel::Base do
|
5
5
|
before(:each) do
|
6
|
-
@login = { :
|
6
|
+
@login = { host: @whm_host, hash: @whm_hash }
|
7
7
|
@server = Whm::Server.new(@login.dup)
|
8
|
-
@base = Cpanel::Base.new(:
|
8
|
+
@base = Cpanel::Base.new(server: @server, api_username: "foodawg")
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "::api_module" do
|
@@ -29,7 +29,7 @@ module Lumberg
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "allows a server hash to be passed in" do
|
32
|
-
base = Cpanel::Base.new(:
|
32
|
+
base = Cpanel::Base.new(server: @login, api_username: "foodawg")
|
33
33
|
base.server.should be_a(Whm::Server)
|
34
34
|
end
|
35
35
|
|
@@ -37,9 +37,9 @@ module Lumberg
|
|
37
37
|
|
38
38
|
describe "#perform_request" do
|
39
39
|
let(:valid_options) {{
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
40
|
+
api_username: "foodawg",
|
41
|
+
api_module: "SomeModule",
|
42
|
+
api_function: "some_function"
|
43
43
|
}}
|
44
44
|
|
45
45
|
context "requires api_username" do
|
@@ -47,12 +47,12 @@ module Lumberg
|
|
47
47
|
@base.server.should_receive(:perform_request).with(
|
48
48
|
anything,
|
49
49
|
hash_including(
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
50
|
+
cpanel_jsonapi_module: "SomeModule",
|
51
|
+
cpanel_jsonapi_func: "some_function",
|
52
|
+
cpanel_jsonapi_user: "foodawg"
|
53
53
|
)
|
54
54
|
)
|
55
|
-
@base.perform_request(:
|
55
|
+
@base.perform_request(api_module: "SomeModule", api_function: "some_function")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -60,9 +60,9 @@ module Lumberg
|
|
60
60
|
it "performs the request with specified API version" do
|
61
61
|
@base.server.should_receive(:perform_request).with(
|
62
62
|
anything,
|
63
|
-
hash_including(:
|
63
|
+
hash_including(cpanel_jsonapi_apiversion: 1234)
|
64
64
|
)
|
65
|
-
@base.perform_request(valid_options.merge(:
|
65
|
+
@base.perform_request(valid_options.merge(api_version: 1234))
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -70,7 +70,7 @@ module Lumberg
|
|
70
70
|
it "sets API version to 2" do
|
71
71
|
@base.server.should_receive(:perform_request).with(
|
72
72
|
anything,
|
73
|
-
hash_including(:
|
73
|
+
hash_including(cpanel_jsonapi_apiversion: 2)
|
74
74
|
)
|
75
75
|
@base.perform_request(valid_options)
|
76
76
|
end
|
@@ -80,9 +80,9 @@ module Lumberg
|
|
80
80
|
it "performs the request with specified key" do
|
81
81
|
@base.server.should_receive(:perform_request).with(
|
82
82
|
anything,
|
83
|
-
hash_including(:
|
83
|
+
hash_including(response_key: "some_key")
|
84
84
|
)
|
85
|
-
@base.perform_request(valid_options.merge(:
|
85
|
+
@base.perform_request(valid_options.merge(response_key: "some_key"))
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -90,7 +90,7 @@ module Lumberg
|
|
90
90
|
it "sets key to \"cpanelresult\"" do
|
91
91
|
@base.server.should_receive(:perform_request).with(
|
92
92
|
anything,
|
93
|
-
hash_including(:
|
93
|
+
hash_including(response_key: "cpanelresult")
|
94
94
|
)
|
95
95
|
@base.perform_request(valid_options)
|
96
96
|
end
|
@@ -104,9 +104,9 @@ module Lumberg
|
|
104
104
|
it "accepts additional call parameters" do
|
105
105
|
@base.server.should_receive(:perform_request).with(
|
106
106
|
anything,
|
107
|
-
hash_including(:
|
107
|
+
hash_including(awesome: "sauce")
|
108
108
|
)
|
109
|
-
@base.perform_request(valid_options.merge({ :
|
109
|
+
@base.perform_request(valid_options.merge({ awesome: "sauce" }))
|
110
110
|
end
|
111
111
|
|
112
112
|
context "@api_username is not nil" do
|
@@ -114,7 +114,7 @@ module Lumberg
|
|
114
114
|
@base.api_username = "foodawg"
|
115
115
|
@base.server.should_receive(:perform_request).with(
|
116
116
|
anything,
|
117
|
-
hash_including(:
|
117
|
+
hash_including(cpanel_jsonapi_user: "foodawg")
|
118
118
|
)
|
119
119
|
|
120
120
|
options = valid_options
|
@@ -2,12 +2,12 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module Lumberg
|
4
4
|
describe Cpanel::BoxTrapper do
|
5
|
-
let(:server) { Whm::Server.new(:
|
5
|
+
let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
|
6
6
|
let(:api_username) { "lumberg" }
|
7
7
|
let(:boxtrapper) do
|
8
8
|
described_class.new(
|
9
|
-
:
|
10
|
-
:
|
9
|
+
server: server,
|
10
|
+
api_username: api_username
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
@@ -2,12 +2,12 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module Lumberg
|
4
4
|
describe Cpanel::Branding do
|
5
|
-
let(:server) { Whm::Server.new(:
|
5
|
+
let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
|
6
6
|
let(:api_username) { "lumberg" }
|
7
7
|
let(:branding) do
|
8
8
|
described_class.new(
|
9
|
-
:
|
10
|
-
:
|
9
|
+
server: server,
|
10
|
+
api_username: api_username
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
data/spec/cpanel/contact_spec.rb
CHANGED
@@ -2,12 +2,12 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module Lumberg
|
4
4
|
describe Cpanel::Contact do
|
5
|
-
let(:server) { Whm::Server.new(:
|
5
|
+
let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
|
6
6
|
let(:api_username) { "lumberg" }
|
7
7
|
let(:contact) do
|
8
8
|
described_class.new(
|
9
|
-
:
|
10
|
-
:
|
9
|
+
server: server,
|
10
|
+
api_username: api_username
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
@@ -20,7 +20,7 @@ module Lumberg
|
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "#show" do
|
23
|
-
use_vcr_cassette("cpanel/contact/show", :
|
23
|
+
use_vcr_cassette("cpanel/contact/show", record: :new_episodes)
|
24
24
|
subject { contact.show[:params][:data].first[:enabled] }
|
25
25
|
it { should == 1 }
|
26
26
|
end
|
@@ -29,11 +29,11 @@ module Lumberg
|
|
29
29
|
let(:email_address) { "testing@lumberg-test.com" }
|
30
30
|
let(:result) { Hash.new }
|
31
31
|
|
32
|
-
use_vcr_cassette("cpanel/contact/update", :
|
32
|
+
use_vcr_cassette("cpanel/contact/update", record: :new_episodes)
|
33
33
|
|
34
34
|
context "configure contact email address and enables notifications" do
|
35
35
|
it "should setup email address and bandwidth limit notification" do
|
36
|
-
res = contact.update({ :
|
36
|
+
res = contact.update({ email: email_address, bandwidth: 1 })
|
37
37
|
|
38
38
|
res[:params][:data].collect do |r|
|
39
39
|
if ((r[:name] == 'email') or (r[:name] == 'notify_bandwidth_limit'))
|
data/spec/cpanel/cron_spec.rb
CHANGED
@@ -2,12 +2,12 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module Lumberg
|
4
4
|
describe Cpanel::Cron do
|
5
|
-
let(:server) { Whm::Server.new(:
|
5
|
+
let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
|
6
6
|
let(:api_username) { "lumberg" }
|
7
7
|
let(:cron) do
|
8
8
|
described_class.new(
|
9
|
-
:
|
10
|
-
:
|
9
|
+
server: server,
|
10
|
+
api_username: api_username
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
@@ -17,7 +17,7 @@ module Lumberg
|
|
17
17
|
use_vcr_cassette("cpanel/cron/set_email")
|
18
18
|
|
19
19
|
it "sets cron notification email address" do
|
20
|
-
cron.set_email(:
|
20
|
+
cron.set_email(email: email)
|
21
21
|
cron.email[:params][:data][0][:email].should == email
|
22
22
|
end
|
23
23
|
end
|
@@ -27,7 +27,7 @@ module Lumberg
|
|
27
27
|
|
28
28
|
use_vcr_cassette("cpanel/cron/email")
|
29
29
|
|
30
|
-
before { cron.set_email(:
|
30
|
+
before { cron.set_email(email: email) }
|
31
31
|
|
32
32
|
it "gets cron notification email address" do
|
33
33
|
cron.email[:params][:data][0][:email].should == email
|
@@ -41,12 +41,12 @@ module Lumberg
|
|
41
41
|
|
42
42
|
before do
|
43
43
|
cron.add(
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
44
|
+
command: command,
|
45
|
+
minute: 1,
|
46
|
+
hour: 1,
|
47
|
+
day: 1,
|
48
|
+
month: 1,
|
49
|
+
weekday: 1
|
50
50
|
)
|
51
51
|
end
|
52
52
|
|
@@ -54,12 +54,12 @@ module Lumberg
|
|
54
54
|
cron.list[:params][:data].find {|e|
|
55
55
|
e[:command] == command
|
56
56
|
}.should include(
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
57
|
+
command: command,
|
58
|
+
minute: "1",
|
59
|
+
hour: "1",
|
60
|
+
day: "1",
|
61
|
+
month: "1",
|
62
|
+
weekday: "1"
|
63
63
|
)
|
64
64
|
end
|
65
65
|
end
|
@@ -71,23 +71,23 @@ module Lumberg
|
|
71
71
|
|
72
72
|
it "adds a crontab entry" do
|
73
73
|
cron.add(
|
74
|
-
:
|
75
|
-
:
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
79
|
-
:
|
74
|
+
command: command,
|
75
|
+
minute: 1,
|
76
|
+
hour: 1,
|
77
|
+
day: 1,
|
78
|
+
month: 1,
|
79
|
+
weekday: 1
|
80
80
|
)
|
81
81
|
|
82
82
|
cron.list[:params][:data].find {|e|
|
83
83
|
e[:command] == command
|
84
84
|
}.should include(
|
85
|
-
:
|
86
|
-
:
|
87
|
-
:
|
88
|
-
:
|
89
|
-
:
|
90
|
-
:
|
85
|
+
command: command,
|
86
|
+
minute: "1",
|
87
|
+
hour: "1",
|
88
|
+
day: "1",
|
89
|
+
month: "1",
|
90
|
+
weekday: "1"
|
91
91
|
)
|
92
92
|
end
|
93
93
|
end
|
@@ -104,15 +104,15 @@ module Lumberg
|
|
104
104
|
|
105
105
|
before do
|
106
106
|
cron.add(
|
107
|
-
:
|
108
|
-
:
|
109
|
-
:
|
110
|
-
:
|
111
|
-
:
|
112
|
-
:
|
107
|
+
command: command,
|
108
|
+
minute: 1,
|
109
|
+
hour: 1,
|
110
|
+
day: 1,
|
111
|
+
month: 1,
|
112
|
+
weekday: 1
|
113
113
|
)
|
114
114
|
|
115
|
-
cron.remove(:
|
115
|
+
cron.remove(linekey: linekey)
|
116
116
|
end
|
117
117
|
|
118
118
|
it "removes a crontab entry" do
|
@@ -129,31 +129,31 @@ module Lumberg
|
|
129
129
|
|
130
130
|
before do
|
131
131
|
@linekey = cron.add(
|
132
|
-
:
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
132
|
+
command: command,
|
133
|
+
minute: 1,
|
134
|
+
hour: 1,
|
135
|
+
day: 1,
|
136
|
+
month: 1,
|
137
|
+
weekday: 1
|
138
138
|
)[:params][:data][0][:linekey]
|
139
139
|
end
|
140
140
|
|
141
141
|
it "edits a crontab entry" do
|
142
142
|
@linekey = cron.edit(
|
143
|
-
:
|
144
|
-
:
|
145
|
-
:
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
143
|
+
linekey: @linekey,
|
144
|
+
command: "taco",
|
145
|
+
day: 1,
|
146
|
+
hour: 3,
|
147
|
+
minute: 1,
|
148
|
+
month: 1,
|
149
|
+
weekday: 1
|
150
150
|
)[:params][:data][0][:linekey]
|
151
151
|
|
152
152
|
cron.list[:params][:data].find {|e|
|
153
153
|
e[:linekey] == @linekey
|
154
154
|
}.should include(
|
155
|
-
:
|
156
|
-
:
|
155
|
+
command: "taco",
|
156
|
+
hour: "3"
|
157
157
|
)
|
158
158
|
end
|
159
159
|
end
|
@@ -2,19 +2,19 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module Lumberg
|
4
4
|
describe Cpanel::DnsLookup do
|
5
|
-
let(:server) { Whm::Server.new(:
|
5
|
+
let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
|
6
6
|
let(:api_username) { "lumberg" }
|
7
7
|
let(:dns_lookup) do
|
8
8
|
described_class.new(
|
9
|
-
:
|
10
|
-
:
|
9
|
+
server: server,
|
10
|
+
api_username: api_username
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "#name_to_ip" do
|
15
15
|
use_vcr_cassette "cpanel/dns_lookup/name_to_ip"
|
16
16
|
|
17
|
-
subject { dns_lookup.name_to_ip({ :
|
17
|
+
subject { dns_lookup.name_to_ip({ domain: 'google.com' })[:params][:data] }
|
18
18
|
|
19
19
|
it { should be_an(Array) }
|
20
20
|
end
|
@@ -2,12 +2,12 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module Lumberg
|
4
4
|
describe Cpanel::DomainKeys do
|
5
|
-
let(:server) { Whm::Server.new(:
|
5
|
+
let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
|
6
6
|
let(:api_username) { "lumberg" }
|
7
7
|
let(:domain_keys) do
|
8
8
|
described_class.new(
|
9
|
-
:
|
10
|
-
:
|
9
|
+
server: server,
|
10
|
+
api_username: api_username
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
@@ -2,12 +2,12 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module Lumberg
|
4
4
|
describe Cpanel::DomainLookup do
|
5
|
-
let(:server) { Whm::Server.new(:
|
5
|
+
let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
|
6
6
|
let(:api_username) { "lumberg" }
|
7
7
|
let(:domain_lookup) do
|
8
8
|
described_class.new(
|
9
|
-
:
|
10
|
-
:
|
9
|
+
server: server,
|
10
|
+
api_username: api_username
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
@@ -26,7 +26,7 @@ module Lumberg
|
|
26
26
|
use_vcr_cassette "cpanel/domain_lookup/document_root"
|
27
27
|
|
28
28
|
it "gets DocumentRoot for domain" do
|
29
|
-
result = domain_lookup.document_root({ :
|
29
|
+
result = domain_lookup.document_root({ domain: domain })
|
30
30
|
|
31
31
|
result[:params][:data][0][:docroot].should == document_root
|
32
32
|
end
|
@@ -36,7 +36,7 @@ module Lumberg
|
|
36
36
|
use_vcr_cassette "cpanel/domain_lookup/docroot"
|
37
37
|
|
38
38
|
it "gets DocumentRoot for domain, as an alias for #document_root" do
|
39
|
-
result = domain_lookup.document_root({ :
|
39
|
+
result = domain_lookup.document_root({ domain: domain })
|
40
40
|
|
41
41
|
result[:params][:data][0][:docroot].should == document_root
|
42
42
|
end
|