diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-22 08:24:42 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-22 08:24:42 +0000 |
commit | 372dcece3f69989d133f720468f1e24aa1133cda () | |
tree | c173ca48a23ce18afa44feb15bf68d2dd14ac619 /test | |
parent | d0e5a34ac7c34e70c145024a0fed8f6042814f29 (diff) |
Update to RubyGems 1.3.7.pre.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
24 files changed, 338 insertions, 49 deletions
@@ -8,13 +8,17 @@ else require 'rubygems' end require 'fileutils' -require 'minitest/unit' require 'tmpdir' require 'uri' require 'rubygems/package' require 'rubygems/test_utilities' require 'pp' require 'yaml' begin gem 'rdoc' @@ -66,10 +70,10 @@ class RubyGemTestCase < MiniTest::Unit::TestCase Gem.ensure_gem_subdirectories @gemhome - if ruby = ENV['RUBY'] - Gem.class_eval {ruby, @ruby = @ruby, ruby} - @orig_ruby = ruby - end Gem.ensure_gem_subdirectories @gemhome @@ -131,7 +135,6 @@ class RubyGemTestCase < MiniTest::Unit::TestCase Gem.pre_uninstall do |uninstaller| @pre_uninstall_hook_arg = uninstaller end - end def teardown @@ -150,9 +153,7 @@ class RubyGemTestCase < MiniTest::Unit::TestCase Gem.clear_paths - if ruby = @orig_ruby - Gem.class_eval {@ruby = ruby} - end if @orig_ENV_HOME then ENV['HOME'] = @orig_ENV_HOME @@ -585,5 +586,3 @@ Also, a list: end -MiniTest::Unit.autorun - @@ -0,0 +1,2 @@ @@ -0,0 +1 @@ @@ -0,0 +1,2 @@ @@ -0,0 +1,5 @@ @@ -1,5 +1,10 @@ require 'rubygems/command_manager' class Gem::Commands::InterruptCommand < Gem::Command def initialize @@ -16,6 +16,8 @@ class TestGem < RubyGemTestCase else %r|/[Rr]uby/[Gg]ems/[0-9.]+| end end def test_self_all_load_paths @@ -258,8 +260,8 @@ class TestGem < RubyGemTestCase def test_self_find_files discover_path = File.join 'lib', 'foo', 'discover.rb' - cwd = File.expand_path('..', __FILE__) - $LOAD_PATH.unshift(cwd.dup) foo1 = quick_gem 'foo', '1' do |s| s.files << discover_path @@ -290,7 +292,7 @@ class TestGem < RubyGemTestCase assert_equal expected, Gem.find_files('foo/discover') ensure - assert_equal(cwd, $LOAD_PATH.shift) end def test_self_latest_load_paths @@ -617,6 +619,38 @@ class TestGem < RubyGemTestCase ENV['USERPATH'] = orig_user_path end if '1.9' > RUBY_VERSION def util_ensure_gem_dirs Gem.ensure_gem_subdirectories @gemhome @additional.each do |dir| @@ -665,5 +699,10 @@ class TestGem < RubyGemTestCase defined?(@RUBY_REVISION) end end @@ -10,6 +10,8 @@ class TestGemCommandManager < RubyGemTestCase end def test_run_interrupt use_ui @ui do assert_raises MockGemUi::TermError do @command_manager.run 'interrupt' @@ -19,6 +21,18 @@ class TestGemCommandManager < RubyGemTestCase end end def test_process_args_bad_arg use_ui @ui do assert_raises(MockGemUi::TermError) { @@ -139,13 +139,15 @@ Rakefile end def test_handle_options - assert_equal false, @cmd.options[:lib_only] - assert_equal [], @cmd.options[:specdirs] - assert_equal nil, @cmd.options[:version] - @cmd.send :handle_options, %w[-l -s foo --version 0.0.2] - assert_equal true, @cmd.options[:lib_only] assert_equal %w[foo], @cmd.options[:specdirs] assert_equal Gem::Requirement.new('0.0.2'), @cmd.options[:version] end @@ -12,6 +12,7 @@ class TestGemCommandsEnvironmentCommand < RubyGemTestCase def test_execute orig_sources = Gem.sources.dup Gem.sources.replace %w[http://gems.example.com] @cmd.send :handle_options, %w[] @@ -32,6 +33,7 @@ class TestGemCommandsEnvironmentCommand < RubyGemTestCase assert_match %r|GEM PATHS:|, @ui.output assert_match %r|- #{Regexp.escape @gemhome}|, @ui.output assert_match %r|GEM CONFIGURATION:|, @ui.output assert_match %r|:verbose => |, @ui.output assert_match %r|REMOTE SOURCES:|, @ui.output assert_equal '', @ui.error @@ -125,7 +127,7 @@ class TestGemCommandsEnvironmentCommand < RubyGemTestCase @cmd.execute end - assert_equal "#{Gem::RubyGemsVersion}\n", @ui.output assert_equal '', @ui.error end @@ -27,7 +27,7 @@ class TestGemCommandsFetchCommand < RubyGemTestCase end assert File.exist?(File.join(@tempdir, @a2.file_name)), - "#{@a2.full_name} fetched" end def test_execute_prerelease @@ -52,5 +52,25 @@ class TestGemCommandsFetchCommand < RubyGemTestCase "#{@a2_pre.full_name} not fetched" end end @@ -145,8 +145,7 @@ class TestGemCommandsInstallCommand < RubyGemTestCase end # HACK no repository was checked - assert_equal "ERROR: could not find gem no_such_gem locally or in a repository\n", - @ui.error end def test_execute_no_gem @@ -170,8 +169,7 @@ class TestGemCommandsInstallCommand < RubyGemTestCase assert_equal 2, e.exit_code end - assert_equal "ERROR: could not find gem nonexistent locally or in a repository\n", - @ui.error end def test_execute_prerelease @@ -29,7 +29,34 @@ class TestGemCommandsQueryCommand < RubyGemTestCase *** REMOTE GEMS *** a (2) -pl (1) EOF assert_equal expected, @ui.output @@ -51,7 +78,7 @@ pl (1) *** REMOTE GEMS *** a (2, 1) -pl (1) EOF assert_equal expected, @ui.output @@ -73,7 +100,7 @@ pl (1) *** REMOTE GEMS *** a (3.a, 2, 1) -pl (1) EOF assert_equal expected, @ui.output @@ -311,7 +338,7 @@ a (3.a, 2, 1) a_evil (9) b (2) c (1.2) -pl (1) EOF assert_equal expected, @ui.output @@ -348,7 +375,7 @@ pl expected = <<-EOF a (2) -pl (1) EOF assert_equal expected, @ui.output @@ -388,7 +415,7 @@ a (3.a, 2, 1) a_evil (9) b (2) c (1.2) -pl (1) EOF assert_equal expected, @ui.output @@ -13,16 +13,23 @@ class TestGemCommandsServerCommand < RubyGemTestCase @cmd.send :handle_options, %w[-p 8808 --no-daemon] assert_equal false, @cmd.options[:daemon] - assert_equal @gemhome, @cmd.options[:gemdir] assert_equal 8808, @cmd.options[:port] @cmd.send :handle_options, %w[-p 9999 -d /nonexistent --daemon] assert_equal true, @cmd.options[:daemon] - assert_equal File.expand_path('/nonexistent'), @cmd.options[:gemdir] assert_equal 9999, @cmd.options[:port] end def test_handle_options_port @cmd.send :handle_options, %w[-p 0] assert_equal 0, @cmd.options[:port] @@ -64,11 +64,10 @@ class TestGemCommandsUninstallCommand < GemInstallerTestCase util_setup_gem - use_ui @ui do - tmp_rake = ENV['rake'] - ENV['rake'] = @@rake - @installer.install - ENV['rake'] = tmp_rake end @cmd.options[:args] = ["pre"] @@ -22,8 +22,8 @@ class TestGemCommandsUnpackCommand < RubyGemTestCase end end - assert File.exist?(File.join(@tempdir, 'a-3.a')), 'a should be installed' - assert File.exist?(File.join(@tempdir, 'b-2')), 'b should be installed' end def test_execute_gem_path @@ -49,6 +49,7 @@ class TestGemCommandsUnpackCommand < RubyGemTestCase def test_execute_gem_path_missing util_make_gems Gem.clear_paths @@ -68,6 +69,49 @@ class TestGemCommandsUnpackCommand < RubyGemTestCase assert_equal '', @ui.output end def test_execute_with_target_option util_make_gems @@ -46,6 +46,7 @@ class TestGemConfigFile < RubyGemTestCase fp.puts ":benchmark: true" fp.puts ":bulk_threshold: 10" fp.puts ":verbose: false" fp.puts ":sources:" fp.puts " - http://more-gems.example.com" fp.puts "install: --wrappers" @@ -61,6 +62,7 @@ class TestGemConfigFile < RubyGemTestCase assert_equal 10, @cfg.bulk_threshold assert_equal false, @cfg.verbose assert_equal false, @cfg.update_sources assert_equal %w[http://more-gems.example.com], Gem.sources assert_equal '--wrappers', @cfg[:install] assert_equal(['/usr/ruby/1.8/lib/ruby/gems/1.8', '/var/ruby/1.8/gem_home'], @@ -134,5 +134,16 @@ class TestGemDependency < RubyGemTestCase assert d.prerelease? end end @@ -1,5 +1,4 @@ require_relative 'gemutilities' - require 'rubygems/indexer' unless ''.respond_to? :to_xs then @@ -166,7 +165,7 @@ pl-1-i386-linux <title>ExampleForge gems</title> <link>http://example.com</link> <description>Recently released gems from http://example.com</description> - <generator>RubyGems v#{Gem::RubyGemsVersion}</generator> <docs>http://cyber.law.harvard.edu/rss/rss.html</docs> <item> <title>a-2</title> @@ -30,6 +30,9 @@ class TestGemPlatform < RubyGemTestCase 'hppa2.0w-hpux11.31' => ['hppa2.0w', 'hpux', '11'], 'java' => [nil, 'java', nil], 'jruby' => [nil, 'java', nil], 'powerpc-aix5.3.0.0' => ['powerpc', 'aix', '5'], 'powerpc-darwin7' => ['powerpc', 'darwin', '7'], 'powerpc-darwin8' => ['powerpc', 'darwin', '8'], @@ -227,6 +230,22 @@ class TestGemPlatform < RubyGemTestCase util_set_arch 'java' assert_match 'java', Gem::Platform.local assert_match 'jruby', Gem::Platform.local util_set_arch 'powerpc-darwin' assert_match 'powerpc-darwin', Gem::Platform.local @@ -20,6 +20,17 @@ class TestGemServer < RubyGemTestCase @res = WEBrick::HTTPResponse.new :HTTPVersion => '1.0' end def test_Marshal data = StringIO.new "GET /Marshal.#{Gem.marshal_version} HTTP/1.0\r\n\r\n" @req.parse data @@ -85,7 +85,7 @@ Gem::Specification.new do |s| current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then else end else @@ -115,6 +115,21 @@ class TestGemSpecFetcher < RubyGemTestCase assert_equal [[@pl1.full_name, @gem_repo]], spec_names end def test_fetch_spec spec_uri = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}" @fetcher.data["#{spec_uri}.rz"] = util_zip(Marshal.dump(@a1)) @@ -220,6 +235,33 @@ class TestGemSpecFetcher < RubyGemTestCase assert_equal [], specs end def test_find_all_platforms util_set_arch 'i386-freebsd6' @@ -473,6 +473,31 @@ end assert_equal expected, @a1.files.sort end def test_files_duplicate @a2.files = %w[a b c d b] @a2.extra_rdoc_files = %w[x y z x] @@ -748,14 +773,14 @@ Gem::Specification.new do |s| s.files = [\"lib/code.rb\"] s.homepage = %q{http://example.com} s.require_paths = [\"lib\"] - s.rubygems_version = %q{#{Gem::RubyGemsVersion}} s.summary = %q{this is a summary} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION} - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<b>, [\"= 1\"]) else s.add_dependency(%q<b>, [\"= 1\"]) @@ -802,7 +827,7 @@ Gem::Specification.new do |s| s.require_paths = [\"lib\"] s.requirements = [\"A working computer\"] s.rubyforge_project = %q{example} - s.rubygems_version = %q{#{Gem::RubyGemsVersion}} s.summary = %q{this is a summary} s.test_files = [\"test/suite.rb\"] @@ -810,7 +835,7 @@ Gem::Specification.new do |s| current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<rake>, [\"> 0.4\"]) s.add_runtime_dependency(%q<jabber4r>, [\"> 0.0.0\"]) s.add_runtime_dependency(%q<pqa>, [\"> 0.4\", \"<= 0.6\"]) @@ -883,7 +908,7 @@ end yaml_str = @a1.to_yaml - same_spec = YAML.load(yaml_str) assert_equal Gem::Platform.new('powerpc-darwin7'), same_spec.platform assert_equal 'powerpc-darwin7.9.0', same_spec.original_platform @@ -1173,7 +1198,7 @@ end @a1.validate end - assert_equal "expected RubyGems version #{Gem::RubyGemsVersion}, was 3", e.message end @@ -1228,6 +1253,20 @@ end assert_equal Gem::Version.new('1'), @a1.version end def util_setup_validate Dir.chdir @tempdir do FileUtils.mkdir_p File.join('ext', 'a') |