vagrant-hostmanager 0.2.0 → 0.3.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/README.md CHANGED
@@ -57,6 +57,17 @@ Vagrant.configure("2") do |config|
57
57
  end
58
58
  ```
59
59
 
60
+ As a last option, you can also choose hostmanager as a provisioner.
61
+ This allows you to use the provisioning order to ensure that hostmanager
62
+ runs before or after provisioning. The provisioner will collect hosts from
63
+ boxes with the same provider as the running box.
64
+
65
+ Use:
66
+
67
+ ```ruby
68
+ config.vm.provision :hostmanager
69
+ ```
70
+
60
71
  Contribute
61
72
  ----------
62
73
  Contributions are welcome.
@@ -16,6 +16,8 @@ module VagrantPlugins
16
16
  end
17
17
 
18
18
  argv = parse_options(opts)
19
+ return if !argv
20
+
19
21
  options[:provider] ||= @env.default_provider
20
22
 
21
23
  generate(@env, options[:provider].to_sym)
@@ -32,7 +32,7 @@ module VagrantPlugins
32
32
  host = machine.config.vm.hostname || name
33
33
  ip = get_ip_address.call(machine)
34
34
  host_aliases = machine.config.hostmanager.aliases.join("\s").chomp
35
- @logger.info "Adding /etc/hosts entry: #{ip} #{host} #{host_aliases}"
35
+ machine.env.ui.info "Adding /etc/hosts entry: #{ip} #{host} #{host_aliases}"
36
36
  file << "#{ip}\t#{host}\s#{host_aliases}\n"
37
37
  end
38
38
  end
@@ -7,6 +7,8 @@ module VagrantPlugins
7
7
  description <<-DESC
8
8
  This plugin manages the /etc/hosts file for guest machines. An entry is
9
9
  created for each active machine using the hostname attribute.
10
+
11
+ You can also use the hostmanager provisioner to update the hosts file.
10
12
  DESC
11
13
 
12
14
  config(:hostmanager) do
@@ -22,6 +24,11 @@ module VagrantPlugins
22
24
  hook.append(Action::UpdateHostsFile)
23
25
  end
24
26
 
27
+ provisioner(:hostmanager) do
28
+ require_relative 'provisioner'
29
+ Provisioner
30
+ end
31
+
25
32
  command(:hostmanager) do
26
33
  require_relative 'command'
27
34
  Command
@@ -0,0 +1,12 @@
1
+ module VagrantPlugins
2
+ module HostManager
3
+ class Provisioner < Vagrant.plugin('2', :provisioner)
4
+ include HostsFile
5
+
6
+ def provision
7
+ generate(@machine.env, @machine.box.provider.to_sym)
8
+ update(@machine)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module HostManager
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-hostmanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
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-04-27 00:00:00.000000000 Z
12
+ date: 2013-05-02 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Vagrant plugin that manages the /etc/hosts file within a multi-machine
15
15
  environment
@@ -31,6 +31,7 @@ files:
31
31
  - lib/vagrant-hostmanager/errors.rb
32
32
  - lib/vagrant-hostmanager/hosts_file.rb
33
33
  - lib/vagrant-hostmanager/plugin.rb
34
+ - lib/vagrant-hostmanager/provisioner.rb
34
35
  - lib/vagrant-hostmanager/version.rb
35
36
  - locales/en.yml
36
37
  - test/Vagrantfile