vagrant-hostsupdater 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA512:
|
3
|
-
data.tar.gz: 0c34e096d35dfa78632d0957a9f711e6bb3616139e47869ba38a940bb2e172cee4cecb21ebc8c83fcf8914777a3074077e8d7fb3c8267f76bb863c20277c0412
|
4
|
-
metadata.gz: e03091cf84b813ab34b68e60796c3136ac21acc01fb936e0d671867644223c5b636ba22b1cbaf32b059bf3f2c9de56c0190e510fea8068b8d9cd3fc7cc6cb3c4
|
5
2
|
SHA1:
|
6
|
-
|
7
|
-
|
3
|
+
metadata.gz: 01d5aa0f13ab1d213adbff522d9cc6825492c0d3
|
4
|
+
data.tar.gz: c7d0971e65e54de6cad8022c127645b1a93c632d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 373c154650de651c9fde2dcfec57ee154210b99af767aac96ae7994788db2766e20b14a31b3ac1842adf65d568d7ccf28e1c8d706bcda47f39bfeb5e9ab35569
|
7
|
+
data.tar.gz: bf16bbf73b6971e1c557ff475140e0357db372e1c88a21769d9d792089b23c7fc6d82164b4d9a42ccbed349862d2d37a5366d6c7420439e0013774f1f8a8a456
|
data/README.md
CHANGED
@@ -11,6 +11,9 @@ By setting the remove\_on\_suspend option, you can have them removed on **suspen
|
|
11
11
|
|
12
12
|
## Versions
|
13
13
|
|
14
|
+
### 0.0.6
|
15
|
+
* no sudo, if /etc/hosts is writeable
|
16
|
+
|
14
17
|
### 0.0.5
|
15
18
|
* option added to not remove hosts on suspend, adding hosts on resume (Thanks to Svelix)
|
16
19
|
|
@@ -36,11 +36,19 @@ module VagrantPlugins
|
|
36
36
|
hostEntries.each do |hostEntry|
|
37
37
|
escapedEntry = Regexp.quote(hostEntry)
|
38
38
|
if !hostsContents.match(/#{escapedEntry}/)
|
39
|
+
@ui.info "pushing #{hostEntry}"
|
39
40
|
entries.push(hostEntry)
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|
43
|
-
|
44
|
+
@ui.info entries
|
45
|
+
if !File.writable?("/etc/hosts")
|
46
|
+
sudo(addToHosts(entries))
|
47
|
+
else
|
48
|
+
command = addToHosts(entries)
|
49
|
+
@ui.info command
|
50
|
+
`#{command}`
|
51
|
+
end
|
44
52
|
|
45
53
|
end
|
46
54
|
|
@@ -54,7 +62,11 @@ module VagrantPlugins
|
|
54
62
|
if hostsContents.match(/#{escapedId}/)
|
55
63
|
puts "removing uids"
|
56
64
|
puts "#{removeFromHosts}"
|
57
|
-
|
65
|
+
if !File.writable?("/etc/hosts")
|
66
|
+
sudo(removeFromHosts)
|
67
|
+
else
|
68
|
+
removeFromHosts
|
69
|
+
end
|
58
70
|
end
|
59
71
|
end
|
60
72
|
|
@@ -80,7 +92,7 @@ module VagrantPlugins
|
|
80
92
|
def removeFromHosts(options = {})
|
81
93
|
hosts_path = '/etc/hosts'
|
82
94
|
uuid = @machine.id
|
83
|
-
%Q(sed -e '/#{uuid}/ d' -
|
95
|
+
%Q(sed -e '/#{uuid}/ d' -n #{hosts_path})
|
84
96
|
end
|
85
97
|
|
86
98
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-hostsupdater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Falk K\xC3\xBChnel"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-10 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
prerelease: false
|