From 08837d081d764af01a30d325007c3c9527e383a6 Mon Sep 17 00:00:00 2001 From: drbrain Date: Thu, 19 Jun 2008 18:15:26 +0000 Subject: [PATCH] Update to RubyGems 1.1.1 r1784 (pre 1.2) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++ lib/rubygems/commands/dependency_command.rb | 11 +++- lib/rubygems/config_file.rb | 1 + test/rubygems/test_gem.rb | 4 +- .../test_gem_commands_dependency_command.rb | 52 +++++++++++++++++++ test/rubygems/test_gem_config_file.rb | 6 +++ .../rubygems/test_gem_dependency_installer.rb | 2 +- test/rubygems/test_gem_installer.rb | 6 ++- test/rubygems/test_gem_source_info_cache.rb | 2 +- test/rubygems/test_gem_spec_fetcher.rb | 2 +- 10 files changed, 82 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ddf400043..7e982ec3d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jun 20 03:14:31 2008 Eric Hodel + + * lib/rubygems*, test/rubygems/*: Update to RubyGems 1.1.1 r1784 (pre + 1.2). + Fri Jun 20 03:01:59 2008 Yusuke Endoh * thread.c: try to remove false positive of deadlock detection (second diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb index 8fae87c90f..44b269bb11 100644 --- a/lib/rubygems/commands/dependency_command.rb +++ b/lib/rubygems/commands/dependency_command.rb @@ -43,14 +43,21 @@ class Gem::Commands::DependencyCommand < Gem::Command end def execute - options[:args] << '.' if options[:args].empty? + options[:args] << '' if options[:args].empty? specs = {} source_indexes = Hash.new do |h, source_uri| h[source_uri] = Gem::SourceIndex.new end - pattern = /\A#{Regexp.union(*options[:args])}/ + pattern = if options[:args].length == 1 and + options[:args].first =~ /\A\/(.*)\/(i)?\z/m then + flags = $2 ? Regexp::IGNORECASE : nil + Regexp.new $1, flags + else + /\A#{Regexp.union(*options[:args])}/ + end + dependency = Gem::Dependency.new pattern, options[:version] if options[:reverse_dependencies] and remote? and not local? then diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb index c657bf7f01..8cea513790 100644 --- a/lib/rubygems/config_file.rb +++ b/lib/rubygems/config_file.rb @@ -79,6 +79,7 @@ class Gem::ConfigFile arg_list = arg_list.map do |arg| if need_config_file_name then @config_file_name = arg + need_config_file_name = false nil elsif arg =~ /^--config-file=(.*)/ then @config_file_name = $1 diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 8a9e2c6e61..e5dcef0d57 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -27,7 +27,7 @@ class TestGem < RubyGemTestCase assert_equal expected, Gem.all_load_paths.sort end - + def test_self_available? util_make_gems assert(Gem.available?("a")) @@ -252,7 +252,7 @@ class TestGem < RubyGemTestCase end Gem.instance_variable_set :@gem_path, nil - assert_equal [Gem.default_path, Gem.dir], Gem.path + assert_equal [Gem.default_path, Gem.dir].flatten, Gem.path ensure Object.const_set :APPLE_GEM_HOME, orig_APPLE_GEM_HOME end diff --git a/test/rubygems/test_gem_commands_dependency_command.rb b/test/rubygems/test_gem_commands_dependency_command.rb index 93e772c691..e143110a71 100644 --- a/test/rubygems/test_gem_commands_dependency_command.rb +++ b/test/rubygems/test_gem_commands_dependency_command.rb @@ -30,6 +30,34 @@ class TestGemCommandsDependencyCommand < RubyGemTestCase assert_equal '', @ui.error end + def test_execute_no_args + Gem.source_index = nil + + @cmd.options[:args] = [] + + use_ui @ui do + @cmd.execute + end + + expected = <<-EOF +Gem a-1 + +Gem a-2 + +Gem a_evil-9 + +Gem b-2 + +Gem c-1.2 + +Gem pl-1-x86-linux + + EOF + + assert_equal expected, @ui.output + assert_equal '', @ui.error + end + def test_execute_no_match @cmd.options[:args] = %w[foo] @@ -59,6 +87,30 @@ class TestGemCommandsDependencyCommand < RubyGemTestCase assert_equal '', @ui.error end + def test_execute_regexp + Gem.source_index = nil + + @cmd.options[:args] = %w[/[ab]/] + + use_ui @ui do + @cmd.execute + end + + expected = <<-EOF +Gem a-1 + +Gem a-2 + +Gem a_evil-9 + +Gem b-2 + + EOF + + assert_equal expected, @ui.output + assert_equal '', @ui.error + end + def test_execute_reverse quick_gem 'foo' do |gem| gem.add_dependency 'bar', '> 1' diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb index c7f6b93c7f..46f200d88d 100644 --- a/test/rubygems/test_gem_config_file.rb +++ b/test/rubygems/test_gem_config_file.rb @@ -72,6 +72,12 @@ class TestGemConfigFile < RubyGemTestCase assert_equal @temp_conf, @cfg.config_file_name end + def test_initialize_handle_arguments_config_file_with_other_params + util_config_file %W[--config-file #{@temp_conf} --backtrace] + + assert_equal @temp_conf, @cfg.config_file_name + end + def test_initialize_handle_arguments_config_file_equals util_config_file %W[--config-file=#{@temp_conf}] diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb index 80c446a2ad..fbf92632b3 100644 --- a/test/rubygems/test_gem_dependency_installer.rb +++ b/test/rubygems/test_gem_dependency_installer.rb @@ -372,7 +372,7 @@ class TestGemDependencyInstaller < RubyGemTestCase end ENV['GEM_HOME'] = @gemhome - ENV['GEM_PATH'] = [@gemhome, gemhome2].join ':' + ENV['GEM_PATH'] = [@gemhome, gemhome2].join File::PATH_SEPARATOR Gem.clear_paths Dir.chdir @tempdir do diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index edd8b472cd..f57d1c820c 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -327,8 +327,10 @@ load 'my_exec' real_exec = File.join util_gem_dir, 'bin', 'my_exec' # fake --no-wrappers for previous install - FileUtils.mkdir_p File.dirname(installed_exec) - FileUtils.ln_s real_exec, installed_exec + unless Gem.win_platform? then + FileUtils.mkdir_p File.dirname(installed_exec) + FileUtils.ln_s real_exec, installed_exec + end @installer.generate_bin assert_equal true, File.directory?(util_inst_bindir) diff --git a/test/rubygems/test_gem_source_info_cache.rb b/test/rubygems/test_gem_source_info_cache.rb index 83cd100a9d..86866a8012 100644 --- a/test/rubygems/test_gem_source_info_cache.rb +++ b/test/rubygems/test_gem_source_info_cache.rb @@ -401,7 +401,7 @@ class TestGemSourceInfoCache < RubyGemTestCase assert_equal @gem_repo, user_cache_data.first gems = user_cache_data.last.source_index.map { |_,spec| spec.full_name } - assert_equal [@a1.full_name, @a2.full_name], gems + assert_equal [@a1.full_name, @a2.full_name], gems.sort user_cache_data = read_cache(@sic.latest_user_cache_file).to_a.sort assert_equal 1, user_cache_data.length diff --git a/test/rubygems/test_gem_spec_fetcher.rb b/test/rubygems/test_gem_spec_fetcher.rb index 7539d0ff4c..8b97787023 100644 --- a/test/rubygems/test_gem_spec_fetcher.rb +++ b/test/rubygems/test_gem_spec_fetcher.rb @@ -284,7 +284,7 @@ RubyGems will revert to legacy indexes degrading performance. @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}"] = ' ' * Marshal.dump(@latest_specs).length - cache_dir = File.join Gem.user_home, '.gem', 'specs', 'gems.example.com:80' + cache_dir = File.join Gem.user_home, '.gem', 'specs', 'gems.example.com%80' FileUtils.mkdir_p cache_dir