Vagrant plugins are esentially RubyGems and most of the RubyGems guidelines apply to them. This guide discusses only specifics in which Vagrant plugins differ.
Ruby Compatibility
Each Vagrant plugin package must indicate it depends on a Ruby interpreter. Use ruby(release) virtual requirement to achieve that:
Requires: ruby(release)
If the package requires Ruby of certain version(s), make the requirement versioned like this:
Requires: ruby(release) >= 1.9.1
Different Interpreters Compatibility
Vagrant and its plugins current does not work with alternative Ruby interpreters. You do not need to specify the requirement on ruby package though.
Naming Guidelines
- Plugins should follow upstream name that usually starts with
vagrant-
.
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. |