Created
April 8, 2019 09:32
-
-
Save EdwardPrentice/40d630d9776a270f19dfe93b427f1158 to your computer and use it in GitHub Desktop.
Automatically install required plugins used within a Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ARGV[0] != 'plugin' | |
required_plugins = ['vagrant-vbguest', 'vagrant-reload'] | |
plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin } | |
if not plugins_to_install.empty? | |
puts "Installing plugins: #{plugins_to_install.join(' ')}" | |
if system "vagrant plugin install #{plugins_to_install.join(' ')}" | |
exec "vagrant #{ARGV.join(' ')}" | |
else | |
abort "Installation of one or more plugins has failed. Aborting." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment