Add support for disabling the plugin [GH-72]

This commit is contained in:
Fabio Rehm 2014-02-01 18:38:35 -02:00
parent a8963c3741
commit beffce64fa

View file

@ -18,7 +18,6 @@ module VagrantPlugins
end end
def enable_nfs=(value) def enable_nfs=(value)
# TODO: Show warning!!!
@ui.warn "The `enable_nfs` config for vagrant-cachier has been deprecated " \ @ui.warn "The `enable_nfs` config for vagrant-cachier has been deprecated " \
"and will be removed on 0.7.0, please use " \ "and will be removed on 0.7.0, please use " \
"`synced_folder_opts = { type: :nfs }` instead.\n" "`synced_folder_opts = { type: :nfs }` instead.\n"
@ -38,6 +37,16 @@ module VagrantPlugins
{ "vagrant cachier" => errors } { "vagrant cachier" => errors }
end end
def enabled?
return @enabled unless @enabled.nil?
@enabled = (@auto_detect != UNSET_VALUE || @buckets != nil)
end
def disable!
@enabled = false
end
def finalize! def finalize!
return unless enabled? return unless enabled?
@ -46,11 +55,6 @@ module VagrantPlugins
@synced_folder_opts = nil if @synced_folder_opts == UNSET_VALUE @synced_folder_opts = nil if @synced_folder_opts == UNSET_VALUE
@buckets = @buckets ? @buckets.dup : {} @buckets = @buckets ? @buckets.dup : {}
end end
def enabled?
@enabled ||= @auto_detect != UNSET_VALUE ||
@buckets != nil
end
end end
end end
end end