From 3b838674279250ecb2c65b719473d168255faa33 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sat, 1 Feb 2014 00:03:20 -0200 Subject: [PATCH] Replace `enable_nfs` and `sync_opts` config with `synced_folder_opts` --- lib/vagrant-cachier/config.rb | 14 ++++++-------- lib/vagrant-cachier/provision_ext.rb | 8 ++------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/vagrant-cachier/config.rb b/lib/vagrant-cachier/config.rb index f06883b..77a3e97 100644 --- a/lib/vagrant-cachier/config.rb +++ b/lib/vagrant-cachier/config.rb @@ -1,16 +1,15 @@ module VagrantPlugins module Cachier class Config < Vagrant.plugin(2, :config) - attr_accessor :scope, :auto_detect, :enable_nfs, :sync_opts + attr_accessor :scope, :auto_detect, :enable_nfs, :synced_folder_opts attr_reader :buckets ALLOWED_SCOPES = %w( box machine ) def initialize - @scope = UNSET_VALUE + @scope = UNSET_VALUE @auto_detect = UNSET_VALUE - @enable_nfs = UNSET_VALUE - @sync_opts = UNSET_VALUE + @synced_folder_opts = UNSET_VALUE end def enable(bucket, opts = {}) @@ -32,11 +31,10 @@ module VagrantPlugins def finalize! return unless enabled? - @scope = :box if @scope == UNSET_VALUE + @scope = :box if @scope == UNSET_VALUE @auto_detect = false if @auto_detect == UNSET_VALUE - @enable_nfs = false if @enable_nfs == UNSET_VALUE - @sync_opts = {} if @sync_opts == UNSET_VALUE - @buckets = @buckets ? @buckets.dup : {} + @synced_folder_opts = nil if @synced_folder_opts == UNSET_VALUE + @buckets = @buckets ? @buckets.dup : {} end def enabled? diff --git a/lib/vagrant-cachier/provision_ext.rb b/lib/vagrant-cachier/provision_ext.rb index bcdb3d4..e3c446c 100644 --- a/lib/vagrant-cachier/provision_ext.rb +++ b/lib/vagrant-cachier/provision_ext.rb @@ -18,12 +18,8 @@ module VagrantPlugins FileUtils.mkdir_p(cache_root.to_s) unless cache_root.exist? synced_folder_opts = {id: "vagrant-cache"} - synced_folder_opts.merge!(env[:machine].config.cache.sync_opts) - - if env[:machine].config.cache.enable_nfs - # REFACTOR: Drop the `nfs: true` argument once we drop support for Vagrant < 1.4 - synced_folder_opts.merge!({ nfs: true, type: 'nfs' }) - end + synced_folder_opts.merge!(env[:machine].config.cache.synced_folder_opts) + env[:machine].config.vm.synced_folder cache_root, '/tmp/vagrant-cache', synced_folder_opts env[:cache_dirs] = []