vagrant-hostmanager 1.7.0 → 1.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 121bc1248376867fa1c58a5041c69e85fb04a528
4
- data.tar.gz: dd4766ae4162c0396141ed577d6733ec1ab30c4f
3
+ metadata.gz: 075560d0ced2cfb86f6b0e4688ef929ff3d7883d
4
+ data.tar.gz: 0f7fcfd445d8b99f37b506c200fc2f1f1e1dfb9c
5
5
  SHA512:
6
- metadata.gz: af705fe74b172461d276b554d9a610d31ae311d9cedc892280e91f979c31b29df854a6ded2b0c156294c2017ff5151bd65975bcb734a28432502a18fe2a3df3c
7
- data.tar.gz: d8b206c2ee441e96a303cf90407a79fa7bf47087be8bb4da14e1342548fb9eb94e3ec28b81bd6f354b6296fceda6cb60ab5450f92040eb907e4847850adb7f14
6
+ metadata.gz: 48e7d74ad76e812646c25f9fdb65ca36b6077e83caaf53b28005a2e8a0daf1b4fe8006c97026354077f16dc1c27234c1319bbea2519902dba80c950d031f3f01
7
+ data.tar.gz: 4f5afe7118dedf2bbae2c1f8d04c75ad5955fe356ad2e17d6b2e0410dafdb0110058c52c1df7e8243e89c831854d2ae466ee2b03e9399d51535b3365bb1a0828
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  Vagrant Host Manager
2
2
  ====================
3
3
 
4
+ [![Gem](https://img.shields.io/gem/v/vagrant-hostmanager.svg)](https://rubygems.org/gems/vagrant-hostmanager)
4
5
  [![Gem](https://img.shields.io/gem/dt/vagrant-hostmanager.svg)](https://rubygems.org/gems/vagrant-hostmanager)
5
6
  [![Gem](https://img.shields.io/gem/dtv/vagrant-hostmanager.svg)](https://rubygems.org/gems/vagrant-hostmanager)
6
7
  [![Twitter](https://img.shields.io/twitter/url/https/github.com/smdahlen/vagrant-hostmanager.svg?style=social)](https://twitter.com/intent/tweet?text=Check%20out%20this%20awesome%20Vagrant%20plugin%21&url=https%3A%2F%2Fgithub.com%2Fsmdahlen%2Fvagrant-hostmanager&hashtags=vagrant%hostmanager&original_referer=)
@@ -120,13 +121,31 @@ end
120
121
  Passwordless sudo
121
122
  -----------------
122
123
 
123
- Add the following snippet to the sudoers file (for example, to
124
- ```/etc/sudoers.d/vagrant_hostmanager```) to make it stop asking
125
- password when updating hosts file (replace ```/home/user``` with your
126
- actual home directory):
124
+ To avoid being asked for the password every time the hosts file is updated,
125
+ enable passwordless sudo for the specific command that hostmanager uses to
126
+ update the hosts file.
127
127
 
128
- Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp /home/user/.vagrant.d/tmp/hosts.local /etc/hosts
129
- %sudo ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE
128
+ - Add the following snippet to the sudoers file (e.g.
129
+ `/etc/sudoers.d/vagrant_hostmanager`):
130
+
131
+ ```
132
+ Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp <home-directory>/.vagrant.d/tmp/hosts.local /etc/hosts
133
+ %<admin-group> ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE
134
+ ```
135
+
136
+ Replace `<home-directory>` with your actual home directory (e.g.
137
+ `/home/joe`) and `<admin-group>` with the group that is used by the system
138
+ for sudo access (usually `sudo` on Debian/Ubuntu systems and `wheel`
139
+ on Fedora/Red Hat systems).
140
+
141
+ - If necessary, add yourself to the `<admin-group>`:
142
+
143
+ ```
144
+ usermod -aG <admin-group> <user-name>
145
+ ```
146
+
147
+ Replace `<admin-group>` with the group that is used by the system for sudo
148
+ access (see above) and `<user-name>` with you user name.
130
149
 
131
150
  Windows support
132
151
  ---------------
@@ -148,19 +167,6 @@ and give your user Modify permission.
148
167
  Due to limitations caused by UAC, cancelling out of the UAC prompt will not cause any
149
168
  visible errors, however the ```hosts``` file will not be updated.
150
169
 
151
- Installing development version
152
- ------------------------------
153
-
154
- If you want to install the bleeding version of vagrant-hostmanager (*at your own risk*), you can do the following
155
- (requires ruby and git):
156
-
157
- ```
158
- git clone https://github.com/smdahlen/vagrant-hostmanager.git
159
- cd vagrant-hostmanager
160
- rake gem:build
161
- vagrant plugin install pkg/vagrant-hostmanager-*.gem
162
- ```
163
-
164
170
 
165
171
  Contribute
166
172
  ----------
@@ -174,6 +180,17 @@ To contribute, fork then clone the repository, and then the following:
174
180
  3. Then install vagrant-hostmanager dependancies:
175
181
  * `bundle _1.6.9_ install`
176
182
 
183
+ **Testing**
184
+
185
+ 1. Build and package your newly developed code:
186
+ * `rake gem:build`
187
+ 2. Then install the packaged plugin:
188
+ * `vagrant plugin install pkg/vagrant-hostmanager-*.gem`
189
+ 3. Once you're done testing, roll-back to the latest released version:
190
+ * `vagrant plugin uninstall vagrant-hostmanager`
191
+ * `vagrant plugin install vagrant-hostmanager`
192
+ 4. Once you're satisfied developing and testing your new code, please submit a pull request for review.
193
+
177
194
  **Releasing**
178
195
 
179
196
  To release a new version of vagrant-hostmanager you will need to do the following:
@@ -17,17 +17,14 @@ module VagrantPlugins
17
17
 
18
18
  if (machine.communicate.test("uname -s | grep SunOS"))
19
19
  realhostfile = '/etc/inet/hosts'
20
- move_cmd = 'mv'
21
20
  elsif (machine.communicate.test("test -d $Env:SystemRoot"))
22
21
  windir = ""
23
22
  machine.communicate.execute("echo %SYSTEMROOT%", {:shell => :cmd}) do |type, contents|
24
23
  windir << contents.gsub("\r\n", '') if type == :stdout
25
24
  end
26
25
  realhostfile = "#{windir}\\System32\\drivers\\etc\\hosts"
27
- move_cmd = 'mv -force'
28
26
  else
29
27
  realhostfile = '/etc/hosts'
30
- move_cmd = 'mv -f'
31
28
  end
32
29
  # download and modify file with Vagrant-managed entries
33
30
  file = @global_env.tmp_path.join("hosts.#{machine.name}")
@@ -37,11 +34,9 @@ module VagrantPlugins
37
34
  # upload modified file and remove temporary file
38
35
  machine.communicate.upload(file, '/tmp/hosts')
39
36
  if windir
40
- machine.communicate.sudo("#{move_cmd} /tmp/hosts/hosts.#{machine.name} #{realhostfile}")
41
- elsif machine.communicate.test('test -f /.dockerinit')
42
- machine.communicate.sudo("cat /tmp/hosts > #{realhostfile}")
37
+ machine.communicate.sudo("mv -force /tmp/hosts/hosts.#{machine.name} #{realhostfile}")
43
38
  else
44
- machine.communicate.sudo("#{move_cmd} /tmp/hosts #{realhostfile}")
39
+ machine.communicate.sudo("cat /tmp/hosts > #{realhostfile}")
45
40
  end
46
41
  end
47
42
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module HostManager
3
- VERSION = '1.7.0'
3
+ VERSION = '1.7.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-hostmanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shawn Dahlen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-30 00:00:00.000000000 Z
11
+ date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler