vagrant-vmware-dhcp 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +10 -0
- data/LICENSE +8 -0
- data/README.md +41 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/vagrant-vmware-dhcp.rb +13 -0
- data/lib/vagrant-vmware-dhcp/action.rb +6 -0
- data/lib/vagrant-vmware-dhcp/action/config_dhcp.rb +194 -0
- data/lib/vagrant-vmware-dhcp/action/set_mac.rb +47 -0
- data/lib/vagrant-vmware-dhcp/plugin.rb +29 -0
- data/lib/vagrant-vmware-dhcp/version.rb +5 -0
- data/locales/en.yml +4 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/vagrant/vmware/dhcp_spec.rb +11 -0
- data/templates/dhcpd_static.erb +9 -0
- data/vagrant-vmware-dhcp.gemspec +55 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 580ce2d6830ec3d6114e6217d2c0c290a34541fb
|
4
|
+
data.tar.gz: 1c44b7ce6cea8ad07ee9d61ef3fd8e2a7992f704
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 51a54ffece7e1d6413183c5a00749519cf347c28fcd9d98530c850a15ce5f5fd0f88ffae54d99ab0a25d44dd4b24ad47004cc19796c7528381a2f73ce34ad497
|
7
|
+
data.tar.gz: 9ac30514b6724f8c9ef031bdb449c0b6bd5ad1c18f9e47bb745e44de323b9f48844293e7f32dce1f82a118ca99a9fe6b119759f31f30b660f5133f3420f05125
|
data/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# OS-specific
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
# editors
|
5
|
+
*.swp
|
6
|
+
|
7
|
+
# Bundler/Rubygems
|
8
|
+
*.gem
|
9
|
+
.bundle
|
10
|
+
pkg/*
|
11
|
+
tags
|
12
|
+
Gemfile.lock
|
13
|
+
|
14
|
+
# Vagrant
|
15
|
+
.vagrant
|
16
|
+
Vagrantfile
|
17
|
+
!example_box/Vagrantfile
|
18
|
+
|
19
|
+
# RVM files for gemset/ruby setting
|
20
|
+
.ruby-*
|
21
|
+
.rvmrc
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# This never actually worked for me in combination with the fusion plugin due to the licensing wacking out... YMMV.
|
4
|
+
group :development do
|
5
|
+
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
|
6
|
+
end
|
7
|
+
|
8
|
+
group :plugins do
|
9
|
+
gem "vagrant-vmware-dhcp", path: "."
|
10
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
Copyright (c) 2014 Mitchell Hashimoto
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
+
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
7
|
+
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Vagrant::Vmware::Dhcp
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vagrant/vmware/dhcp`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'vagrant-vmware-dhcp'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install vagrant-vmware-dhcp
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vagrant-vmware-dhcp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vagrant/vmware/dhcp"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "vagrant-vmware-dhcp/plugin"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module VagrantVmwareDhcp
|
6
|
+
lib_path = Pathname.new(File.expand_path("../vagrant-vmware-dhcp", __FILE__))
|
7
|
+
autoload :Action, lib_path.join("action")
|
8
|
+
|
9
|
+
def self.source_root
|
10
|
+
@source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "digest"
|
3
|
+
|
4
|
+
# Someone who's had some sleep recently is welcome to come fill in comments here...
|
5
|
+
module VagrantPlugins
|
6
|
+
module VagrantVmwareDhcp
|
7
|
+
module Action
|
8
|
+
class ConfigDhcp
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
@env = env
|
12
|
+
@logger = Log4r::Logger.new("vagrant::plugins::vagrant-vmware-dhcp::config_dhcp")
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
@env = env
|
17
|
+
|
18
|
+
if @env[:machine]
|
19
|
+
@logger.info("In config_dhcp provider_name is #{@env[:machine].provider_name}")
|
20
|
+
|
21
|
+
# or env[:machine].provider_name == :vmware_desktop
|
22
|
+
if @env[:machine].provider_name == :vmware_fusion
|
23
|
+
configure_dhcp
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
@app.call(@env)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def configure_dhcp
|
33
|
+
machine = @env[:machine]
|
34
|
+
|
35
|
+
vmx_networks = retrieve_vmx_network_settings(machine)
|
36
|
+
|
37
|
+
@logger.debug("After retrieval vmx_networks are #{vmx_networks}")
|
38
|
+
|
39
|
+
network_map = make_network_map(machine, vmx_networks)
|
40
|
+
|
41
|
+
@logger.debug("After retrieval network_map is #{network_map}")
|
42
|
+
|
43
|
+
apply_static_dhcp_config(machine, network_map)
|
44
|
+
end
|
45
|
+
|
46
|
+
def retrieve_vmx_network_settings(machine)
|
47
|
+
vmx_networks = {}
|
48
|
+
|
49
|
+
File.open(machine.provider.driver.vmx_path).each_line {
|
50
|
+
|line|
|
51
|
+
|
52
|
+
matches = /^(ethernet\d+\.)(.+?)\s*=\s*"?(.*?)"?\s*$/.match(line)
|
53
|
+
|
54
|
+
if not matches
|
55
|
+
next
|
56
|
+
end
|
57
|
+
|
58
|
+
adapter_name = matches[1]
|
59
|
+
adapter_property = matches[2]
|
60
|
+
property_value = matches[3]
|
61
|
+
|
62
|
+
if not vmx_networks.has_key?(adapter_name)
|
63
|
+
vmx_networks[adapter_name] = {}
|
64
|
+
end
|
65
|
+
|
66
|
+
vmx_networks[adapter_name][adapter_property] = property_value
|
67
|
+
}
|
68
|
+
|
69
|
+
vmx_networks_by_mac = {}
|
70
|
+
|
71
|
+
vmx_networks.each {
|
72
|
+
|adapter_name, properties|
|
73
|
+
|
74
|
+
if not properties.has_key?("address") or not properties.has_key?("vnet")
|
75
|
+
next
|
76
|
+
end
|
77
|
+
|
78
|
+
vmx_networks_by_mac[ properties['address'] ] = properties
|
79
|
+
}
|
80
|
+
|
81
|
+
vmx_networks_by_mac
|
82
|
+
end
|
83
|
+
|
84
|
+
def make_network_map(machine, vmx_networks)
|
85
|
+
vm_networks = machine.config.vm.networks.select { |vm_network| vm_network[0] == :private_network and vm_network[1][:ip] and vm_network[1][:mac] }
|
86
|
+
|
87
|
+
network_map = {}
|
88
|
+
|
89
|
+
vm_networks.each { |vm_network|
|
90
|
+
mac = vm_network[1][ :mac ]
|
91
|
+
mac = mac.scan(/.{2}/).join(":")
|
92
|
+
|
93
|
+
if not vmx_networks.has_key?(mac)
|
94
|
+
@logger.error("Missing VMX network configuration for vm_network #{vm_network}")
|
95
|
+
next
|
96
|
+
end
|
97
|
+
|
98
|
+
network_map[mac] = { :ip => vm_network[1][:ip], :vnet => vmx_networks[mac]["vnet"], :mac => mac }
|
99
|
+
}
|
100
|
+
|
101
|
+
network_map
|
102
|
+
end
|
103
|
+
|
104
|
+
def guess_dhcpd_conf_location(network)
|
105
|
+
@logger.debug("Using dhcpd.conf at #{network[:vnet]}")
|
106
|
+
location = "/Library/Preferences/VMware Fusion/#{network[:vnet]}/dhcpd.conf"
|
107
|
+
return location
|
108
|
+
end
|
109
|
+
|
110
|
+
def apply_static_dhcp_config(machine, network_map)
|
111
|
+
|
112
|
+
network_map.each {
|
113
|
+
|mac, network|
|
114
|
+
|
115
|
+
@env[:ui].info("Configuring DHCP for #{network[:ip]} on #{network[:vnet]}")
|
116
|
+
|
117
|
+
prune_dhcpd_conf(network)
|
118
|
+
write_dhcpd_conf(network)
|
119
|
+
}
|
120
|
+
|
121
|
+
trigger_dhcpd_update
|
122
|
+
|
123
|
+
@env[:ui].info("DHCP Configured")
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
def prune_dhcpd_conf(network)
|
128
|
+
conf_location = guess_dhcpd_conf_location(network)
|
129
|
+
escaped_conf_location = Vagrant::Util::ShellQuote.escape(conf_location, "'")
|
130
|
+
|
131
|
+
mac = network[:mac]
|
132
|
+
|
133
|
+
sudo_command = ""
|
134
|
+
sudo_command = "sudo " if !File.writable?(conf_location)
|
135
|
+
|
136
|
+
system("#{sudo_command}sed -r -e '\\\x01^# VAGRANT-BEGIN: #{mac}\x01,\\\x01^# VAGRANT-END: #{mac}\x01 d' -ibak '#{escaped_conf_location}'")
|
137
|
+
end
|
138
|
+
|
139
|
+
def write_dhcpd_conf(network)
|
140
|
+
conf_location = guess_dhcpd_conf_location(network)
|
141
|
+
escaped_conf_location = Vagrant::Util::ShellQuote.escape(conf_location, "'")
|
142
|
+
|
143
|
+
sudo_command = ""
|
144
|
+
sudo_command = "sudo " if !File.writable?(conf_location)
|
145
|
+
|
146
|
+
netname = [network[:vnet], network[:ip].gsub(/\./, '_')].join('_')
|
147
|
+
|
148
|
+
output = Vagrant::Util::TemplateRenderer.render('dhcpd_static',
|
149
|
+
mac: network[:mac],
|
150
|
+
ip: network[:ip],
|
151
|
+
vnet: network[:vnet],
|
152
|
+
name: netname,
|
153
|
+
template_root: VagrantPlugins::VagrantVmwareDhcp.source_root().join("templates")
|
154
|
+
)
|
155
|
+
|
156
|
+
@logger.debug("DHCPD template for interface #{network[:vnet]} is #{output}")
|
157
|
+
|
158
|
+
before = File.open(conf_location).read
|
159
|
+
@logger.debug("Before altering, dhcpd.conf content is #{before}")
|
160
|
+
|
161
|
+
output.split("\n").each do |line|
|
162
|
+
line = Vagrant::Util::ShellQuote.escape(line, "'")
|
163
|
+
system(%Q[echo '#{line}' | #{sudo_command}tee -a '#{escaped_conf_location}' >/dev/null])
|
164
|
+
end
|
165
|
+
|
166
|
+
after = File.open(conf_location).read
|
167
|
+
@logger.debug("After, dhcpd.conf content is #{after}")
|
168
|
+
end
|
169
|
+
|
170
|
+
def trigger_dhcpd_update
|
171
|
+
# Per http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1026510
|
172
|
+
|
173
|
+
vmnet_cli = "/Applications/VMware Fusion.app/Contents/Library/vmnet-cli"
|
174
|
+
|
175
|
+
configureCommand = [ "sudo", vmnet_cli, "--configure" ].flatten
|
176
|
+
stopCommand = [ "sudo", vmnet_cli, "--stop" ].flatten
|
177
|
+
startCommand = [ "sudo", vmnet_cli, "--start" ].flatten
|
178
|
+
statusCommand = [ "sudo", vmnet_cli, "--status" ].flatten
|
179
|
+
|
180
|
+
Vagrant::Util::Subprocess.execute(*configureCommand)
|
181
|
+
Vagrant::Util::Subprocess.execute(*stopCommand)
|
182
|
+
Vagrant::Util::Subprocess.execute(*startCommand)
|
183
|
+
r = Vagrant::Util::Subprocess.execute(*statusCommand)
|
184
|
+
|
185
|
+
if r.exit_code != 0
|
186
|
+
@env[:ui].error("VMNet status exited with code #{r.exit_code} and output:\n#{r.stdout.chomp}")
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "digest"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module VagrantVmwareDhcp
|
6
|
+
module Action
|
7
|
+
class SetMac
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
@env = env
|
11
|
+
@logger = Log4r::Logger.new("vagrant::plugins::vagrant-vmware-dhcp::set_mac")
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
@env = env
|
16
|
+
|
17
|
+
machine = env[:machine]
|
18
|
+
|
19
|
+
if machine
|
20
|
+
set_mac_address(env)
|
21
|
+
end
|
22
|
+
|
23
|
+
@app.call(@env)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def set_mac_address(env)
|
29
|
+
machine = env[:machine]
|
30
|
+
|
31
|
+
networks = machine.config.vm.networks.select { |network| network[0] == :private_network and network[1][:ip] and not network[1][:mac] }
|
32
|
+
|
33
|
+
networks.each { |network| network[1][:mac] = mac_from_ip(network[1][:ip]) }
|
34
|
+
|
35
|
+
@logger.info("Added MAC addresses for #{networks}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def mac_from_ip(ip)
|
39
|
+
sha = Digest::SHA256.hexdigest ip
|
40
|
+
mac = sha.scan(/.{12}/)[0]
|
41
|
+
|
42
|
+
mac
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative "action"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module VagrantVmwareDhcp
|
5
|
+
class Plugin < Vagrant.plugin("2")
|
6
|
+
name "VagrantVmwareDhcp"
|
7
|
+
description <<-DESC
|
8
|
+
Adds static private IPs to VMware's DHCP configuration so that your networks behave normally.
|
9
|
+
Especially nice on multi-vm environments with Windows.
|
10
|
+
DESC
|
11
|
+
|
12
|
+
action_hook('DA VMWare Network: Configure MAC addresses') do |hook|
|
13
|
+
action = Vagrant::Action::Builtin::ConfigValidate
|
14
|
+
hook.before(action, VagrantVmwareDhcp::Action::SetMac)
|
15
|
+
end
|
16
|
+
|
17
|
+
action_hook('DA VMWare Network: Configure dhcp.conf') do |hook|
|
18
|
+
action = HashiCorp::VagrantVMwarefusion::Action::Network
|
19
|
+
hook.after(action, VagrantVmwareDhcp::Action::ConfigDhcp)
|
20
|
+
end
|
21
|
+
|
22
|
+
# action_hook(:init_i18n, :environment_load) { init_i18n }
|
23
|
+
# def self.init_i18n
|
24
|
+
# I18n.load_path << File.expand_path("locales/en.yml", VagrantVmwareDhcp.source_root)
|
25
|
+
# I18n.reload!
|
26
|
+
# end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/locales/en.yml
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
$:.unshift File.expand_path("../lib", __FILE__)
|
2
|
+
require "vagrant-vmware-dhcp/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "vagrant-vmware-dhcp"
|
6
|
+
s.version = VagrantPlugins::VagrantVmwareDhcp::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.license = "MIT"
|
9
|
+
s.authors = "Israel Shirk"
|
10
|
+
s.email = "israelshirk@gmail.com"
|
11
|
+
s.homepage = "http://www.github.com/israelshirk/vagrant-vmware-dhcp"
|
12
|
+
s.summary = "Sets up VMware's DHCP server to serve correct IP addresses to vagrant guests."
|
13
|
+
s.description = "Sets up VMware's DHCP server to serve correct IP addresses to vagrant guests."
|
14
|
+
|
15
|
+
s.required_rubygems_version = ">= 1.3.6"
|
16
|
+
s.rubyforge_project = "vagrant-vmware-dhcp"
|
17
|
+
|
18
|
+
s.add_development_dependency "rake"
|
19
|
+
s.add_development_dependency "rspec"
|
20
|
+
|
21
|
+
# The following block of code determines the files that should be included
|
22
|
+
# in the gem. It does this by reading all the files in the directory where
|
23
|
+
# this gemspec is, and parsing out the ignored files from the gitignore.
|
24
|
+
# Note that the entire gitignore(5) syntax is not supported, specifically
|
25
|
+
# the "!" syntax, but it should mostly work correctly.
|
26
|
+
root_path = File.dirname(__FILE__)
|
27
|
+
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
|
28
|
+
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
|
29
|
+
gitignore_path = File.join(root_path, ".gitignore")
|
30
|
+
gitignore = File.readlines(gitignore_path)
|
31
|
+
gitignore.map! { |line| line.chomp.strip }
|
32
|
+
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
33
|
+
|
34
|
+
unignored_files = all_files.reject do |file|
|
35
|
+
# Ignore any directories, the gemspec only cares about files
|
36
|
+
next true if File.directory?(file)
|
37
|
+
|
38
|
+
# Ignore any paths that match anything in the gitignore. We do
|
39
|
+
# two tests here:
|
40
|
+
#
|
41
|
+
# - First, test to see if the entire path matches the gitignore.
|
42
|
+
# - Second, match if the basename does, this makes it so that things
|
43
|
+
# like '.DS_Store' will match sub-directories too (same behavior
|
44
|
+
# as git).
|
45
|
+
#
|
46
|
+
gitignore.any? do |ignore|
|
47
|
+
File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
|
48
|
+
File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
s.files = unignored_files
|
53
|
+
s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
|
54
|
+
s.require_path = 'lib'
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-vmware-dhcp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Israel Shirk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Sets up VMware's DHCP server to serve correct IP addresses to vagrant
|
42
|
+
guests.
|
43
|
+
email: israelshirk@gmail.com
|
44
|
+
executables:
|
45
|
+
- console
|
46
|
+
- setup
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- .gitignore
|
51
|
+
- .travis.yml
|
52
|
+
- CODE_OF_CONDUCT.md
|
53
|
+
- Gemfile
|
54
|
+
- LICENSE
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- bin/console
|
58
|
+
- bin/setup
|
59
|
+
- lib/vagrant-vmware-dhcp.rb
|
60
|
+
- lib/vagrant-vmware-dhcp/action.rb
|
61
|
+
- lib/vagrant-vmware-dhcp/action/config_dhcp.rb
|
62
|
+
- lib/vagrant-vmware-dhcp/action/set_mac.rb
|
63
|
+
- lib/vagrant-vmware-dhcp/plugin.rb
|
64
|
+
- lib/vagrant-vmware-dhcp/version.rb
|
65
|
+
- locales/en.yml
|
66
|
+
- spec/spec_helper.rb
|
67
|
+
- spec/vagrant/vmware/dhcp_spec.rb
|
68
|
+
- templates/dhcpd_static.erb
|
69
|
+
- vagrant-vmware-dhcp.gemspec
|
70
|
+
homepage: http://www.github.com/israelshirk/vagrant-vmware-dhcp
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.3.6
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project: vagrant-vmware-dhcp
|
90
|
+
rubygems_version: 2.4.6
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: Sets up VMware's DHCP server to serve correct IP addresses to vagrant guests.
|
94
|
+
test_files: []
|