Skip to content

Instantly share code, notes, and snippets.

@adrianwebb
Last active August 29, 2015 14:20
Show Gist options
  • Save adrianwebb/61c22b5e8badb0d94073 to your computer and use it in GitHub Desktop.
Save adrianwebb/61c22b5e8badb0d94073 to your computer and use it in GitHub Desktop.
Clean and update Vagrant gems for current user.
#!/bin/bash
vagrant_home_dir="$HOME/.vagrant.d"
/usr/bin/env ruby <<-EORUBY
require 'json'
require 'fileutils'
puts 'Loading current Vagrant plugin data'
plugin_data = JSON.parse(File.read("$vagrant_home_dir/plugins.json"))
puts 'Removing existing Vagrant plugins'
FileUtils.rm_rf('$vagrant_home_dir')
plugin_data['installed'].each do |gem_name, info|
system("vagrant plugin install #{gem_name}")
end
EORUBY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment