landrush 0.7.0 → 0.7.1
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.
@@ -13,26 +13,31 @@ module Landrush
|
|
13
13
|
`uname`.chomp == 'Darwin'
|
14
14
|
end
|
15
15
|
|
16
|
+
def self.config_dir
|
17
|
+
@config_dir ||= Pathname('/etc/resolver')
|
18
|
+
end
|
19
|
+
|
16
20
|
def self.config_file
|
17
|
-
|
21
|
+
config_dir.join('vagrant.dev')
|
18
22
|
end
|
19
23
|
|
20
24
|
def self.contents_match?
|
21
25
|
config_file.exist? && File.read(config_file) == desired_contents
|
22
26
|
end
|
23
27
|
|
24
|
-
def self.write_config
|
28
|
+
def self.write_config(opts)
|
25
29
|
puts "Mometarily using sudo to put the host config in place..."
|
30
|
+
sudo = opts.fetch(:sudo, 'sudo')
|
31
|
+
system "#{sudo} mkdir #{config_dir}" unless config_dir.directory?
|
26
32
|
Tempfile.open('vagrant_landrush_host_config') do |f|
|
27
33
|
f.write(desired_contents)
|
28
34
|
f.close
|
29
|
-
sudo = config_file.parent.writable? ? '' : 'sudo'
|
30
35
|
system "#{sudo} cp #{f.path} #{config_file}"
|
31
36
|
system "#{sudo} chmod 644 #{config_file}"
|
32
37
|
end
|
33
38
|
end
|
34
39
|
|
35
|
-
def self.ensure_config_exists
|
40
|
+
def self.ensure_config_exists(opts={})
|
36
41
|
unless osx?
|
37
42
|
puts "Not an OSX machine, so skipping host DNS resolver config."
|
38
43
|
return
|
@@ -42,7 +47,7 @@ module Landrush
|
|
42
47
|
puts "Host DNS resolver config looks good."
|
43
48
|
else
|
44
49
|
puts "Need to configure the host."
|
45
|
-
write_config
|
50
|
+
write_config(opts)
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
data/lib/landrush/version.rb
CHANGED
@@ -6,7 +6,7 @@ module Landrush
|
|
6
6
|
it 'writes a resolver config on the host if one is not already there' do
|
7
7
|
ResolverConfig.config_file.exist?.must_equal false
|
8
8
|
hush {
|
9
|
-
ResolverConfig.ensure_config_exists
|
9
|
+
ResolverConfig.ensure_config_exists(sudo: '')
|
10
10
|
}
|
11
11
|
ResolverConfig.config_file.exist?.must_equal true
|
12
12
|
ResolverConfig.config_file.read.must_equal <<-EOF.gsub(/^ +/, '')
|
@@ -14,7 +14,9 @@ module Landrush
|
|
14
14
|
nameserver 127.0.0.1
|
15
15
|
port 10053
|
16
16
|
EOF
|
17
|
-
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
module FakeResolverConfigHooks
|
2
2
|
def setup
|
3
3
|
super
|
4
|
-
@
|
4
|
+
@test_resolver_config_dir = Pathname('/tmp/landrush_fake_resolver')
|
5
5
|
Landrush::ResolverConfig.instance_variable_set(
|
6
|
-
"@
|
7
|
-
@
|
6
|
+
"@config_dir",
|
7
|
+
@test_resolver_config_dir
|
8
8
|
)
|
9
9
|
end
|
10
10
|
|
11
11
|
def teardown
|
12
12
|
super
|
13
|
-
if @
|
14
|
-
@
|
13
|
+
if @test_resolver_config_dir.exist?
|
14
|
+
@test_resolver_config_dir.rmtree
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: landrush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
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-11-
|
12
|
+
date: 2013-11-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubydns
|