vagrant-rubydns 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -1
- data/examples/Vagrantfile +1 -0
- data/lib/vagrant-rubydns/action/setup.rb +4 -2
- data/lib/vagrant-rubydns/action/teardown.rb +4 -2
- data/lib/vagrant-rubydns/config.rb +13 -0
- data/lib/vagrant-rubydns/version.rb +1 -1
- data/test/test_helper.rb +2 -0
- data/test/vagrant-rubydns/action/setup_test.rb +14 -0
- data/test/vagrant-rubydns/action/teardown_test.rb +17 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -17,6 +17,10 @@ Spin up the DNS server
|
|
17
17
|
|
18
18
|
$ vagrant rubydns
|
19
19
|
|
20
|
+
Enable the plugin in your `Vagrantfile`:
|
21
|
+
|
22
|
+
config.rubydns.enable
|
23
|
+
|
20
24
|
Bring up a machine that has a private network IP address and a hostname (see the `Vagrantfile` for an example)
|
21
25
|
|
22
26
|
$ vagrant up
|
@@ -27,7 +31,7 @@ And you should be able to get your hostname from your host:
|
|
27
31
|
|
28
32
|
If you shut down your guest, the entries associated with it will be removed.
|
29
33
|
|
30
|
-
You can add static host entries to the DNS server in your Vagrantfile like so:
|
34
|
+
You can add static host entries to the DNS server in your `Vagrantfile` like so:
|
31
35
|
|
32
36
|
config.rubydns.host 'myhost.example.com', '1.2.3.4'
|
33
37
|
|
data/examples/Vagrantfile
CHANGED
@@ -4,6 +4,19 @@ module VagrantRubydns
|
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@hosts = {}
|
7
|
+
@enabled = false
|
8
|
+
end
|
9
|
+
|
10
|
+
def enable(enabled=true)
|
11
|
+
@enabled = true
|
12
|
+
end
|
13
|
+
|
14
|
+
def disable
|
15
|
+
@enabled = false
|
16
|
+
end
|
17
|
+
|
18
|
+
def enabled?
|
19
|
+
@enabled
|
7
20
|
end
|
8
21
|
|
9
22
|
def host(hostname, ip_address)
|
data/test/test_helper.rb
CHANGED
@@ -26,6 +26,20 @@ module VagrantRubydns
|
|
26
26
|
|
27
27
|
Store.get('somehost.vagrant.dev').must_equal '1.2.3.4'
|
28
28
|
end
|
29
|
+
|
30
|
+
it "does nothing if it is not enabled via config" do
|
31
|
+
Store.clear!
|
32
|
+
|
33
|
+
app = Proc.new {}
|
34
|
+
setup = Setup.new(app, nil)
|
35
|
+
|
36
|
+
env = fake_environment_with_machine('somehost.vagrant.dev', '1.2.3.4')
|
37
|
+
env[:global_config].rubydns.disable
|
38
|
+
|
39
|
+
setup.call(env)
|
40
|
+
|
41
|
+
Store.get('somehost.vagrant.dev').must_equal nil
|
42
|
+
end
|
29
43
|
end
|
30
44
|
end
|
31
45
|
end
|
@@ -15,7 +15,7 @@ module VagrantRubydns
|
|
15
15
|
env[:called].must_equal true
|
16
16
|
end
|
17
17
|
|
18
|
-
it "
|
18
|
+
it "clears the machine's hostname => ip address" do
|
19
19
|
Store.set('somehost.vagrant.dev', '1.2.3.4')
|
20
20
|
|
21
21
|
app = Proc.new {}
|
@@ -26,6 +26,22 @@ module VagrantRubydns
|
|
26
26
|
|
27
27
|
Store.get('somehost.vagrant.dev').must_equal nil
|
28
28
|
end
|
29
|
+
|
30
|
+
it "does nothing when rubydns is disabled" do
|
31
|
+
# somewhat unrealistic since this entry shouldn't be there if it was
|
32
|
+
# disabled in the first place, but oh well
|
33
|
+
Store.set('somehost.vagrant.dev', '1.2.3.4')
|
34
|
+
|
35
|
+
app = Proc.new {}
|
36
|
+
teardown = Teardown.new(app, nil)
|
37
|
+
|
38
|
+
env = fake_environment_with_machine('somehost.vagrant.dev', '1.2.3.4')
|
39
|
+
env[:global_config].rubydns.disable
|
40
|
+
|
41
|
+
teardown.call(env)
|
42
|
+
|
43
|
+
Store.get('somehost.vagrant.dev').must_equal '1.2.3.4'
|
44
|
+
end
|
29
45
|
end
|
30
46
|
end
|
31
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-rubydns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubydns
|