Skip to content
jimmycuadra edited this page Mar 15, 2013 · 2 revisions

How a plugin is detected and activated

v1.0.x

Vagrant checks installed gems for a file in its root lib path called vagrant_init.rb and requires it, if present.

v1.1

Require "vagrant" inside your plugin gem. Then create a class that inherits from the dynamically determined plugin base class:

class MyPlugin < Vagrant.plugin(2)
  name "My Plugin"
end

The call to name will both name the plugin and register it with Vagrant's global plugin manager.

When a user runs vagrant plugin install <YOUR_PLUGIN>, your plugin gem is added to ~/.vagrant.d/plugins.json. This file is checked when Vagrant runs to determine which plugins to activate.

Clone this wiki locally