From 77def39754bf79d287f6eaf4ea5f9c00beabc4cc Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sat, 1 Feb 2014 02:57:51 -0200 Subject: [PATCH] Display enable_nfs deprecation warning only once --- lib/vagrant-cachier/config.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/vagrant-cachier/config.rb b/lib/vagrant-cachier/config.rb index dddc807..1648179 100644 --- a/lib/vagrant-cachier/config.rb +++ b/lib/vagrant-cachier/config.rb @@ -10,6 +10,7 @@ module VagrantPlugins @scope = UNSET_VALUE @auto_detect = UNSET_VALUE @synced_folder_opts = UNSET_VALUE + @ui = Vagrant::UI::Colored.new end def enable(bucket, opts = {}) @@ -17,18 +18,15 @@ module VagrantPlugins end def enable_nfs=(value) - # Flag to raise warning on #validate - @_enable_nfs_set = true + # TODO: Show warning!!! + @ui.warn "The `enable_nfs` config for vagrant-cachier has been deprecated " \ + "and will be removed on 0.7.0, please use " \ + "`synced_folder_opts = { type: 'nfs' }` instead.\n" + @synced_folder_opts = { type: 'nfs', nfs: true } if value end def validate(machine) - if @_enable_nfs_set - machine.ui.warn "The `enable_nfs` config for vagrant-cachier has been deprecated " \ - "and will be removed on 0.7.0, please use " \ - "`synced_folder_opts = { type: 'nfs' }` instead." - end - errors = _detected_errors if enabled? && ! ALLOWED_SCOPES.include?(@scope.to_s)