Skip to content

Instantly share code, notes, and snippets.

@charlesjohnson
Last active December 26, 2015 08:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save charlesjohnson/7121911 to your computer and use it in GitHub Desktop.
Save charlesjohnson/7121911 to your computer and use it in GitHub Desktop.
Vagrant.has_plugin? example
# Plugin-specific configurations
if Vagrant.has_plugin?('vagrant-cachier')
puts 'INFO: Vagrant-cachier plugin detected. Optimizing caches.'
config.cache.enable :chef
config.cache.enable :apt
else
puts 'WARN: Vagrant-cachier plugin not detected. Continuing unoptimized.'
end
if Vagrant.has_plugin?('Omnibus')
puts 'INFO: Vagrant-omnibus plugin detected.'
config.omnibus.chef_version = :latest
else
puts "FATAL: Vagrant-omnibus plugin not detected. Please install the plugin with\n 'vagrant plugin install vagrant-omnibus' before continuing."
exit
end
# This detects the Berkshelf plugin. No, seriously.
if Vagrant.has_plugin?('berkshelf')
# The path to the Berksfile to use with Vagrant Berkshelf
puts 'INFO: Vagrant-berkshelf plugin detected.'
config.berkshelf.berksfile_path = './Berksfile'
else
puts "FATAL: Vagrant-berkshelf plugin not detected. Please install the plugin with\n 'vagrant plugin install vagrant-berkshelf' before continuing."
exit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment