diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-22 07:28:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-22 07:28:35 +0000 |
commit | 018e1e4f5ef9ce7242d971d42d923d8edb87225b (patch) | |
tree | 9050ba595a75200c60f9bd3fe6d2f6ff49bad79c | |
parent | 9e83ce20b1121068d9a708b41c623f4493c2eb53 (diff) | |
download | ruby-018e1e4f5ef9ce7242d971d42d923d8edb87225b.tar.gz |
* lib/rubygems/installer.rb (Gem::Installer#initialize): fixed
typos.
* test/rubygems/test_gem.rb (test_self_dir): removed false
assertions.
* test/rubygems/test_gem.rb (test_self_set_paths): checks if paths
are included.
* test/rubygems/test_gem_commands_install_command.rb
(test_execute_remote): checks diagnostic message too.
* test/rubygems/test_gem_installer.rb (load): uses Gem.ruby.
* test/rubygems/gemutilities.rb (Gem.ruby): initializes from the
environment variable to run without installation.
* test/rubygems/gemutilities.rb (RubyGemTestCase#util_build_gem):
creates cache directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | lib/rubygems/installer.rb | 4 | ||||
-rw-r--r-- | test/rubygems/gemutilities.rb | 6 | ||||
-rw-r--r-- | test/rubygems/test_gem.rb | 10 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_install_command.rb | 12 | ||||
-rw-r--r-- | test/rubygems/test_gem_installer.rb | 2 |
6 files changed, 44 insertions, 12 deletions
@@ -1,3 +1,25 @@ +Thu Jan 22 16:29:50 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/rubygems/installer.rb (Gem::Installer#initialize): fixed + typos. + + * test/rubygems/test_gem.rb (test_self_dir): removed false + assertions. + + * test/rubygems/test_gem.rb (test_self_set_paths): checks if paths + are included. + + * test/rubygems/test_gem_commands_install_command.rb + (test_execute_remote): checks diagnostic message too. + + * test/rubygems/test_gem_installer.rb (load): uses Gem.ruby. + + * test/rubygems/gemutilities.rb (Gem.ruby): initializes from the + environment variable to run without installation. + + * test/rubygems/gemutilities.rb (RubyGemTestCase#util_build_gem): + creates cache directory. + Thu Jan 22 16:12:51 2009 NAKAMURA Usaku <usa@ruby-lang.org> * revert previous revision. it's already out-of-date. diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 259c3ed31e..bb08549c21 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -118,8 +118,8 @@ class Gem::Installer begin FileUtils.mkdir_p @gem_home - rescue Errno::EACCESS, Errno::ENOTDIR - # We'll divert to ~/.gems below + rescue Errno::EACCES, Errno::ENOTDIR + # We'll divert to ~/.gem below end if not File.writable? @gem_home or diff --git a/test/rubygems/gemutilities.rb b/test/rubygems/gemutilities.rb index 3720da5d6a..02ebb33837 100644 --- a/test/rubygems/gemutilities.rb +++ b/test/rubygems/gemutilities.rb @@ -24,6 +24,8 @@ require 'rubygems/test_utilities' require File.join(File.expand_path(File.dirname(__FILE__)), 'mockgemui') module Gem + @ruby = ENV['RUBY'] + def self.searcher=(searcher) MUTEX.synchronize do @searcher = searcher end end @@ -252,8 +254,10 @@ class RubyGemTestCase < MiniTest::Unit::TestCase Gem::Builder.new(spec).build end + cache_dir = File.join(@gemhome, 'cache') + FileUtils.mkdir_p cache_dir FileUtils.mv "#{spec.full_name}.gem", - File.join(@gemhome, 'cache', "#{spec.original_name}.gem") + File.join(cache_dir, "#{spec.original_name}.gem") end end diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 0707832367..b1a9d9d0a2 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -152,11 +152,6 @@ class TestGem < RubyGemTestCase def test_self_dir assert_equal @gemhome, Gem.dir - - Gem::DIRECTORIES.each do |filename| - assert File.directory?(File.join(Gem.dir, filename)), - "expected #{filename} to exist" - end end def test_self_ensure_gem_directories @@ -483,9 +478,10 @@ class TestGem < RubyGemTestCase other = File.join @tempdir, 'other' path = [@userhome, other].join File::PATH_SEPARATOR Gem.send :set_paths, path + path = Gem.path - assert File.exist?(File.join(@userhome, 'gems')) - assert File.exist?(File.join(other, 'gems')) + assert_equal path[0], @userhome + assert_equal path[1], other end def test_self_set_paths_nonexistent_home diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index 46e5e28caf..97fefbf859 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -112,9 +112,18 @@ class TestGemCommandsInstallCommand < RubyGemTestCase @cmd.options[:args] = [@a2.name] + err = "" + class << err + alias write << + end use_ui @ui do e = assert_raises Gem::SystemExitException do - @cmd.execute + stderr, $stderr = $stderr, err + begin + @cmd.execute + ensure + $stderr = stderr + end end assert_equal 0, e.exit_code end @@ -127,6 +136,7 @@ class TestGemCommandsInstallCommand < RubyGemTestCase assert_equal "Installing RDoc documentation for #{@a2.full_name}...", out.shift assert out.empty?, out.inspect + assert_match /^Updating class cache with \d+ classes/, err end def test_execute_two diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index 3df9dbc28c..0d677d6d71 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -508,7 +508,7 @@ load 'my_exec' @installer.generate_bin - default_shebang = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) + default_shebang = Gem.ruby shebang_line = open("#{@gemhome}/bin/my_exec") { |f| f.readlines.first } assert_match(/\A#!/, shebang_line) assert_match(/#{default_shebang}/, shebang_line) |