ganddyn 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/ganddyn.gemspec +6 -6
- data/lib/ganddyn/version.rb +1 -1
- data/spec/lib/ganddyn/client_spec.rb +29 -33
- data/spec/lib/ganddyn/ipresolver_spec.rb +10 -10
- data/spec/spec_helper.rb +0 -1
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b49d35850088e3e44ddbdfbcad22a57520147f0
|
4
|
+
data.tar.gz: 09e06697d82a4b71d27e6baae5daa858a6d005c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9486953c7cb321f0b173d827adde7f6ba87819661e942adb5e7d74f042f3e9f609e668551c10de79623bc7c2445f4c3645cce6a9206596355cb5e199b18f74d8
|
7
|
+
data.tar.gz: eb7303d5fcf0c270a62497534f41141922f9cc6fd02ebcf37581d773eb2993c301ef437b36fea76638c46734d1caff1001f667c0cb480adc6765c475976f1665
|
data/CHANGELOG.md
ADDED
data/ganddyn.gemspec
CHANGED
@@ -22,11 +22,11 @@ this version.}
|
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
-
spec.add_development_dependency 'rake', '~>10.3
|
26
|
-
spec.add_development_dependency 'rspec', '~>
|
27
|
-
spec.add_development_dependency 'webmock', '~>1.
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.3'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
+
spec.add_development_dependency 'webmock', '~> 1.18'
|
28
28
|
|
29
|
-
spec.add_dependency 'gandi', '~>2.0
|
30
|
-
spec.add_dependency 'highline', '~>1.6
|
31
|
-
spec.add_dependency 'certified', '~> 0.1
|
29
|
+
spec.add_dependency 'gandi', '~> 2.0'
|
30
|
+
spec.add_dependency 'highline', '~> 1.6'
|
31
|
+
spec.add_dependency 'certified', '~> 0.1'
|
32
32
|
end
|
data/lib/ganddyn/version.rb
CHANGED
@@ -48,7 +48,7 @@ describe Ganddyn::Client do
|
|
48
48
|
before :each do
|
49
49
|
end
|
50
50
|
it 'takes 1 parameters' do
|
51
|
-
Ganddyn::Client.new(
|
51
|
+
expect(Ganddyn::Client.new(@param)).to be_a Ganddyn::Client
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'raises an error if parameter opts is not a Hash' do
|
@@ -92,7 +92,7 @@ describe Ganddyn::Client do
|
|
92
92
|
|
93
93
|
it 'asks gandi for ipv4' do
|
94
94
|
expect(@gand).to receive(:get_record).with('A').and_return(@ipv4)
|
95
|
-
expect(@gand.update).to
|
95
|
+
expect(@gand.update).to be_truthy
|
96
96
|
end
|
97
97
|
|
98
98
|
end
|
@@ -100,7 +100,7 @@ describe Ganddyn::Client do
|
|
100
100
|
context 'when yaml config file exist' do
|
101
101
|
it 'does not ask Gandi' do
|
102
102
|
allow(@gand).to receive(:get_record)
|
103
|
-
expect(@gand.update).to
|
103
|
+
expect(@gand.update).to be_truthy
|
104
104
|
expect(@gand).to_not have_received(:get_record)
|
105
105
|
end
|
106
106
|
end
|
@@ -122,7 +122,7 @@ describe Ganddyn::Client do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'returns true' do
|
125
|
-
expect(@gand.update).to
|
125
|
+
expect(@gand.update).to be_truthy
|
126
126
|
end
|
127
127
|
|
128
128
|
it 'does not modify the yaml config file' do
|
@@ -133,7 +133,7 @@ describe Ganddyn::Client do
|
|
133
133
|
|
134
134
|
context 'when ip to update' do
|
135
135
|
it 'updates the ip' do
|
136
|
-
expect(@gand.update).to
|
136
|
+
expect(@gand.update).to be_truthy
|
137
137
|
end
|
138
138
|
|
139
139
|
it 'updates the yaml config file content' do
|
@@ -193,26 +193,26 @@ describe_internally Ganddyn::Client do
|
|
193
193
|
|
194
194
|
describe '#get_zone_id' do
|
195
195
|
it 'returns the current zone id' do
|
196
|
-
@api.
|
197
|
-
@gand.get_zone_id.
|
196
|
+
expect(@api).to receive(:info).with(@domain).and_return(Hashie::Mash.new({:zone_id => 666}))
|
197
|
+
expect(@gand.get_zone_id).to eq(666)
|
198
198
|
end
|
199
199
|
|
200
200
|
it 'calls gandi api only once' do
|
201
|
-
@api.
|
202
|
-
@gand.get_zone_id.
|
203
|
-
@gand.get_zone_id.
|
201
|
+
expect(@api).to receive(:info).once.with(@domain).and_return(Hashie::Mash.new({:zone_id => 666}))
|
202
|
+
expect(@gand.get_zone_id).to eq(666)
|
203
|
+
expect(@gand.get_zone_id).to eq(666)
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
207
|
describe '#create_new_zone_version' do
|
208
|
-
pending 'not really necessary'
|
208
|
+
pending 'not really necessary to test'
|
209
209
|
end
|
210
210
|
|
211
211
|
describe '#get_zone_version' do
|
212
212
|
it 'returns 2 values' do
|
213
213
|
version, versions = @gand.get_zone_version
|
214
|
-
version.
|
215
|
-
versions.
|
214
|
+
expect(version).to eq(@cur_ver)
|
215
|
+
expect(versions).to eq(@vers)
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
@@ -224,7 +224,7 @@ describe_internally Ganddyn::Client do
|
|
224
224
|
end
|
225
225
|
|
226
226
|
it 'takes 1 parameter as argument' do
|
227
|
-
@api.
|
227
|
+
expect(@api).to receive(:list).with(anything(), 0, @filter).and_return([@res])
|
228
228
|
@gand.get_record('A')
|
229
229
|
end
|
230
230
|
|
@@ -234,7 +234,7 @@ describe_internally Ganddyn::Client do
|
|
234
234
|
end
|
235
235
|
|
236
236
|
it 'returns the IPv4 address' do
|
237
|
-
@gand.get_record('A').
|
237
|
+
expect(@gand.get_record('A')).to eq(@ipv4)
|
238
238
|
end
|
239
239
|
|
240
240
|
# it 'output record found with value' do
|
@@ -291,18 +291,18 @@ describe_internally Ganddyn::Client do
|
|
291
291
|
end
|
292
292
|
|
293
293
|
it 'takes 3 arguments' do
|
294
|
-
expect(@gand.update_record( @cur_ver, @ipv4, 'A')).to
|
294
|
+
expect(@gand.update_record( @cur_ver, @ipv4, 'A')).to be_truthy
|
295
295
|
end
|
296
296
|
|
297
297
|
context 'when input ip is empty' do
|
298
298
|
it 'returns false' do
|
299
|
-
expect(@gand.update_record( @cur_ver, '', 'A')).to
|
299
|
+
expect(@gand.update_record( @cur_ver, '', 'A')).to be_falsey
|
300
300
|
end
|
301
301
|
end
|
302
302
|
|
303
303
|
context 'when record does not exist yet' do
|
304
304
|
it 'adds a new record' do
|
305
|
-
expect(@gand.update_record( @cur_ver, @ipv4, 'A')).to
|
305
|
+
expect(@gand.update_record( @cur_ver, @ipv4, 'A')).to be_truthy
|
306
306
|
expect(@api).to have_received(:add).with(anything, @cur_ver, @rec )
|
307
307
|
expect(@api).to_not have_received(:update)
|
308
308
|
end
|
@@ -323,7 +323,7 @@ describe_internally Ganddyn::Client do
|
|
323
323
|
end
|
324
324
|
|
325
325
|
it 'returns true' do
|
326
|
-
expect(@gand.update_record( @cur_ver, "#{@ipv4}1", 'A')).to
|
326
|
+
expect(@gand.update_record( @cur_ver, "#{@ipv4}1", 'A')).to be_truthy
|
327
327
|
end
|
328
328
|
end
|
329
329
|
|
@@ -335,7 +335,7 @@ describe_internally Ganddyn::Client do
|
|
335
335
|
end
|
336
336
|
|
337
337
|
it 'returns false' do
|
338
|
-
expect(@gand.update_record( @cur_ver, @ipv4, 'A')).to
|
338
|
+
expect(@gand.update_record( @cur_ver, @ipv4, 'A')).to be_falsey
|
339
339
|
end
|
340
340
|
end
|
341
341
|
end
|
@@ -394,7 +394,7 @@ describe_internally Ganddyn::Client do
|
|
394
394
|
describe '#activate_updated_version' do
|
395
395
|
context 'when activation succeeded' do
|
396
396
|
it 'returns true' do
|
397
|
-
expect(@gand.activate_updated_version(2)).to
|
397
|
+
expect(@gand.activate_updated_version(2)).to be_truthy
|
398
398
|
end
|
399
399
|
|
400
400
|
# it 'output activation of zone version successful' do
|
@@ -408,7 +408,7 @@ describe_internally Ganddyn::Client do
|
|
408
408
|
expect(@api).to receive(:set).with(anything(), 9).and_return(false)
|
409
409
|
end
|
410
410
|
it 'returns false' do
|
411
|
-
expect(@gand.activate_updated_version(9)).to
|
411
|
+
expect(@gand.activate_updated_version(9)).to be_falsey
|
412
412
|
end
|
413
413
|
|
414
414
|
# it 'output activation of zone version failed' do
|
@@ -420,13 +420,13 @@ describe_internally Ganddyn::Client do
|
|
420
420
|
end
|
421
421
|
|
422
422
|
describe '#update_ipv4' do
|
423
|
-
|
423
|
+
pending 'not really necessary to test'
|
424
424
|
end
|
425
425
|
|
426
426
|
|
427
427
|
describe '#update_ips' do
|
428
428
|
it 'take 1 input as parameter' do
|
429
|
-
expect(@gand.update_ips('')).to
|
429
|
+
expect(@gand.update_ips('')).to be_truthy
|
430
430
|
end
|
431
431
|
|
432
432
|
context 'when input is not a String' do
|
@@ -441,7 +441,7 @@ describe_internally Ganddyn::Client do
|
|
441
441
|
allow(@gand).to receive(:create_new_zone_version)
|
442
442
|
allow(@gand).to receive(:clone_zone_version)
|
443
443
|
|
444
|
-
expect(@gand.update_ips('')).to
|
444
|
+
expect(@gand.update_ips('')).to be_truthy
|
445
445
|
|
446
446
|
expect(@gand).to_not have_received(:get_zone_version)
|
447
447
|
expect(@gand).to_not have_received(:create_new_zone_version)
|
@@ -463,7 +463,7 @@ describe_internally Ganddyn::Client do
|
|
463
463
|
|
464
464
|
context 'when activation of new zone version is OK' do
|
465
465
|
it 'returns true' do
|
466
|
-
expect(@gand.update_ips('1.2.3.4')).to
|
466
|
+
expect(@gand.update_ips('1.2.3.4')).to be_truthy
|
467
467
|
end
|
468
468
|
|
469
469
|
it 'output update done' do
|
@@ -479,7 +479,7 @@ describe_internally Ganddyn::Client do
|
|
479
479
|
end
|
480
480
|
|
481
481
|
it 'returns false' do
|
482
|
-
expect(@gand.update_ips('1.2.3.4')).to
|
482
|
+
expect(@gand.update_ips('1.2.3.4')).to be_falsey
|
483
483
|
end
|
484
484
|
|
485
485
|
it 'output update FAILED' do
|
@@ -544,15 +544,11 @@ describe_internally Ganddyn::Client do
|
|
544
544
|
end
|
545
545
|
|
546
546
|
context 'on windows platform' do
|
547
|
-
it 'redirect output to > NUL'
|
548
|
-
pending
|
549
|
-
end
|
547
|
+
it 'redirect output to > NUL'
|
550
548
|
end
|
551
549
|
|
552
550
|
context 'on Linux platform' do
|
553
|
-
it 'redirect output to > /dev/null 2>&1'
|
554
|
-
pending
|
555
|
-
end
|
551
|
+
it 'redirect output to > /dev/null 2>&1'
|
556
552
|
end
|
557
553
|
end
|
558
554
|
|
@@ -10,11 +10,11 @@ describe Ganddyn::IpResolver do
|
|
10
10
|
|
11
11
|
context '#intialize' do
|
12
12
|
it 'takes 0 parameter' do
|
13
|
-
Ganddyn::IpResolver.new.
|
13
|
+
expect(Ganddyn::IpResolver.new).to be_a Ganddyn::IpResolver
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'take 1 parameter' do
|
17
|
-
Ganddyn::IpResolver.new({}).
|
17
|
+
expect(Ganddyn::IpResolver.new({})).to be_a Ganddyn::IpResolver
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'raises an error if parameter is not Hash' do
|
@@ -25,17 +25,17 @@ describe Ganddyn::IpResolver do
|
|
25
25
|
context '#get_ipv4' do
|
26
26
|
it 'returns the ipv4' do
|
27
27
|
stub_request(:get, 'v4.rspec.domain.com').to_return(:body => '1.2.3.4', :status => 200, :headers => { 'Content-Length' => 3 })
|
28
|
-
@ip.get_ipv4.
|
28
|
+
expect(@ip.get_ipv4).to eq('1.2.3.4')
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'returns empty string if client has no ipv4' do
|
32
32
|
stub_request(:get, 'v4.rspec.domain.com').to_raise(Exception)
|
33
|
-
@ip.get_ipv4.
|
33
|
+
expect(@ip.get_ipv4).to be_nil
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'returns nil if server is not reachable' do
|
37
37
|
stub_request(:get, 'v4.rspec.domain.com').to_raise(SocketError)
|
38
|
-
@ip.get_ipv4.
|
38
|
+
expect(@ip.get_ipv4).to be_nil
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'returns nil if url is incorrect' do
|
@@ -46,25 +46,25 @@ describe Ganddyn::IpResolver do
|
|
46
46
|
<p>The requested URL xxx was not found on this server.</p>
|
47
47
|
<hr>
|
48
48
|
</body></html>', :status => 404, :headers => { 'Content-Length' => 3 })
|
49
|
-
@ip.get_ipv4.
|
49
|
+
expect(@ip.get_ipv4).to be_nil
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
context '#get_ipv6' do
|
54
54
|
it 'returns the ipv6' do
|
55
55
|
stub_request(:get, 'v6.rspec.domain.com').to_return(:body => '3b12:d24:1e6a:8e81:b6a2:6f67:5627:bf44', :status => 200, :headers => { 'Content-Length' => 3 })
|
56
|
-
@ip.get_ipv6.
|
56
|
+
expect(@ip.get_ipv6).to eq('3b12:d24:1e6a:8e81:b6a2:6f67:5627:bf44')
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'returns nil if client has no ipv6' do
|
60
60
|
stub_request(:get, 'v6.rspec.domain.com').to_raise(Exception)
|
61
|
-
@ip.get_ipv6.
|
61
|
+
expect(@ip.get_ipv6).to be_nil
|
62
62
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'returns nil if server is not reachable' do
|
66
66
|
stub_request(:get, 'v6.rspec.domain.com').to_raise(SocketError)
|
67
|
-
@ip.get_ipv6.
|
67
|
+
expect(@ip.get_ipv6).to be_nil
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'returns nil if url is incorrect' do
|
@@ -75,7 +75,7 @@ describe Ganddyn::IpResolver do
|
|
75
75
|
<p>The requested URL xxx was not found on this server.</p>
|
76
76
|
<hr>
|
77
77
|
</body></html>', :status => 404, :headers => { 'Content-Length' => 3 })
|
78
|
-
@ip.get_ipv6.
|
78
|
+
expect(@ip.get_ipv6).to be_nil
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ganddyn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Virlet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05
|
11
|
+
date: 2014-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,84 +30,84 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 10.3
|
33
|
+
version: '10.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 10.3
|
40
|
+
version: '10.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '3.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: '1.18'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: '1.18'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: gandi
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.0
|
75
|
+
version: '2.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.0
|
82
|
+
version: '2.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: highline
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.6
|
89
|
+
version: '1.6'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.6
|
96
|
+
version: '1.6'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: certified
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.1
|
103
|
+
version: '0.1'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.1
|
110
|
+
version: '0.1'
|
111
111
|
description: |-
|
112
112
|
This gem allows to update your GANDI DNS zone with the current external IPv4 of your machine.
|
113
113
|
It duplicate current zone information in the last inactive version of the zone (or a newly
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- .gitignore
|
124
124
|
- .rspec
|
125
125
|
- .travis.yml
|
126
|
+
- CHANGELOG.md
|
126
127
|
- Gemfile
|
127
128
|
- LICENSE.txt
|
128
129
|
- README.md
|
@@ -156,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
157
|
version: '0'
|
157
158
|
requirements: []
|
158
159
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.2.2
|
160
161
|
signing_key:
|
161
162
|
specification_version: 4
|
162
163
|
summary: Update GANDI DNS zone IPv4
|