From f66d08d73cb5ad688ba8eb479a1757cda5aa928a Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 23 Nov 2013 16:45:45 -0800 Subject: [PATCH] commands/plugin: style nitpick --- plugins/commands/plugin/action/install_gem.rb | 4 ++++ plugins/commands/plugin/action/prune_gems.rb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/commands/plugin/action/install_gem.rb b/plugins/commands/plugin/action/install_gem.rb index c845b5be0..72d0bc13a 100644 --- a/plugins/commands/plugin/action/install_gem.rb +++ b/plugins/commands/plugin/action/install_gem.rb @@ -1,5 +1,6 @@ require "rubygems" require "rubygems/dependency_installer" + begin require "rubygems/format" rescue LoadError @@ -31,10 +32,13 @@ module VagrantPlugins # If we're installing from a gem file, determine the name # based on the spec in the file. pkg = if defined?(Gem::Format) + # RubyGems 1.x Gem::Format.from_file_by_path(plugin_name) else + # RubyGems 2.x Gem::Package.new(plugin_name) end + find_plugin_name = pkg.spec.name version = pkg.spec.version end diff --git a/plugins/commands/plugin/action/prune_gems.rb b/plugins/commands/plugin/action/prune_gems.rb index 0cccc1f05..cade522b4 100644 --- a/plugins/commands/plugin/action/prune_gems.rb +++ b/plugins/commands/plugin/action/prune_gems.rb @@ -126,8 +126,8 @@ module VagrantPlugins if prune_specs.length > 0 env[:gem_helper].with_environment do - - # due to a bug in rubygems 2.0, we need to load the specifications before removing any + # Due to a bug in rubygems 2.0, we need to load the + # specifications before removing any. This achieves that. Gem::Specification.to_a prune_specs.each do |prune_spec|