Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled passing options to the synced folders #56

Merged
merged 6 commits into from
Nov 29, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ The default is an empty Array, or `[]`. The example:

```ruby
driver_config:
synced_folders: [["/Users/mray/ws/cookbooks/pxe_dust/.kitchen/kitchen-vagrant/opt/chef", "/opt/chef"]]
synced_folders: [["/Users/mray/ws/cookbooks/pxe_dust/.kitchen/kitchen-vagrant/opt/chef", "/opt/chef"],
["/host_path", "/vm_path", "create: true, disabled: false"]]
```

will generate a Vagrantfile configuration similar to:
Expand All @@ -210,6 +211,7 @@ Vagrant.configure("2") do |config|
# ...

c.vm.synced_folder "/Users/mray/ws/cookbooks/pxe_dust/.kitchen/kitchen-vagrant/opt/chef", "/opt/chef"
c.vm.synced_folder "/host_path", "/vm_path", create: true, disabled: false
end
```

Expand Down
8 changes: 6 additions & 2 deletions lib/kitchen/vagrant/vagrantfile_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ def chef_block(arr)
end

def synced_folders_block(arr)
config[:synced_folders].each do |source, destination|
arr << %{ c.vm.synced_folder "#{source}", "#{destination}" }
instance_name = instance.name
config[:synced_folders].each do |source, destination, options|
l_source = source.gsub("%{instance_name}", instance_name)
l_destination = destination.gsub("%{instance_name}", instance_name)
opt = (options.nil? ? '' : ", #{options}")
arr << %{ c.vm.synced_folder "#{l_source}", "#{l_destination}"#{opt} }
end
end

Expand Down