Skip to content

Instantly share code, notes, and snippets.

@mattolenik
Created May 1, 2018 20:09
Show Gist options
  • Save mattolenik/b9176c68d5124ad3768801a304a3beb5 to your computer and use it in GitHub Desktop.
Save mattolenik/b9176c68d5124ad3768801a304a3beb5 to your computer and use it in GitHub Desktop.
Automatically install missing Vagrant plugins upon 'vagrant up'
# 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