lib/kitchen/driver/vagrant.rb in kitchen-vagrant-0.14.0 vs lib/kitchen/driver/vagrant.rb in kitchen-vagrant-0.15.0

- old
+ new

@@ -31,11 +31,11 @@ # # @todo Vagrant installation check and version will be placed into any # dependency hook checks when feature is released class Vagrant < Kitchen::Driver::SSHBase - default_config :customize, { :memory => '256' } + default_config :customize, {} default_config :network, [] default_config :synced_folders, [] default_config :pre_create_command, nil default_config :vagrantfile_erb, @@ -141,15 +141,30 @@ end def create_vagrantfile return if @vagrantfile_created + finalize_synced_folder_config + vagrantfile = File.join(vagrant_root, "Vagrantfile") debug("Creating Vagrantfile for #{instance.to_str} (#{vagrantfile})") FileUtils.mkdir_p(vagrant_root) File.open(vagrantfile, "wb") { |f| f.write(render_template) } debug_vagrantfile(vagrantfile) @vagrantfile_created = true + end + + def finalize_synced_folder_config + config[:synced_folders].map! do |source, destination, options| + [ + File.expand_path( + source.gsub("%{instance_name}", instance.name), + config[:kitchen_root] + ), + destination.gsub("%{instance_name}", instance.name), + options || "nil" + ] + end end def render_template if File.exists?(template) ERB.new(IO.read(template)).result(binding).gsub(%r{^\s*$\n}, '')