vagrant-hostsupdater 0.0.4 → 0.0.5

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
2
  SHA512:
3
- metadata.gz: 0db0091503f284153dc70c41d7da1810620cefeacec001296315c7d7e6d776a299b61ac8e8dfca101471b7d81f3b59ff19e3b24370e3ee5e5b5525a22d869705
4
- data.tar.gz: 9d52c0a9a17543fcf3b0308f01f30bfd10d32452fc7025042b5c9681e2de5e4a494b45ba5eb06a42f78c482b4e0b8538d13f32c56d35ef765d8e164b8dbb53f4
3
+ data.tar.gz: 0c34e096d35dfa78632d0957a9f711e6bb3616139e47869ba38a940bb2e172cee4cecb21ebc8c83fcf8914777a3074077e8d7fb3c8267f76bb863c20277c0412
4
+ metadata.gz: e03091cf84b813ab34b68e60796c3136ac21acc01fb936e0d671867644223c5b636ba22b1cbaf32b059bf3f2c9de56c0190e510fea8068b8d9cd3fc7cc6cb3c4
5
5
  SHA1:
6
- metadata.gz: 655539ef1ab9bb5ca3bf093c3a362e433e41ac20
7
- data.tar.gz: 96ea3992b37bdb460838bde11ced120bc6f7a86b
6
+ data.tar.gz: 49e43d54e0c0065c1313ec7c7748a15c6743e68d
7
+ metadata.gz: f27951158dcd3e6a1281e344e4afe55936fe5333
data/README.md CHANGED
@@ -2,13 +2,21 @@
2
2
 
3
3
  This plugin adds an entry to your /etc/hosts file on the host system.
4
4
 
5
- On **up** and **reload** commands, it tries to add the information, if its not already existant in your hosts file. If it needs to be added, you will be asked for an administrator password, since it uses sudo to edit the file.
5
+ On **up**, **resume** and **reload** commands, it tries to add the information, if its not already existant in your hosts file. If it needs to be added, you will be asked for an administrator password, since it uses sudo to edit the file.
6
6
 
7
- On **halt**, **suspend** and **destroy**, those entries will be removed again.
7
+ On **halt** and **destroy**, those entries will be removed again.
8
+ By setting the remove\_on\_suspend option, you can have them removed on **suspend**, too:
9
+
10
+ config.hostsupdater.remove_on_suspend = true
8
11
 
9
12
  ## Versions
13
+
14
+ ### 0.0.5
15
+ * option added to not remove hosts on suspend, adding hosts on resume (Thanks to Svelix)
16
+
10
17
  ### 0.0.4
11
18
  * fixed problem with removing hosts entries on destroy command (Thanks to Andy Bohne)
19
+
12
20
  ### 0.0.3
13
21
  * added aliases config option to define additional hostnames
14
22
 
@@ -24,9 +32,9 @@ Uninstall it with:
24
32
 
25
33
  At the moment, the only things you need, are the hostname and a :private_network network with a fixed ip.
26
34
 
27
- $ config.vm.network :private_network, ip: "192.168.3.10"
28
- $ config.vm.hostname = "www.testing.de"
29
- $ config.hostsupdater.aliases = ["alias.testing.de", "alias2.somedomain.com"]
35
+ config.vm.network :private_network, ip: "192.168.3.10"
36
+ config.vm.hostname = "www.testing.de"
37
+ config.hostsupdater.aliases = ["alias.testing.de", "alias2.somedomain.com"]
30
38
 
31
39
  This ip and the hostname will be used for the entry in the /etc/hosts file.
32
40
 
@@ -11,8 +11,13 @@ module VagrantPlugins
11
11
  end
12
12
 
13
13
  def call(env)
14
- @ui.info "Removing hosts"
15
- removeHostEntries
14
+ machine_action = env[:machine_action]
15
+ if machine_action != :suspend || @machine.config.hostsupdater.remove_on_suspend
16
+ @ui.info "Removing hosts"
17
+ removeHostEntries
18
+ else
19
+ @ui.info "Removing on suspend disabled"
20
+ end
16
21
  @app.call(env)
17
22
  end
18
23
 
@@ -4,6 +4,7 @@ module VagrantPlugins
4
4
  module HostsUpdater
5
5
  class Config < Vagrant.plugin("2", :config)
6
6
  attr_accessor :aliases
7
+ attr_accessor :remove_on_suspend
7
8
  end
8
9
  end
9
- end
10
+ end
@@ -35,10 +35,14 @@ module VagrantPlugins
35
35
  hook.append(Action::UpdateHosts)
36
36
  end
37
37
 
38
+ action_hook(:hostsupdater, :machine_action_resume) do |hook|
39
+ hook.append(Action::UpdateHosts)
40
+ end
41
+
38
42
  command(:hostsupdater) do
39
43
  require_relative 'command'
40
44
  Command
41
45
  end
42
46
  end
43
47
  end
44
- end
48
+ end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module HostsUpdater
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
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
4
+ version: 0.0.5
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-05-10 00:00:00 Z
12
+ date: 2013-05-29 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  prerelease: false