core: Vagrant.has_plugin? to check if plugin installed [GH-1736]

This commit is contained in:
Mitchell Hashimoto 2013-09-02 15:22:40 -07:00
parent bd90f54a55
commit 7f0cbd8fea
2 changed files with 9 additions and 0 deletions

View File

@ -35,6 +35,8 @@ FEATURES:
- NFS: Arbitrary export options can be specified using
`bsd__nfs_options` and `linux__nfs_options`. [GH-1029]
- Static IP can now be set on public networks. [GH-1745]
- Add `Vagrant.has_plugin?` method for use in Vagrantfile to check
if a plugin is installed. [GH-1736]
IMPROVEMENTS:

View File

@ -132,6 +132,13 @@ module Vagrant
Config.run(version, &block)
end
# This checks if a plugin with the given name is installed. This can
# be used from the Vagrantfile to easily branch based on plugin
# availability.
def self.has_plugin?(name)
plugin("2").registered.include?(name)
end
# Returns a superclass to use when creating a plugin for Vagrant.
# Given a specific version, this returns a proper superclass to use
# to register plugins for that version.