vagrant-rubydns 0.1.0 → 0.2.0
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.
- data/lib/ext/rexec.rb +10 -0
- data/lib/vagrant-rubydns.rb +7 -2
- data/lib/vagrant-rubydns/resolver_config.rb +53 -0
- data/lib/vagrant-rubydns/server.rb +4 -0
- data/lib/vagrant-rubydns/version.rb +1 -1
- metadata +3 -1
data/lib/ext/rexec.rb
ADDED
data/lib/vagrant-rubydns.rb
CHANGED
@@ -14,9 +14,14 @@ module VagrantRubydns
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
require '
|
18
|
-
|
17
|
+
require 'rubydns'
|
18
|
+
|
19
19
|
require 'vagrant-rubydns/dependent_vms'
|
20
|
+
require 'vagrant-rubydns/plugin'
|
21
|
+
require 'vagrant-rubydns/resolver_config'
|
20
22
|
require 'vagrant-rubydns/server'
|
23
|
+
require 'vagrant-rubydns/store'
|
21
24
|
require 'vagrant-rubydns/util'
|
22
25
|
require 'vagrant-rubydns/version'
|
26
|
+
|
27
|
+
require 'ext/rexec'
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
module VagrantRubydns
|
4
|
+
class ResolverConfig
|
5
|
+
def self.desired_contents; <<-EOS.gsub(/^ /, '')
|
6
|
+
# Generated by vagrant-rubydns
|
7
|
+
nameserver 127.0.0.1
|
8
|
+
port 10053
|
9
|
+
EOS
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.osx?
|
13
|
+
`uname`.chomp == 'Darwin'
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.config_file
|
17
|
+
Pathname('/etc/resolver/vagrant.dev')
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.contents_match?
|
21
|
+
config_file.exist? && File.read(config_file) == desired_contents
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.write_config
|
25
|
+
puts "Mometarily using sudo to put the host config in place..."
|
26
|
+
Tempfile.open('vagrant_rubydns_host_config') do |f|
|
27
|
+
f.write(desired_contents)
|
28
|
+
f.close
|
29
|
+
`sudo cp #{f.path} /etc/resolver/vagrant.dev`
|
30
|
+
`sudo chown root:wheel /etc/resolver/vagrant.dev`
|
31
|
+
`sudo chmod 644 /etc/resolver/vagrant.dev`
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.ensure_config_exists
|
36
|
+
unless osx?
|
37
|
+
puts "Not an OSX machine, so skipping host DNS resolver config."
|
38
|
+
return
|
39
|
+
end
|
40
|
+
|
41
|
+
if contents_match?
|
42
|
+
puts "Host DNS resolver config looks good."
|
43
|
+
else
|
44
|
+
puts "Need to configure the host."
|
45
|
+
write_config
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.puts(str)
|
50
|
+
Kernel.puts("[vagrant-rubydns] #{str}")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
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.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- README.md
|
73
73
|
- Rakefile
|
74
74
|
- examples/Vagrantfile
|
75
|
+
- lib/ext/rexec.rb
|
75
76
|
- lib/vagrant-rubydns.rb
|
76
77
|
- lib/vagrant-rubydns/action/redirect_dns.rb
|
77
78
|
- lib/vagrant-rubydns/action/setup.rb
|
@@ -80,6 +81,7 @@ files:
|
|
80
81
|
- lib/vagrant-rubydns/config.rb
|
81
82
|
- lib/vagrant-rubydns/dependent_vms.rb
|
82
83
|
- lib/vagrant-rubydns/plugin.rb
|
84
|
+
- lib/vagrant-rubydns/resolver_config.rb
|
83
85
|
- lib/vagrant-rubydns/server.rb
|
84
86
|
- lib/vagrant-rubydns/store.rb
|
85
87
|
- lib/vagrant-rubydns/util.rb
|