vagrant-vmhosts 0.0.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.
- data/LICENSE +13 -0
- data/README.md +31 -0
- data/lib/vagrant-vmhosts/action.rb +20 -0
- data/lib/vagrant-vmhosts/config.rb +5 -0
- data/lib/vagrant-vmhosts/version.rb +3 -0
- data/lib/vagrant-vmhosts.rb +11 -0
- data/lib/vagrant_init.rb +4 -0
- data/locales/en.yml +5 -0
- metadata +93 -0
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (C) 2012 Kristof Willaert
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Vagrant VM Hosts Plugin
|
2
|
+
=======================
|
3
|
+
|
4
|
+
This Vagrant plugin allows you to add entries to the hosts file of the VM. This is particularly useful in a multi-VM environment to get all machines to know each other by name.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
vagrant gem install vagrant-vmhosts
|
10
|
+
|
11
|
+
Usage
|
12
|
+
-----
|
13
|
+
|
14
|
+
|
15
|
+
TODO
|
16
|
+
----
|
17
|
+
|
18
|
+
* command
|
19
|
+
* unit tests
|
20
|
+
* hosts format
|
21
|
+
* validate config
|
22
|
+
|
23
|
+
Copyright
|
24
|
+
---------
|
25
|
+
|
26
|
+
Copyright (c) 2012 Cegeka NV
|
27
|
+
|
28
|
+
License
|
29
|
+
-------
|
30
|
+
|
31
|
+
Vagrant-vmhosts is licensed under the Apache License, Version 2.0. See the LICENSE file for more details.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module VagrantVmHosts
|
2
|
+
class Action
|
3
|
+
def initialize(app, env)
|
4
|
+
@app = app
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(env)
|
8
|
+
@app.call(env)
|
9
|
+
|
10
|
+
hosts = env[:vm].config.vmhosts.list
|
11
|
+
env[:ui].info I18n.t("vagrant.plugins.vmhosts.adding")
|
12
|
+
hosts.each do |host|
|
13
|
+
if !env[:vm].channel.test("grep '^#{host['ip']}' /etc/hosts")
|
14
|
+
env[:vm].channel.sudo("printf '%s\t%s %s\n' '#{host['ip']}' '#{host['canonical']}' '#{host['aliases'].join(' ')}' >> /etc/hosts")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'vagrant'
|
2
|
+
require 'vagrant-vmhosts/config'
|
3
|
+
require 'vagrant-vmhosts/action'
|
4
|
+
|
5
|
+
Vagrant.config_keys.register(:vmhosts) { VagrantVmHosts::Config }
|
6
|
+
|
7
|
+
Vagrant.actions[:start].insert_after(Vagrant::Action::VM::Boot,
|
8
|
+
VagrantVmHosts::Action)
|
9
|
+
|
10
|
+
# Custom translations are added to the load path here
|
11
|
+
I18n.load_path << File.expand_path("../../locales/en.yml", __FILE__)
|
data/lib/vagrant_init.rb
ADDED
data/locales/en.yml
ADDED
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-vmhosts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Kristof Willaert
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-05-22 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: vagrant
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 1.0.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: This Vagrant plugin allows you to add entries to the hosts file of the VM. This is particularly useful in a multi-VM environment to get all machines to know each other by name.
|
38
|
+
email:
|
39
|
+
- kristof.willaert@gmail.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
45
|
+
- LICENSE
|
46
|
+
- README.md
|
47
|
+
files:
|
48
|
+
- lib/vagrant-vmhosts/action.rb
|
49
|
+
- lib/vagrant-vmhosts/version.rb
|
50
|
+
- lib/vagrant-vmhosts/config.rb
|
51
|
+
- lib/vagrant_init.rb
|
52
|
+
- lib/vagrant-vmhosts.rb
|
53
|
+
- locales/en.yml
|
54
|
+
- LICENSE
|
55
|
+
- README.md
|
56
|
+
has_rdoc: true
|
57
|
+
homepage: https://github.com/cegeka/vagrant-vmhosts
|
58
|
+
licenses:
|
59
|
+
- Apache 2.0
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 23
|
80
|
+
segments:
|
81
|
+
- 1
|
82
|
+
- 3
|
83
|
+
- 6
|
84
|
+
version: 1.3.6
|
85
|
+
requirements: []
|
86
|
+
|
87
|
+
rubyforge_project: vagrant-vmhosts
|
88
|
+
rubygems_version: 1.3.7
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: A Vagrant plugin to add entries to the hosts file of the VM
|
92
|
+
test_files: []
|
93
|
+
|