ruby/rubygems-2.0.0-Fixes-for-empty-ruby-version.patch

82 lines
2.8 KiB
Diff
Raw Normal View History

2013-02-14 14:26:28 +00:00
From c9b2eff36728266052ccfff54d3ac0a0624fd0f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 14 Feb 2013 11:50:41 +0100
Subject: [PATCH 1/2] Use File.join insteado of manual path creation.
This prevents issues, when File.join in #new_default_spec removes
superfluous slashes while they are kept in expected paths. E.g. the test
would fail if ruby configuration specifies --with-ruby-version=''.
---
test/rubygems/test_gem_commands_contents_command.rb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb
index 60df53f..35c9631 100644
--- a/test/rubygems/test_gem_commands_contents_command.rb
+++ b/test/rubygems/test_gem_commands_contents_command.rb
@@ -140,10 +140,10 @@ lib/foo.rb
@cmd.execute
end
- expected = %W[
- #{Gem::ConfigMap[:bindir]}/default_command
- #{Gem::ConfigMap[:rubylibdir]}/default/gem.rb
- #{Gem::ConfigMap[:archdir]}/default_gem.so
+ expected = [
+ File.join(Gem::ConfigMap[:bindir], 'default_command'),
+ File.join(Gem::ConfigMap[:rubylibdir], 'default/gem.rb'),
+ File.join(Gem::ConfigMap[:archdir], 'default_gem.so')
].sort.join "\n"
assert_equal expected, @ui.output.chomp
--
1.8.1.2
From b022cef7b2e6c2d138388a6c2db02cca8c408cc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 14 Feb 2013 13:35:20 +0100
Subject: [PATCH 2/2] Do not add last slash to Gem.user_dir if ruby_version
string is empty.
---
lib/rubygems/defaults.rb | 4 +++-
test/rubygems/test_gem.rb | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index ea84e5c..05c35bb 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -54,7 +54,9 @@ module Gem
# Path for gems in the user's home directory
def self.user_dir
- File.join Gem.user_home, '.gem', ruby_engine, ConfigMap[:ruby_version]
+ parts = [Gem.user_home, '.gem', ruby_engine]
+ parts << ConfigMap[:ruby_version] unless ConfigMap[:ruby_version].empty?
+ File.join parts
end
##
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index bf77009..9ee78f7 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1186,8 +1186,10 @@ class TestGem < Gem::TestCase
end
def test_self_user_dir
- assert_equal File.join(@userhome, '.gem', Gem.ruby_engine,
- Gem::ConfigMap[:ruby_version]), Gem.user_dir
+ parts = [@userhome, '.gem', Gem.ruby_engine]
+ parts << Gem::ConfigMap[:ruby_version] unless Gem::ConfigMap[:ruby_version].empty?
+
+ assert_equal File.join(parts), Gem.user_dir
end
def test_self_user_home
--
1.8.1.2