vagrant-dotvm 0.32.1 → 0.33.0

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: 632d2263870c84ee44c0458bb6d6a45be951064f
4
- data.tar.gz: 94b2f3faed97c06d50487361d2267fdfae6c4167
3
+ metadata.gz: f2c4493bbc971762cd78c087bddafd0f65a28e1e
4
+ data.tar.gz: 25b550ad3122a86fdba3798ad3837087bda96c52
5
5
  SHA512:
6
- metadata.gz: 9699c4dfe139fe1fba8090d01fb75892c0f669b50fdcb58fb169f422391fe3ba08239d0089429cc08ad22246f115dd3a80849db720ed16b9b17743f984ae47dc
7
- data.tar.gz: 95c69e6dffdbac8d168d5a0aaff806a333ad57164551689a93cf03fbdf054828661eab1e4605d1737fcf121f199d8b98d22b8912ae96784e65c4b6b355ef5719
6
+ metadata.gz: 9c855e57c186204b4b9c7c26db8a64c770eab5a12385a52853f6546491ee6270596890fc5ac26b9ca47e76ef53e0eef7002480c37c4b74d841f8d8c37e53dc0a
7
+ data.tar.gz: 129cc8bf0e2cbffa2b5985f33af4fd7e65a5224d53e74d57e40d9c5f8359d72b48d607990b4f9fa72b2ad577f066c95ebb58c9d2bf0744d5d8be28ae837d7c4c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.32.1
2
+ * Bugfix for situation when configuration file is empty
3
+ * Bugfix for situation when configuration doesn't have machines
4
+
5
+ # 0.32.0
6
+ * Local variables
7
+ * Global variables
8
+ * Refering another variables within variable
9
+
1
10
  # 0.31.0
2
11
  * Authorized keys and hosts were broken. It has been fixed.
3
12
  * Docker provision
@@ -1,4 +1,4 @@
1
- # Go to %project.guest% directory, so relative pathes will work here.
1
+ # Go to %project.guest% directory, so relative paths will work here.
2
2
  cd "$1"
3
3
 
4
4
  # Ruby gems binaries go there.
data/lib/vagrant-dotvm.rb CHANGED
@@ -3,7 +3,7 @@ require 'yaml'
3
3
 
4
4
  require 'vagrant-dotvm/plugin'
5
5
  require 'vagrant-dotvm/version'
6
- require 'vagrant-dotvm/pathes'
6
+ require 'vagrant-dotvm/paths'
7
7
  require 'vagrant-dotvm/dotvm'
8
8
 
9
9
  require 'vagrant-dotvm/injector/abstractinjector'
@@ -16,6 +16,8 @@ require 'vagrant-dotvm/injector/sharedfolder'
16
16
  require 'vagrant-dotvm/injector/route'
17
17
  require 'vagrant-dotvm/injector/network'
18
18
 
19
+ require 'vagrant-dotvm/config/optionssetter'
20
+ require 'vagrant-dotvm/config/invalidconfigerror'
19
21
  require 'vagrant-dotvm/config/abstractconfig'
20
22
  require 'vagrant-dotvm/config/root'
21
23
  require 'vagrant-dotvm/config/machine'
@@ -2,13 +2,42 @@ module VagrantPlugins
2
2
  module Dotvm
3
3
  module Config
4
4
  class AbstractConfig
5
+ # Populates current object with provided data.
6
+ #
7
+ # @param data [Hash] Hash with data
5
8
  def populate(data)
6
9
  data.each do |key, value|
7
- raise "Invalid configuration option: #{key}." until respond_to? "#{key}="
10
+ raise InvalidConfigError.new "Invalid configuration option: #{key}." until respond_to? "#{key}="
8
11
  send("#{key}=", value)
9
12
  end
10
13
  end
11
14
 
15
+ def ensure_type(value, type, name = '')
16
+ raise InvalidConfigError.new "'#{name}' must be #{type.name}." unless value.kind_of?(type) || value.kind_of?(NilClass)
17
+ end
18
+
19
+ # Converts array of hashes into array of specialized objects.
20
+ #
21
+ # @param data [Array] Array of hashes
22
+ # @param type [String] Specialized class name
23
+ # @return [Array] Array of specialized objects.
24
+ def convert_array(data, type)
25
+ result = []
26
+
27
+ data.to_a.each do |item|
28
+ object = Object.const_get(type).new
29
+ object.populate item
30
+ result << object
31
+ end
32
+
33
+ result
34
+ end
35
+
36
+ # Replaces variables in target object.
37
+ #
38
+ # @param vars [Hash] Hash of variables to be replaced.
39
+ # @param target [Object] Object to operate on.
40
+ # @return [Number] Number of performed replaces.
12
41
  def replace_vars(vars, target)
13
42
  replaced = 0
14
43
 
@@ -23,7 +52,7 @@ module VagrantPlugins
23
52
  elsif target.kind_of?(String)
24
53
  vars.each do |k, v|
25
54
  pattern = "%#{k}%"
26
- replaced+=1 unless (target.gsub! pattern, v).kind_of?(NilClass)
55
+ replaced += 1 unless (target.gsub! pattern, v).kind_of?(NilClass)
27
56
  end
28
57
  elsif target.kind_of?(AbstractConfig)
29
58
  replaced += target.replace_vars!(vars)
@@ -32,6 +61,11 @@ module VagrantPlugins
32
61
  replaced
33
62
  end
34
63
 
64
+ # Search for variables within this object
65
+ # and performs replaces of them.
66
+ #
67
+ # @param vars [Hash] Hash of variables to be replaced.
68
+ # @return [Number] Number of performed replaces.
35
69
  def replace_vars!(vars)
36
70
  replaced = 0
37
71
 
@@ -0,0 +1,8 @@
1
+ module VagrantPlugins
2
+ module Dotvm
3
+ module Config
4
+ class InvalidConfigError < ArgumentError
5
+ end
6
+ end
7
+ end
8
+ end
@@ -2,6 +2,12 @@ module VagrantPlugins
2
2
  module Dotvm
3
3
  module Config
4
4
  class Machine < AbstractConfig
5
+ include OptionsSetter
6
+
7
+ OPTIONS_CATEGORIES = [
8
+ :virtualbox,
9
+ ]
10
+
5
11
  attr_accessor :nick
6
12
  attr_accessor :hostname # name
7
13
  attr_accessor :box
@@ -22,7 +28,7 @@ module VagrantPlugins
22
28
  attr_accessor :post_up_message
23
29
  attr_accessor :autostart
24
30
  attr_reader :hosts
25
- attr_reader :options
31
+ attr_reader :options # mixin
26
32
  attr_reader :shared_folders
27
33
  attr_accessor :box_download_checksum
28
34
  attr_accessor :box_download_checksum_type
@@ -42,45 +48,27 @@ module VagrantPlugins
42
48
 
43
49
  def usable_port_range=(value)
44
50
  m = value.scan(/^(\d+)\.\.(\d+)$/)
45
- raise "Invalid usable_port_range, it must be in A..B format." if m.length == 0
51
+ raise InvalidConfigError.new 'Invalid usable_port_range, it must be in A..B format.' if m.length == 0
46
52
  @usable_port_range = Range.new(m[0][0].to_i, m[0][1].to_i)
47
53
  end
48
54
 
49
55
  def networks=(networks)
50
- raise "'networks' must be array." unless networks.kind_of?(Array) || networks.kind_of?(NilClass)
51
-
52
- @networks = []
53
- networks.to_a.each do |conf|
54
- item = Network.new
55
- item.populate conf
56
- @networks << item
57
- end
56
+ ensure_type networks, Array, 'networks'
57
+ @networks = convert_array(networks, Network.name)
58
58
  end
59
59
 
60
60
  def routes=(routes)
61
- raise "'routes' must be array." unless routes.kind_of?(Array) || routes.kind_of?(NilClass)
62
-
63
- @routes = []
64
- routes.to_a.each do |conf|
65
- item = Route.new
66
- item.populate conf
67
- @routes << item
68
- end
61
+ ensure_type routes, Array, 'routes'
62
+ @routes = convert_array(routes, Route.name)
69
63
  end
70
64
 
71
65
  def provision=(provision)
72
- raise "'provision' must be array." unless provision.kind_of?(Array) || provision.kind_of?(NilClass)
73
-
74
- @provision = []
75
- provision.to_a.each do |conf|
76
- item = Provision.new
77
- item.populate conf
78
- @provision << item
79
- end
66
+ ensure_type provision, Array, 'provision'
67
+ @provision = convert_array(provision, Provision.name)
80
68
  end
81
69
 
82
70
  def groups=(groups)
83
- raise "'groups' must be array." unless groups.kind_of?(Array) || groups.kind_of?(NilClass)
71
+ ensure_type groups, Array, 'groups'
84
72
 
85
73
  @groups = []
86
74
  groups.to_a.each do |item|
@@ -89,59 +77,25 @@ module VagrantPlugins
89
77
  end
90
78
 
91
79
  def authorized_keys=(keys)
92
- raise "'authorized_keys' must be array." unless keys.kind_of?(Array) || keys.kind_of?(NilClass)
93
-
94
- @authorized_keys = []
95
- keys.to_a.each do |conf|
96
- item = AuthorizedKey.new
97
- item.populate conf
98
- @authorized_keys << item
99
- end
80
+ ensure_type keys, Array, 'authorized_keys'
81
+ @authorized_keys = convert_array(keys, AuthorizedKey.name)
100
82
  end
101
83
 
102
84
  def hosts=(hosts)
103
- raise "'hosts' must be array." unless hosts.kind_of?(Array) || hosts.kind_of?(NilClass)
104
-
105
- @hosts = []
106
- hosts.to_a.each do |conf|
107
- item = Host.new
108
- item.populate conf
109
- @hosts << item
110
- end
111
- end
112
-
113
- def options=(options)
114
- raise "'options' must be hash." unless options.kind_of?(Hash) || options.kind_of?(NilClass)
115
-
116
- @options = {
117
- :virtualbox => [],
118
- }
119
- options.to_h.each do |key, confs|
120
- key = key.to_sym
121
- raise "Invalid options category: #{key}." unless @options.has_key?(key)
122
-
123
- confs.to_a.each do |conf|
124
- item = Option.new
125
- item.populate conf
126
- @options[key] << item
127
- end
128
- end
85
+ ensure_type hosts, Array, 'hosts'
86
+ @hosts = convert_array(hosts, Host.name)
129
87
  end
130
88
 
131
89
  def shared_folders=(shared_folders)
132
- @shared_folders = []
133
- shared_folders.to_a.each do |conf|
134
- item = SharedFolder.new
135
- item.populate conf
136
- @shared_folders << item
137
- end
90
+ ensure_type shared_folders, Array, 'shared_folders'
91
+ @shared_folders = convert_array(shared_folders, SharedFolder.name)
138
92
 
139
93
  settings = {
140
- "host" => "%project.host%",
141
- "guest" => "%project.guest%",
142
- "disabled" => false,
143
- "create" => false,
144
- "type" => nil,
94
+ 'host' => '%project.host%',
95
+ 'guest' => '%project.guest%',
96
+ 'disabled' => false,
97
+ 'create' => false,
98
+ 'type' => nil,
145
99
  }
146
100
  item = SharedFolder.new
147
101
  item.populate settings
@@ -16,18 +16,18 @@ module VagrantPlugins
16
16
  attr_accessor :auto_correct
17
17
  attr_accessor :auto_config
18
18
 
19
- def initialize()
19
+ def initialize
20
20
  @net = :private_network
21
21
  end
22
22
 
23
23
  def net=(value)
24
24
  nets = {
25
- "private_network" => :private_network,
26
- "private" => :private_network,
27
- "public_network" => :public_network,
28
- "public" => :public_network,
29
- "forwarded_port" => :forwarded_port,
30
- "port" => :forwarded_port,
25
+ 'private_network' => :private_network,
26
+ 'private' => :private_network,
27
+ 'public_network' => :public_network,
28
+ 'public' => :public_network,
29
+ 'forwarded_port' => :forwarded_port,
30
+ 'port' => :forwarded_port,
31
31
  }
32
32
 
33
33
  @net = nets[value]
@@ -0,0 +1,30 @@
1
+ module VagrantPlugins
2
+ module Dotvm
3
+ module Config
4
+ module OptionsSetter
5
+ def options=(options)
6
+ ensure_type options, Hash, 'options'
7
+
8
+ @options = {}
9
+ self.class::OPTIONS_CATEGORIES.each do |cat|
10
+ @options[cat] = []
11
+ end
12
+
13
+ options.to_h.each do |key, confs|
14
+ key = key.to_sym
15
+ raise InvalidConfigError.new "Invalid options category: #{key}." unless @options.has_key?(key)
16
+ ensure_type confs, Array, "options.#{key}"
17
+
18
+ confs.to_a.each do |conf|
19
+ ensure_type conf, Hash, "option item within options.#{key}"
20
+
21
+ item = Option.new
22
+ item.populate conf
23
+ @options[key] << item
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -128,25 +128,13 @@ module VagrantPlugins
128
128
  attr_reader :runs
129
129
 
130
130
  def build_images=(build_images)
131
- raise "'build_images' must be array." unless build_images.kind_of?(Array) || build_images.kind_of?(NilClass)
132
-
133
- @build_images = []
134
- build_images.to_a.each do |conf|
135
- item = BuildImage.new
136
- item.populate conf
137
- @build_images << item
138
- end
131
+ ensure_type build_images, Array, 'build_images'
132
+ @build_images = convert_array(build_images, BuildImage.name)
139
133
  end
140
134
 
141
135
  def runs=(runs)
142
- raise "'runs' must be array." unless runs.kind_of?(Array) || runs.kind_of?(NilClass)
143
-
144
- @runs = []
145
- runs.to_a.each do |conf|
146
- item = Run.new
147
- item.populate conf
148
- @runs << item
149
- end
136
+ ensure_type runs, Array, 'runs'
137
+ @runs = convert_array(runs, Run.name)
150
138
  end
151
139
  end
152
140
  end
@@ -2,43 +2,25 @@ module VagrantPlugins
2
2
  module Dotvm
3
3
  module Config
4
4
  class Root < AbstractConfig
5
+ OPTIONS_CATEGORIES = [
6
+ :ssh,
7
+ :winrm,
8
+ :vagrant,
9
+ ]
10
+
11
+ include OptionsSetter
12
+
5
13
  attr_reader :machines
6
- attr_reader :options
14
+ attr_reader :options # mixin
7
15
  attr_reader :vars
8
16
 
9
17
  def machines=(machines)
10
- raise "'machines' must be array." unless machines.kind_of?(Array) || machines.kind_of?(NilClass)
11
-
12
- @machines = []
13
- machines.to_a.each do |item|
14
- machine = Machine.new
15
- machine.populate item
16
- @machines << machine
17
- end
18
- end
19
-
20
- def options=(data)
21
- raise "'options' must be hash." unless options.kind_of?(Hash) || options.kind_of?(NilClass)
22
-
23
- @options = {
24
- :ssh => [],
25
- :winrm => [],
26
- :vagrant => [],
27
- }
28
- options.to_h.each do |key, confs|
29
- key = key.to_sym
30
- raise "Invalid options category: #{key}." unless @options.has_key?(key)
31
-
32
- confs.to_a.each do |conf|
33
- item = Option.new
34
- item.populate conf
35
- @options[key] << item
36
- end
37
- end
18
+ ensure_type machines, Array, 'machines'
19
+ @machines = convert_array(machines, Machine.name)
38
20
  end
39
21
 
40
22
  def vars=(vars)
41
- raise "'vars' must be hash." unless vars.kind_of?(Hash) || vars.kind_of?(NilClass)
23
+ ensure_type vars, Hash, 'vars'
42
24
  @vars = vars
43
25
  end
44
26
  end
@@ -3,10 +3,7 @@ module VagrantPlugins
3
3
  class Dotvm
4
4
 
5
5
  def initialize(path = nil)
6
- if not path
7
- path = Dir.pwd
8
- end
9
-
6
+ raise 'path must be set.' until path
10
7
  @path = path
11
8
  end
12
9
 
@@ -14,7 +11,7 @@ module VagrantPlugins
14
11
  def get_globals
15
12
  globals = {}
16
13
 
17
- Dir[@path + "/globals/*.yaml"].each do |fname|
14
+ Dir[@path + '/globals/*.yaml'].each do |fname|
18
15
  yaml = YAML::load(File.read(fname)) || {}
19
16
  yaml.each do |name, value|
20
17
  globals[name] = value
@@ -25,45 +22,55 @@ module VagrantPlugins
25
22
  end
26
23
 
27
24
  private
28
- def get_configs()
29
- configs = []
30
-
31
- Dir[@path + "/projects/*/*.yaml"].each do |fname|
32
- yaml = YAML::load(File.read(fname)) || {}
25
+ def prefix_vars(vars, prefix)
26
+ result = {}
33
27
 
34
- vars = {
35
- 'project.host' => File.dirname(fname),
36
- 'project.guest' => '/dotvm/project',
37
- }
28
+ vars.each do |name, value|
29
+ result[prefix + name] = value
30
+ end
38
31
 
39
- ENV.each_pair do |name, value|
40
- vars['env.' + name] = value
41
- end
32
+ result
33
+ end
42
34
 
43
- get_globals.each do |name, value|
44
- vars['global.' + name] = value
35
+ private
36
+ def process_config(fname)
37
+ yaml = YAML::load(File.read(fname)) || {}
38
+
39
+ begin
40
+ conf = Config::Root.new
41
+ conf.populate yaml
42
+
43
+ vars = {}
44
+ vars.merge! prefix_vars(ENV, 'env.')
45
+ vars.merge! prefix_vars(get_globals, 'global.')
46
+ vars.merge! prefix_vars(conf.vars.to_h, 'local.')
47
+ vars.merge!(
48
+ {
49
+ 'project.host' => File.dirname(fname),
50
+ 'project.guest' => '/dotvm/project',
51
+ }
52
+ )
53
+
54
+ for _ in (0..5)
55
+ last = conf.replace_vars! vars
56
+ break if last == 0
45
57
  end
46
58
 
47
- begin
48
- conf = Config::Root.new
49
- conf.populate yaml
50
-
51
- conf.vars.to_h.each do |name, value|
52
- vars['local.' + name] = value
53
- end
59
+ raise 'Too deep variables relations, possible recurrence.' unless last == 0
60
+ rescue VagrantPlugins::Dotvm::Config::InvalidConfigError => e
61
+ file = fname[(@path.length + '/projects/'.length)..-1]
62
+ raise Vagrant::Errors::VagrantError.new, "DotVM: #{file}: #{e.message}"
63
+ end
54
64
 
55
- for _ in (0..5)
56
- last = conf.replace_vars! vars
57
- break if last == 0
58
- end
65
+ conf
66
+ end
59
67
 
60
- raise "Too deep variables relations, possible recurrence." unless last == 0
61
- rescue Exception => e
62
- file = fname[(@path.length+"/projects/".length)..-1]
63
- raise Vagrant::Errors::VagrantError.new, "DotVM: #{file}: #{e.message}"
64
- end
68
+ private
69
+ def get_configs
70
+ configs = []
65
71
 
66
- configs << conf
72
+ Dir[@path + '/projects/*/*.yaml'].each do |fname|
73
+ configs << process_config(fname)
67
74
  end
68
75
 
69
76
  return configs
@@ -2,6 +2,11 @@ module VagrantPlugins
2
2
  module Dotvm
3
3
  module Injector
4
4
  class AbstractInjector
5
+ # Extracts specified `options` from `source` and return them as hash.
6
+ #
7
+ # @param source [Object] Object to extract data from
8
+ # @param options [Array] List of options to be extraced
9
+ # @return [Hash] Extracted data
5
10
  def self.generate_hash(source, options)
6
11
  hash = {}
7
12
 
@@ -13,6 +18,11 @@ module VagrantPlugins
13
18
  return hash
14
19
  end
15
20
 
21
+ # Rewrite `options` from `source` to `target`.
22
+ #
23
+ # @param source [Object] Object to rewrite data from
24
+ # @param target [Object] Object to rewrite data to
25
+ # @param options [Array] List of options to be rewritten
16
26
  def self.rewrite_options(source, target, options)
17
27
  options.each do |opt|
18
28
  val = source.send(opt)
@@ -3,13 +3,13 @@ module VagrantPlugins
3
3
  module Injector
4
4
  class AuthorizedKey < AbstractInjector
5
5
  def self.inject(key: nil, machine: nil)
6
- if key.type == "file"
6
+ if key.type == 'file'
7
7
  pubkey = File.readlines(File.expand_path(key.path)).first.strip
8
- elsif key.type == "static"
8
+ elsif key.type == 'static'
9
9
  pubkey = key.key
10
10
  end
11
11
 
12
- machine.vm.provision "shell" do |s|
12
+ machine.vm.provision 'shell' do |s|
13
13
  s.path = "#{UTILS_PATH}/authorize_key.sh"
14
14
  s.args = [pubkey]
15
15
  s.privileged = false
@@ -3,7 +3,7 @@ module VagrantPlugins
3
3
  module Injector
4
4
  class Host < AbstractInjector
5
5
  def self.inject(host: nil, machine: nil)
6
- machine.vm.provision "shell", run: "always" do |s|
6
+ machine.vm.provision 'shell', run: 'always' do |s|
7
7
  s.path = "#{UTILS_PATH}/add_host.sh"
8
8
  s.args = [host.ip, host.host]
9
9
  s.privileged = true
@@ -34,20 +34,20 @@ module VagrantPlugins
34
34
  machine.vm.send("#{opt}=", val) unless val.nil?
35
35
  end
36
36
 
37
- machine.vm.provider "virtualbox" do |vb|
38
- vb.customize ["modifyvm", :id, "--memory", machine_cfg.memory] unless machine_cfg.memory.nil?
39
- vb.customize ["modifyvm", :id, "--cpus", machine_cfg.cpus] unless machine_cfg.cpus.nil?
40
- vb.customize ["modifyvm", :id, "--cpuexecutioncap", machine_cfg.cpucap] unless machine_cfg.cpucap.nil?
41
- vb.customize ["modifyvm", :id, "--natnet1", machine_cfg.natnet] unless machine_cfg.natnet.nil?
37
+ machine.vm.provider 'virtualbox' do |vb|
38
+ vb.customize ['modifyvm', :id, '--memory', machine_cfg.memory] unless machine_cfg.memory.nil?
39
+ vb.customize ['modifyvm', :id, '--cpus', machine_cfg.cpus] unless machine_cfg.cpus.nil?
40
+ vb.customize ['modifyvm', :id, '--cpuexecutioncap', machine_cfg.cpucap] unless machine_cfg.cpucap.nil?
41
+ vb.customize ['modifyvm', :id, '--natnet1', machine_cfg.natnet] unless machine_cfg.natnet.nil?
42
42
 
43
43
  machine_cfg.options.to_h[:virtualbox].to_a.each do |option|
44
- vb.customize ["modifyvm", :id, option.name, option.value]
44
+ vb.customize ['modifyvm', :id, option.name, option.value]
45
45
  end
46
46
  end
47
47
 
48
- machine.vm.provider "vmware_fusion" do |vf|
49
- vf.vmx["memsize"] = machine_cfg.memory unless machine_cfg.memory.nil?
50
- vf.vmz["numvcpus"] = machine_cfg.cpus unless machine_cfg.cpus.nil?
48
+ machine.vm.provider 'vmware_fusion' do |vf|
49
+ vf.vmx['memsize'] = machine_cfg.memory unless machine_cfg.memory.nil?
50
+ vf.vmx['numvcpus'] = machine_cfg.cpus unless machine_cfg.cpus.nil?
51
51
  end
52
52
 
53
53
  machine_cfg.networks.to_a.each do |net|
@@ -80,7 +80,7 @@ module VagrantPlugins
80
80
  machine: machine
81
81
  end
82
82
 
83
- if Vagrant.has_plugin?("vagrant-group")
83
+ if Vagrant.has_plugin?('vagrant-group')
84
84
  vc.group.groups = {} unless vc.group.groups.kind_of?(Hash)
85
85
 
86
86
  machine_cfg.groups.to_a.each do |group|
@@ -5,7 +5,7 @@ module VagrantPlugins
5
5
  def self.inject(config: nil, vc: nil)
6
6
  config.options.to_h.each do |category, options|
7
7
  options.to_a.each do |option|
8
- vc.call(category).call("#{option.name}=", option.value)
8
+ vc.send(category).send("#{option.name}=", option.value)
9
9
  end
10
10
  end
11
11
 
@@ -3,7 +3,7 @@ module VagrantPlugins
3
3
  module Injector
4
4
  class Route < AbstractInjector
5
5
  def self.inject(route: nil, machine: nil)
6
- machine.vm.provision "shell", run: "always" do |s|
6
+ machine.vm.provision 'shell', run: 'always' do |s|
7
7
  s.path = "#{UTILS_PATH}/setup_route.sh"
8
8
  s.args = [route.destination, route.gateway]
9
9
  s.privileged = true
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module Dotvm
3
+ UTILS_PATH = File.dirname(__FILE__) + '/../../utils'
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Dotvm
3
- VERSION = "0.32.1"
3
+ VERSION = '0.33.0'
4
4
  end
5
5
  end
data/utils/add_host.sh CHANGED
@@ -1,3 +1,5 @@
1
+ # This script adds new host entry and avoid duplicates.
2
+
1
3
  quote() {
2
4
  sed 's/[]\.|$(){}?+*^]/\\&/g' <<< "$*"
3
5
  }
@@ -1,3 +1,6 @@
1
+ # This script adds specified pubkey into authorized_keys file.
2
+ # Duplicates are avoided.
3
+
1
4
  PUBKEY="$1"
2
5
  SSH="$HOME/.ssh"
3
6
  KEYS="$SSH/authorized_keys"
data/utils/setup_route.sh CHANGED
@@ -1,3 +1,6 @@
1
+ # This script removes previously set route to
2
+ # specific destination and then setup new one.
3
+
1
4
  DESTINATION="$1"
2
5
  GATEWAY="$2"
3
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-dotvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.1
4
+ version: 0.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Magosa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-16 00:00:00.000000000 Z
11
+ date: 2015-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -64,9 +64,11 @@ files:
64
64
  - lib/vagrant-dotvm/config/authorizedkey.rb
65
65
  - lib/vagrant-dotvm/config/buildimage.rb
66
66
  - lib/vagrant-dotvm/config/host.rb
67
+ - lib/vagrant-dotvm/config/invalidconfigerror.rb
67
68
  - lib/vagrant-dotvm/config/machine.rb
68
69
  - lib/vagrant-dotvm/config/network.rb
69
70
  - lib/vagrant-dotvm/config/option.rb
71
+ - lib/vagrant-dotvm/config/optionssetter.rb
70
72
  - lib/vagrant-dotvm/config/provision.rb
71
73
  - lib/vagrant-dotvm/config/root.rb
72
74
  - lib/vagrant-dotvm/config/route.rb
@@ -82,7 +84,7 @@ files:
82
84
  - lib/vagrant-dotvm/injector/root.rb
83
85
  - lib/vagrant-dotvm/injector/route.rb
84
86
  - lib/vagrant-dotvm/injector/sharedfolder.rb
85
- - lib/vagrant-dotvm/pathes.rb
87
+ - lib/vagrant-dotvm/paths.rb
86
88
  - lib/vagrant-dotvm/plugin.rb
87
89
  - lib/vagrant-dotvm/version.rb
88
90
  - utils/add_host.sh
@@ -1,5 +0,0 @@
1
- module VagrantPlugins
2
- module Dotvm
3
- UTILS_PATH = File.dirname(__FILE__) + "/../../utils"
4
- end
5
- end