From 3d35c5237230b11436374379196c8d10e358e4cd Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Mon, 22 Mar 2021 11:51:41 +0000 Subject: [PATCH] Replace obsolete usage of Vagrant.require_plugin (#1234) Fixes #509 --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 50f7e79..e5a1292 100644 --- a/README.md +++ b/README.md @@ -1788,11 +1788,25 @@ $ bundle exec rspec spec/ If those pass, you're ready to start developing the plugin. You can test the plugin without installing it into your Vagrant environment by just creating a `Vagrantfile` in the top level of this directory (it is gitignored) that uses -it. Don't forget to add following line at the beginning of your `Vagrantfile` -while in development mode: +it. You can add the following line to your Vagrantfile while in development to +ensure vagrant checks that the plugin is installed: ```ruby -Vagrant.require_plugin "vagrant-libvirt" +Vagrant.configure("2") do |config| + config.vagrant.plugins = "vagrant-libvirt" +end +``` +Or add the following to the top of the file to ensure that any required plugins +are installed globally: +```ruby +REQUIRED_PLUGINS = %w(vagrant-libvirt) +exit unless REQUIRED_PLUGINS.all? do |plugin| + Vagrant.has_plugin?(plugin) || ( + puts "The #{plugin} plugin is required. Please install it with:" + puts "$ vagrant plugin install #{plugin}" + false + ) +end ``` Now you can use bundler to execute Vagrant: