Created
May 1, 2018 20:09
-
-
Save mattolenik/b9176c68d5124ad3768801a304a3beb5 to your computer and use it in GitHub Desktop.
Automatically install missing Vagrant plugins upon 'vagrant up'
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
# Install any missing plugins upon 'vagrant up' | |
def ensure_plugins(required_plugins) | |
if ARGV[0] == 'up' | |
missing_plugins = required_plugins.select {|p| not Vagrant.has_plugin? p} | |
unless missing_plugins.empty? | |
plugins = missing_plugins.join(' ') | |
puts "Found missing plugins: #{plugins}, installing..." | |
exec "vagrant plugin install #{plugins} && vagrant up" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment