Katz Consulting Group

View Original

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: 

See this content in the original post

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:

See this content in the original post

If you have only one dependency you can simply add the following line to your Vagrantfile

See this content in the original post

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

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!