required_plugins = {} # Example usage: # required_plugins["plugin-name"] = { version: "1.2.3", source: "https://rubygems.org" } <% plugins.each do |p| -%> required_plugins["<%= p %>"] = {} <% end -%> needs_restart = false required_plugins.each do |plugin, options| version = options[:version] unless Vagrant.has_plugin?(plugin, version) command = "vagrant plugin install #{plugin}" command += " --plugin-version #{version}" if version command += " --plugin-source #{options[:source]}" if options[:source] system command needs_restart = true end end if needs_restart exec "vagrant #{ARGV.join' '}" end