summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib/rubygems/commands/install_command.rb7
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb8
3 files changed, 21 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index bb9bffd76b..42e53bd98b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Dec 9 08:40:40 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Update to RubyGems master bf37240. Fixes useless
+ error message with `gem install -g` with no gem dependencies file.
+ * test/rubygems: ditto.
+
Mon Dec 9 04:52:25 2013 Eric Hodel <drbrain@segment7.net>
* NEWS: Update RubyGems entry with notable features.
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 68a2fad129..d2dd7ac920 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -40,6 +40,13 @@ class Gem::Commands::InstallCommand < Gem::Command
File.exist? file
end unless v
+ unless v then
+ message = v ? v : "(tried #{Gem::GEM_DEP_FILES.join ', '})"
+
+ raise OptionParser::InvalidArgument,
+ "cannot find gem dependencies file #{message}"
+ end
+
o[:gemdeps] = v
end
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index ed7f72d6a5..32f6fc4237 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -809,14 +809,22 @@ ERROR: Possible alternatives: non_existent_with_hint
end
def test_handle_options_file
+ FileUtils.touch 'Gemfile'
+
@cmd.handle_options %w[-g Gemfile]
assert_equal 'Gemfile', @cmd.options[:gemdeps]
+ FileUtils.rm 'Gemfile'
+
+ FileUtils.touch 'gem.deps.rb'
+
@cmd.handle_options %w[--file gem.deps.rb]
assert_equal 'gem.deps.rb', @cmd.options[:gemdeps]
+ FileUtils.rm 'gem.deps.rb'
+
FileUtils.touch 'Isolate'
@cmd.handle_options %w[-g]