From 4f17a70c4e1a412b3def65d0132d3e8a85c395f1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 3 Dec 2013 23:48:06 -0800 Subject: [PATCH] commands/plugin: ignore default gems when pruning For modern RubyGems compatibility --- plugins/commands/plugin/action/prune_gems.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/commands/plugin/action/prune_gems.rb b/plugins/commands/plugin/action/prune_gems.rb index cade522b4..ae5a38196 100644 --- a/plugins/commands/plugin/action/prune_gems.rb +++ b/plugins/commands/plugin/action/prune_gems.rb @@ -38,9 +38,14 @@ module VagrantPlugins # Get the actual specifications of installed gems all_specs = env[:gem_helper].with_environment do - result = [] - Gem::Specification.find_all { |s| result << s } - result + [].tap do |result| + Gem::Specification.find_all do |s| + # Ignore default gems since they can't be uninstalled + next if s.respond_to?(:default_gem?) && s.default_gem? + + result << s + end + end end # The list of specs to prune initially starts out as all of them