Enforce Plugin Dependency Requirements Using Vagrant Plugin Bundler
We like package managers. They help us maintain our dependencies easily.
Vagrant has a package manager for it's plugins which make them very easy to install, upgrade or remove but before Vagrant Plugin Bundler we had no way to ensure our Vagrantfile is using the right version of each plugin.
With Vagrant Plugin Bundler you can do so very easily.
Installation
This is simply a must if you use Vagrant. To install type:
Done? Great!
This should be installed with every machine that runs Vagrant. Period.
Usage
It's very easy to get started with Vagrant Plugin Bundler. Open up your Vagrantfile and define your dependencies in the following way:
If you have only one dependency you can simply add the following line to your Vagrantfile:
Assuming that vagrant-omnibus is not installed you will get an error that says that you should install the version you specified in your Vagrantfile of vagrant-omnibus in order to proceed.
Why Vagrant Plugin Bundler Is Useful
If you distribute your Vagrant boxes to be used as baselines you can specify the dependency requirements with the Vagrantfile that was included inside the box. This ensures that further development on that box will be made possible quickly. In fact you should include the plugin dependencies anyway as they will be required to run the box at times (if not at all times).
Assuming that Travis will be able to run Vagrant in the near future, with Vagrant Plugin Bundler you can ensure your build fails very early if you haven't installed all your plugin dependencies correctly.
What's Missing
- Specifying the plugin's version is currently a requirement. It should be optional.
- A plugins sandbox that will allow to install plugins per Vagrantfile in order to run Vagrant projects with the same plugins but different versions.
- A command to install all required dependencies and a command to check that the current state of the dependencies matches the required state.
- Flexible Version Constraints.
Got more ideas? Create an issue.
Would you like to contribute? Fork it.
And Finally
You should all thank the developer that made it happen. Thank you @tknerr!