Documentation: conditional plugin specific configs
Wrap plugin specific configs into has_plugin checks to avoid breakage when Vagrantfile is shared and/or plugin is removed (for testing/development).
This commit is contained in:
parent
5342a7ce33
commit
949df52a26
3 changed files with 17 additions and 8 deletions
|
@ -23,9 +23,11 @@ from within your `Vagrantfile`:
|
||||||
```ruby
|
```ruby
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
config.vm.box = 'your-box'
|
config.vm.box = 'your-box'
|
||||||
|
if Vagrant.has_plugin?("vagrant-cachier")
|
||||||
config.cache.auto_detect = true
|
config.cache.auto_detect = true
|
||||||
# If you are using VirtualBox, you might want to enable NFS for shared folders
|
# If you are using VirtualBox, you might want to enable NFS for shared folders
|
||||||
# config.cache.enable_nfs = true
|
# config.cache.enable_nfs = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,11 @@ from within your `Vagrantfile`:
|
||||||
```ruby
|
```ruby
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
config.vm.box = 'your-box'
|
config.vm.box = 'your-box'
|
||||||
|
if Vagrant.has_plugin?("vagrant-cachier")
|
||||||
config.cache.auto_detect = true
|
config.cache.auto_detect = true
|
||||||
# If you are using VirtualBox, you might want to enable NFS for shared folders
|
# If you are using VirtualBox, you might want to enable NFS for shared folders
|
||||||
# config.cache.enable_nfs = true
|
# config.cache.enable_nfs = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,17 @@
|
||||||
## Auto detect supported cache buckets
|
## Auto detect supported cache buckets
|
||||||
|
|
||||||
This is the easiest way to get started with plugin. By adding the code below to
|
This is the easiest way to get started with plugin. By adding the code below to
|
||||||
your `Vagrantfile` you can enable automatic detection of supported cache _buckets_:
|
your `Vagrantfile` you can enable automatic detection of supported cache _buckets_.
|
||||||
|
It is a good practise to wrap plugin specific configuration with `has_plugin?` checks
|
||||||
|
so the user's Vagrantfiles do not break if plugin is uninstalled or Vagrantfile shared
|
||||||
|
with people not having the plugin installed.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
# ...
|
# ...
|
||||||
|
if Vagrant.has_plugin?("vagrant-cachier")
|
||||||
config.cache.auto_detect = true
|
config.cache.auto_detect = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue