Skip to content

Instantly share code, notes, and snippets.

@nomeaning777
Created July 31, 2017 03:43
Show Gist options
  • Save nomeaning777/c2270d4603a742d90c1760582f7d01c4 to your computer and use it in GitHub Desktop.
Save nomeaning777/c2270d4603a742d90c1760582f7d01c4 to your computer and use it in GitHub Desktop.
古いvagrant boxを削除する
#!/usr/bin/ruby
data = `vagrant box list`.gsub(/\(|\)|,/,'').lines.sort.map(&:split)
u = []
data.reverse_each do |name, provider, version|
if u.include?([name, provider])
system 'vagrant', 'box', 'remove', '--provider', provider, '--box-version', version, name
else
u << [name, provider]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment