vagrant-dnsmasq 0.0.5
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 +7 -0
- data/.gitignore +21 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +42 -0
- data/LICENSE.txt +23 -0
- data/Makefile +26 -0
- data/README.md +49 -0
- data/Rakefile +25 -0
- data/lib/vagrant-dnsmasq.rb +26 -0
- data/lib/vagrant-dnsmasq/actions.rb +79 -0
- data/lib/vagrant-dnsmasq/config.rb +37 -0
- data/lib/vagrant-dnsmasq/includes/Dnsmasq.class.rb +38 -0
- data/lib/vagrant-dnsmasq/includes/Domain.class.rb +39 -0
- data/lib/vagrant-dnsmasq/includes/Ip.class.rb +24 -0
- data/lib/vagrant-dnsmasq/includes/Resolver.class.rb +46 -0
- data/lib/vagrant-dnsmasq/includes/helper.rb +22 -0
- data/lib/vagrant-dnsmasq/version.rb +5 -0
- data/test/Vagrantfile +27 -0
- data/vagrant-dnsmasq.gemspec +23 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5111a30318f9e218273d6d70c080a1c554d1b12f
|
4
|
+
data.tar.gz: 8ebdd313a4e50a4b3841daf7977bc0eb6a1cfa21
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db23f6b1a476394f7ce76ce1490a248a6b311dee0cc6b0ec908a2863b544185160f624ef5d5c72238c7fb4c1ee575b41821ec9fa963b751187402a572e5031e6
|
7
|
+
data.tar.gz: 1dbaf62f3975b08541220fa470dfed587ac8e72dd32e3e0033a5de6d9dbcfb15fd1b22756072cb098f8bc2ad07693210bed47c5e8b440295abb102370e7b4ef8
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/mitchellh/vagrant.git
|
3
|
+
revision: 7e400d00a3c5a0fdf2809c8b5001a035415a607b
|
4
|
+
tag: v1.2.2
|
5
|
+
specs:
|
6
|
+
vagrant (1.2.2)
|
7
|
+
childprocess (~> 0.3.7)
|
8
|
+
erubis (~> 2.7.0)
|
9
|
+
i18n (~> 0.6.0)
|
10
|
+
json (>= 1.5.1, < 1.8.0)
|
11
|
+
log4r (~> 1.1.9)
|
12
|
+
net-scp (~> 1.1.0)
|
13
|
+
net-ssh (~> 2.6.6)
|
14
|
+
|
15
|
+
PATH
|
16
|
+
remote: .
|
17
|
+
specs:
|
18
|
+
vagrant-dnsmasq (0.0.5)
|
19
|
+
|
20
|
+
GEM
|
21
|
+
remote: https://rubygems.org/
|
22
|
+
specs:
|
23
|
+
childprocess (0.3.9)
|
24
|
+
ffi (~> 1.0, >= 1.0.11)
|
25
|
+
erubis (2.7.0)
|
26
|
+
ffi (1.9.0)
|
27
|
+
i18n (0.6.4)
|
28
|
+
json (1.7.7)
|
29
|
+
log4r (1.1.10)
|
30
|
+
net-scp (1.1.1)
|
31
|
+
net-ssh (>= 2.6.5)
|
32
|
+
net-ssh (2.6.7)
|
33
|
+
rake (10.1.0)
|
34
|
+
|
35
|
+
PLATFORMS
|
36
|
+
ruby
|
37
|
+
|
38
|
+
DEPENDENCIES
|
39
|
+
bundler (~> 1.3)
|
40
|
+
rake
|
41
|
+
vagrant!
|
42
|
+
vagrant-dnsmasq!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2013 Matthias Kadenbach
|
2
|
+
https://github.com/mattes/vagrant-dnsmasq
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
refresh:
|
2
|
+
rake build && vagrant plugin uninstall vagrant-dnsmasq && vagrant plugin install pkg/vagrant-dnsmasq-0.0.*.gem
|
3
|
+
|
4
|
+
test-and-destroy:
|
5
|
+
make refresh && make up-and-destroy
|
6
|
+
|
7
|
+
test:
|
8
|
+
make refresh && make up
|
9
|
+
|
10
|
+
up:
|
11
|
+
cd test && vagrant up
|
12
|
+
|
13
|
+
debug-up:
|
14
|
+
cd test && VAGRANT_LOG=INFO vagrant up
|
15
|
+
|
16
|
+
destroy:
|
17
|
+
cd test && vagrant destroy -f
|
18
|
+
|
19
|
+
reload:
|
20
|
+
cd test && vagrant reload
|
21
|
+
|
22
|
+
up-and-destroy:
|
23
|
+
make up; make destroy
|
24
|
+
|
25
|
+
|
26
|
+
.PHONY: refresh up debug-up destroy reload up-and-destroy test-and-destroy test
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
vagrant-dnsmasq
|
2
|
+
===============
|
3
|
+
|
4
|
+
A Dnsmasq Vagrant plugin that manages the dnsmasq.conf file and /etc/resolver directory on your host system.
|
5
|
+
|
6
|
+
## Prerequisites
|
7
|
+
* Mac OS X Mountain Lion
|
8
|
+
* [brew](http://mxcl.github.io/homebrew/)
|
9
|
+
* [Dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) ```brew install dnsmasq```
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
```
|
13
|
+
vagrant plugin install vagrant-dnsmasq
|
14
|
+
```
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
in your Vagrantfile
|
18
|
+
```
|
19
|
+
# dnsmasq ...
|
20
|
+
|
21
|
+
# enable dnsmasq?
|
22
|
+
# set to false or delete line to disable dnsmasq handling
|
23
|
+
config.dnsmasq.enable = true
|
24
|
+
|
25
|
+
# set domain ending
|
26
|
+
config.dnsmasq.domain = '.dev'
|
27
|
+
|
28
|
+
# this plugin runs 'hostname -I' on the guest machine to obtain
|
29
|
+
# the guest ip address. you could overwrite the ip here. optional.
|
30
|
+
# config.dnsmasq.ip = '192.168.59.100'
|
31
|
+
```
|
32
|
+
|
33
|
+
## Uninstall
|
34
|
+
```
|
35
|
+
vagrant plugin uninstall vagrant-dnsmasq
|
36
|
+
```
|
37
|
+
|
38
|
+
Verify ```/etc/resolver``` and ```$(brew --prefix)/etc/dnsmasq.conf```.
|
39
|
+
|
40
|
+
|
41
|
+
## Alternatives
|
42
|
+
|
43
|
+
__`/etc/resolver` approach__
|
44
|
+
* [vagrant-dns](https://github.com/BerlinVagrant/vagrant-dns) (using [rubydns](http://www.codeotaku.com/projects/rubydns/index.en))
|
45
|
+
|
46
|
+
__`/etc/hosts` approach__
|
47
|
+
* [vagrant-hostmaster](https://github.com/mosaicxm/vagrant-hostmaster)
|
48
|
+
* [vagrant-hostmanager](https://github.com/smdahlen/vagrant-hostmanager)
|
49
|
+
* [vagrant-hostsupdater](https://github.com/cogitatio/vagrant-hostsupdater)
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
task :default do
|
6
|
+
system 'rake -T'
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "tag this version and rake release"
|
10
|
+
task :publish do
|
11
|
+
lib = File.expand_path('../lib', __FILE__)
|
12
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
13
|
+
require 'vagrant-dnsmasq/version'
|
14
|
+
|
15
|
+
puts "VERSION: #{Vagrant::Dnsmasq::VERSION}"
|
16
|
+
|
17
|
+
system "git add ."
|
18
|
+
system "git commit -a"
|
19
|
+
system "git push"
|
20
|
+
|
21
|
+
system "git tag -a v#{Vagrant::Dnsmasq::VERSION}"
|
22
|
+
system "git push origin v#{Vagrant::Dnsmasq::VERSION}"
|
23
|
+
|
24
|
+
system 'rake release'
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Dnsmasq
|
3
|
+
|
4
|
+
class Plugin < Vagrant.plugin("2")
|
5
|
+
name "vagrant-dnsmasq"
|
6
|
+
|
7
|
+
config "dnsmasq" do
|
8
|
+
require "vagrant-dnsmasq/config"
|
9
|
+
Config
|
10
|
+
end
|
11
|
+
|
12
|
+
lib_path = Pathname.new(File.expand_path("../vagrant-dnsmasq", __FILE__))
|
13
|
+
require lib_path.join("actions")
|
14
|
+
|
15
|
+
action_hook(:dnsmasq, :machine_action_up) do |hook|
|
16
|
+
hook.append(Vagrant::Action::Up)
|
17
|
+
end
|
18
|
+
|
19
|
+
action_hook(:dnsmasq, :machine_action_destroy) do |hook|
|
20
|
+
hook.append(Vagrant::Action::Destroy)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Action
|
3
|
+
|
4
|
+
class Up
|
5
|
+
def initialize(app, env)
|
6
|
+
inc_path = Pathname.new(File.expand_path("../includes", __FILE__))
|
7
|
+
require inc_path.join("Domain.class.rb")
|
8
|
+
require inc_path.join("Ip.class.rb")
|
9
|
+
require inc_path.join("Dnsmasq.class.rb")
|
10
|
+
require inc_path.join("Resolver.class.rb")
|
11
|
+
require inc_path.join("helper.rb")
|
12
|
+
|
13
|
+
@app = app
|
14
|
+
@machine = env[:machine]
|
15
|
+
@ip = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def call(env)
|
19
|
+
if @machine.config.dnsmasq.enabled?
|
20
|
+
|
21
|
+
# overwrite ip with value from config?
|
22
|
+
@ip = @machine.config.dnsmasq.ip if @machine.config.dnsmasq.ip.count > 0
|
23
|
+
|
24
|
+
|
25
|
+
# ... or try to fetch it from guest system
|
26
|
+
if @ip.count === 0
|
27
|
+
@machine.communicate.sudo("hostname -I") do |type, data|
|
28
|
+
@ip = data.scan /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/
|
29
|
+
end
|
30
|
+
@ip.map!{|ip| begin Ip.new(ip) rescue nil end}.compact!
|
31
|
+
end
|
32
|
+
|
33
|
+
# is there a ip?
|
34
|
+
if @ip.count > 0
|
35
|
+
|
36
|
+
# update dnsmasq.conf
|
37
|
+
brew_prefix = `brew --prefix`
|
38
|
+
brew_prefix.strip!
|
39
|
+
dnsmasq_conf_file = brew_prefix + "/etc/dnsmasq.conf"
|
40
|
+
|
41
|
+
dnsmasq = DnsmasqConf.new(dnsmasq_conf_file)
|
42
|
+
@ip.each do |ip|
|
43
|
+
dnsmasq.insert(@machine.config.dnsmasq.domain, ip)
|
44
|
+
end
|
45
|
+
|
46
|
+
# update /etc/resolver
|
47
|
+
resolver = Resolver.new('/etc/resolver')
|
48
|
+
@ip.each do |ip|
|
49
|
+
resolver.insert(@machine.config.dnsmasq.domain, ip)
|
50
|
+
end
|
51
|
+
|
52
|
+
env[:ui].info "Added domain #{@machine.config.dnsmasq.domain} for IP #{@ip}"
|
53
|
+
@app.call(env)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
class Destroy
|
61
|
+
def initialize(app, env)
|
62
|
+
inc_path = Pathname.new(File.expand_path("../includes", __FILE__))
|
63
|
+
require inc_path.join("Domain.class.rb")
|
64
|
+
require inc_path.join("Ip.class.rb")
|
65
|
+
require inc_path.join("Dnsmasq.class.rb")
|
66
|
+
require inc_path.join("Resolver.class.rb")
|
67
|
+
require inc_path.join("helper.rb")
|
68
|
+
|
69
|
+
@app = app
|
70
|
+
end
|
71
|
+
|
72
|
+
def call(env)
|
73
|
+
# @todo delete from dnsmasq.conf and /etc/resolver
|
74
|
+
@app.call(env)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Dnsmasq
|
3
|
+
class Config < Vagrant.plugin("2", :config)
|
4
|
+
|
5
|
+
attr_accessor :enable
|
6
|
+
attr_accessor :domain
|
7
|
+
attr_accessor :ip
|
8
|
+
|
9
|
+
alias_method :enabled?, :enable
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
inc_path = Pathname.new(File.expand_path("../includes", __FILE__))
|
13
|
+
require inc_path.join("Domain.class.rb")
|
14
|
+
require inc_path.join("Ip.class.rb")
|
15
|
+
|
16
|
+
@enable = UNSET_VALUE
|
17
|
+
@domain = UNSET_VALUE
|
18
|
+
@ip = UNSET_VALUE
|
19
|
+
end
|
20
|
+
|
21
|
+
def finalize!
|
22
|
+
@enable = false if @enable == UNSET_VALUE
|
23
|
+
@domain = nil if @domain == UNSET_VALUE
|
24
|
+
@ip = nil if @ip == UNSET_VALUE
|
25
|
+
|
26
|
+
# make it a Domain instance
|
27
|
+
@domain = Domain.new @domain
|
28
|
+
|
29
|
+
# make it an Ip instance
|
30
|
+
@ip = [@ip] unless @ip.kind_of? Array
|
31
|
+
@ip.map!{|ip| begin Ip.new(ip) rescue nil end}.compact!
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class DnsmasqConf
|
2
|
+
|
3
|
+
attr_reader :filename
|
4
|
+
|
5
|
+
def initialize(filename)
|
6
|
+
raise ArgumentError, 'wrong filename' if filename.blank?
|
7
|
+
raise IOError unless File.exists? filename
|
8
|
+
@filename = filename
|
9
|
+
end
|
10
|
+
|
11
|
+
def insert(domain, ip)
|
12
|
+
raise ArgumentError, 'invalid domain instance' unless domain.is_a? Domain
|
13
|
+
raise ArgumentError, 'invalid ip instance' unless ip.is_a? Ip
|
14
|
+
|
15
|
+
delete(domain) if includes?(domain)
|
16
|
+
|
17
|
+
File.open(@filename, 'a') { |file|
|
18
|
+
file.write "\naddress=/#{domain.dotted}/#{ip.v4}"
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def includes?(domain)
|
23
|
+
raise ArgumentError, 'invalid domain instance' unless domain.is_a? Domain
|
24
|
+
|
25
|
+
File.open(@filename, "r").each_line do |l|
|
26
|
+
return true if Regexp.new("address=/\.#{domain.name}").match(l.strip)
|
27
|
+
end
|
28
|
+
return false
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete(domain)
|
32
|
+
raise ArgumentError, 'invalid domain instance' unless domain.is_a? Domain
|
33
|
+
|
34
|
+
delete_line_from_file(@filename, Regexp.new("address=/\.#{domain.name}"))
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class Domain
|
2
|
+
|
3
|
+
MATCH = /^\.?[a-z]*$/
|
4
|
+
|
5
|
+
def initialize(name)
|
6
|
+
@name = nil
|
7
|
+
|
8
|
+
if name.is_a? Domain
|
9
|
+
@name = name.dotted
|
10
|
+
return
|
11
|
+
end
|
12
|
+
|
13
|
+
raise ArgumentError, "no domain name given" unless name
|
14
|
+
|
15
|
+
# parse domain name ...
|
16
|
+
name = name.to_s
|
17
|
+
name = name[1..-1] if name.start_with? '.'
|
18
|
+
name = name.downcase
|
19
|
+
raise ArgumentError, "Domain '#{name}' must match #{MATCH}" unless Domain::valid?(name)
|
20
|
+
@name = name # without leading .
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.valid?(name)
|
24
|
+
Domain::MATCH.match(name.downcase)
|
25
|
+
end
|
26
|
+
|
27
|
+
def dotted
|
28
|
+
'.' + @name
|
29
|
+
end
|
30
|
+
|
31
|
+
def name
|
32
|
+
@name
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_s
|
36
|
+
dotted
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Ip
|
2
|
+
|
3
|
+
MATCH_IP4 = /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/
|
4
|
+
|
5
|
+
def initialize(ipv4)
|
6
|
+
|
7
|
+
raise ArgumentError, "IPv4 '#{ipv4}' must match #{MATCH_IP4}" unless Ip::ipv4_valid?(ipv4)
|
8
|
+
|
9
|
+
@ipv4 = ipv4
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.ipv4_valid?(ipv4)
|
13
|
+
Ip::MATCH_IP4.match(ipv4)
|
14
|
+
end
|
15
|
+
|
16
|
+
def v4
|
17
|
+
@ipv4
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
v4
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class Resolver
|
2
|
+
|
3
|
+
attr_reader :dirname
|
4
|
+
|
5
|
+
def initialize(dirname)
|
6
|
+
raise ArgumentError, 'wrong dirname' if dirname.blank?
|
7
|
+
raise IOError unless Dir.exists? dirname
|
8
|
+
@dirname = dirname
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.flush_cache!
|
12
|
+
system 'sudo dscacheutil -flushcache'
|
13
|
+
end
|
14
|
+
|
15
|
+
def list
|
16
|
+
Dir["#{@dirname}/*"].map{|dir| '.' + File.basename(dir)}
|
17
|
+
end
|
18
|
+
|
19
|
+
def insert(domain, ip)
|
20
|
+
raise ArgumentError, 'invalid domain instance' unless domain.is_a? Domain
|
21
|
+
|
22
|
+
delete(domain) if includes?(domain)
|
23
|
+
|
24
|
+
puts "You may be asked for your password to insert #{@dirname}/#{domain.name} (ip: #{ip})"
|
25
|
+
system("sudo sh -c \"echo 'nameserver #{ip.v4}' >> #{@dirname}/#{domain.name}\"")
|
26
|
+
Resolver::flush_cache!
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
def delete(domain)
|
31
|
+
raise ArgumentError, 'invalid domain instance' unless domain.is_a? Domain
|
32
|
+
|
33
|
+
if includes? domain
|
34
|
+
puts "You may be asked for your password to delete #{@dirname}/#{domain.name}"
|
35
|
+
system("sudo rm -rf #{@dirname}/#{domain.name}")
|
36
|
+
Resolver::flush_cache!
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def includes?(domain)
|
41
|
+
raise ArgumentError, 'invalid domain instance' unless domain.is_a? Domain
|
42
|
+
|
43
|
+
File.exists? "#{@dirname}/#{domain.name}"
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
def delete_line_from_file(filename, line)
|
2
|
+
# create empty file string
|
3
|
+
tmp_file = ''
|
4
|
+
|
5
|
+
# iterate over every line and skip lines that match
|
6
|
+
File.open(filename, "r").each_line do |l|
|
7
|
+
tmp_file += l unless line.match(l.strip)
|
8
|
+
end
|
9
|
+
|
10
|
+
# write tmp file without matching lines
|
11
|
+
File.open(filename, 'w') { |file| file.write tmp_file }
|
12
|
+
|
13
|
+
# clear memory
|
14
|
+
tmp_file = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
class Object
|
19
|
+
def blank?
|
20
|
+
self.nil? || self.empty?
|
21
|
+
end
|
22
|
+
end
|
data/test/Vagrantfile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.require_plugin('vagrant-dnsmasq')
|
5
|
+
|
6
|
+
Vagrant.configure('2') do |config|
|
7
|
+
config.vm.box = 'precise64'
|
8
|
+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
9
|
+
|
10
|
+
# config.vm.network :private_network, ip: "192.168.59.100"
|
11
|
+
config.vm.network :public_network
|
12
|
+
|
13
|
+
|
14
|
+
# dnsmasq ...
|
15
|
+
|
16
|
+
# enable dnsmasq?
|
17
|
+
# set to false or delete line to disable dnsmasq handling
|
18
|
+
config.dnsmasq.enable = true
|
19
|
+
|
20
|
+
# set domain ending
|
21
|
+
config.dnsmasq.domain = '.dev'
|
22
|
+
|
23
|
+
# this plugin runs 'hostname -I' on the guest machine to obtain
|
24
|
+
# the guest ip address. you could overwrite the ip here. optional.
|
25
|
+
# config.dnsmasq.ip = '192.168.59.100'
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-dnsmasq/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-dnsmasq"
|
8
|
+
spec.version = Vagrant::Dnsmasq::VERSION
|
9
|
+
spec.authors = ["mattes"]
|
10
|
+
spec.email = ["matthias.kadenbach@gmail.com"]
|
11
|
+
spec.description = "A Dnsmasq Vagrant plugin that manages the dnsmasq.conf file and /etc/resolver directory on your host system."
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = "https://github.com/mattes/vagrant-dnsmasq"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-dnsmasq
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mattes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
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: A Dnsmasq Vagrant plugin that manages the dnsmasq.conf file and /etc/resolver
|
42
|
+
directory on your host system.
|
43
|
+
email:
|
44
|
+
- matthias.kadenbach@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- LICENSE.txt
|
53
|
+
- Makefile
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- lib/vagrant-dnsmasq.rb
|
57
|
+
- lib/vagrant-dnsmasq/actions.rb
|
58
|
+
- lib/vagrant-dnsmasq/config.rb
|
59
|
+
- lib/vagrant-dnsmasq/includes/Dnsmasq.class.rb
|
60
|
+
- lib/vagrant-dnsmasq/includes/Domain.class.rb
|
61
|
+
- lib/vagrant-dnsmasq/includes/Ip.class.rb
|
62
|
+
- lib/vagrant-dnsmasq/includes/Resolver.class.rb
|
63
|
+
- lib/vagrant-dnsmasq/includes/helper.rb
|
64
|
+
- lib/vagrant-dnsmasq/version.rb
|
65
|
+
- test/Vagrantfile
|
66
|
+
- vagrant-dnsmasq.gemspec
|
67
|
+
homepage: https://github.com/mattes/vagrant-dnsmasq
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.0.3
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: A Dnsmasq Vagrant plugin that manages the dnsmasq.conf file and /etc/resolver
|
91
|
+
directory on your host system.
|
92
|
+
test_files:
|
93
|
+
- test/Vagrantfile
|