maphosts 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/maphosts/host_manager.rb +10 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbadb93ab581c3b339ae2b71d692f9e5bdae6fa7
|
4
|
+
data.tar.gz: 9a87667fbb0ec23b24d32fa750a6da564dbc6f04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 162aae6901dc1be99fe2240412930b66cb6efd074ed330511043b062d911752b54aa33f5b44c815c420e2dcd28b3042a768d46226ba8653503558a107e789e46
|
7
|
+
data.tar.gz: 6a1b960cb1829f23bfcb3597ae14a587fe6faa15fa73b18f91f74d19e346e45cfc9a7a7acaf89091aedad82497abfff6ee8f4bc80ec8976350903926ceb65817
|
@@ -36,7 +36,16 @@ class HostManager
|
|
36
36
|
if !@dirty
|
37
37
|
nil
|
38
38
|
else
|
39
|
-
|
39
|
+
# Strip whitespace at end of file
|
40
|
+
if !@hostsfile.elements.last.nil? && @hostsfile.elements.last.kind_of?(Hosts::EmptyElement)
|
41
|
+
@hostsfile.elements.delete @hostsfile.elements.last
|
42
|
+
end
|
43
|
+
|
44
|
+
if @hostsfile.to_s.empty?
|
45
|
+
raise "The patched hostsfile is empty. This is most likely due to a bug. No worry, the file has not been written."
|
46
|
+
end
|
47
|
+
|
48
|
+
@hostsfile
|
40
49
|
end
|
41
50
|
end
|
42
51
|
|