Vagrant plugins are esentially RubyGems that are installed to a different directory and that need to be registered in Vagrant plugin configuration file upon installation. As most of the RubyGems guidelines apply to them, this guide discusses only specifics in which Vagrant plugins differ.
Ruby Compatibility
Vagrant and its plugins current does not work with alternative Ruby interpreters. You do not need to specify the requirement on ruby package in plugins spec files though. Specify:
Requires: ruby(release)
Naming Guidelines
Plugins should follow upstream name that usually starts with vagrant-
. Do not add the rubygem-
prefix.
Macros
Vagrant plugins must be installed to certain standard locations. The vagrant
package contains usuful macros that should be used to achieve that.
Macro | Expanded path | Usage |
---|---|---|
From vagrant; intended for Vagrant plugin packages. | ||
%{vagrant_dir}
|
%{_datadir}/vagrant | Vagrant installation directory. |
%{vagrant_plugin_conf_dir}
|
%{_sharedstatedir}/vagrant | Plugin configuration files. |
%{vagrant_plugin_conf}
|
%{vagrant_plugin_conf_dir}/plugins.json | Configuration file for system-wide plugins. |
%{vagrant_plugin_dir}
|
%{vagrant_dir}/gems | Common locations for Vagrant plugin gems. |
%{vagrant_plugin_instdir}
|
%{vagrant_plugin_dir}/gems/%{vagrant_plugin_name}-%{version} | Directory with the actual content of the plugin. |
%{vagrant_plugin_libdir}
|
%{vagrant_plugin_instdir}/lib | The lib folder of the plugin.
|
%{vagrant_plugin_cache}
|
%{vagrant_plugin_dir}/cache/%{vagrant_plugin_name}-%{version}.gem | The cached plugin. |
%{vagrant_plugin_spec}
|
%{vagrant_plugin_dir}/specifications/%{vagrant_plugin_name}-%{version}.gemspec | The plugin's specification file. |
%{vagrant_plugin_docdir}
|
%{vagrant_plugin_dir}/doc/%{vagrant_plugin_name}-%{version} | The rdoc documentation of the plugin. |
%{vagrant_plugin_extdir}
|
%{_libdir}/vagrant/gems/ruby/%{vagrant_plugin_name}-%{version} | The directory for MRI Ruby plugin extensions. Currently unused. |