lh-vagrant-dns 0.0.5 → 0.0.6

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
@@ -5,12 +5,18 @@ heavily based on https://github.com/BerlinVagrant/vagrant-dns (which doesn't
5
5
  seem to support Vagrant 1.1.x currently), so credit goes to the author of that
6
6
  lib.
7
7
 
8
+ Currently, it doesn't support running multiple vagrant machines. All vagrant-dns
9
+ related files are located in `~/.vagrant.d/tmp/dns`. This may be something
10
+ that needs to be addressed later on.
11
+
8
12
  ## TODOs
9
13
 
10
- * Add specs
14
+ * <del>Default this plugin disabled, and enable by `config.dns.enable = true`</del>
11
15
  * Add config validation
16
+ * Add specs
12
17
  * Add DNS resolver uninstall command
13
18
  * Add Vagrant destroy action hook to clean dns tmp path
19
+ * Move resolvers create and installation to command
14
20
 
15
21
  ## Installation
16
22
 
@@ -37,7 +43,7 @@ It is only used as a plugin for Vagrant, so to install:
37
43
  config.vm.network :private_network, ip: "33.33.33.100"
38
44
  end
39
45
 
40
- After `vagrant up`, install DNS resolver on mac:
46
+ **After** `vagrant up`, install DNS resolver on mac:
41
47
 
42
48
  $ sudo vagrant dns --install
43
49
 
@@ -7,6 +7,10 @@ module VagrantPlugins
7
7
  end
8
8
 
9
9
  def call(env)
10
+ unless env[:machine].config.dns.enabled
11
+ return @app.call(env)
12
+ end
13
+
10
14
  daemon_path = env[:dns].daemon_path
11
15
 
12
16
  if File.directory?(daemon_path)
@@ -8,6 +8,10 @@ module VagrantPlugins
8
8
  end
9
9
 
10
10
  def call(env)
11
+ unless env[:machine].config.dns.enabled
12
+ return @app.call(env)
13
+ end
14
+
11
15
  tmp_dns_path = env[:dns].tmp_path
12
16
  resolver_folder = File.join(tmp_dns_path, "resolver")
13
17
 
@@ -8,6 +8,10 @@ module VagrantPlugins
8
8
  end
9
9
 
10
10
  def call(env)
11
+ unless env[:machine].config.dns.enabled
12
+ return @app.call(env)
13
+ end
14
+
11
15
  config_file = env[:dns].config_file
12
16
  registry = File.exists?(config_file) ? \
13
17
  YAML.load(File.read(config_file)) : {}
@@ -7,6 +7,10 @@ module VagrantPlugins
7
7
  end
8
8
 
9
9
  def call(env)
10
+ unless env[:machine].config.dns.enabled
11
+ return @app.call(env)
12
+ end
13
+
10
14
  env[:dns].tmp_path = File.join(env[:tmp_path], DNS.namespace)
11
15
  env[:dns].daemon_path = File.join(env[:dns].tmp_path, "daemon")
12
16
  env[:dns].config_file = File.join(env[:dns].tmp_path, "config")
@@ -9,6 +9,10 @@ module VagrantPlugins
9
9
  end
10
10
 
11
11
  def call(env)
12
+ unless env[:machine].config.dns.enabled
13
+ return @app.call(env)
14
+ end
15
+
12
16
  env[:dns].ui.info "Restarting dns server..."
13
17
  env[:dns].dns_server.restart!
14
18
 
@@ -9,6 +9,10 @@ module VagrantPlugins
9
9
  end
10
10
 
11
11
  def call(env)
12
+ unless env[:machine].config.dns.enabled
13
+ return @app.call(env)
14
+ end
15
+
12
16
  env[:dns].ui.info "Stopping dns server..."
13
17
  env[:dns].dns_server.stop!
14
18
 
@@ -1,19 +1,41 @@
1
1
  module VagrantPlugins
2
2
  module DNS
3
3
  class Config < ::Vagrant.plugin("2", :config)
4
- # config.dns.tld = "dev"
5
- # config.dns.tlds = ["dev", "dom"]
4
+ # Enable the use of this plugin
5
+ #
6
+ # @return [Boolean]
7
+ attr_accessor :enabled
8
+
9
+ # Configures DNS patterns
10
+ #
11
+ # Usage example:
12
+ #
13
+ # config.dns.patterns = [/^.*promojam.dev$/, /^.*coca-cola.dev$/]
14
+ #
15
+ # @return [Array]
16
+ attr_accessor :patterns
17
+
18
+ # Configures tlds, taking an Array or a String as its argument.
19
+ #
20
+ # Usage example:
21
+ #
22
+ # config.dns.tlds = ["dev", "dom"]
23
+ # config.dns.tld = "dev"
6
24
  #
7
25
  def tld=(tlds)
8
26
  @tlds = Array(tlds)
9
27
  end
10
28
  alias :tlds= :tld=
11
29
 
30
+ # @return [Array]
12
31
  attr_reader :tlds
13
32
 
14
- # config.dns.patterns = [/^.*promojam.dev$/, /^.*coca-cola.dev$/]
15
- #
16
- attr_accessor :patterns
33
+ def initialize
34
+ super
35
+
36
+ @enabled = false
37
+ end
38
+
17
39
  end
18
40
  end
19
41
  end
@@ -13,8 +13,6 @@ end
13
13
  module VagrantPlugins
14
14
  module DNS
15
15
  class Plugin < ::Vagrant.plugin("2")
16
- name "DNS"
17
-
18
16
  class << self
19
17
  def provision(hook)
20
18
  hook.before ::Vagrant::Action::Builtin::ConfigValidate, Action.setup
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module DNS
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lh-vagrant-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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-17 00:00:00.000000000 Z
12
+ date: 2013-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubydns