# See: https://github.com/hashicorp/vagrant/issues/4347

required_plugins = {
  'vagrant-sshfs' => '~>1.3.0',
}

needs_restart = false
required_plugins.each do |name, version|
  unless Vagrant.has_plugin? name, version
    system "vagrant plugin install #{name} --plugin-version=\"#{version}\""
    needs_restart = true
  end
end

if needs_restart
  exec "vagrant #{ARGV.join' '}"
end
