Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/bin/._gem and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/bin/._gem differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/bin/._update_rubygems and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/bin/._update_rubygems differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/ChangeLog libgems-ruby-1.3.1/ChangeLog --- libgems-ruby-1.3.0~RC1really1.2.0/ChangeLog 2008-06-21 21:03:33.000000000 -0500 +++ libgems-ruby-1.3.1/ChangeLog 2008-10-25 17:16:43.000000000 -0500 @@ -1,3 +1,189 @@ +# -*- coding: utf-8 -*- + +2008-10-25 Eric Hodel + + * lib/rubygems.rb, lib/rubygems/custom_require.rb: Make kernel + methods private. Patch #20801 by Stefan Rusterholz. Expose + our kernel extensions to RDoc. Make Gem::location_of_caller behave on + Windows. Patch by Daniel Berger. + * doc/release_notes/rel_1_3_1.rdoc: Final release notes for 1.3.1. + * lib/rubygems/rubygems_version.rb: 1.3.1. + +2008-10-10 Eric Hodel + + * lib/rubygems/commands/unpack_command.rb: Silence PATH warning. + +2008-10-09 Eric Hodel + + * lib/rubygems.rb: Fix requires for inflate, deflate, etc. + * test/*: Convert to minitest/unit. + * lib/rubygems/validator.rb: Fix for MiniTest instead of test/unit + classic in 1.9. + +2008-10-03 Phil Hagelberg + + * lib/rubygems.rb: Make Gem.dir respect :gemhome value from config. + * lib/rubygems/config_file.rb: Expose :gemhome value. + +2008-09-26 Luis Lavena + + * lib/rubygems.rb: Disregard ownership of ~ under Windows while + creating ~/.gem. Fixes issues related to no uid support under + Windows. + +2008-09-24 Eric Hodel + + * doc/release_notes/rel_1_3_0.rdoc: Final release notes for 1.3.0. + * lib/rubygems/rubygems_version.rb: 1.3.0. + * lib/rubygems/builder.rb: Examine process status correctly. Patch + by Nobu. + * test/test_gem_ext_rake_builder.rb: Override Gem.ruby and + ENV['rake'] for 1.9 integration. Patch by Nobu. + +2008-09-16 Eric Hodel + + * lib/rubygems.rb: Only create ~/.gem by user owning ~. Bug #21561 + by Neil Wilson. + +2008-09-15 Eric Hodel + + * lib/rubygems/source_index.rb: Autoload SpecFetcher to improve load + time. Patch #21577 by Simon Chiang. + * lib/rubygems/commands/lock_command.rb: Modernize. Fix --strict. + Patch #21814 by Sven Engelhardt. + * lib/rubygems/platform.rb: Fix for solaris platform. Patch #21911 + by Bob Remeika. + +2008-09-10 Eric Hodel + + * lib/rubygems/commands/install_command.rb: Describe _version_ in `gem + help install`. + * lib/rubygems/commands/environment_command.rb: Describe environment + variables and gemrc in `gem help env`. + * lib/rubygems.rb: Warn when executing Gem::manage_gems. + * lib/rubygems/doc_manager.rb: Have RubyGems update the ri cache. + * lib/rubygems/source_index.rb: Ensure specs are read as UTF-8. + * lib/rubygems/specification.rb: Add magic comment to .gemspec files + so they are read in as UTF-8. + +2008-08-22 Luis Lavena + + * lib/rubygems.rb: Corrected usage of HOMEDRIVE and HOMEPATH on Windows. + Escape Gem.ruby if spaces in the path are present. Solves bug related to + extensions compile process. + * test/test_gem.rb: Added test to verify both conditions. + +2008-08-17 Eric Hodel + + * doc/release_notes/rel_1_3_0.rdoc: Initial release notes for 1.3.0. + * util/CL2notes: Release note creation helper script. + +2008-08-16 Eric Hodel + + * lib/rubygems/local_remote_options.rb: Added #both? to complement + #local? and #remote?. + * lib/rubygems/commands/query_command.rb: Print out LOCAL/REMOTE with + --both, even without a TTY. + * lib/rubygems.rb: Add Gem.find_files, allows a gem to discover + features provided by other gems. + +2008-08-14 Wilson Bilkovich + + * lib/rubygems/source_index.rb: Deprecate options to 'search' other than + Gem::Dependency instances and issue warning until November 2008. + * lib/rubygems/platform.rb: Remove deprecated constant warnings + and really deprecate them. + * Rakefile: If the SETUP_OPTIONS environment variable is set, pass its + contents as arguments to setup.rb + * test/test_gem_commands_uninstall_command.rb: Added + +2008-08-13 Wilson Bilkovich + + * lib/rubygems/uninstaller.rb: Fix binary script uninstallation. + Bug #21234 by Neil Wilson. + * test/test_gem_commands_uninstall_command.rb: Added + +2008-08-12 Eric Hodel + + * lib/rubygems/installer.rb: Try to create directory before diverting + to ~/.gems. + * lib/rubygems/uninstaller.rb: Fix uninstallation with -i. Bug + #20812 by John Clayton. Have #remove_all call #uninstall_gem so hooks + get called. Bug #21242 by Neil Wilson. + * lib/rubygems/commands/update_command.rb: Fix updating RubyGems when + no previous rubygems-update is installed. Bug #20775 by Hemant Kumar. + +2008-08-11 Eric Hodel + + * lib/rubygems/remote_fetcher.rb: Fix HTTPS support. Patch #21072 by + Alex Arnell. Fix Not Modified handling. Bug #21310 by Gordon + Thiesfeld. + +2008-07-11 Luis Lavena + + * setup.rb: Properly build --destdir folder structure using Pathname. + * test/mockgemui.rb: Fix warnings about instance variables in a module. + +2008-07-02 Phil Hagelberg + + * lib/rubygems/defaults.rb: Add Gem.user_dir to use paths like + ~/.gem/ruby/1.8/gems and the like instead of just ~/.gem. Update + remote fetcher and installer to use it. + +2008-07-01 Eric Hodel + + * lib/rubygems/installer.rb: Add #gem_home, #bin_dir for hooks. Use + DependencyInstaller's source_index so reinstallation via -i does not + fail. + * lib/rubygems/uninstaller.rb: Add #gem_home, #bin_dir for hooks. + * lib/rubygems/commands/query_command.rb: Don't print LOCAL/REMOTE + gems if stdout is not a TTY. + * lib/rubygems/commands/query_command.rb: Use the regexp we already + have for `gem list --installed`. Bug #20876 by Nick Hoffman. + * lib/rubygems/commands/which_command.rb: Clarify what `gem which` is + for. + +2008-06-30 Eric Hodel + + * test/test_ext_configure_builder.rb: Locale-free patch by Yusuke + Endoh [ruby-core:17444]. + * lib/rubygems.rb: Add pre/post (un)install hooks. + * lib/rubygems/installer.rb: Call pre/post install hooks as + appropriate. + * lib/rubygems/uninstaller.rb: Call pre/post uninstall hooks as + appropriate. Minor refactoring of #uninstall. + * lib/rubygems/package/tar_reader.rb: Some OSs raise EINVAL on seek. + Based on patch in bug #20791 by Neil Wilson. + * lib/rubygems/specification.rb: Correctly check for support of + development dependencies for #to_ruby. Bug #20778 by Evan Weaver. + * lib/rubygems/spec_fetcher.rb: Correctly load all cache file even if + latest has been loaded. Bug #20776 by Uwe Kubosch. + +2008-06-25 Eric Hodel + + * lib/rubygems/config_file.rb: Add Gem::ConfigFile constants for + packagers and implementors to override defaults. + * test/*: Fixes to run tests when under test/rubygems/. Patch by + Yusuke ENDOH [ruby-core:17353]. + +2008-06-24 Eric Hodel + + * lib/rubygems/remote_fetcher.rb: Cleanup to support + if-modified-since requests. pair: Ryan Davis + * lib/rubygems/indexer: Force platform to Gem::Platform::RUBY when + nil or blank. Fixes various uninstallable gems. + +2008-06-24 Phil Hagelberg + + * lib/rubygems/installer.rb: Fall back on ~/.gem if GEM_HOME is + not writable. + * lib/rubygems/install_update_options.rb: Allow --user-install or + --no-user-install command-line switch to explicitly force whether + or not ~/.gem should be used. + * lib/rubygems/remote_fetcher.rb: Use ~/.gem/cache if cache dir is + not writable. + * test/gemutilities.rb: Use MockGemUi for all tests. + 2008-06-21 Eric Hodel * lib/rubygems/specification.rb: Load specifications from the future. diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/debian/changelog libgems-ruby-1.3.1/debian/changelog --- libgems-ruby-1.3.0~RC1really1.2.0/debian/changelog 2009-03-25 07:56:01.000000000 -0500 +++ libgems-ruby-1.3.1/debian/changelog 2009-03-25 07:56:02.000000000 -0500 @@ -1,42 +1,18 @@ -libgems-ruby (1.3.0~RC1really1.2.0-2ubuntu3) intrepid; urgency=low +libgems-ruby (1.3.1-1) experimental; urgency=low - * Add back a rubygems package, currently depending on rubygems1.8. Thanks - to Daigo Moriwaki and Simon Huerlimann. (LP: #284364) - - This is done in Debian 1.2.0-3. - - -- James Westby Fri, 17 Oct 2008 13:22:18 +0100 - -libgems-ruby (1.3.0~RC1really1.2.0-2ubuntu2) intrepid; urgency=low - - * Revert last upload. - - -- Stefan Potyra Sat, 30 Aug 2008 01:11:42 +0200 - -libgems-ruby (1.3.0~RC1-0ubuntu1) intrepid; urgency=low - - [ Neil Wilson ] - * Make alternatives respond to verbose option. - * Use a gem specific alternatives database. - * Add rubygems default package that points at rubygems1.8 - * debian/patches: 40_make_update_system_run_apt_get - make - 'update --system' call apt-get. Replaces 03_disable_update_system. - * Import from SVN to obtain hooks. - * Use defaults/operating_system.rb to enforce Debian standards. - * Use alternatives system to make gems available on PATH. - Closes LP: #145267. - * Move to CDBS simple patch system from dpatch. - * Remove tight ruby1.9 build dependency to allow backports. - * debian/patches: remove 21_avoid_ioseek - incorporated upstream. - * debian/patches: remove 01_default_gem_path - replaced by - debian/operating_system.rb. - * debian/patches: remove 08_tighter_regex_search - upstream now uses - a different search system that does not have the substring problem. - - [ Mathias Gug ] - * Sponsor to intrepid. - * Remove .cvsignore files. + * New upstream release + * Removed debian/patches/21_avoid_ioseek.dpatch - -- Mathias Gug Wed, 27 Aug 2008 12:40:08 -0400 + -- Daigo Moriwaki Wed, 19 Nov 2008 00:03:20 +0900 + +libgems-ruby (1.2.0-3) unstable; urgency=low + + * debian/control: + - `rubygems' is present again to provide a dependency + package referring to rubygems1.8. + - Bumped up Standards-Version to 3.8.0: used ${binary:Version} instread. + + -- Daigo Moriwaki Sun, 31 Aug 2008 23:56:21 +0900 libgems-ruby (1.2.0-2) unstable; urgency=low diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/debian/control libgems-ruby-1.3.1/debian/control --- libgems-ruby-1.3.0~RC1really1.2.0/debian/control 2009-03-25 07:56:01.000000000 -0500 +++ libgems-ruby-1.3.1/debian/control 2009-03-25 07:56:02.000000000 -0500 @@ -1,19 +1,20 @@ Source: libgems-ruby Section: interpreters Priority: optional -Maintainer: Ubuntu MOTU Developers -XSBC-Original-Maintainer: Daigo Moriwaki +Maintainer: Daigo Moriwaki Uploaders: Debian Ruby Extras Maintainers Build-Depends: cdbs, dpatch (>= 2.0.10), debhelper (>= 4.0.0), ruby1.8, rdoc1.8, ruby1.9 (>= 1.9.0.1-5), rdoc1.9, ruby-pkg-tools -Standards-Version: 3.7.3 +Standards-Version: 3.8.0 Homepage: http://rubygems.org/ +Vcs-Svn: svn://svn.debian.org/svn/pkg-ruby-extras/packages/libgems-ruby +Vcs-Browser: http://svn.debian.org/wsvn/pkg-ruby-extras/packages/libgems-ruby Package: rubygems1.8 Architecture: all Depends: ruby1.8, rdoc1.8 Suggests: ruby1.8-dev, build-essential, rubygems-doc -Conflicts: libgems-ruby1.8, rubygems (<= 1.3.0~RC1really1.2.0-2ubuntu2) -Replaces: libgems-ruby1.8, rubygems +Conflicts: libgems-ruby1.8, rubygems (<= 1.2.0-2) +Replaces: libgems-ruby1.8 Description: package management framework for Ruby libraries/applications This is a way to package Ruby libraries/applications for distribution. RubyGems provides the ability to manage concurrent versions of libraries and diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/debian/patches/00list libgems-ruby-1.3.1/debian/patches/00list --- libgems-ruby-1.3.0~RC1really1.2.0/debian/patches/00list 2009-03-25 07:56:01.000000000 -0500 +++ libgems-ruby-1.3.1/debian/patches/00list 2009-03-25 07:56:02.000000000 -0500 @@ -1,6 +1,5 @@ 01_default_gem_path.dpatch 03_disable_update_system.dpatch 08_tighter_search_regex.dpatch -21_avoid_ioseek.dpatch #05_gem_commands.dpatch #09_installer.dpatch diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/debian/patches/01_default_gem_path.dpatch libgems-ruby-1.3.1/debian/patches/01_default_gem_path.dpatch --- libgems-ruby-1.3.0~RC1really1.2.0/debian/patches/01_default_gem_path.dpatch 2009-03-25 07:56:01.000000000 -0500 +++ libgems-ruby-1.3.1/debian/patches/01_default_gem_path.dpatch 2009-03-25 07:56:02.000000000 -0500 @@ -6,38 +6,38 @@ @DPATCH@ diff -urNad trunk~/lib/rubygems/defaults.rb trunk/lib/rubygems/defaults.rb ---- trunk~/lib/rubygems/defaults.rb 2008-03-09 12:42:07.000000000 +0900 -+++ trunk/lib/rubygems/defaults.rb 2008-05-10 16:07:33.000000000 +0900 -@@ -7,16 +7,14 @@ - +--- trunk~/lib/rubygems/defaults.rb 2008-10-11 05:29:53.000000000 +0900 ++++ trunk/lib/rubygems/defaults.rb 2008-11-19 09:05:38.000000000 +0900 +@@ -15,15 +15,15 @@ + ## # Default home directory path to be used if an alternate value is not - # specified in the environment. + # specified in the environment + # + # Debian patch: search order of this directory. + # 1. GEM_HOME enviroment variable + # (Using this, Gems are to be installed in any path as you like) + # 2. /var/lib/gems/{ruby version} (This is the default path in Debian system) + # + def self.default_dir - if defined? RUBY_FRAMEWORK_VERSION then - File.join File.dirname(ConfigMap[:sitedir]), 'Gems', - ConfigMap[:ruby_version] -- elsif defined? RUBY_ENGINE then -- File.join ConfigMap[:libdir], RUBY_ENGINE, 'gems', -- ConfigMap[:ruby_version] - else -- File.join ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version] +- File.join(ConfigMap[:libdir], ruby_engine, 'gems', +- ConfigMap[:ruby_version]) - end + File.join('/', 'var', 'lib', 'gems', ConfigMap[:ruby_version]) end - # Default gem path. -@@ -31,12 +29,10 @@ - end + ## +@@ -51,13 +51,11 @@ + ## # The default directory for binaries + # Debian patch: + # /var/lib/gems/{ruby version}/bin is the default path in Debian system + def self.default_bindir - if defined? RUBY_FRAMEWORK_VERSION then # mac framework support - '/usr/bin' @@ -47,4 +47,4 @@ + File.join('/', 'var', 'lib', 'gems', ConfigMap[:ruby_version], 'bin') end - # The default system-wide source info cache directory. + ## diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/debian/patches/03_disable_update_system.dpatch libgems-ruby-1.3.1/debian/patches/03_disable_update_system.dpatch --- libgems-ruby-1.3.0~RC1really1.2.0/debian/patches/03_disable_update_system.dpatch 2009-03-25 07:56:01.000000000 -0500 +++ libgems-ruby-1.3.1/debian/patches/03_disable_update_system.dpatch 2009-03-25 07:56:02.000000000 -0500 @@ -6,11 +6,11 @@ @DPATCH@ diff -urNad trunk~/lib/rubygems/commands/update_command.rb trunk/lib/rubygems/commands/update_command.rb ---- trunk~/lib/rubygems/commands/update_command.rb 2008-04-08 06:32:28.000000000 +0900 -+++ trunk/lib/rubygems/commands/update_command.rb 2008-05-10 15:38:29.000000000 +0900 -@@ -47,13 +47,7 @@ +--- trunk~/lib/rubygems/commands/update_command.rb 2008-10-11 06:24:10.000000000 +0900 ++++ trunk/lib/rubygems/commands/update_command.rb 2008-11-19 09:15:18.000000000 +0900 +@@ -48,18 +48,7 @@ + hig = {} - def execute if options[:system] then - say "Updating RubyGems" - @@ -18,8 +18,13 @@ - fail "No gem names are allowed with the --system option" - end - -- options[:args] = ["rubygems-update"] +- rubygems_update = Gem::Specification.new +- rubygems_update.name = 'rubygems-update' +- rubygems_update.version = Gem::Version.new Gem::RubyGemsVersion +- hig['rubygems-update'] = rubygems_update +- +- options[:user_install] = false + fail "gem update --system is disabled on Debian. RubyGems can be updated using the official Debian repositories by aptitude or apt-get." else say "Updating installed gems" - end + diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/debian/patches/21_avoid_ioseek.dpatch libgems-ruby-1.3.1/debian/patches/21_avoid_ioseek.dpatch --- libgems-ruby-1.3.0~RC1really1.2.0/debian/patches/21_avoid_ioseek.dpatch 2009-03-25 07:56:01.000000000 -0500 +++ libgems-ruby-1.3.1/debian/patches/21_avoid_ioseek.dpatch 1969-12-31 18:00:00.000000000 -0600 @@ -1,34 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 21_avoid_ioseek.dpatch by Daigo Moriwaki -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: A work around for Bug#406388. - -@DPATCH@ -diff -urNad trunk~/lib/rubygems/package/tar_reader.rb trunk/lib/rubygems/package/tar_reader.rb ---- trunk~/lib/rubygems/package/tar_reader.rb 2008-02-29 17:55:01.000000000 +0900 -+++ trunk/lib/rubygems/package/tar_reader.rb 2008-05-10 15:44:05.000000000 +0900 -@@ -47,10 +47,10 @@ - - skip = (512 - (size % 512)) % 512 - -- if @io.respond_to? :seek then -- # avoid reading... -- @io.seek(size - entry.bytes_read, IO::SEEK_CUR) -- else -+ #if @io.respond_to? :seek then -+ # # avoid reading... -+ # @io.seek(size - entry.bytes_read, IO::SEEK_CUR) -+ #else - pending = size - entry.bytes_read - - while pending > 0 do -@@ -58,7 +58,7 @@ - raise UnexpectedEOF if @io.eof? - pending -= bread - end -- end -+ #end - - @io.read skip # discard trailing zeros - Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._docs-rubygems-announce.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._docs-rubygems-announce.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_2_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_2_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_3_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_3_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_4_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_4_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_5_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_5_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_6_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_6_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_7_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_7_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_8_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_8_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_8_10.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_8_10.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_8_11.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_8_11.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_8_1.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_8_1.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_8_3.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_8_3.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_8_4.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_8_4.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_8_5.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_8_5.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_8_7.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_8_7.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_9_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_9_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_9_2.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_9_2.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_9_3.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_9_3.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_9_4.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_9_4.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_0_9_5.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_0_9_5.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_1_0_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_1_0_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_1_0_1.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_1_0_1.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_1_1_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_1_1_0.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_1_1_1.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_1_1_1.rdoc differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/._rel_1_2_0.rdoc and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/doc/release_notes/._rel_1_2_0.rdoc differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/rel_1_3_0.rdoc libgems-ruby-1.3.1/doc/release_notes/rel_1_3_0.rdoc --- libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/rel_1_3_0.rdoc 1969-12-31 18:00:00.000000000 -0600 +++ libgems-ruby-1.3.1/doc/release_notes/rel_1_3_0.rdoc 2008-09-24 21:59:01.000000000 -0500 @@ -0,0 +1,125 @@ += Announce: RubyGems Release 1.3.0 + +Release 1.3.0 adds new features and fixes some bugs. + +New features: + +* RubyGems doesn't print LOCAL/REMOTE titles for `gem query` and friends if + stdout is not a TTY, except with --both. +* Added Gem.find_files, allows a gem to discover features provided by other + gems. +* Added pre/post (un)install hooks for packagers of RubyGems. (Not for gems + themselves). +* RubyGems now installs gems into ~/.gem if GEM_HOME is not writable. Use + --no-user-install command-line switch to disable this behavior. +* Fetching specs for update now uses If-Modified-Since requests. +* RubyGems now updates the ri cache when the rdoc gem is installed and + documentation is generated. + +Deprecation Notices: + +* Gem::manage_gems now warns when called. It will be removed on or after March + 2009. + +Bugs Fixed: + +* RubyGems 1.3.0+ now updates when no previous rubygems-update is installed. + Bug #20775 by Hemant Kumar. +* RubyGems now uses the regexp we already have for `gem list --installed`. Bug + #20876 by Nick Hoffman. +* Platform is now forced to Gem::Platform::RUBY when nil or blank in the + indexer. Fixes various uninstallable gems. +* Handle EINVAL on seek. Based on patch in bug #20791 by Neil Wilson. +* Fix HTTPS support. Patch #21072 by Alex Arnell. +* RubyGems now loads all cache files even if latest has been loaded. Bug + #20776 by Uwe Kubosch. +* RubyGems checks for support of development dependencies for #to_ruby. Bug + #20778 by Evan Weaver. +* Now specifications from the future can be loaded. +* Binary script uninstallation fixed. Bug #21234 by Neil Wilson. +* Uninstallation with -i fixed. Bug #20812 by John Clayton. +* Gem::Uninstaller#remove_all now calls Gem::Uninstaller#uninstall_gem so hooks + get called. Bug #21242 by Neil Wilson. +* Gem.ruby now properly escaped on windows. Fixes problem with extension + compilation. +* `gem lock --strict` works again. Patch #21814 by Sven Engelhardt. +* Platform detection for Solaris was improved. Patch #21911 by Bob Remeika. + +Other Changes Include: + +* `gem help install` now describes _version_ argument to executable stubs +* `gem help environment` describes environment variables and ~/.gemrc and + /etc/gemrc +* On-disk gemspecs are now read in UTF-8 and written with a UTF-8 magic comment +* Rakefile + * If the SETUP_OPTIONS environment variable is set, pass its contents as + arguments to setup.rb +* lib/rubygems/platform.rb + * Remove deprecated constant warnings and really deprecate them. (WIN32, + etc). +* lib/rubygems/remote_fetcher.rb + * Now uses ~/.gem/cache if the cache dir in GEM_HOME is not writable. +* lib/rubygems/source_index.rb + * Deprecate options to 'search' other than Gem::Dependency instances and + issue warning until November 2008. +* setup.rb + * --destdir folder structure now built using Pathname, so it works for + Windows platforms. +* test/* + * Fixes to run tests when under test/rubygems/. Patch by Yusuke ENDOH + [ruby-core:17353]. +* test/test_ext_configure_builder.rb + * Locale-free patch by Yusuke Endoh [ruby-core:17444]. + +For a full list of changes to RubyGems and the contributor for each change, see +the ChangeLog file. + +Special thanks to Chad Wooley for backwards compatibility testing and Luis +Lavena for continuing windows support. + +== How can I get RubyGems? + +NOTE: If you have installed RubyGems using a package system you may want to +install a new RubyGems through the same packaging system. + +If you have a recent version of RubyGems (0.8.5 or later), then all +you need to do is: + + $ gem update --system (you might need to be admin/root) + +NOTE: RubyGems 1.1 and 1.2 have problems upgrading when there is no +rubygems-update installed. You will need to follow the second set of update +instructions if you see "Nothing to update". + +NOTE: You may have to run the command twice if you have any previosly +installed rubygems-update gems. + +If you have an older version of RubyGems installed, then you can still +do it in two steps: + + $ gem install rubygems-update (again, might need to be admin/root) + $ update_rubygems (... here too) + +If you don't have any gems install, there is still the pre-gem +approach to getting software ... doing it manually: + +1. DOWNLOAD FROM: http://rubyforge.org/frs/?group_id=126 +2. UNPACK INTO A DIRECTORY AND CD THERE +3. INSTALL WITH: ruby setup.rb (you may need admin/root privilege) + +== To File Bugs + +The RubyGems bug tracker can be found on RubyForge at: +http://rubyforge.org/tracker/?func=add&group_id=126&atid=575 + +When filing a bug, `gem env` output will be helpful in diagnosing the issue. + +If you find a bug where RubyGems crashes, please provide debug output. You can +do that with `gem --debug the_command`. + +== Thanks + +Keep those gems coming! + +-- Jim & Chad & Eric (for the RubyGems team) + diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/rel_1_3_1.rdoc libgems-ruby-1.3.1/doc/release_notes/rel_1_3_1.rdoc --- libgems-ruby-1.3.0~RC1really1.2.0/doc/release_notes/rel_1_3_1.rdoc 1969-12-31 18:00:00.000000000 -0600 +++ libgems-ruby-1.3.1/doc/release_notes/rel_1_3_1.rdoc 2008-10-25 17:10:05.000000000 -0500 @@ -0,0 +1,75 @@ += Announce: RubyGems Release 1.3.0 + +NOTE: RubyGems 1.1 and 1.2 have problems upgrading when there is no +rubygems-update installed. You will need to follow the second set of update +instructions if you see "Nothing to update". + +Release 1.3.0 fixes some bugs. + +Bugs fixed: + +* Disregard ownership of ~ under Windows while creating ~/.gem. Fixes + issues related to no uid support under Windows. +* Fix requires for Gem::inflate, Gem::deflate, etc. +* Make Gem.dir respect :gemhome value from config. (Note: this feature may be + removed since it is hard to implement on 1.9.) +* Kernel methods are now private. Patch #20801 by Stefan Rusterholz. +* Gem::location_of_caller now behaves on Windows. Patch by Daniel Berger. +* Silence PATH warning. + +Deprecation Notices: + +* Gem::manage_gems will be removed on or after March 2009. + +For a full list of changes to RubyGems and the contributor for each change, see +the ChangeLog file. + +Special thanks to Chad Wooley for backwards compatibility testing and Luis +Lavena for continuing windows support. + +== How can I get RubyGems? + +NOTE: If you have installed RubyGems using a package system you may want to +install a new RubyGems through the same packaging system. + +If you have a recent version of RubyGems (0.8.5 or later), then all +you need to do is: + + $ gem update --system (you might need to be admin/root) + +NOTE: RubyGems 1.1 and 1.2 have problems upgrading when there is no +rubygems-update installed. You will need to follow the second set of update +instructions if you see "Nothing to update". + +NOTE: You may have to run the command twice if you have any previosly +installed rubygems-update gems. + +If you have an older version of RubyGems installed, then you can still +do it in two steps: + + $ gem install rubygems-update (again, might need to be admin/root) + $ update_rubygems (... here too) + +If you don't have any gems install, there is still the pre-gem +approach to getting software ... doing it manually: + +1. DOWNLOAD FROM: http://rubyforge.org/frs/?group_id=126 +2. UNPACK INTO A DIRECTORY AND CD THERE +3. INSTALL WITH: ruby setup.rb (you may need admin/root privilege) + +== To File Bugs + +The RubyGems bug tracker can be found on RubyForge at: +http://rubyforge.org/tracker/?func=add&group_id=126&atid=575 + +When filing a bug, `gem env` output will be helpful in diagnosing the issue. + +If you find a bug where RubyGems crashes, please provide debug output. You can +do that with `gem --debug the_command`. + +== Thanks + +Keep those gems coming! + +-- Jim & Chad & Eric (for the RubyGems team) + Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/._.document and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/._.document differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/._GPL.txt and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/._GPL.txt differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rbconfig/._datadir.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rbconfig/._datadir.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._builder.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._builder.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._command_manager.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._command_manager.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._command.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._build_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._build_command.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._cert_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._cert_command.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/check_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/check_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/check_command.rb 2007-11-09 20:24:00.000000000 -0600 +++ libgems-ruby-1.3.1/lib/rubygems/commands/check_command.rb 2008-10-09 19:03:27.000000000 -0500 @@ -31,7 +31,8 @@ def execute if options[:test] version = options[:version] || Gem::Requirement.default - gem_spec = Gem::SourceIndex.from_installed_gems.search(get_one_gem_name, version).first + dep = Gem::Dependency.new get_one_gem_name, version + gem_spec = Gem::SourceIndex.from_installed_gems.search(dep).first Gem::Validator.new.unit_test(gem_spec) end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._cleanup_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._cleanup_command.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/contents_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/contents_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/contents_command.rb 2007-09-23 19:43:02.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/contents_command.rb 2008-08-14 17:57:27.000000000 -0500 @@ -51,7 +51,7 @@ si = Gem::SourceIndex.from_gems_in(*s) - gem_spec = si.search(/\A#{gem}\z/, version).last + gem_spec = si.find_name(gem, version).last unless gem_spec then say "Unable to find gem '#{gem}' in #{path_kind}" Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._dependency_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._dependency_command.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/environment_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/environment_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/environment_command.rb 2008-06-09 13:38:56.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/environment_command.rb 2008-09-17 11:21:42.000000000 -0500 @@ -18,6 +18,46 @@ return args.gsub(/^\s+/, '') end + def description # :nodoc: + <<-EOF +The RubyGems environment can be controlled through command line arguments, +gemrc files, environment variables and built-in defaults. + +Command line argument defaults and some RubyGems defaults can be set in +~/.gemrc file for individual users and a /etc/gemrc for all users. A gemrc +is a YAML file with the following YAML keys: + + :sources: A YAML array of remote gem repositories to install gems from + :verbose: Verbosity of the gem command. false, true, and :really are the + levels + :update_sources: Enable/disable automatic updating of repository metadata + :backtrace: Print backtrace when RubyGems encounters an error + :bulk_threshold: Switch to a bulk update when this many sources are out of + date (legacy setting) + :gempath: The paths in which to look for gems + gem_command: A string containing arguments for the specified gem command + +Example: + + :verbose: false + install: --no-wrappers + update: --no-wrappers + +RubyGems' default local repository can be overriden with the GEM_PATH and +GEM_HOME environment variables. GEM_HOME sets the default repository to +install into. GEM_PATH allows multiple local repositories to be searched for +gems. + +If you are behind a proxy server, RubyGems uses the HTTP_PROXY, +HTTP_PROXY_USER and HTTP_PROXY_PASS environment variables to discover the +proxy server. + +If you are packaging RubyGems all of RubyGems' defaults are in +lib/rubygems/defaults.rb. You may override these in +lib/rubygems/defaults/operating_system.rb + EOF + end + def usage # :nodoc: "#{program_name} [arg]" end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._fetch_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._fetch_command.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._help_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._help_command.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/help_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/help_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/help_command.rb 2008-06-17 03:19:22.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/help_command.rb 2008-07-02 17:59:32.000000000 -0500 @@ -20,9 +20,9 @@ gem install --remote rake --test --rdoc --ri * Install 'rake', but only version 0.3.1, even if dependencies - are not met, and into a specific directory: + are not met, and into a user-specific directory: - gem install rake --version 0.3.1 --force --install-dir $HOME/.gems + gem install rake --version 0.3.1 --force --user-install * List local gems whose name begins with 'D': diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/install_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/install_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/install_command.rb 2008-06-20 15:05:41.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/install_command.rb 2008-09-10 16:55:28.000000000 -0500 @@ -38,6 +38,19 @@ "--no-test --install-dir #{Gem.dir}" end + def description # :nodoc: + <<-EOF +The install command installs local or remote gem into a gem repository. + +For gems with executables ruby installs a wrapper file into the executable +directory by deault. This can be overridden with the --no-wrappers option. +The wrapper allows you to choose among alternate gem versions using _version_. + +For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer +version is also installed. + EOF + end + def usage # :nodoc: "#{program_name} GEMNAME [GEMNAME ...] [options] -- --build-flags" end @@ -106,6 +119,8 @@ installed_gems.each do |gem| Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri end + + Gem::DocManager.update_ri_cache end if options[:generate_rdoc] then Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._list_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._list_command.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/lock_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/lock_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/lock_command.rb 2008-05-06 21:15:51.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/lock_command.rb 2008-09-15 23:19:11.000000000 -0500 @@ -58,15 +58,15 @@ end def complain(message) - if options.strict then - raise message + if options[:strict] then + raise Gem::Exception, message else say "# #{message}" end end def execute - say 'require "rubygems"' + say "require 'rubygems'" locked = {} @@ -77,15 +77,20 @@ spec = Gem::SourceIndex.load_specification spec_path(full_name) + if spec.nil? then + complain "Could not find gem #{full_name}, try using the full name" + next + end + say "gem '#{spec.name}', '= #{spec.version}'" unless locked[spec.name] locked[spec.name] = true spec.runtime_dependencies.each do |dep| next if locked[dep.name] - candidates = Gem.source_index.search dep.name, dep.requirement_list + candidates = Gem.source_index.search dep if candidates.empty? then - complain "Unable to satisfy '#{dep}' from currently installed gems." + complain "Unable to satisfy '#{dep}' from currently installed gems" else pending << candidates.last.full_name end @@ -94,7 +99,11 @@ end def spec_path(gem_full_name) - File.join Gem.path, "specifications", "#{gem_full_name }.gemspec" + gemspecs = Gem.path.map do |path| + File.join path, "specifications", "#{gem_full_name}.gemspec" + end + + gemspecs.find { |gemspec| File.exist? gemspec } end end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._mirror_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._mirror_command.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/outdated_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/outdated_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/outdated_command.rb 2008-06-04 16:53:41.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/outdated_command.rb 2008-08-14 17:57:27.000000000 -0500 @@ -19,7 +19,7 @@ locals = Gem::SourceIndex.from_installed_gems locals.outdated.sort.each do |name| - local = locals.search(/^#{name}$/).last + local = locals.find_name(name).last dep = Gem::Dependency.new local.name, ">= #{local.version}" remotes = Gem::SpecFetcher.fetcher.fetch dep diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/pristine_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/pristine_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/pristine_command.rb 2008-06-06 19:07:17.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/pristine_command.rb 2008-08-14 17:57:27.000000000 -0500 @@ -57,7 +57,7 @@ end else gem_name = get_one_gem_name - Gem::SourceIndex.from_installed_gems.search(gem_name, + Gem::SourceIndex.from_installed_gems.find_name(gem_name, options[:version]) end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/query_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/query_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/query_command.rb 2008-06-21 15:46:49.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/query_command.rb 2008-08-16 17:03:45.000000000 -0500 @@ -59,7 +59,7 @@ if name.source.empty? then alert_error "You must specify a gem name" exit_code |= 4 - elsif installed? name.source, options[:version] then + elsif installed? name, options[:version] then say "true" else say "false" @@ -69,12 +69,16 @@ raise Gem::SystemExitException, exit_code end + dep = Gem::Dependency.new name, Gem::Requirement.default + if local? then - say - say "*** LOCAL GEMS ***" - say + if ui.outs.tty? or both? then + say + say "*** LOCAL GEMS ***" + say + end - specs = Gem.source_index.search name + specs = Gem.source_index.search dep spec_tuples = specs.map do |spec| [[spec.name, spec.version, spec.original_platform, spec], :local] @@ -84,13 +88,14 @@ end if remote? then - say - say "*** REMOTE GEMS ***" - say + if ui.outs.tty? or both? then + say + say "*** REMOTE GEMS ***" + say + end all = options[:all] - dep = Gem::Dependency.new name, Gem::Requirement.default begin fetcher = Gem::SpecFetcher.fetcher spec_tuples = fetcher.find_matching dep, all, false diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/rdoc_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/rdoc_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/rdoc_command.rb 2007-09-23 19:46:56.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/rdoc_command.rb 2008-09-10 18:16:59.000000000 -0500 @@ -59,11 +59,15 @@ if specs.empty? fail "Failed to find gem #{gem_name} to generate RDoc for #{options[:version]}" end + if options[:include_ri] specs.each do |spec| Gem::DocManager.new(spec).generate_ri end + + Gem::DocManager.update_ri_cache end + if options[:include_rdoc] specs.each do |spec| Gem::DocManager.new(spec).generate_rdoc @@ -73,6 +77,6 @@ true end end - + end end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._search_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._search_command.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._server_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._server_command.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._sources_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._sources_command.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/specification_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/specification_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/specification_command.rb 2008-05-23 15:49:20.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/specification_command.rb 2008-08-14 17:57:27.000000000 -0500 @@ -40,6 +40,7 @@ def execute specs = [] gem = get_one_gem_name + dep = Gem::Dependency.new gem, options[:version] if local? then if File.exist? gem then @@ -47,12 +48,11 @@ end if specs.empty? then - specs.push(*Gem.source_index.search(/\A#{gem}\z/, options[:version])) + specs.push(*Gem.source_index.search(dep)) end end if remote? then - dep = Gem::Dependency.new gem, options[:version] found = Gem::SpecFetcher.fetcher.fetch dep specs.push(*found.map { |spec,| spec }) Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._stale_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._stale_command.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._uninstall_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._uninstall_command.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/unpack_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/unpack_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/unpack_command.rb 2008-02-23 21:32:12.000000000 -0600 +++ libgems-ruby-1.3.1/lib/rubygems/commands/unpack_command.rb 2008-10-10 13:23:08.000000000 -0500 @@ -43,7 +43,7 @@ basename = File.basename(path).sub(/\.gem$/, '') target_dir = File.expand_path File.join(options[:target], basename) FileUtils.mkdir_p target_dir - Gem::Installer.new(path).unpack target_dir + Gem::Installer.new(path, :unpack => true).unpack target_dir say "Unpacked gem: '#{target_dir}'" else alert_error "Gem '#{gemname}' not installed." @@ -68,7 +68,7 @@ def get_path(gemname, version_req) return gemname if gemname =~ /\.gem$/i - specs = Gem::source_index.search(/\A#{gemname}\z/, version_req) + specs = Gem::source_index.find_name gemname, version_req selected = specs.sort_by { |s| s.version }.last diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/update_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/update_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/update_command.rb 2008-06-09 17:49:12.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/update_command.rb 2008-10-10 16:24:10.000000000 -0500 @@ -45,6 +45,8 @@ end def execute + hig = {} + if options[:system] then say "Updating RubyGems" @@ -52,16 +54,21 @@ fail "No gem names are allowed with the --system option" end - options[:args] = ["rubygems-update"] + rubygems_update = Gem::Specification.new + rubygems_update.name = 'rubygems-update' + rubygems_update.version = Gem::Version.new Gem::RubyGemsVersion + hig['rubygems-update'] = rubygems_update + + options[:user_install] = false else say "Updating installed gems" - end - hig = {} # highest installed gems + hig = {} # highest installed gems - Gem.source_index.each do |name, spec| - if hig[spec.name].nil? or hig[spec.name].version < spec.version then - hig[spec.name] = spec + Gem.source_index.each do |name, spec| + if hig[spec.name].nil? or hig[spec.name].version < spec.version then + hig[spec.name] = spec + end end end @@ -84,14 +91,14 @@ end if gems_to_update.include? "rubygems-update" then - latest_ruby_gem = remote_gemspecs.select do |s| - s.name == 'rubygems-update' - end + Gem.source_index.refresh! + + update_gems = Gem.source_index.search 'rubygems-update' - latest_ruby_gem = latest_ruby_gem.sort_by { |s| s.version }.last + latest_update_gem = update_gems.sort_by { |s| s.version }.last - say "Updating version of RubyGems to #{latest_ruby_gem.version}" - installed = do_rubygems_update latest_ruby_gem.version + say "Updating RubyGems to #{latest_update_gem.version}" + installed = do_rubygems_update latest_update_gem.version say "RubyGems system software updated" if installed else @@ -103,6 +110,9 @@ end end + ## + # Update the RubyGems software to +version+. + def do_rubygems_update(version) args = [] args.push '--prefix', Gem.prefix unless Gem.prefix.nil? @@ -112,8 +122,6 @@ update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}" - success = false - Dir.chdir update_dir do say "Installing RubyGems #{version}" setup_cmd = "#{Gem.ruby} setup.rb #{args.join ' '}" Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/._which_command.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/commands/._which_command.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/which_command.rb libgems-ruby-1.3.1/lib/rubygems/commands/which_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/commands/which_command.rb 2007-09-22 17:54:41.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/commands/which_command.rb 2008-07-01 18:25:15.000000000 -0500 @@ -3,10 +3,10 @@ class Gem::Commands::WhichCommand < Gem::Command - EXT = %w[.rb .rbw .so .dll] # HACK + EXT = %w[.rb .rbw .so .dll .bundle] # HACK def initialize - super 'which', 'Find the location of a library', + super 'which', 'Find the location of a library file you can require', :search_gems_first => false, :show_all => false add_option '-a', '--[no-]all', 'show all matching files' do |show_all, options| @@ -52,7 +52,7 @@ paths = find_paths arg, dirs if paths.empty? then - say "Can't find #{arg}" + say "Can't find ruby library file or shared library #{arg}" else say paths end @@ -84,3 +84,4 @@ end end + diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/config_file.rb libgems-ruby-1.3.1/lib/rubygems/config_file.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/config_file.rb 2008-06-18 03:25:20.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/config_file.rb 2008-10-03 12:07:02.000000000 -0500 @@ -18,6 +18,18 @@ DEFAULT_VERBOSITY = true DEFAULT_UPDATE_SOURCES = true + ## + # For Ruby packagers to set configuration defaults. Set in + # rubygems/defaults/operating_system.rb + + OPERATING_SYSTEM_DEFAULTS = {} + + ## + # For Ruby implementers to set configuration defaults. Set in + # rubygems/defaults/#{RUBY_ENGINE}.rb + + PLATFORM_DEFAULTS = {} + system_config_path = begin require 'Win32API' @@ -37,6 +49,11 @@ # List of arguments supplied to the config file object. attr_reader :args + # Where to look for gems + attr_accessor :path + + attr_accessor :home + # True if we print backtraces on errors. attr_writer :backtrace @@ -98,16 +115,24 @@ @verbose = DEFAULT_VERBOSITY @update_sources = DEFAULT_UPDATE_SOURCES - @hash = load_file(SYSTEM_WIDE_CONFIG_FILE) - @hash.merge!(load_file(config_file_name.dup.untaint)) + operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS) + platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS) + system_config = load_file SYSTEM_WIDE_CONFIG_FILE + user_config = load_file config_file_name.dup.untaint + + @hash = operating_system_config.merge platform_config + @hash = @hash.merge system_config + @hash = @hash.merge user_config # HACK these override command-line args, which is bad @backtrace = @hash[:backtrace] if @hash.key? :backtrace @benchmark = @hash[:benchmark] if @hash.key? :benchmark @bulk_threshold = @hash[:bulk_threshold] if @hash.key? :bulk_threshold - Gem.sources.replace @hash[:sources] if @hash.key? :sources + Gem.sources = @hash[:sources] if @hash.key? :sources @verbose = @hash[:verbose] if @hash.key? :verbose @update_sources = @hash[:update_sources] if @hash.key? :update_sources + @path = @hash[:gempath] if @hash.key? :gempath + @home = @hash[:gemhome] if @hash.key? :gemhome handle_arguments arg_list end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/custom_require.rb libgems-ruby-1.3.1/lib/rubygems/custom_require.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/custom_require.rb 2008-05-06 21:15:51.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/custom_require.rb 2008-10-25 16:07:37.000000000 -0500 @@ -7,11 +7,15 @@ require 'rubygems' module Kernel - alias gem_original_require require # :nodoc: - # - # We replace Ruby's require with our own, which is capable of - # loading gems on demand. + ## + # The Kernel#require from before RubyGems was loaded. + + alias gem_original_require require + + ## + # When RubyGems is required, Kernel#require is replaced with our own which + # is capable of loading gems on demand. # # When you call require 'x', this is what happens: # * If the file can be loaded from the existing Ruby loadpath, it @@ -22,8 +26,8 @@ # # The normal require functionality of returning false if # that file has already been loaded is preserved. - # - def require(path) # :nodoc: + + def require(path) # :doc: gem_original_require path rescue LoadError => load_error if load_error.message =~ /#{Regexp.escape path}\z/ and @@ -34,5 +38,9 @@ raise load_error end end -end # module Kernel + + private :require + private :gem_original_require + +end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/defaults.rb libgems-ruby-1.3.1/lib/rubygems/defaults.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/defaults.rb 2008-06-04 21:34:47.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/defaults.rb 2008-10-10 15:29:53.000000000 -0500 @@ -1,36 +1,57 @@ module Gem - # An Array of the default sources that come with RubyGems. + @post_install_hooks ||= [] + @post_uninstall_hooks ||= [] + @pre_uninstall_hooks ||= [] + @pre_install_hooks ||= [] + + ## + # An Array of the default sources that come with RubyGems + def self.default_sources %w[http://gems.rubyforge.org/] end + ## # Default home directory path to be used if an alternate value is not - # specified in the environment. + # specified in the environment + def self.default_dir if defined? RUBY_FRAMEWORK_VERSION then File.join File.dirname(ConfigMap[:sitedir]), 'Gems', ConfigMap[:ruby_version] - elsif defined? RUBY_ENGINE then - File.join ConfigMap[:libdir], RUBY_ENGINE, 'gems', - ConfigMap[:ruby_version] else - File.join ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version] + File.join(ConfigMap[:libdir], ruby_engine, 'gems', + ConfigMap[:ruby_version]) end end - # Default gem path. + ## + # Path for gems in the user's home directory + + def self.user_dir + File.join(Gem.user_home, '.gem', ruby_engine, + ConfigMap[:ruby_version]) + end + + ## + # Default gem load path + def self.default_path - default_dir + [user_dir, default_dir] end - # Deduce Ruby's --program-prefix and --program-suffix from its install name. + ## + # Deduce Ruby's --program-prefix and --program-suffix from its install name + def self.default_exec_format baseruby = ConfigMap[:BASERUBY] || 'ruby' ConfigMap[:RUBY_INSTALL_NAME].sub(baseruby, '%s') rescue '%s' end + ## # The default directory for binaries + def self.default_bindir if defined? RUBY_FRAMEWORK_VERSION then # mac framework support '/usr/bin' @@ -39,15 +60,30 @@ end end - # The default system-wide source info cache directory. + ## + # The default system-wide source info cache directory + def self.default_system_source_cache_dir File.join Gem.dir, 'source_cache' end - # The default user-specific source info cache directory. + ## + # The default user-specific source info cache directory + def self.default_user_source_cache_dir File.join Gem.user_home, '.gem', 'source_cache' end + ## + # A wrapper around RUBY_ENGINE const that may not be defined + + def self.ruby_engine + if defined? RUBY_ENGINE then + RUBY_ENGINE + else + 'ruby' + end + end + end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/dependency_installer.rb libgems-ruby-1.3.1/lib/rubygems/dependency_installer.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/dependency_installer.rb 2008-06-20 14:55:40.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/dependency_installer.rb 2008-08-12 16:50:22.000000000 -0500 @@ -38,9 +38,17 @@ # :ignore_dependencies:: Don't install any dependencies. # :install_dir:: See Gem::Installer#install. # :security_policy:: See Gem::Installer::new and Gem::Security. + # :user_install:: See Gem::Installer.new # :wrappers:: See Gem::Installer::new def initialize(options = {}) + if options[:install_dir] then + spec_dir = options[:install_dir], 'specifications' + @source_index = Gem::SourceIndex.from_gems_in spec_dir + else + @source_index = Gem.source_index + end + options = DEFAULT_OPTIONS.merge options @bin_dir = options[:bin_dir] @@ -51,19 +59,13 @@ @format_executable = options[:format_executable] @ignore_dependencies = options[:ignore_dependencies] @security_policy = options[:security_policy] + @user_install = options[:user_install] @wrappers = options[:wrappers] @installed_gems = [] @install_dir = options[:install_dir] || Gem.dir @cache_dir = options[:cache_dir] || @install_dir - - if options[:install_dir] then - spec_dir = File.join @install_dir, 'specifications' - @source_index = Gem::SourceIndex.from_gems_in spec_dir - else - @source_index = Gem.source_index - end end ## @@ -232,15 +234,17 @@ end inst = Gem::Installer.new local_gem_path, - :env_shebang => @env_shebang, - :force => @force, - :format_executable => @format_executable, + :bin_dir => @bin_dir, + :development => @development, + :env_shebang => @env_shebang, + :force => @force, + :format_executable => @format_executable, :ignore_dependencies => @ignore_dependencies, - :install_dir => @install_dir, - :security_policy => @security_policy, - :wrappers => @wrappers, - :bin_dir => @bin_dir, - :development => @development + :install_dir => @install_dir, + :security_policy => @security_policy, + :source_index => @source_index, + :user_install => @user_install, + :wrappers => @wrappers spec = inst.install Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._dependency_list.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._dependency_list.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._dependency.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._dependency.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/digest/._digest_adapter.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/digest/._digest_adapter.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/digest/._md5.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/digest/._md5.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/digest/._sha1.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/digest/._sha1.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/digest/._sha2.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/digest/._sha2.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/doc_manager.rb libgems-ruby-1.3.1/lib/rubygems/doc_manager.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/doc_manager.rb 2008-06-06 19:38:05.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/doc_manager.rb 2008-09-24 00:55:18.000000000 -0500 @@ -5,132 +5,194 @@ #++ require 'fileutils' +require 'rubygems' -module Gem +## +# The documentation manager generates RDoc and RI for RubyGems. - class DocManager +class Gem::DocManager - include UserInteraction + include Gem::UserInteraction - # Create a document manager for the given gem spec. - # - # spec:: The Gem::Specification object representing the gem. - # rdoc_args:: Optional arguments for RDoc (template etc.) as a String. - # - def initialize(spec, rdoc_args="") - @spec = spec - @doc_dir = File.join(spec.installation_path, "doc", spec.full_name) - @rdoc_args = rdoc_args.nil? ? [] : rdoc_args.split - end - - # Is the RDoc documentation installed? - def rdoc_installed? - return File.exist?(File.join(@doc_dir, "rdoc")) - end - - # Generate the RI documents for this gem spec. - # - # Note that if both RI and RDoc documents are generated from the - # same process, the RI docs should be done first (a likely bug in - # RDoc will cause RI docs generation to fail if run after RDoc). - def generate_ri - if @spec.has_rdoc then - load_rdoc - install_ri # RDoc bug, ri goes first - end + @configured_args = [] + + def self.configured_args + @configured_args ||= [] + end - FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) + def self.configured_args=(args) + case args + when Array + @configured_args = args + when String + @configured_args = args.split end + end - # Generate the RDoc documents for this gem spec. - # - # Note that if both RI and RDoc documents are generated from the - # same process, the RI docs should be done first (a likely bug in - # RDoc will cause RI docs generation to fail if run after RDoc). - def generate_rdoc - if @spec.has_rdoc then - load_rdoc - install_rdoc - end + ## + # Load RDoc from a gem if it is available, otherwise from Ruby's stdlib - FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) + def self.load_rdoc + begin + gem 'rdoc' + rescue Gem::LoadError + # use built-in RDoc end - # Load the RDoc documentation generator library. - def load_rdoc - if File.exist?(@doc_dir) && !File.writable?(@doc_dir) then - raise Gem::FilePermissionError.new(@doc_dir) - end + begin + require 'rdoc/rdoc' + rescue LoadError => e + raise Gem::DocumentError, + "ERROR: RDoc documentation generator not installed!" + end + end - FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) + ## + # Updates the RI cache for RDoc 2 if it is installed - begin - gem 'rdoc' - rescue Gem::LoadError - # use built-in RDoc - end + def self.update_ri_cache + load_rdoc rescue return - begin - require 'rdoc/rdoc' - rescue LoadError => e - raise Gem::DocumentError, - "ERROR: RDoc documentation generator not installed!" - end - end + return unless defined? RDoc::VERSION # RDoc 1 does not have VERSION - def install_rdoc - rdoc_dir = File.join @doc_dir, 'rdoc' + require 'rdoc/ri/driver' + + options = { + :use_cache => true, + :use_system => true, + :use_site => true, + :use_home => true, + :use_gems => true, + :formatter => RDoc::RI::Formatter, + } - FileUtils.rm_rf rdoc_dir + driver = RDoc::RI::Driver.new(options).class_cache + end + + ## + # Create a document manager for +spec+. +rdoc_args+ contains arguments for + # RDoc (template etc.) as a String. + + def initialize(spec, rdoc_args="") + @spec = spec + @doc_dir = File.join(spec.installation_path, "doc", spec.full_name) + @rdoc_args = rdoc_args.nil? ? [] : rdoc_args.split + end + + ## + # Is the RDoc documentation installed? + + def rdoc_installed? + File.exist?(File.join(@doc_dir, "rdoc")) + end - say "Installing RDoc documentation for #{@spec.full_name}..." - run_rdoc '--op', rdoc_dir + ## + # Generate the RI documents for this gem spec. + # + # Note that if both RI and RDoc documents are generated from the same + # process, the RI docs should be done first (a likely bug in RDoc will cause + # RI docs generation to fail if run after RDoc). + + def generate_ri + if @spec.has_rdoc then + setup_rdoc + install_ri # RDoc bug, ri goes first end - def install_ri - ri_dir = File.join @doc_dir, 'ri' + FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) + end - FileUtils.rm_rf ri_dir + ## + # Generate the RDoc documents for this gem spec. + # + # Note that if both RI and RDoc documents are generated from the same + # process, the RI docs should be done first (a likely bug in RDoc will cause + # RI docs generation to fail if run after RDoc). + + def generate_rdoc + if @spec.has_rdoc then + setup_rdoc + install_rdoc + end + + FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) + end + + ## + # Generate and install RDoc into the documentation directory - say "Installing ri documentation for #{@spec.full_name}..." - run_rdoc '--ri', '--op', ri_dir + def install_rdoc + rdoc_dir = File.join @doc_dir, 'rdoc' + + FileUtils.rm_rf rdoc_dir + + say "Installing RDoc documentation for #{@spec.full_name}..." + run_rdoc '--op', rdoc_dir + end + + ## + # Generate and install RI into the documentation directory + + def install_ri + ri_dir = File.join @doc_dir, 'ri' + + FileUtils.rm_rf ri_dir + + say "Installing ri documentation for #{@spec.full_name}..." + run_rdoc '--ri', '--op', ri_dir + end + + ## + # Run RDoc with +args+, which is an ARGV style argument list + + def run_rdoc(*args) + args << @spec.rdoc_options + args << self.class.configured_args + args << '--quiet' + args << @spec.require_paths.clone + args << @spec.extra_rdoc_files + args = args.flatten.map do |arg| arg.to_s end + + r = RDoc::RDoc.new + + old_pwd = Dir.pwd + Dir.chdir(@spec.full_gem_path) + begin + r.document args + rescue Errno::EACCES => e + dirname = File.dirname e.message.split("-")[1].strip + raise Gem::FilePermissionError.new(dirname) + rescue RuntimeError => ex + alert_error "While generating documentation for #{@spec.full_name}" + ui.errs.puts "... MESSAGE: #{ex}" + ui.errs.puts "... RDOC args: #{args.join(' ')}" + ui.errs.puts "\t#{ex.backtrace.join "\n\t"}" if + Gem.configuration.backtrace + ui.errs.puts "(continuing with the rest of the installation)" + ensure + Dir.chdir(old_pwd) end + end - def run_rdoc(*args) - args << @spec.rdoc_options - args << DocManager.configured_args - args << '--quiet' - args << @spec.require_paths.clone - args << @spec.extra_rdoc_files - args = args.flatten.map do |arg| arg.to_s end - - r = RDoc::RDoc.new - - old_pwd = Dir.pwd - Dir.chdir(@spec.full_gem_path) - begin - r.document args - rescue Errno::EACCES => e - dirname = File.dirname e.message.split("-")[1].strip - raise Gem::FilePermissionError.new(dirname) - rescue RuntimeError => ex - alert_error "While generating documentation for #{@spec.full_name}" - ui.errs.puts "... MESSAGE: #{ex}" - ui.errs.puts "... RDOC args: #{args.join(' ')}" - ui.errs.puts "\t#{ex.backtrace.join "\n\t"}" if - Gem.configuration.backtrace - ui.errs.puts "(continuing with the rest of the installation)" - ensure - Dir.chdir(old_pwd) - end + def setup_rdoc + if File.exist?(@doc_dir) && !File.writable?(@doc_dir) then + raise Gem::FilePermissionError.new(@doc_dir) end - def uninstall_doc - raise Gem::FilePermissionError.new(@spec.installation_path) unless - File.writable? @spec.installation_path + FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) - original_name = [ - @spec.name, @spec.version, @spec.original_platform].join '-' + self.class.load_rdoc + end + + ## + # Remove RDoc and RI documentation + + def uninstall_doc + raise Gem::FilePermissionError.new(@spec.installation_path) unless + File.writable? @spec.installation_path + + original_name = [ + @spec.name, @spec.version, @spec.original_platform].join '-' doc_dir = File.join @spec.installation_path, 'doc', @spec.full_name unless File.directory? doc_dir then @@ -146,22 +208,7 @@ end FileUtils.rm_rf ri_dir - end - - class << self - def configured_args - @configured_args ||= [] - end - - def configured_args=(args) - case args - when Array - @configured_args = args - when String - @configured_args = args.split - end - end - end - end + end + Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._exceptions.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._exceptions.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/ext/builder.rb libgems-ruby-1.3.1/lib/rubygems/ext/builder.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/ext/builder.rb 2007-08-15 22:40:56.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/ext/builder.rb 2008-09-25 05:07:41.000000000 -0500 @@ -35,7 +35,7 @@ results << `#{cmd} #{redirector}` raise Gem::InstallError, "make#{target} failed:\n\n#{results}" unless - $?.exitstatus.zero? + $?.success? end end @@ -47,7 +47,7 @@ results << command results << `#{command} #{redirector}` - unless $?.exitstatus.zero? then + unless $?.success? then raise Gem::InstallError, "#{class_name} failed:\n\n#{results.join "\n"}" end end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/ext/._configure_builder.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/ext/._configure_builder.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/ext/._ext_conf_builder.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/ext/._ext_conf_builder.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/ext/._rake_builder.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/ext/._rake_builder.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/ext/rake_builder.rb libgems-ruby-1.3.1/lib/rubygems/ext/rake_builder.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/ext/rake_builder.rb 2007-08-15 22:43:16.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/ext/rake_builder.rb 2008-06-25 19:11:30.000000000 -0500 @@ -16,7 +16,7 @@ end cmd = ENV['rake'] || 'rake' - cmd << " RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}" + cmd += " RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}" # ENV is frozen run cmd, results Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._ext.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._ext.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._format.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._format.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._gem_openssl.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._gem_openssl.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/gem_path_searcher.rb libgems-ruby-1.3.1/lib/rubygems/gem_path_searcher.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/gem_path_searcher.rb 2007-12-19 18:25:24.000000000 -0600 +++ libgems-ruby-1.3.1/lib/rubygems/gem_path_searcher.rb 2008-09-09 16:33:35.000000000 -0500 @@ -6,15 +6,15 @@ require 'rubygems' -# +## # GemPathSearcher has the capability to find loadable files inside # gems. It generates data up front to speed up searches later. -# + class Gem::GemPathSearcher - # + ## # Initialise the data we need to make searches later. - # + def initialize # We want a record of all the installed gemspecs, in the order # we wish to examine them. @@ -27,7 +27,7 @@ end end - # + ## # Look in all the installed gems until a matching _path_ is found. # Return the _gemspec_ of the gem where it was found. If no match # is found, return nil. @@ -46,36 +46,52 @@ # others), which may or may not already be attached to _file_. # This method doesn't care about the full filename that matches; # only that there is a match. - # + def find(path) - @gemspecs.each do |spec| - return spec if matching_file(spec, path) + @gemspecs.find do |spec| matching_file? spec, path end + end + + ## + # Works like #find, but finds all gemspecs matching +path+. + + def find_all(path) + @gemspecs.select do |spec| + matching_file? spec, path end - nil end - private + ## + # Attempts to find a matching path using the require_paths of the given + # +spec+. - # Attempts to find a matching path using the require_paths of the - # given _spec_. - # - # Some of the intermediate results are cached in @lib_dirs for - # speed. - def matching_file(spec, path) # :doc: + def matching_file?(spec, path) + !matching_files(spec, path).empty? + end + + ## + # Returns files matching +path+ in +spec+. + #-- + # Some of the intermediate results are cached in @lib_dirs for speed. + + def matching_files(spec, path) glob = File.join @lib_dirs[spec.object_id], "#{path}#{Gem.suffix_pattern}" - return true unless Dir[glob].select { |f| File.file?(f.untaint) }.empty? + Dir[glob].select { |f| File.file? f.untaint } end - # Return a list of all installed gemspecs, sorted by alphabetical - # order and in reverse version order. + ## + # Return a list of all installed gemspecs, sorted by alphabetical order and + # in reverse version order. + def init_gemspecs Gem.source_index.map { |_, spec| spec }.sort { |a,b| (a.name <=> b.name).nonzero? || (b.version <=> a.version) } end + ## # Returns library directories glob for a gemspec. For example, # '/usr/local/lib/ruby/gems/1.8/gems/foobar-1.0/{lib,ext}' + def lib_dirs_for(spec) "#{spec.full_gem_path}/{#{spec.require_paths.join(',')}}" end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._gem_runner.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._gem_runner.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/indexer.rb libgems-ruby-1.3.1/lib/rubygems/indexer.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/indexer.rb 2008-06-21 20:32:42.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/indexer.rb 2008-09-09 16:39:29.000000000 -0500 @@ -116,7 +116,7 @@ open @specs_index, 'wb' do |io| specs = index.sort.map do |_, spec| platform = spec.original_platform - platform = Gem::Platform::RUBY if platform.nil? + platform = Gem::Platform::RUBY if platform.nil? or platform.empty? [spec.name, spec.version, platform] end @@ -129,7 +129,9 @@ open @latest_specs_index, 'wb' do |io| specs = index.latest_specs.sort.map do |spec| - [spec.name, spec.version, spec.original_platform] + platform = spec.original_platform + platform = Gem::Platform::RUBY if platform.nil? or platform.empty? + [spec.name, spec.version, platform] end specs = compact_specs specs @@ -283,10 +285,7 @@ # Builds and installs indexicies. def generate_index - FileUtils.rm_rf @directory - FileUtils.mkdir_p @directory, :mode => 0700 - FileUtils.mkdir_p @quick_marshal_dir - + make_temp_directories index = collect_specs build_indicies index install_indicies @@ -323,6 +322,15 @@ end ## + # Make directories for index generation + + def make_temp_directories + FileUtils.rm_rf @directory + FileUtils.mkdir_p @directory, :mode => 0700 + FileUtils.mkdir_p @quick_marshal_dir + end + + ## # Ensure +path+ and path with +extension+ are identical. def paranoid(path, extension) @@ -344,6 +352,7 @@ spec.description = sanitize_string(spec.description) spec.post_install_message = sanitize_string(spec.post_install_message) spec.authors = spec.authors.collect { |a| sanitize_string(a) } + spec end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/installer.rb libgems-ruby-1.3.1/lib/rubygems/installer.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/installer.rb 2008-06-06 19:15:11.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/installer.rb 2008-10-10 13:22:39.000000000 -0500 @@ -20,6 +20,7 @@ # filesystem including unpacking the gem into its gem dir, installing the # gemspec in the specifications dir, storing the cached gem in the cache dir, # and installing either wrappers or symlinks for executables. + class Gem::Installer ## @@ -31,8 +32,36 @@ include Gem::RequirePathsBuilder + ## + # The directory a gem's executables will be installed into + + attr_reader :bin_dir + + ## + # The gem repository the gem will be installed into + + attr_reader :gem_home + + ## + # The Gem::Specification for the gem being installed + + attr_reader :spec + + @home_install_warning = false + @path_warning = false + class << self + ## + # True if we've warned about ~/.gems install + + attr_accessor :home_install_warning + + ## + # True if we've warned about PATH not including Gem.bindir + + attr_accessor :path_warning + attr_writer :exec_format # Defaults to use Ruby's program prefix and suffix. @@ -61,11 +90,12 @@ @gem = gem options = { - :force => false, - :install_dir => Gem.dir, - :exec_format => false, - :env_shebang => false, - :bin_dir => nil + :bin_dir => nil, + :env_shebang => false, + :exec_format => false, + :force => false, + :install_dir => Gem.dir, + :source_index => Gem.source_index, }.merge options @env_shebang = options[:env_shebang] @@ -78,6 +108,7 @@ @wrappers = options[:wrappers] @bin_dir = options[:bin_dir] @development = options[:development] + @source_index = options[:source_index] begin @format = Gem::Format.from_file_by_path @gem, @security_policy @@ -85,6 +116,43 @@ raise Gem::InstallError, "invalid gem format for #{@gem}" end + begin + FileUtils.mkdir_p @gem_home + rescue Errno::EACCESS, Errno::ENOTDIR + # We'll divert to ~/.gems below + end + + if not File.writable? @gem_home or + # TODO: Shouldn't have to test for existence of bindir; tests need it. + (@gem_home.to_s == Gem.dir and File.exist? Gem.bindir and + not File.writable? Gem.bindir) then + if options[:user_install] == false then # You don't want to use ~ + raise Gem::FilePermissionError, @gem_home + elsif options[:user_install].nil? then + unless self.class.home_install_warning then + alert_warning "Installing to ~/.gem since #{@gem_home} and\n\t #{Gem.bindir} aren't both writable." + self.class.home_install_warning = true + end + end + options[:user_install] = true + end + + if options[:user_install] and not options[:unpack] then + @gem_home = Gem.user_dir + + user_bin_dir = File.join(@gem_home, 'bin') + unless ENV['PATH'].split(File::PATH_SEPARATOR).include? user_bin_dir then + unless self.class.path_warning then + alert_warning "You don't have #{user_bin_dir} in your PATH,\n\t gem executables will not run." + self.class.path_warning = true + end + end + + FileUtils.mkdir_p @gem_home unless File.directory? @gem_home + # If it's still not writable, you've got issues. + raise Gem::FilePermissionError, @gem_home unless File.writable? @gem_home + end + @spec = @format.spec @gem_dir = File.join(@gem_home, "gems", @spec.full_name).untaint @@ -131,8 +199,11 @@ end end + Gem.pre_install_hooks.each do |hook| + hook.call self + end + FileUtils.mkdir_p @gem_home unless File.directory? @gem_home - raise Gem::FilePermissionError, @gem_home unless File.writable? @gem_home Gem.ensure_gem_subdirectories @gem_home @@ -156,7 +227,11 @@ @spec.loaded_from = File.join(@gem_home, 'specifications', "#{@spec.full_name}.gemspec") - Gem.source_index.add_spec @spec + @source_index.add_spec @spec + + Gem.post_install_hooks.each do |hook| + hook.call self + end return @spec rescue Zlib::GzipFile::Error @@ -179,10 +254,10 @@ end ## - # True if the gems in Gem.source_index satisfy +dependency+. + # True if the gems in the source_index satisfy +dependency+. def installation_satisfies_dependency?(dependency) - Gem.source_index.find_name(dependency.name, dependency.version_requirements).size > 0 + @source_index.find_name(dependency.name, dependency.version_requirements).size > 0 end ## @@ -206,6 +281,7 @@ file_name = File.join @gem_home, 'specifications', "#{@spec.full_name}.gemspec" + file_name.untaint File.open(file_name, "w") do |file| Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._install_update_options.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._install_update_options.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/install_update_options.rb libgems-ruby-1.3.1/lib/rubygems/install_update_options.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/install_update_options.rb 2008-05-06 21:15:51.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/install_update_options.rb 2008-06-24 13:56:30.000000000 -0500 @@ -90,6 +90,13 @@ options[:format_executable] = value end + add_option(:"Install/Update", '--[no-]user-install', + 'Install in user\'s home directory instead', + 'of GEM_HOME. Defaults to using home directory', + 'only if GEM_HOME is not writable.') do |value, options| + options[:user_install] = value + end + add_option(:"Install/Update", "--development", "Install any additional development", "dependencies") do |value, options| diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/local_remote_options.rb libgems-ruby-1.3.1/lib/rubygems/local_remote_options.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/local_remote_options.rb 2008-06-05 15:55:37.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/local_remote_options.rb 2008-08-16 17:03:45.000000000 -0500 @@ -110,6 +110,13 @@ end ## + # Is fetching of local and remote information enabled? + + def both? + options[:domain] == :both + end + + ## # Is local fetching enabled? def local? Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._old_format.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._old_format.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/package/._f_sync_dir.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/package/._f_sync_dir.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/package/._tar_header.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/package/._tar_header.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/package/._tar_input.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/package/._tar_input.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/package/._tar_output.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/package/._tar_output.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/package/tar_reader/._entry.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/package/tar_reader/._entry.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/package/._tar_reader.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/package/._tar_reader.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/package/tar_reader.rb libgems-ruby-1.3.1/lib/rubygems/package/tar_reader.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/package/tar_reader.rb 2008-02-29 02:55:01.000000000 -0600 +++ libgems-ruby-1.3.1/lib/rubygems/package/tar_reader.rb 2008-06-30 18:05:11.000000000 -0500 @@ -46,17 +46,17 @@ yield entry skip = (512 - (size % 512)) % 512 + pending = size - entry.bytes_read - if @io.respond_to? :seek then + begin # avoid reading... - @io.seek(size - entry.bytes_read, IO::SEEK_CUR) - else - pending = size - entry.bytes_read - + @io.seek pending, IO::SEEK_CUR + pending = 0 + rescue Errno::EINVAL, NameError while pending > 0 do - bread = @io.read([pending, 4096].min).size + bytes_read = @io.read([pending, 4096].min).size raise UnexpectedEOF if @io.eof? - pending -= bread + pending -= bytes_read end end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/package/._tar_writer.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/package/._tar_writer.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._package.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._package.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/platform.rb libgems-ruby-1.3.1/lib/rubygems/platform.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/platform.rb 2008-06-16 01:14:45.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/platform.rb 2008-09-15 23:24:59.000000000 -0500 @@ -13,23 +13,6 @@ attr_accessor :version - DEPRECATED_CONSTS = [ - :DARWIN, - :LINUX_586, - :MSWIN32, - :PPC_DARWIN, - :WIN32, - :X86_LINUX - ] - - def self.const_missing(name) # TODO remove six months from 2007/12 - if DEPRECATED_CONSTS.include? name then - raise NameError, "#{name} has been removed, use CURRENT instead" - else - super - end - end - def self.local arch = Gem::ConfigMap[:arch] arch = "#{arch}_60" if arch =~ /mswin32$/ @@ -73,7 +56,7 @@ else cpu end - if arch.length == 2 and arch.last =~ /^\d+$/ then # for command-line + if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/ then # for command-line @os, @version = arch return end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/remote_fetcher.rb libgems-ruby-1.3.1/lib/rubygems/remote_fetcher.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/remote_fetcher.rb 2008-06-21 16:21:17.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/remote_fetcher.rb 2008-10-09 18:50:18.000000000 -0500 @@ -1,5 +1,6 @@ require 'net/http' require 'stringio' +require 'time' require 'uri' require 'rubygems' @@ -74,7 +75,12 @@ # always replaced. def download(spec, source_uri, install_dir = Gem.dir) - cache_dir = File.join install_dir, 'cache' + if File.writable?(install_dir) + cache_dir = File.join install_dir, 'cache' + else + cache_dir = File.join(Gem.user_dir, 'cache') + end + gem_file_name = "#{spec.full_name}.gem" local_gem_path = File.join cache_dir, gem_file_name @@ -87,7 +93,7 @@ scheme = nil if scheme =~ /^[a-z]$/i case scheme - when 'http' then + when 'http', 'https' then unless File.exist? local_gem_path then begin say "Downloading gem #{gem_file_name}" if @@ -132,51 +138,27 @@ ## # Downloads +uri+ and returns it as a String. - def fetch_path(uri) - open_uri_or_path(uri) do |input| - input.read - end + def fetch_path(uri, mtime = nil, head = false) + data = open_uri_or_path uri, mtime, head + data = Gem.gunzip data if data and not head and uri.to_s =~ /gz$/ + data rescue FetchError raise rescue Timeout::Error raise FetchError.new('timed out', uri) rescue IOError, SocketError, SystemCallError => e raise FetchError.new("#{e.class}: #{e}", uri) - rescue => e - raise FetchError.new("#{e.class}: #{e}", uri) end ## # Returns the size of +uri+ in bytes. - def fetch_size(uri) - return File.size(get_file_uri_path(uri)) if file_uri? uri - - uri = URI.parse uri unless URI::Generic === uri - - raise ArgumentError, 'uri is not an HTTP URI' unless URI::HTTP === uri - - response = request uri, Net::HTTP::Head + def fetch_size(uri) # TODO: phase this out + response = fetch_path(uri, nil, true) - case response - when Net::HTTPOK then - else - raise FetchError.new("bad response #{response.message} #{response.code}", uri) - end - - if response['content-length'] then - return response['content-length'].to_i - else - response = http.get uri.request_uri - return response.body.size - end - - rescue SocketError, SystemCallError, Timeout::Error => e - raise FetchError.new("#{e.message} (#{e.class})\n\tfetching size", uri) + response['content-length'].to_i end - private - def escape(str) return unless str URI.escape(str) @@ -234,8 +216,9 @@ connection = @connections[connection_id] if uri.scheme == 'https' and not connection.started? then - http_obj.use_ssl = true - http_obj.verify_mode = OpenSSL::SSL::VERIFY_NONE + require 'net/https' + connection.use_ssl = true + connection.verify_mode = OpenSSL::SSL::VERIFY_NONE end connection.start unless connection.started? @@ -247,24 +230,27 @@ # Read the data from the (source based) URI, but if it is a file:// URI, # read from the filesystem instead. - def open_uri_or_path(uri, depth = 0, &block) - if file_uri?(uri) - open(get_file_uri_path(uri), &block) - else - uri = URI.parse uri unless URI::Generic === uri + def open_uri_or_path(uri, last_modified = nil, head = false, depth = 0) + raise "block is dead" if block_given? - response = request uri + return open(get_file_uri_path(uri)) if file_uri? uri - case response - when Net::HTTPOK then - block.call(StringIO.new(response.body)) if block - when Net::HTTPRedirection then - raise FetchError.new('too many redirects', uri) if depth > 10 - - open_uri_or_path(response['Location'], depth + 1, &block) - else - raise FetchError.new("bad response #{response.message} #{response.code}", uri) - end + uri = URI.parse uri unless URI::Generic === uri + raise ArgumentError, 'uri is not an HTTP URI' unless URI::HTTP === uri + + fetch_type = head ? Net::HTTP::Head : Net::HTTP::Get + response = request uri, fetch_type, last_modified + + case response + when Net::HTTPOK, Net::HTTPNotModified then + head ? response : response.body + when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther, + Net::HTTPTemporaryRedirect then + raise FetchError.new('too many redirects', uri) if depth > 10 + + open_uri_or_path(response['Location'], last_modified, head, depth + 1) + else + raise FetchError.new("bad response #{response.message} #{response.code}", uri) end end @@ -273,7 +259,7 @@ # a Net::HTTP response object. request maintains a table of persistent # connections to reduce connect overhead. - def request(uri, request_class = Net::HTTP::Get) + def request(uri, request_class, last_modified = nil) request = request_class.new uri.request_uri unless uri.nil? || uri.user.nil? || uri.user.empty? then @@ -289,14 +275,16 @@ request.add_field 'Connection', 'keep-alive' request.add_field 'Keep-Alive', '30' + if last_modified then + last_modified = last_modified.utc + request.add_field 'If-Modified-Since', last_modified.rfc2822 + end + connection = connection_for uri retried = false bad_response = false - # HACK work around EOFError bug in Net::HTTP - # NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible - # to install gems. begin @requests[connection.object_id] += 1 response = connection.request request @@ -309,6 +297,9 @@ bad_response = true retry + # HACK work around EOFError bug in Net::HTTP + # NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible + # to install gems. rescue EOFError, Errno::ECONNABORTED, Errno::ECONNRESET requests = @requests[connection.object_id] say "connection reset after #{requests} requests, retrying" if Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._requirement.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._requirement.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._require_paths_builder.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._require_paths_builder.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/rubygems_version.rb libgems-ruby-1.3.1/lib/rubygems/rubygems_version.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/rubygems_version.rb 2008-06-21 21:05:42.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/rubygems_version.rb 2008-10-25 17:51:02.000000000 -0500 @@ -2,5 +2,5 @@ # This file is auto-generated by build scripts. # See: rake update_version module Gem - RubyGemsVersion = '1.2.0' + RubyGemsVersion = '1.3.1' end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._security.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._security.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._server.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._server.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/source_index.rb libgems-ruby-1.3.1/lib/rubygems/source_index.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/source_index.rb 2008-06-20 14:55:34.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/source_index.rb 2008-10-09 19:03:11.000000000 -0500 @@ -7,7 +7,9 @@ require 'rubygems' require 'rubygems/user_interaction' require 'rubygems/specification' -require 'rubygems/spec_fetcher' +module Gem + autoload(:SpecFetcher, 'rubygems/spec_fetcher') +end ## # The SourceIndex object indexes all the gems available from a @@ -80,8 +82,14 @@ def load_specification(file_name) begin - spec_code = File.read(file_name).untaint + spec_code = if RUBY_VERSION < '1.9' then + File.read file_name + else + File.read file_name, :encoding => 'UTF-8' + end.untaint + gemspec = eval spec_code, binding, file_name + if gemspec.is_a?(Gem::Specification) gemspec.loaded_from = file_name return gemspec @@ -93,7 +101,7 @@ alert_warning e alert_warning spec_code rescue Exception => e - alert_warning(e.inspect.to_s + "\n" + spec_code) + alert_warning "#{e.inspect}\n#{spec_code}" alert_warning "Invalid .gemspec format in '#{file_name}'" end return nil @@ -230,7 +238,8 @@ # Find a gem by an exact match on the short name. def find_name(gem_name, version_requirement = Gem::Requirement.default) - search(/^#{gem_name}$/, version_requirement) + dep = Gem::Dependency.new(/^#{gem_name}$/, version_requirement) + search dep end ## @@ -246,7 +255,12 @@ version_requirement = nil only_platform = false - case gem_pattern # TODO warn after 2008/03, remove three months after + # TODO - Remove support and warning for legacy arguments after 2008/11 + unless Gem::Dependency === gem_pattern + warn "#{Gem.location_of_caller.join ':'}:Warning: Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated" + end + + case gem_pattern when Regexp then version_requirement = platform_only || Gem::Requirement.default when Gem::Dependency then @@ -270,7 +284,7 @@ specs = @gems.values.select do |spec| spec.name =~ gem_pattern and - version_requirement.satisfied_by? spec.version + version_requirement.satisfied_by? spec.version end if only_platform then @@ -539,7 +553,7 @@ # objects to load properly. Cache = SourceIndex - # :starddoc: + # :startdoc: end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._source_info_cache_entry.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._source_info_cache_entry.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/source_info_cache.rb libgems-ruby-1.3.1/lib/rubygems/source_info_cache.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/source_info_cache.rb 2008-06-17 15:59:40.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/source_info_cache.rb 2008-08-14 17:57:27.000000000 -0500 @@ -284,6 +284,10 @@ cache_data.map do |source_uri, sic_entry| next unless Gem.sources.include? source_uri + # TODO - Remove this gunk after 2008/11 + unless pattern.kind_of?(Gem::Dependency) + pattern = Gem::Dependency.new(pattern, Gem::Requirement.default) + end sic_entry.source_index.search pattern, platform_only end.flatten.compact end @@ -300,6 +304,11 @@ cache_data.map do |source_uri, sic_entry| next unless Gem.sources.include? source_uri + # TODO - Remove this gunk after 2008/11 + unless pattern.kind_of?(Gem::Dependency) + pattern = Gem::Dependency.new(pattern, Gem::Requirement.default) + end + sic_entry.source_index.search(pattern, only_platform).each do |spec| results << [spec, source_uri] end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/spec_fetcher.rb libgems-ruby-1.3.1/lib/rubygems/spec_fetcher.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/spec_fetcher.rb 2008-06-17 16:35:37.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/spec_fetcher.rb 2008-08-11 21:48:14.000000000 -0500 @@ -167,7 +167,7 @@ if all and @specs.include? source_uri then list[source_uri] = @specs[source_uri] - elsif @latest_specs.include? source_uri then + elsif not all and @latest_specs.include? source_uri then list[source_uri] = @latest_specs[source_uri] else specs = load_specs source_uri, file @@ -182,30 +182,28 @@ list end - def load_specs(source_uri, file) - file_name = "#{file}.#{Gem.marshal_version}.gz" - - spec_path = source_uri + file_name - - cache_dir = cache_dir spec_path + ## + # Loads specs in +file+, fetching from +source_uri+ if the on-disk cache is + # out of date. - local_file = File.join(cache_dir, file_name).chomp '.gz' + def load_specs(source_uri, file) + file_name = "#{file}.#{Gem.marshal_version}" + spec_path = source_uri + "#{file_name}.gz" + cache_dir = cache_dir spec_path + local_file = File.join(cache_dir, file_name) + loaded = false if File.exist? local_file then - local_size = File.stat(local_file).size - - remote_file = spec_path.dup - remote_file.path = remote_file.path.chomp '.gz' - remote_size = @fetcher.fetch_size remote_file + spec_dump = @fetcher.fetch_path spec_path, File.mtime(local_file) - spec_dump = Gem.read_binary local_file if remote_size == local_size - end - - unless spec_dump then + if spec_dump.nil? then + spec_dump = Gem.read_binary local_file + else + loaded = true + end + else + spec_dump = @fetcher.fetch_path spec_path loaded = true - - spec_dump_gz = @fetcher.fetch_path spec_path - spec_dump = Gem.gunzip spec_dump_gz end specs = Marshal.load spec_dump diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/specification.rb libgems-ruby-1.3.1/lib/rubygems/specification.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/specification.rb 2008-06-21 16:54:48.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/specification.rb 2008-09-10 18:59:41.000000000 -0500 @@ -24,6 +24,7 @@ module Gem + ## # == Gem::Specification # # The Specification class contains the metadata for a Gem. Typically @@ -38,7 +39,7 @@ # # There are many gemspec attributes, and the best place to learn # about them in the "Gemspec Reference" linked from the RubyGems wiki. - # + class Specification ## @@ -46,8 +47,6 @@ attr_accessor :original_platform # :nodoc: - # ------------------------- Specification version constants. - ## # The the version number of a specification that does not specify one # (i.e. RubyGems 0.7 or earlier). @@ -88,77 +87,98 @@ TODAY = now - ((now.to_i + now.gmt_offset) % 86400) # :startdoc: - # ------------------------- Class variables. - + ## # List of Specification instances. + @@list = [] + ## # Optional block used to gather newly defined instances. + @@gather = nil + ## # List of attribute names: [:name, :version, ...] @@required_attributes = [] - # List of _all_ attributes and default values: [[:name, nil], [:bindir, 'bin'], ...] + ## + # List of _all_ attributes and default values: + # + # [[:name, nil], + # [:bindir, 'bin'], + # ...] + @@attributes = [] @@nil_attributes = [] @@non_nil_attributes = [:@original_platform] + ## # List of array attributes + @@array_attributes = [] + ## # Map of attribute names to default values. + @@default_value = {} - # ------------------------- Convenience class methods. + ## + # Names of all specification attributes def self.attribute_names @@attributes.map { |name, default| name } end + ## + # Default values for specification attributes + def self.attribute_defaults @@attributes.dup end + ## + # The default value for specification attribute +name+ + def self.default_value(name) @@default_value[name] end + ## + # Required specification attributes + def self.required_attributes @@required_attributes.dup end + ## + # Is +name+ a required attribute? + def self.required_attribute?(name) @@required_attributes.include? name.to_sym end + ## + # Specification attributes that are arrays (appendable and so-forth) + def self.array_attributes @@array_attributes.dup end - # ------------------------- Infrastructure class methods. + ## + # A list of Specification instances that have been defined in this Ruby + # instance. - # A list of Specification instances that have been defined in this Ruby instance. def self.list @@list end - # Used to specify the name and default value of a specification - # attribute. The side effects are: - # * the name and default value are added to the @@attributes list - # and @@default_value map - # * a standard _writer_ method (attribute=) is created - # * a non-standard _reader method (attribute) is created - # - # The reader method behaves like this: - # def attribute - # @attribute ||= (copy of default value) - # end - # - # This allows lazy initialization of attributes to their default - # values. + ## + # Specifies the +name+ and +default+ for a specification attribute, and + # creates a reader and writer method like Module#attr_accessor. # + # The reader method returns the default if the value hasn't been set. + def self.attribute(name, default=nil) ivar_name = "@#{name}".intern if default.nil? then @@ -172,8 +192,10 @@ attr_accessor(name) end - # Same as :attribute, but ensures that values assigned to the - # attribute are array values by applying :to_a to the value. + ## + # Same as :attribute, but ensures that values assigned to the attribute + # are array values by applying :to_a to the value. + def self.array_attribute(name) @@non_nil_attributes << ["@#{name}".intern, []] @@ -192,51 +214,60 @@ module_eval code, __FILE__, __LINE__ - 9 end + ## # Same as attribute above, but also records this attribute as mandatory. + def self.required_attribute(*args) @@required_attributes << args.first attribute(*args) end - # Sometimes we don't want the world to use a setter method for a particular attribute. + ## + # Sometimes we don't want the world to use a setter method for a + # particular attribute. + # # +read_only+ makes it private so we can still use it internally. + def self.read_only(*names) names.each do |name| private "#{name}=" end end - # Shortcut for creating several attributes at once (each with a default value of - # +nil+). + # Shortcut for creating several attributes at once (each with a default + # value of +nil+). + def self.attributes(*args) args.each do |arg| attribute(arg, nil) end end - # Some attributes require special behaviour when they are accessed. This allows for - # that. + ## + # Some attributes require special behaviour when they are accessed. This + # allows for that. + def self.overwrite_accessor(name, &block) remove_method name define_method(name, &block) end - # Defines a _singular_ version of an existing _plural_ attribute - # (i.e. one whose value is expected to be an array). This means - # just creating a helper method that takes a single value and - # appends it to the array. These are created for convenience, so - # that in a spec, one can write + ## + # Defines a _singular_ version of an existing _plural_ attribute (i.e. one + # whose value is expected to be an array). This means just creating a + # helper method that takes a single value and appends it to the array. + # These are created for convenience, so that in a spec, one can write # # s.require_path = 'mylib' # - # instead of + # instead of: # # s.require_paths = ['mylib'] # - # That above convenience is available courtesy of + # That above convenience is available courtesy of: # # attribute_alias_singular :require_path, :require_paths - # + def self.attribute_alias_singular(singular, plural) define_method("#{singular}=") { |val| send("#{plural}=", [val]) @@ -320,189 +351,45 @@ spec end - # REQUIRED gemspec attributes ------------------------------------ - - required_attribute :rubygems_version, Gem::RubyGemsVersion - required_attribute :specification_version, CURRENT_SPECIFICATION_VERSION - required_attribute :name - required_attribute :version - required_attribute :date, TODAY - required_attribute :summary - required_attribute :require_paths, ['lib'] - - # OPTIONAL gemspec attributes ------------------------------------ - - attributes :email, :homepage, :rubyforge_project, :description - attributes :autorequire, :default_executable - - attribute :bindir, 'bin' - attribute :has_rdoc, false - attribute :required_ruby_version, Gem::Requirement.default - attribute :required_rubygems_version, Gem::Requirement.default - attribute :platform, Gem::Platform::RUBY - - attribute :signing_key, nil - attribute :cert_chain, [] - attribute :post_install_message, nil - - array_attribute :authors - array_attribute :files - array_attribute :test_files - array_attribute :rdoc_options - array_attribute :extra_rdoc_files - array_attribute :executables - - # Array of extensions to build. See Gem::Installer#build_extensions for - # valid values. - - array_attribute :extensions - array_attribute :requirements - array_attribute :dependencies - - read_only :dependencies + ## + # List of depedencies that will automatically be activated at runtime. def runtime_dependencies dependencies.select { |d| d.type == :runtime || d.type == nil } end + ## + # List of dependencies that are used for development + def development_dependencies dependencies.select { |d| d.type == :development } end - # ALIASED gemspec attributes ------------------------------------- - - attribute_alias_singular :executable, :executables - attribute_alias_singular :author, :authors - attribute_alias_singular :require_path, :require_paths - attribute_alias_singular :test_file, :test_files - - # DEPRECATED gemspec attributes ---------------------------------- - - def test_suite_file + def test_suite_file # :nodoc: warn 'test_suite_file deprecated, use test_files' test_files.first end - def test_suite_file=(val) + def test_suite_file=(val) # :nodoc: warn 'test_suite_file= deprecated, use test_files=' @test_files = [] unless defined? @test_files @test_files << val end + ## # true when this gemspec has been loaded from a specifications directory. # This attribute is not persisted. - attr_writer :loaded + attr_accessor :loaded + ## # Path this gemspec was loaded from. This attribute is not persisted. - attr_accessor :loaded_from - - # Special accessor behaviours (overwriting default) -------------- - - overwrite_accessor :version= do |version| - @version = Version.create(version) - end - - overwrite_accessor :platform do - @new_platform - end - - overwrite_accessor :platform= do |platform| - if @original_platform.nil? or - @original_platform == Gem::Platform::RUBY then - @original_platform = platform - end - - case platform - when Gem::Platform::CURRENT then - @new_platform = Gem::Platform.local - @original_platform = @new_platform.to_s - - when Gem::Platform then - @new_platform = platform - - # legacy constants - when nil, Gem::Platform::RUBY then - @new_platform = Gem::Platform::RUBY - when 'mswin32' then # was Gem::Platform::WIN32 - @new_platform = Gem::Platform.new 'x86-mswin32' - when 'i586-linux' then # was Gem::Platform::LINUX_586 - @new_platform = Gem::Platform.new 'x86-linux' - when 'powerpc-darwin' then # was Gem::Platform::DARWIN - @new_platform = Gem::Platform.new 'ppc-darwin' - else - @new_platform = Gem::Platform.new platform - end - - @platform = @new_platform.to_s - - @new_platform - end - - overwrite_accessor :required_ruby_version= do |value| - @required_ruby_version = Gem::Requirement.create(value) - end - - overwrite_accessor :required_rubygems_version= do |value| - @required_rubygems_version = Gem::Requirement.create(value) - end - - overwrite_accessor :date= do |date| - # We want to end up with a Time object with one-day resolution. - # This is the cleanest, most-readable, faster-than-using-Date - # way to do it. - case date - when String then - @date = if /\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then - Time.local($1.to_i, $2.to_i, $3.to_i) - else - require 'time' - Time.parse date - end - when Time then - @date = Time.local(date.year, date.month, date.day) - when Date then - @date = Time.local(date.year, date.month, date.day) - else - @date = TODAY - end - end - - overwrite_accessor :date do - self.date = nil if @date.nil? # HACK Sets the default value for date - @date - end - - overwrite_accessor :summary= do |str| - @summary = if str then - str.strip. - gsub(/(\w-)\n[ \t]*(\w)/, '\1\2'). - gsub(/\n[ \t]*/, " ") - end - end - overwrite_accessor :description= do |str| - @description = if str then - str.strip. - gsub(/(\w-)\n[ \t]*(\w)/, '\1\2'). - gsub(/\n[ \t]*/, " ") - end - end + attr_accessor :loaded_from - overwrite_accessor :default_executable do - begin - if defined?(@default_executable) and @default_executable - result = @default_executable - elsif @executables and @executables.size == 1 - result = Array(@executables).first - else - result = nil - end - result - rescue - nil - end - end + ## + # Returns an array with bindir attached to each executable in the + # executables list def add_bindir(executables) return nil if executables.nil? @@ -516,17 +403,9 @@ return nil end - overwrite_accessor :files do - result = [] - result.push(*@files) if defined?(@files) - result.push(*@test_files) if defined?(@test_files) - result.push(*(add_bindir(@executables))) - result.push(*@extra_rdoc_files) if defined?(@extra_rdoc_files) - result.push(*@extensions) if defined?(@extensions) - result.uniq.compact - end - + ## # Files in the Gem under one of the require_paths + def lib_files @files.select do |file| require_paths.any? do |path| @@ -535,34 +414,25 @@ end end - overwrite_accessor :test_files do - # Handle the possibility that we have @test_suite_file but not - # @test_files. This will happen when an old gem is loaded via - # YAML. - if defined? @test_suite_file then - @test_files = [@test_suite_file].flatten - @test_suite_file = nil - end - if defined?(@test_files) and @test_files then - @test_files - else - @test_files = [] - end + ## + # True if this gem was loaded from disk + + alias :loaded? :loaded + + ## + # True if this gem has files in test_files + + def has_unit_tests? + not test_files.empty? end - # Predicates ----------------------------------------------------- - - def loaded?; @loaded ? true : false ; end - def has_rdoc?; has_rdoc ? true : false ; end - def has_unit_tests?; not test_files.empty?; end - alias has_test_suite? has_unit_tests? # (deprecated) - - # Constructors --------------------------------------------------- + alias has_test_suite? has_unit_tests? # :nodoc: deprecated + ## # Specification constructor. Assigns the default values to the # attributes, adds this spec to the list of loaded specs (see # Specification.list), and yields itself for further initialization. - # + def initialize @new_platform = nil assign_defaults @@ -575,11 +445,13 @@ @@gather.call(self) if @@gather end - # Each attribute has a default value (possibly nil). Here, we - # initialize all attributes to their default value. This is - # done through the accessor methods, so special behaviours will - # be honored. Furthermore, we take a _copy_ of the default so - # each specification instance has its own empty arrays, etc. + ## + # Each attribute has a default value (possibly nil). Here, we initialize + # all attributes to their default value. This is done through the + # accessor methods, so special behaviours will be honored. Furthermore, + # we take a _copy_ of the default so each specification instance has its + # own empty arrays, etc. + def assign_defaults @@nil_attributes.each do |name| instance_variable_set name, nil @@ -598,13 +470,14 @@ instance_variable_set :@new_platform, Gem::Platform::RUBY end - # Special loader for YAML files. When a Specification object is - # loaded from a YAML file, it bypasses the normal Ruby object - # initialization routine (#initialize). This method makes up for - # that and deals with gems of different ages. + ## + # Special loader for YAML files. When a Specification object is loaded + # from a YAML file, it bypasses the normal Ruby object initialization + # routine (#initialize). This method makes up for that and deals with + # gems of different ages. # # 'input' can be anything that YAML.load() accepts: String or IO. - # + def self.from_yaml(input) input = normalize_yaml_input input spec = YAML.load input @@ -627,6 +500,9 @@ spec end + ## + # Loads ruby format gemspec from +filename+ + def self.load(filename) gemspec = nil fail "NESTED Specification.load calls not allowed!" if @@gather @@ -638,22 +514,25 @@ @@gather = nil end - # Make sure the yaml specification is properly formatted with dashes. + ## + # Make sure the YAML specification is properly formatted with dashes + def self.normalize_yaml_input(input) result = input.respond_to?(:read) ? input.read : input result = "--- " + result unless result =~ /^--- / result end - # Instance methods ----------------------------------------------- - - # Sets the rubygems_version to Gem::RubyGemsVersion. - # + ## + # Sets the rubygems_version to the current RubyGems version + def mark_version @rubygems_version = RubyGemsVersion end - # Ignore unknown attributes if the + ## + # Ignore unknown attributes while loading + def method_missing(sym, *a, &b) # :nodoc: if @specification_version > CURRENT_SPECIFICATION_VERSION and sym.to_s =~ /=$/ then @@ -663,35 +542,39 @@ end end - # Adds a development dependency to this Gem. For example, - # - # spec.add_development_dependency('jabber4r', '> 0.1', '<= 0.5') + ## + # Adds a development dependency named +gem+ with +requirements+ to this + # Gem. For example: # - # Development dependencies aren't installed by default, and - # aren't activated when a gem is required. + # spec.add_development_dependency 'jabber4r', '> 0.1', '<= 0.5' # - # gem:: [String or Gem::Dependency] The Gem name/dependency. - # requirements:: [default=">= 0"] The version requirements. + # Development dependencies aren't installed by default and aren't + # activated when a gem is required. + def add_development_dependency(gem, *requirements) add_dependency_with_type(gem, :development, *requirements) end - # Adds a runtime dependency to this Gem. For example, - # - # spec.add_runtime_dependency('jabber4r', '> 0.1', '<= 0.5') + ## + # Adds a runtime dependency named +gem+ with +requirements+ to this Gem. + # For example: # - # gem:: [String or Gem::Dependency] The Gem name/dependency. - # requirements:: [default=">= 0"] The version requirements. + # spec.add_runtime_dependency 'jabber4r', '> 0.1', '<= 0.5' + def add_runtime_dependency(gem, *requirements) add_dependency_with_type(gem, :runtime, *requirements) end + ## + # Adds a runtime dependency + alias add_dependency add_runtime_dependency + ## # Returns the full name (name-version) of this Gem. Platform information - # is included (name-version-platform) if it is specified (and not the - # default Ruby platform). - # + # is included (name-version-platform) if it is specified and not the + # default Ruby platform. + def full_name if platform == Gem::Platform::RUBY or platform.nil? then "#{@name}-#{@version}" @@ -700,9 +583,10 @@ end end + ## # Returns the full name (name-version) of this gemspec using the original - # platform. - # + # platform. For use with legacy gems. + def original_name # :nodoc: if platform == Gem::Platform::RUBY or platform.nil? then "#{@name}-#{@version}" @@ -736,18 +620,16 @@ File.expand_path path end - # Checks if this Specification meets the requirement of the supplied - # dependency. - # - # dependency:: [Gem::Dependency] the dependency to check - # return:: [Boolean] true if dependency is met, otherwise false - # + ## + # Checks if this specification meets the requirement of +dependency+. + def satisfies_requirement?(dependency) return @name == dependency.name && dependency.version_requirements.satisfied_by?(@version) end - # Comparison methods --------------------------------------------- + ## + # Returns an object you can use to sort specifications in #sort_by. def sort_obj [@name, @version.to_ints, @new_platform == Gem::Platform::RUBY ? -1 : 1] @@ -757,19 +639,25 @@ sort_obj <=> other.sort_obj end + ## # Tests specs for equality (across all attributes). + def ==(other) # :nodoc: self.class === other && same_attributes?(other) end alias eql? == # :nodoc: + ## + # True if this gem has the same attributes as +other+. + def same_attributes?(other) @@attributes.each do |name, default| return false unless self.send(name) == other.send(name) end true end + private :same_attributes? def hash # :nodoc: @@ -779,8 +667,6 @@ } end - # Export methods (YAML and Ruby code) ---------------------------- - def to_yaml(opts = {}) # :nodoc: mark_version @@ -825,6 +711,8 @@ def to_ruby mark_version result = [] + result << "# -*- encoding: utf-8 -*-" + result << nil result << "Gem::Specification.new do |s|" result << " s.name = #{ruby_code name}" @@ -861,7 +749,7 @@ result << " s.specification_version = #{specification_version}" result << nil - result << " if current_version >= 3 then" + result << " if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then" unless dependencies.empty? then dependencies.each do |dep| @@ -895,16 +783,15 @@ result.join "\n" end - # Validation and normalization methods --------------------------- - - # Checks that the specification contains all required fields, and - # does a very basic sanity check. + ## + # Checks that the specification contains all required fields, and does a + # very basic sanity check. # - # Raises InvalidSpecificationException if the spec does not pass - # the checks.. + # Raises InvalidSpecificationException if the spec does not pass the + # checks.. + def validate extend Gem::UserInteraction - normalize if rubygems_version != RubyGemsVersion then @@ -959,13 +846,14 @@ true end + ## # Normalize the list of files so that: # * All file lists have redundancies removed. - # * Files referenced in the extra_rdoc_files are included in the - # package file list. + # * Files referenced in the extra_rdoc_files are included in the package + # file list. # - # Also, the summary and description are converted to a normal - # format. + # Also, the summary and description are converted to a normal format. + def normalize if defined?(@extra_rdoc_files) and @extra_rdoc_files then @extra_rdoc_files.uniq! @@ -975,15 +863,12 @@ @files.uniq! if @files end - # Dependency methods --------------------------------------------- - - # Return a list of all gems that have a dependency on this - # gemspec. The list is structured with entries that conform to: + ## + # Return a list of all gems that have a dependency on this gemspec. The + # list is structured with entries that conform to: # # [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]] - # - # return:: [Array] [[dependent_gem, dependency, [list_of_satisfiers]]] - # + def dependent_gems out = [] Gem.source_index.each do |name,gem| @@ -1004,8 +889,6 @@ "#" end - private - def add_dependency_with_type(dependency, type, *requirements) requirements = if requirements.empty? then Gem::Requirement.default @@ -1022,6 +905,8 @@ dependencies << dependency end + private :add_dependency_with_type + def find_all_satisfiers(dep) Gem.source_index.each do |name,gem| if(gem.satisfies_requirement?(dep)) then @@ -1030,8 +915,12 @@ end end - # Return a string containing a Ruby code representation of the - # given object. + private :find_all_satisfiers + + ## + # Return a string containing a Ruby code representation of the given + # object. + def ruby_code(obj) case obj when String then '%q{' + obj + '}' @@ -1046,6 +935,326 @@ else raise Exception, "ruby_code case not handled: #{obj.class}" end end + + private :ruby_code + + # :section: Required gemspec attributes + + ## + # The version of RubyGems used to create this gem + + required_attribute :rubygems_version, Gem::RubyGemsVersion + + ## + # The Gem::Specification version of this gemspec + + required_attribute :specification_version, CURRENT_SPECIFICATION_VERSION + + ## + # This gem's name + + required_attribute :name + + ## + # This gem's version + + required_attribute :version + + ## + # The date this gem was created + + required_attribute :date, TODAY + + ## + # A short summary of this gem's description. Displayed in `gem list -d`. + + required_attribute :summary + + ## + # Paths in the gem to add to $LOAD_PATH when this gem is activated + + required_attribute :require_paths, ['lib'] + + # :section: Optional gemspec attributes + + ## + # A contact email for this gem + + attribute :email + + ## + # The URL of this gem's home page + + attribute :homepage + + ## + # The rubyforge project this gem lives under. i.e. RubyGems' + # rubyforge_project is "rubygems". + + attribute :rubyforge_project + + ## + # A long description of this gem + + attribute :description + + ## + # Autorequire was used by old RubyGems to automatically require a file. + # It no longer is supported. + + attribute :autorequire + + ## + # The default executable for this gem. + + attribute :default_executable + + ## + # The path in the gem for executable scripts + + attribute :bindir, 'bin' + + ## + # True if this gem is RDoc-compliant + + attribute :has_rdoc, false + + ## + # True if this gem supports RDoc + + alias :has_rdoc? :has_rdoc + + ## + # The ruby of version required by this gem + + attribute :required_ruby_version, Gem::Requirement.default + + ## + # The RubyGems version required by this gem + + attribute :required_rubygems_version, Gem::Requirement.default + + ## + # The platform this gem runs on. See Gem::Platform for details. + + attribute :platform, Gem::Platform::RUBY + + ## + # The key used to sign this gem. See Gem::Security for details. + + attribute :signing_key, nil + + ## + # The certificate chain used to sign this gem. See Gem::Security for + # details. + + attribute :cert_chain, [] + + ## + # A message that gets displayed after the gem is installed + + attribute :post_install_message, nil + + ## + # The list of authors who wrote this gem + + array_attribute :authors + + ## + # Files included in this gem + + array_attribute :files + + ## + # Test files included in this gem + + array_attribute :test_files + + ## + # An ARGV-style array of options to RDoc + + array_attribute :rdoc_options + + ## + # Extra files to add to RDoc + + array_attribute :extra_rdoc_files + + ## + # Executables included in the gem + + array_attribute :executables + + ## + # Extensions to build when installing the gem. See + # Gem::Installer#build_extensions for valid values. + + array_attribute :extensions + + ## + # An array or things required by this gem. Not used by anything + # presently. + + array_attribute :requirements + + ## + # A list of Gem::Dependency objects this gem depends on. Only appendable. + + array_attribute :dependencies + + read_only :dependencies + + # :section: Aliased gemspec attributes + + ## + # Singular accessor for executables + + attribute_alias_singular :executable, :executables + + ## + # Singular accessor for authors + + attribute_alias_singular :author, :authors + + ## + # Singular accessor for require_paths + + attribute_alias_singular :require_path, :require_paths + + ## + # Singular accessor for test_files + + attribute_alias_singular :test_file, :test_files + + overwrite_accessor :version= do |version| + @version = Version.create(version) + end + + overwrite_accessor :platform do + @new_platform + end + + overwrite_accessor :platform= do |platform| + if @original_platform.nil? or + @original_platform == Gem::Platform::RUBY then + @original_platform = platform + end + + case platform + when Gem::Platform::CURRENT then + @new_platform = Gem::Platform.local + @original_platform = @new_platform.to_s + + when Gem::Platform then + @new_platform = platform + + # legacy constants + when nil, Gem::Platform::RUBY then + @new_platform = Gem::Platform::RUBY + when 'mswin32' then # was Gem::Platform::WIN32 + @new_platform = Gem::Platform.new 'x86-mswin32' + when 'i586-linux' then # was Gem::Platform::LINUX_586 + @new_platform = Gem::Platform.new 'x86-linux' + when 'powerpc-darwin' then # was Gem::Platform::DARWIN + @new_platform = Gem::Platform.new 'ppc-darwin' + else + @new_platform = Gem::Platform.new platform + end + + @platform = @new_platform.to_s + + @new_platform + end + + overwrite_accessor :required_ruby_version= do |value| + @required_ruby_version = Gem::Requirement.create(value) + end + + overwrite_accessor :required_rubygems_version= do |value| + @required_rubygems_version = Gem::Requirement.create(value) + end + + overwrite_accessor :date= do |date| + # We want to end up with a Time object with one-day resolution. + # This is the cleanest, most-readable, faster-than-using-Date + # way to do it. + case date + when String then + @date = if /\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then + Time.local($1.to_i, $2.to_i, $3.to_i) + else + require 'time' + Time.parse date + end + when Time then + @date = Time.local(date.year, date.month, date.day) + when Date then + @date = Time.local(date.year, date.month, date.day) + else + @date = TODAY + end + end + + overwrite_accessor :date do + self.date = nil if @date.nil? # HACK Sets the default value for date + @date + end + + overwrite_accessor :summary= do |str| + @summary = if str then + str.strip. + gsub(/(\w-)\n[ \t]*(\w)/, '\1\2'). + gsub(/\n[ \t]*/, " ") + end + end + + overwrite_accessor :description= do |str| + @description = if str then + str.strip. + gsub(/(\w-)\n[ \t]*(\w)/, '\1\2'). + gsub(/\n[ \t]*/, " ") + end + end + + overwrite_accessor :default_executable do + begin + if defined?(@default_executable) and @default_executable + result = @default_executable + elsif @executables and @executables.size == 1 + result = Array(@executables).first + else + result = nil + end + result + rescue + nil + end + end + + overwrite_accessor :test_files do + # Handle the possibility that we have @test_suite_file but not + # @test_files. This will happen when an old gem is loaded via + # YAML. + if defined? @test_suite_file then + @test_files = [@test_suite_file].flatten + @test_suite_file = nil + end + if defined?(@test_files) and @test_files then + @test_files + else + @test_files = [] + end + end + + overwrite_accessor :files do + result = [] + result.push(*@files) if defined?(@files) + result.push(*@test_files) if defined?(@test_files) + result.push(*(add_bindir(@executables))) + result.push(*@extra_rdoc_files) if defined?(@extra_rdoc_files) + result.push(*@extensions) if defined?(@extensions) + result.uniq.compact + end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/test_utilities.rb libgems-ruby-1.3.1/lib/rubygems/test_utilities.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/test_utilities.rb 2008-05-28 18:46:15.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/test_utilities.rb 2008-08-11 21:48:14.000000000 -0500 @@ -30,29 +30,40 @@ @paths = [] end - def fetch_path(path) + def fetch_path path, mtime = nil path = path.to_s @paths << path raise ArgumentError, 'need full URI' unless path =~ %r'^http://' - data = @data[path] - if data.nil? then - raise Gem::RemoteFetcher::FetchError.new('no data', path) + unless @data.key? path then + raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path) end - data.respond_to?(:call) ? data.call : data + data = @data[path] + + if data.respond_to?(:call) then + data.call + else + if path.to_s =~ /gz$/ and not data.nil? and not data.empty? then + data = Gem.gunzip data + end + + data + end end def fetch_size(path) path = path.to_s @paths << path + raise ArgumentError, 'need full URI' unless path =~ %r'^http://' - data = @data[path] - if data.nil? then - raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", nil) + unless @data.key? path then + raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path) end + data = @data[path] + data.respond_to?(:call) ? data.call : data.length end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._timer.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._timer.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/uninstaller.rb libgems-ruby-1.3.1/lib/rubygems/uninstaller.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/uninstaller.rb 2008-06-20 13:34:46.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/uninstaller.rb 2008-08-14 17:57:27.000000000 -0500 @@ -18,9 +18,23 @@ include Gem::UserInteraction ## - # Constructs an Uninstaller instance - # - # gem:: [String] The Gem name to uninstall + # The directory a gem's executables will be installed into + + attr_reader :bin_dir + + ## + # The gem repository the gem will be installed into + + attr_reader :gem_home + + ## + # The Gem::Specification for the gem being uninstalled, only set during + # #uninstall_gem + + attr_reader :spec + + ## + # Constructs an uninstaller that will uninstall +gem+ def initialize(gem, options = {}) @gem = gem @@ -31,42 +45,63 @@ @force_all = options[:all] @force_ignore = options[:ignore] @bin_dir = options[:bin_dir] + + spec_dir = File.join @gem_home, 'specifications' + @source_index = Gem::SourceIndex.from_gems_in spec_dir end ## - # Performs the uninstall of the Gem. This removes the spec, the - # Gem directory, and the cached .gem file, + # Performs the uninstall of the gem. This removes the spec, the Gem + # directory, and the cached .gem file. def uninstall - list = Gem.source_index.search(/^#{@gem}$/, @version) + list = @source_index.find_name @gem, @version if list.empty? then raise Gem::InstallError, "Unknown gem #{@gem} #{@version}" - elsif list.size > 1 && @force_all - remove_all(list.dup) - remove_executables(list.last) - elsif list.size > 1 - say + + elsif list.size > 1 and @force_all then + remove_all list.dup + + elsif list.size > 1 then gem_names = list.collect {|gem| gem.full_name} + ["All versions"] - gem_name, index = - choose_from_list("Select gem to uninstall:", gem_names) - if index == list.size - remove_all(list.dup) - remove_executables(list.last) - elsif index >= 0 && index < list.size - to_remove = list[index] - remove(to_remove, list) - remove_executables(to_remove) + + say + gem_name, index = choose_from_list "Select gem to uninstall:", gem_names + + if index == list.size then + remove_all list.dup + elsif index >= 0 && index < list.size then + uninstall_gem list[index], list.dup else say "Error: must enter a number [1-#{list.size+1}]" end else - remove(list[0], list.dup) - remove_executables(list.last) + uninstall_gem list.first, list.dup end end ## + # Uninstalls gem +spec+ + + def uninstall_gem(spec, specs) + @spec = spec + + Gem.pre_uninstall_hooks.each do |hook| + hook.call self + end + + specs.each { |s| remove_executables s } + remove spec, specs + + Gem.post_uninstall_hooks.each do |hook| + hook.call self + end + + @spec = nil + end + + ## # Removes installed executables and batch files (windows only) for # +gemspec+. @@ -76,7 +111,7 @@ if gemspec.executables.size > 0 then bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home) - list = Gem.source_index.search(gemspec.name).delete_if { |spec| + list = @source_index.find_name(gemspec.name).delete_if { |spec| spec.version == gemspec.version } @@ -118,7 +153,7 @@ # NOTE: removes uninstalled gems from +list+. def remove_all(list) - list.dup.each { |spec| remove spec, list } + list.dup.each { |spec| uninstall_gem spec, list } end ## @@ -185,8 +220,7 @@ def dependencies_ok?(spec) return true if @force_ignore - source_index = Gem::SourceIndex.from_installed_gems - deplist = Gem::DependencyList.from_source_index source_index + deplist = Gem::DependencyList.from_source_index @source_index deplist.ok_to_remove?(spec.full_name) || ask_if_ok(spec) end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._user_interaction.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._user_interaction.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/validator.rb libgems-ruby-1.3.1/lib/rubygems/validator.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/validator.rb 2008-06-17 18:25:38.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems/validator.rb 2008-10-09 19:49:54.000000000 -0500 @@ -10,118 +10,130 @@ require 'rubygems/format' require 'rubygems/installer' -module Gem +## +# Validator performs various gem file and gem database validation + +class Gem::Validator + + include Gem::UserInteraction ## - # Validator performs various gem file and gem database validation - class Validator - include UserInteraction - - ## - # Given a gem file's contents, validates against its own MD5 checksum - # gem_data:: [String] Contents of the gem file - def verify_gem(gem_data) - raise VerificationError, 'empty gem file' if gem_data.size == 0 - - unless gem_data =~ /MD5SUM/ then - return # Don't worry about it...this sucks. Need to fix MD5 stuff for - # new format - # FIXME - end - - sum_data = gem_data.gsub(/MD5SUM = "([a-z0-9]+)"/, - "MD5SUM = \"#{"F" * 32}\"") - - unless Gem::MD5.hexdigest(sum_data) == $1.to_s then - raise VerificationError, 'invalid checksum for gem file' - end + # Given a gem file's contents, validates against its own MD5 checksum + # gem_data:: [String] Contents of the gem file + + def verify_gem(gem_data) + raise Gem::VerificationError, 'empty gem file' if gem_data.size == 0 + + unless gem_data =~ /MD5SUM/ then + return # Don't worry about it...this sucks. Need to fix MD5 stuff for + # new format + # FIXME end - ## - # Given the path to a gem file, validates against its own MD5 checksum - # - # gem_path:: [String] Path to gem file - def verify_gem_file(gem_path) - open gem_path, Gem.binary_mode do |file| - gem_data = file.read - verify_gem gem_data - end - rescue Errno::ENOENT - raise Gem::VerificationError.new("missing gem file #{gem_path}") - end - - private - def find_files_for_gem(gem_directory) - installed_files = [] - Find.find(gem_directory) {|file_name| - fn = file_name.slice((gem_directory.size)..(file_name.size-1)).sub(/^\//, "") - if(!(fn =~ /CVS/ || File.directory?(fn) || fn == "")) then - installed_files << fn - end - - } - installed_files + sum_data = gem_data.gsub(/MD5SUM = "([a-z0-9]+)"/, + "MD5SUM = \"#{"F" * 32}\"") + + unless Gem::MD5.hexdigest(sum_data) == $1.to_s then + raise Gem::VerificationError, 'invalid checksum for gem file' end - + end - public - ErrorData = Struct.new(:path, :problem) + ## + # Given the path to a gem file, validates against its own MD5 checksum + # + # gem_path:: [String] Path to gem file + + def verify_gem_file(gem_path) + open gem_path, Gem.binary_mode do |file| + gem_data = file.read + verify_gem gem_data + end + rescue Errno::ENOENT + raise Gem::VerificationError, "missing gem file #{gem_path}" + end - ## - # Checks the gem directory for the following potential - # inconsistencies/problems: - # * Checksum gem itself - # * For each file in each gem, check consistency of installed versions - # * Check for files that aren't part of the gem but are in the gems directory - # * 1 cache - 1 spec - 1 directory. - # - # returns a hash of ErrorData objects, keyed on the problem gem's name. - def alien - errors = {} - Gem::SourceIndex.from_installed_gems.each do |gem_name, gem_spec| - errors[gem_name] ||= [] - gem_path = File.join(Gem.dir, "cache", gem_spec.full_name) + ".gem" - spec_path = File.join(Gem.dir, "specifications", gem_spec.full_name) + ".gemspec" - gem_directory = File.join(Gem.dir, "gems", gem_spec.full_name) - installed_files = find_files_for_gem(gem_directory) - - if(!File.exist?(spec_path)) then - errors[gem_name] << ErrorData.new(spec_path, "Spec file doesn't exist for installed gem") - end - - begin - verify_gem_file(gem_path) - open gem_path, Gem.binary_mode do |file| - format = Gem::Format.from_file_by_path(gem_path) - format.file_entries.each do |entry, data| - # Found this file. Delete it from list - installed_files.delete remove_leading_dot_dir(entry['path']) - - next unless data # HACK `gem check -a mkrf` - - open File.join(gem_directory, entry['path']), Gem.binary_mode do |f| - unless Gem::MD5.hexdigest(f.read).to_s == - Gem::MD5.hexdigest(data).to_s then - errors[gem_name] << ErrorData.new(entry['path'], "installed file doesn't match original from gem") - end + private + + def find_files_for_gem(gem_directory) + installed_files = [] + Find.find(gem_directory) {|file_name| + fn = file_name.slice((gem_directory.size)..(file_name.size-1)).sub(/^\//, "") + if(!(fn =~ /CVS/ || File.directory?(fn) || fn == "")) then + installed_files << fn + end + + } + installed_files + end + + public + + ErrorData = Struct.new :path, :problem + + ## + # Checks the gem directory for the following potential + # inconsistencies/problems: + # + # * Checksum gem itself + # * For each file in each gem, check consistency of installed versions + # * Check for files that aren't part of the gem but are in the gems directory + # * 1 cache - 1 spec - 1 directory. + # + # returns a hash of ErrorData objects, keyed on the problem gem's name. + + def alien + errors = {} + + Gem::SourceIndex.from_installed_gems.each do |gem_name, gem_spec| + errors[gem_name] ||= [] + + gem_path = File.join(Gem.dir, "cache", gem_spec.full_name) + ".gem" + spec_path = File.join(Gem.dir, "specifications", gem_spec.full_name) + ".gemspec" + gem_directory = File.join(Gem.dir, "gems", gem_spec.full_name) + + installed_files = find_files_for_gem(gem_directory) + + unless File.exist? spec_path then + errors[gem_name] << ErrorData.new(spec_path, "Spec file doesn't exist for installed gem") + end + + begin + verify_gem_file(gem_path) + + open gem_path, Gem.binary_mode do |file| + format = Gem::Format.from_file_by_path(gem_path) + format.file_entries.each do |entry, data| + # Found this file. Delete it from list + installed_files.delete remove_leading_dot_dir(entry['path']) + + next unless data # HACK `gem check -a mkrf` + + open File.join(gem_directory, entry['path']), Gem.binary_mode do |f| + unless Gem::MD5.hexdigest(f.read).to_s == + Gem::MD5.hexdigest(data).to_s then + errors[gem_name] << ErrorData.new(entry['path'], "installed file doesn't match original from gem") end end end - rescue VerificationError => e - errors[gem_name] << ErrorData.new(gem_path, e.message) - end - # Clean out directories that weren't explicitly included in the gemspec - # FIXME: This still allows arbitrary incorrect directories. - installed_files.delete_if {|potential_directory| - File.directory?(File.join(gem_directory, potential_directory)) - } - if(installed_files.size > 0) then - errors[gem_name] << ErrorData.new(gem_path, "Unmanaged files in gem: #{installed_files.inspect}") end + rescue Gem::VerificationError => e + errors[gem_name] << ErrorData.new(gem_path, e.message) + end + + # Clean out directories that weren't explicitly included in the gemspec + # FIXME: This still allows arbitrary incorrect directories. + installed_files.delete_if {|potential_directory| + File.directory?(File.join(gem_directory, potential_directory)) + } + if(installed_files.size > 0) then + errors[gem_name] << ErrorData.new(gem_path, "Unmanaged files in gem: #{installed_files.inspect}") end - errors end + errors + end + + if RUBY_VERSION < '1.9' then class TestRunner def initialize(suite, ui) @suite = suite @@ -147,40 +159,50 @@ end autoload :TestRunner, 'test/unit/ui/testrunnerutilities' - - ## - # Runs unit tests for a given gem specification - def unit_test(gem_spec) - start_dir = Dir.pwd - Dir.chdir(gem_spec.full_gem_path) - $: << File.join(Gem.dir, "gems", gem_spec.full_name) - # XXX: why do we need this gem_spec when we've already got 'spec'? - test_files = gem_spec.test_files - if test_files.empty? - say "There are no unit tests to run for #{gem_spec.full_name}" - require 'test/unit/ui/console/testrunner' - return Test::Unit::TestResult.new - end - gem gem_spec.name, "= #{gem_spec.version.version}" - test_files.each do |f| require f end + end + + ## + # Runs unit tests for a given gem specification + + def unit_test(gem_spec) + start_dir = Dir.pwd + Dir.chdir(gem_spec.full_gem_path) + $: << File.join(Gem.dir, "gems", gem_spec.full_name) + # XXX: why do we need this gem_spec when we've already got 'spec'? + test_files = gem_spec.test_files + + if test_files.empty? then + say "There are no unit tests to run for #{gem_spec.full_name}" + return nil + end + + gem gem_spec.name, "= #{gem_spec.version.version}" + + test_files.each do |f| require f end + + if RUBY_VERSION < '1.9' then suite = Test::Unit::TestSuite.new("#{gem_spec.name}-#{gem_spec.version}") + ObjectSpace.each_object(Class) do |klass| suite << klass.suite if (klass < Test::Unit::TestCase) end - result = TestRunner.run(suite, ui()) - unless result.passed? - alert_error(result.to_s) - #unless ask_yes_no(result.to_s + "...keep Gem?", true) then - #Gem::Uninstaller.new(gem_spec.name, gem_spec.version.version).uninstall - #end - end - result - ensure - Dir.chdir(start_dir) - end - def remove_leading_dot_dir(path) - path.sub(/^\.\//, "") + result = TestRunner.run suite, ui + + alert_error result.to_s unless result.passed? + else + result = MiniTest::Unit.new + result.run end + + result + ensure + Dir.chdir(start_dir) + end + + def remove_leading_dot_dir(path) + path.sub(/^\.\//, "") end + end + Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._version_option.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._version_option.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems/._version.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/rubygems/._version.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems.rb libgems-ruby-1.3.1/lib/rubygems.rb --- libgems-ruby-1.3.0~RC1really1.2.0/lib/rubygems.rb 2008-06-20 14:54:57.000000000 -0500 +++ libgems-ruby-1.3.1/lib/rubygems.rb 2008-10-25 16:14:49.000000000 -0500 @@ -43,12 +43,14 @@ # # GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb - def gem(gem_name, *version_requirements) + def gem(gem_name, *version_requirements) # :doc: skip_list = (ENV['GEM_SKIP'] || "").split(/:/) raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name Gem.activate(gem_name, *version_requirements) end + private :gem + end ## @@ -104,6 +106,11 @@ @ruby = nil @sources = [] + @post_install_hooks ||= [] + @post_uninstall_hooks ||= [] + @pre_uninstall_hooks ||= [] + @pre_install_hooks ||= [] + ## # Activates an installed gem matching +gem+. The gem must satisfy # +version_requirements+. @@ -244,7 +251,10 @@ def self.clear_paths @gem_home = nil @gem_path = nil + @user_home = nil + @@source_index = nil + MUTEX.synchronize do @searcher = nil end @@ -261,9 +271,7 @@ # The standard configuration object for gems. def self.configuration - return @configuration if @configuration - require 'rubygems/config_file' - @configuration = Gem::ConfigFile.new [] + @configuration ||= Gem::ConfigFile.new [] end ## @@ -288,6 +296,7 @@ # A Zlib::Deflate.deflate wrapper def self.deflate(data) + require 'zlib' Zlib::Deflate.deflate data end @@ -296,7 +305,7 @@ def self.dir @gem_home ||= nil - set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home + set_home(ENV['GEM_HOME'] || Gem.configuration.home || default_dir) unless @gem_home @gem_home end @@ -337,6 +346,22 @@ end ## + # Returns a list of paths matching +file+ that can be used by a gem to pick + # up features from other gems. For example: + # + # Gem.find_files('rdoc/discover').each do |path| load path end + # + # find_files does not search $LOAD_PATH for files, only gems. + + def self.find_files(path) + specs = searcher.find_all path + + specs.map do |spec| + searcher.matching_files spec, path + end.flatten + end + + ## # Finds the user's home directory. #-- # Some comments from the ruby-talk list regarding finding the home @@ -353,7 +378,7 @@ end if ENV['HOMEDRIVE'] && ENV['HOMEPATH'] then - return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}" + return "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}" end begin @@ -373,6 +398,8 @@ # Zlib::GzipReader wrapper that unzips +data+. def self.gunzip(data) + require 'stringio' + require 'zlib' data = StringIO.new data Zlib::GzipReader.new(data).read @@ -382,6 +409,8 @@ # Zlib::GzipWriter wrapper that zips +data+. def self.gzip(data) + require 'stringio' + require 'zlib' zipped = StringIO.new Zlib::GzipWriter.wrap zipped do |io| io.write data end @@ -393,6 +422,7 @@ # A Zlib::Inflate#inflate wrapper def self.inflate(data) + require 'zlib' Zlib::Inflate.inflate data end @@ -457,22 +487,20 @@ # The file name and line number of the caller of the caller of this method. def self.location_of_caller - file, lineno = caller[1].split(':') - lineno = lineno.to_i + caller[1] =~ /(.*?):(\d+)$/i + file = $1 + lineno = $2.to_i + [file, lineno] end - private_class_method :location_of_caller - ## # manage_gems is useless and deprecated. Don't call it anymore. - #-- - # TODO warn w/ RubyGems 1.2.x release. - def self.manage_gems - #file, lineno = location_of_caller + def self.manage_gems # :nodoc: + file, lineno = location_of_caller - #warn "#{file}:#{lineno}:Warning: Gem#manage_gems is deprecated and will be removed on or after September 2008." + warn "#{file}:#{lineno}:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009." end ## @@ -489,11 +517,7 @@ @gem_path ||= nil unless @gem_path then - paths = if ENV['GEM_PATH'] then - [ENV['GEM_PATH']] - else - [default_path] - end + paths = [ENV['GEM_PATH'] || Gem.configuration.path || default_path] if defined?(APPLE_GEM_HOME) and not ENV['GEM_PATH'] then paths << APPLE_GEM_HOME @@ -524,6 +548,40 @@ end ## + # Adds a post-install hook that will be passed an Gem::Installer instance + # when Gem::Installer#install is called + + def self.post_install(&hook) + @post_install_hooks << hook + end + + ## + # Adds a post-uninstall hook that will be passed a Gem::Uninstaller instance + # and the spec that was uninstalled when Gem::Uninstaller#uninstall is + # called + + def self.post_uninstall(&hook) + @post_uninstall_hooks << hook + end + + ## + # Adds a pre-install hook that will be passed an Gem::Installer instance + # when Gem::Installer#install is called + + def self.pre_install(&hook) + @pre_install_hooks << hook + end + + ## + # Adds a pre-uninstall hook that will be passed an Gem::Uninstaller instance + # and the spec that will be uninstalled when Gem::Uninstaller#uninstall is + # called + + def self.pre_uninstall(&hook) + @pre_uninstall_hooks << hook + end + + ## # The directory prefix this RubyGems was installed at. def self.prefix @@ -600,6 +658,9 @@ @ruby = File.join(ConfigMap[:bindir], ConfigMap[:ruby_install_name]) @ruby << ConfigMap[:EXEEXT] + + # escape string in case path to ruby executable contain spaces. + @ruby.sub!(/.*\s.*/m, '"\&"') end @ruby @@ -650,11 +711,20 @@ @gem_path << Gem.dir else + # TODO: should this be Gem.default_path instead? @gem_path = [Gem.dir] end @gem_path.uniq! - @gem_path.each do |gp| ensure_gem_subdirectories(gp) end + @gem_path.each do |path| + if 0 == File.expand_path(path).index(Gem.user_home) + unless win_platform? then + # only create by matching user + next if Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid + end + end + ensure_gem_subdirectories path + end end private_class_method :set_paths @@ -685,6 +755,14 @@ end ## + # Need to be able to set the sources without calling + # Gem.sources.replace since that would cause an infinite loop. + + def self.sources=(new_sources) + @sources = new_sources + end + + ## # Glob pattern for require-able path suffixes. def self.suffix_pattern @@ -730,6 +808,27 @@ attr_reader :loaded_specs + ## + # The list of hooks to be run before Gem::Install#install does any work + + attr_reader :post_install_hooks + + ## + # The list of hooks to be run before Gem::Uninstall#uninstall does any + # work + + attr_reader :post_uninstall_hooks + + ## + # The list of hooks to be run after Gem::Install#install is finished + + attr_reader :pre_install_hooks + + ## + # The list of hooks to be run after Gem::Uninstall#uninstall is finished + + attr_reader :pre_uninstall_hooks + # :stopdoc: alias cache source_index # an alias for the old name @@ -780,7 +879,10 @@ end end +require 'rubygems/config_file' + if RUBY_VERSION < '1.9' then require 'rubygems/custom_require' end +Gem.clear_paths Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/lib/._ubygems.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/lib/._ubygems.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/._LICENSE.txt and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/._LICENSE.txt differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/pkgs/sources/lib/._sources.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/pkgs/sources/lib/._sources.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/pkgs/sources/._sources.gemspec and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/pkgs/sources/._sources.gemspec differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/Rakefile libgems-ruby-1.3.1/Rakefile --- libgems-ruby-1.3.0~RC1really1.2.0/Rakefile 2008-06-21 20:57:18.000000000 -0500 +++ libgems-ruby-1.3.1/Rakefile 2008-09-25 03:26:47.000000000 -0500 @@ -298,6 +298,8 @@ p.package_files = PKG_FILES end +warn_unsigned = true + Spec = Gem::Specification.new do |s| s.name = PKG_NAME + "-update" s.version = PKG_VERSION @@ -316,15 +318,27 @@ s.bindir = "bin" # Use these for applications. s.executables = ["update_rubygems"] certdir = ENV['CERT_DIR'] - if certdir - s.signing_key = File.join(certdir, 'gem-private_key.pem') - s.cert_chain = [File.join(certdir, 'gem-public_cert.pem')] + if certdir then + key = File.join certdir, 'gem-private_key.pem' + cert = File.join certdir, 'gem-public_cert.pem' + + if File.exist? key and File.exist? cert then + s.signing_key = File.join(certdir, 'gem-private_key.pem') + s.cert_chain = [File.join(certdir, 'gem-public_cert.pem')] + warn_unsigned = false + else + warn_unsigned = true + end end end # Add console output about signing the Gem file "pkg/#{Spec.full_name}.gem" do - puts "Signed with certificates in '#{ENV['CERT_DIR']}'" if ENV['CERT_DIR'] + if warn_unsigned then + warn "WARNING: gem will not be signed, no key or certificate found in #{ENV['CERT_DIR']}" + else + puts "Signed with certificates in '#{ENV['CERT_DIR']}'" + end end Rake::GemPackageTask.new(Spec) do |p| end @@ -337,7 +351,8 @@ desc "Install RubyGems" task :install do - ruby 'setup.rb' + opts = ENV['SETUP_OPTIONS'] + ruby "setup.rb #{opts}".strip svnversion = `svnversion`.split(':').last.sub(/[^\d]/, '').strip Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/._README and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/._README differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/scripts/._buildtests.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/scripts/._buildtests.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/scripts/._gemdoc.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/scripts/._gemdoc.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/scripts/._runtest.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/scripts/._runtest.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/scripts/._specdoc.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/scripts/._specdoc.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/scripts/._upload_gemdoc.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/scripts/._upload_gemdoc.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/._setup.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/._setup.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/setup.rb libgems-ruby-1.3.1/setup.rb --- libgems-ruby-1.3.0~RC1really1.2.0/setup.rb 2008-06-21 18:51:11.000000000 -0500 +++ libgems-ruby-1.3.1/setup.rb 2008-07-11 03:08:08.000000000 -0500 @@ -90,14 +90,17 @@ end end -unless install_destdir.empty? then - ENV['GEM_HOME'] ||= File.join(install_destdir, - Gem.default_dir.sub(/\A[a-z]:/i, '')) -end - require 'fileutils' require 'rbconfig' require 'tmpdir' +require 'pathname' + +unless install_destdir.empty? then + default_dir = Pathname.new(Gem.default_dir) + top_dir = Pathname.new(RbConfig::TOPDIR) + ENV['GEM_HOME'] ||= File.join(install_destdir, + default_dir.relative_path_from(top_dir)) +end include FileUtils::Verbose @@ -134,8 +137,12 @@ end unless install_destdir.empty? - lib_dir = File.join install_destdir, lib_dir - bin_dir = File.join install_destdir, bin_dir + top_dir = Pathname.new(RbConfig::TOPDIR) + lib_dir_p = Pathname.new(lib_dir) + bin_dir_p = Pathname.new(bin_dir) + + lib_dir = File.join install_destdir, lib_dir_p.relative_path_from(top_dir) + bin_dir = File.join install_destdir, bin_dir_p.relative_path_from(top_dir) end mkdir_p lib_dir @@ -324,3 +331,4 @@ puts "to remove it by hand." puts + Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._bogussources.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._bogussources.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/data/._gem-private_key.pem and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/data/._gem-private_key.pem differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/data/._gem-public_cert.pem and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/data/._gem-public_cert.pem differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/fake_certlib/._openssl.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/fake_certlib/._openssl.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/functional.rb libgems-ruby-1.3.1/test/functional.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/functional.rb 2007-08-16 00:47:25.000000000 -0500 +++ libgems-ruby-1.3.1/test/functional.rb 2008-10-09 18:24:37.000000000 -0500 @@ -5,13 +5,14 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require 'rubygems' +require 'minitest/unit' require 'test/insure_session' require 'rubygems/format' require 'rubygems/command_manager' -class FunctionalTest < Test::Unit::TestCase +class FunctionalTest < MiniTest::Unit::TestCase + def setup @gem_path = File.expand_path("bin/gem") lib_path = File.expand_path("lib") @@ -93,3 +94,6 @@ end end + +MiniTest::Unit.autorun + diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/gem_installer_test_case.rb libgems-ruby-1.3.1/test/gem_installer_test_case.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/gem_installer_test_case.rb 2008-06-04 21:01:32.000000000 -0500 +++ libgems-ruby-1.3.1/test/gem_installer_test_case.rb 2008-10-09 18:03:33.000000000 -0500 @@ -1,4 +1,4 @@ -require 'test/unit' +require 'minitest/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/installer' Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._gem_package_tar_test_case.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._gem_package_tar_test_case.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/gemutilities.rb libgems-ruby-1.3.1/test/gemutilities.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/gemutilities.rb 2008-06-17 17:36:35.000000000 -0500 +++ libgems-ruby-1.3.1/test/gemutilities.rb 2008-10-10 16:42:58.000000000 -0500 @@ -1,4 +1,3 @@ -#!/usr/bin/env ruby #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. @@ -7,8 +6,16 @@ at_exit { $SAFE = 1 } +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) + +require 'rubygems' require 'fileutils' -require 'test/unit' +begin + require 'minitest/unit' +rescue LoadError + warn "Install minitest gem" + raise +end require 'tmpdir' require 'uri' require 'rubygems/package' @@ -17,6 +24,10 @@ require File.join(File.expand_path(File.dirname(__FILE__)), 'mockgemui') module Gem + def self.searcher=(searcher) + MUTEX.synchronize do @searcher = searcher end + end + def self.source_index=(si) @@source_index = si end @@ -24,9 +35,13 @@ def self.win_platform=(val) @@win_platform = val end + + module DefaultUserInteraction + @ui = MockGemUi.new + end end -class RubyGemTestCase < Test::Unit::TestCase +class RubyGemTestCase < MiniTest::Unit::TestCase include Gem::DefaultUserInteraction @@ -47,6 +62,7 @@ @latest_usrcache = File.join(@gemhome, ".gem", "latest_user_cache") @userhome = File.join @tempdir, 'userhome' + @orig_ENV_HOME = ENV['HOME'] ENV['HOME'] = @userhome Gem.instance_variable_set :@user_home, nil @@ -83,6 +99,27 @@ 'private_key.pem') @public_cert = File.expand_path File.join(File.dirname(__FILE__), 'public_cert.pem') + + Gem.post_install_hooks.clear + Gem.post_uninstall_hooks.clear + Gem.pre_install_hooks.clear + Gem.pre_uninstall_hooks.clear + + Gem.post_install do |installer| + @post_install_hook_arg = installer + end + + Gem.post_uninstall do |uninstaller| + @post_uninstall_hook_arg = uninstaller + end + + Gem.pre_install do |installer| + @pre_install_hook_arg = installer + end + + Gem.pre_uninstall do |uninstaller| + @pre_uninstall_hook_arg = uninstaller + end end def teardown @@ -100,6 +137,12 @@ ENV.delete 'GEM_PATH' Gem.clear_paths + + if @orig_ENV_HOME then + ENV['HOME'] = @orig_ENV_HOME + else + ENV.delete 'HOME' + end end def install_gem gem @@ -386,5 +429,60 @@ self.class.process_based_port end + def build_rake_in + gem_ruby = Gem.ruby + ruby = @@ruby + Gem.module_eval {@ruby = ruby} + env_rake = ENV["rake"] + ENV["rake"] = @@rake + yield @@rake + ensure + Gem.module_eval {@ruby = gem_ruby} + if env_rake + ENV["rake"] = env_rake + else + ENV.delete("rake") + end + end + + def self.rubybin + if ruby = ENV["RUBY"] + return ruby + end + ruby = "ruby" + rubyexe = ruby+".exe" + 3.times do + if File.exist? ruby and File.executable? ruby and !File.directory? ruby + return File.expand_path(ruby) + end + if File.exist? rubyexe and File.executable? rubyexe + return File.expand_path(rubyexe) + end + ruby = File.join("..", ruby) + end + begin + require "rbconfig" + File.join( + RbConfig::CONFIG["bindir"], + RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"] + ) + rescue LoadError + "ruby" + end + end + + @@ruby = rubybin + env_rake = ENV['rake'] + ruby19_rake = File.expand_path("../../../bin/rake", __FILE__) + @@rake = if env_rake then + ENV["rake"] + elsif File.exist? ruby19_rake then + @@ruby + " " + ruby19_rake + else + 'rake' + end + end +MiniTest::Unit.autorun + Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._insure_session.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._insure_session.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._mockgemui.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._mockgemui.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/mockgemui.rb libgems-ruby-1.3.1/test/mockgemui.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/mockgemui.rb 2008-03-28 15:56:15.000000000 -0500 +++ libgems-ruby-1.3.1/test/mockgemui.rb 2008-07-11 03:17:40.000000000 -0500 @@ -12,8 +12,28 @@ class MockGemUi < Gem::StreamUI class TermError < RuntimeError; end - def initialize(input="") - super(StringIO.new(input), StringIO.new, StringIO.new) + module TTY + + attr_accessor :tty + + def tty?() + @tty = true unless defined?(@tty) + @tty + end + + end + + def initialize(input = "") + ins = StringIO.new input + outs = StringIO.new + errs = StringIO.new + + ins.extend TTY + outs.extend TTY + errs.extend TTY + + super ins, outs, errs + @terminated = false end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._private_key.pem and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._private_key.pem differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._public_cert.pem and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._public_cert.pem differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._simple_gem.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._simple_gem.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_config.rb libgems-ruby-1.3.1/test/test_config.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_config.rb 2008-04-17 21:46:36.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_config.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,11 +1,9 @@ -#!/usr/bin/env ruby #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rbconfig' require 'rubygems' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_builder.rb libgems-ruby-1.3.1/test/test_gem_builder.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_builder.rb 2007-12-19 18:47:40.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_builder.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/builder' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_command_manager.rb libgems-ruby-1.3.1/test/test_gem_command_manager.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_command_manager.rb 2008-06-09 17:50:44.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_command_manager.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/command_manager' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_command.rb libgems-ruby-1.3.1/test/test_gem_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_command.rb 2007-11-09 21:10:10.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -5,7 +5,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/command' @@ -63,7 +62,7 @@ assert_match %r|-x, --zip|, @cmd.parser.to_s assert_match %r|-z, --exe|, @cmd.parser.to_s - assert_no_match %r|-x, --exe|, @cmd.parser.to_s + refute_match %r|-x, --exe|, @cmd.parser.to_s end def test_basic_accessors @@ -109,7 +108,7 @@ use_ui @ui do @cmd.when_invoked do true end - ex = assert_raise(OptionParser::InvalidOption) do + ex = assert_raises OptionParser::InvalidOption do @cmd.invoke('-zzz') end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_build_command.rb libgems-ruby-1.3.1/test/test_gem_commands_build_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_build_command.rb 2007-12-19 06:04:44.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_commands_build_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/build_command' require 'rubygems/format' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_cert_command.rb libgems-ruby-1.3.1/test/test_gem_commands_cert_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_cert_command.rb 2008-01-26 15:20:42.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_commands_cert_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/cert_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_check_command.rb libgems-ruby-1.3.1/test/test_gem_commands_check_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_check_command.rb 2007-11-09 21:10:19.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_commands_check_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/check_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_contents_command.rb libgems-ruby-1.3.1/test/test_gem_commands_contents_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_contents_command.rb 2007-11-09 21:10:22.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_commands_contents_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/contents_command' @@ -28,7 +27,7 @@ def test_execute_bad_gem @cmd.options[:args] = %w[foo] - assert_raise MockGemUi::TermError do + assert_raises MockGemUi::TermError do use_ui @ui do @cmd.execute end @@ -71,7 +70,7 @@ end assert_match %r|lib/foo\.rb|, @ui.output - assert_no_match %r|Rakefile|, @ui.output + refute_match %r|Rakefile|, @ui.output assert_equal "", @ui.error end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_dependency_command.rb libgems-ruby-1.3.1/test/test_gem_commands_dependency_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_dependency_command.rb 2008-06-18 19:22:19.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_dependency_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/dependency_command' @@ -61,7 +60,7 @@ def test_execute_no_match @cmd.options[:args] = %w[foo] - assert_raise MockGemUi::TermError do + assert_raises MockGemUi::TermError do use_ui @ui do @cmd.execute end @@ -146,7 +145,7 @@ @cmd.options[:reverse_dependencies] = true @cmd.options[:domain] = :remote - assert_raise MockGemUi::TermError do + assert_raises MockGemUi::TermError do use_ui @ui do @cmd.execute end @@ -199,7 +198,7 @@ @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = si.dump - @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] = nil + @fetcher.data.delete "#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz" FileUtils.rm File.join(@gemhome, 'specifications', "#{foo.full_name}.gemspec") diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_environment_command.rb libgems-ruby-1.3.1/test/test_gem_commands_environment_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_environment_command.rb 2008-06-09 13:40:25.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_environment_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/environment_command' @@ -109,7 +108,7 @@ def test_execute_unknown @cmd.send :handle_options, %w[unknown] - assert_raise Gem::CommandLineError do + assert_raises Gem::CommandLineError do use_ui @ui do @cmd.execute end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_fetch_command.rb libgems-ruby-1.3.1/test/test_gem_commands_fetch_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_fetch_command.rb 2008-06-04 23:28:13.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_fetch_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/package' require 'rubygems/security' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_generate_index_command.rb libgems-ruby-1.3.1/test/test_gem_commands_generate_index_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_generate_index_command.rb 2007-11-10 01:12:44.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_commands_generate_index_command.rb 2008-10-09 18:03:33.000000000 -0500 @@ -1,4 +1,4 @@ -require 'test/unit' +require 'minitest/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/indexer' require 'rubygems/commands/generate_index_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_install_command.rb libgems-ruby-1.3.1/test/test_gem_commands_install_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_install_command.rb 2008-06-09 17:24:12.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_install_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/install_command' @@ -16,7 +15,7 @@ @cmd.options[:include_dependencies] = true @cmd.options[:args] = [] - assert_raise Gem::CommandLineError do + assert_raises Gem::CommandLineError do use_ui @ui do @cmd.execute end @@ -79,7 +78,7 @@ def test_execute_no_gem @cmd.options[:args] = %w[] - assert_raise Gem::CommandLineError do + assert_raises Gem::CommandLineError do @cmd.execute end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_list_command.rb libgems-ruby-1.3.1/test/test_gem_commands_list_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_list_command.rb 1969-12-31 18:00:00.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_commands_list_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -0,0 +1,36 @@ +require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') +require 'rubygems/commands/list_command' + +class TestGemCommandsListCommand < RubyGemTestCase + + def setup + super + + @cmd = Gem::Commands::ListCommand.new + + util_setup_fake_fetcher + + @si = util_setup_spec_fetcher @a1, @a2, @pl1 + + @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do + raise Gem::RemoteFetcher::FetchError + end + end + + def test_execute_installed + @cmd.handle_options %w[c --installed] + + e = assert_raises Gem::SystemExitException do + use_ui @ui do + @cmd.execute + end + end + + assert_equal 0, e.exit_code + + assert_equal "true\n", @ui.output + + assert_equal '', @ui.error + end + +end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_lock_command.rb libgems-ruby-1.3.1/test/test_gem_commands_lock_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_lock_command.rb 1969-12-31 18:00:00.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_commands_lock_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -0,0 +1,68 @@ +require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') +require 'rubygems/commands/lock_command' + +class TestGemCommandsLockCommand < RubyGemTestCase + + def setup + super + + @a1 = quick_gem 'a', '1' + @b1 = quick_gem 'b', '1' do |s| + s.add_runtime_dependency 'a' + end + + @d1 = quick_gem 'd', '1' do |s| + s.add_runtime_dependency 'z' + end + + @cmd = Gem::Commands::LockCommand.new + end + + def test_execute + @cmd.handle_options %w[b-1] + + use_ui @ui do + @cmd.execute + end + + expected = <<-EXPECTED +require 'rubygems' +gem 'b', '= 1' +gem 'a', '= 1' + EXPECTED + + assert_equal expected, @ui.output + assert_equal '', @ui.error + end + + def test_execute_missing_dependency + @cmd.handle_options %w[d-1] + + use_ui @ui do + @cmd.execute + end + + expected = <<-EXPECTED +require 'rubygems' +gem 'd', '= 1' +# Unable to satisfy 'z (>= 0, runtime)' from currently installed gems + EXPECTED + + assert_equal expected, @ui.output + assert_equal '', @ui.error + end + + def test_execute_strict + @cmd.handle_options %w[c-1 --strict] + + e = assert_raises Gem::Exception do + use_ui @ui do + @cmd.execute + end + end + + assert_equal 'Could not find gem c-1, try using the full name', e.message + end + +end + diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_mirror_command.rb libgems-ruby-1.3.1/test/test_gem_commands_mirror_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_mirror_command.rb 2007-12-19 06:02:32.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_commands_mirror_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/indexer' require 'rubygems/commands/mirror_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_outdated_command.rb libgems-ruby-1.3.1/test/test_gem_commands_outdated_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_outdated_command.rb 2008-06-06 16:59:43.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_outdated_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/outdated_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_pristine_command.rb libgems-ruby-1.3.1/test/test_gem_commands_pristine_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_pristine_command.rb 2008-06-06 19:07:27.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_pristine_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/pristine_command' @@ -96,7 +95,7 @@ def test_execute_no_gem @cmd.options[:args] = %w[] - e = assert_raise Gem::CommandLineError do + e = assert_raises Gem::CommandLineError do use_ui @ui do @cmd.execute end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_query_command.rb libgems-ruby-1.3.1/test/test_gem_commands_query_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_query_command.rb 2008-06-15 22:25:51.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_query_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/query_command' @@ -99,7 +98,7 @@ def test_execute_installed @cmd.handle_options %w[-n c --installed] - e = assert_raise Gem::SystemExitException do + e = assert_raises Gem::SystemExitException do use_ui @ui do @cmd.execute end @@ -115,7 +114,7 @@ def test_execute_installed_no_name @cmd.handle_options %w[--installed] - e = assert_raise Gem::SystemExitException do + e = assert_raises Gem::SystemExitException do use_ui @ui do @cmd.execute end @@ -130,7 +129,7 @@ def test_execute_installed_not_installed @cmd.handle_options %w[-n not_installed --installed] - e = assert_raise Gem::SystemExitException do + e = assert_raises Gem::SystemExitException do use_ui @ui do @cmd.execute end @@ -145,7 +144,7 @@ def test_execute_installed_version @cmd.handle_options %w[-n c --installed --version 1.2] - e = assert_raise Gem::SystemExitException do + e = assert_raises Gem::SystemExitException do use_ui @ui do @cmd.execute end @@ -160,7 +159,7 @@ def test_execute_installed_version_not_installed @cmd.handle_options %w[-n c --installed --version 2] - e = assert_raise Gem::SystemExitException do + e = assert_raises Gem::SystemExitException do use_ui @ui do @cmd.execute end @@ -180,7 +179,7 @@ @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = si.dump - @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] = nil + @fetcher.data.delete "#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz" @cmd.handle_options %w[-r] @@ -265,6 +264,27 @@ assert_equal '', @ui.error end + def test_execute_local_notty + @cmd.handle_options %w[] + + @ui.outs.tty = false + + use_ui @ui do + @cmd.execute + end + + expected = <<-EOF +a (2, 1) +a_evil (9) +b (2) +c (1.2) +pl (1) + EOF + + assert_equal expected, @ui.output + assert_equal '', @ui.error + end + def test_execute_no_versions @cmd.handle_options %w[-r --no-versions] @@ -284,5 +304,23 @@ assert_equal '', @ui.error end + def test_execute_notty + @cmd.handle_options %w[-r] + + @ui.outs.tty = false + + use_ui @ui do + @cmd.execute + end + + expected = <<-EOF +a (2) +pl (1) + EOF + + assert_equal expected, @ui.output + assert_equal '', @ui.error + end + end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_server_command.rb libgems-ruby-1.3.1/test/test_gem_commands_server_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_server_command.rb 2008-03-26 23:20:55.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_server_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/server_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_sources_command.rb libgems-ruby-1.3.1/test/test_gem_commands_sources_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_sources_command.rb 2008-06-04 23:28:13.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_sources_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/sources_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_specification_command.rb libgems-ruby-1.3.1/test/test_gem_commands_specification_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_specification_command.rb 2008-05-23 19:18:24.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_specification_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/specification_command' @@ -46,7 +45,7 @@ def test_execute_bad_name @cmd.options[:args] = %w[foo] - assert_raise MockGemUi::TermError do + assert_raises MockGemUi::TermError do use_ui @ui do @cmd.execute end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_stale_command.rb libgems-ruby-1.3.1/test/test_gem_commands_stale_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_stale_command.rb 2008-06-15 17:13:43.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_stale_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/stale_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_uninstall_command.rb libgems-ruby-1.3.1/test/test_gem_commands_uninstall_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_uninstall_command.rb 1969-12-31 18:00:00.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_commands_uninstall_command.rb 2008-10-10 16:31:16.000000000 -0500 @@ -0,0 +1,61 @@ +require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') +require File.join(File.expand_path(File.dirname(__FILE__)), + 'gem_installer_test_case') +require 'rubygems/commands/uninstall_command' + +class TestGemCommandsUninstallCommand < GemInstallerTestCase + + def setup + super + + ui = MockGemUi.new + util_setup_gem ui + + build_rake_in do + use_ui ui do + @installer.install + end + end + + @cmd = Gem::Commands::UninstallCommand.new + @cmd.options[:executables] = true + @executable = File.join(@gemhome, 'bin', 'executable') + end + + def test_execute_removes_executable + if win_platform? + assert_equal true, File.exist?(@executable) + else + assert_equal true, File.symlink?(@executable) + end + + # Evil hack to prevent false removal success + FileUtils.rm_f @executable + File.open(@executable, "wb+") {|f| f.puts "binary"} + + @cmd.options[:args] = Array(@spec.name) + use_ui @ui do + @cmd.execute + end + + output = @ui.output.split "\n" + assert_match(/Removing executable/, output.shift) + assert_match(/Successfully uninstalled/, output.shift) + assert_equal false, File.exist?(@executable) + assert_nil output.shift, "UI output should have contained only two lines" + end + + def test_execute_not_installed + @cmd.options[:args] = ["foo"] + e = assert_raises Gem::InstallError do + use_ui @ui do + @cmd.execute + end + end + + assert_match(/\AUnknown gem foo >= 0$/, e.message) + output = @ui.output.split "\n" + assert output.empty?, "UI output should be empty after an uninstall error" + end +end + diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_unpack_command.rb libgems-ruby-1.3.1/test/test_gem_commands_unpack_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_unpack_command.rb 2008-03-26 23:20:55.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_unpack_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/unpack_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_update_command.rb libgems-ruby-1.3.1/test/test_gem_commands_update_command.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_commands_update_command.rb 2008-06-09 17:13:31.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_commands_update_command.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/commands/update_command' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_config_file.rb libgems-ruby-1.3.1/test/test_gem_config_file.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_config_file.rb 2008-06-18 03:25:20.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_config_file.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,11 +1,9 @@ -#!/usr/bin/env ruby #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/config_file' @@ -22,11 +20,15 @@ Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE, File.join(@tempdir, 'system-gemrc') + Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.clear + Gem::ConfigFile::PLATFORM_DEFAULTS.clear util_config_file end def teardown + Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.clear + Gem::ConfigFile::PLATFORM_DEFAULTS.clear Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE, @orig_SYSTEM_WIDE_CONFIG_FILE @@ -53,6 +55,9 @@ fp.puts ":sources:" fp.puts " - http://more-gems.example.com" fp.puts "install: --wrappers" + fp.puts ":gempath:" + fp.puts "- /usr/ruby/1.8/lib/ruby/gems/1.8" + fp.puts "- /var/ruby/1.8/gem_home" end util_config_file @@ -64,6 +69,8 @@ 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'], + @cfg.path) end def test_initialize_handle_arguments_config_file @@ -84,6 +91,48 @@ assert_equal @temp_conf, @cfg.config_file_name end + def test_initialize_operating_system_override + Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS[:bulk_threshold] = 1 + Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS['install'] = '--no-env-shebang' + + Gem::ConfigFile::PLATFORM_DEFAULTS[:bulk_threshold] = 2 + + util_config_file + + assert_equal 2, @cfg.bulk_threshold + assert_equal '--no-env-shebang', @cfg[:install] + end + + def test_initialize_platform_override + Gem::ConfigFile::PLATFORM_DEFAULTS[:bulk_threshold] = 2 + Gem::ConfigFile::PLATFORM_DEFAULTS['install'] = '--no-env-shebang' + + File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, 'w' do |fp| + fp.puts ":bulk_threshold: 3" + end + + util_config_file + + assert_equal 3, @cfg.bulk_threshold + assert_equal '--no-env-shebang', @cfg[:install] + end + + def test_initialize_system_wide_override + File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, 'w' do |fp| + fp.puts ":backtrace: false" + fp.puts ":bulk_threshold: 2048" + end + + File.open @temp_conf, 'w' do |fp| + fp.puts ":backtrace: true" + end + + util_config_file + + assert_equal 2048, @cfg.bulk_threshold + assert_equal true, @cfg.backtrace + end + def test_handle_arguments args = %w[--backtrace --bunch --of --args here] @@ -222,23 +271,6 @@ assert_equal %w[http://even-more-gems.example.com], Gem.sources end - def test_global_config_file - File.open(@temp_conf, 'w') do |fp| - fp.puts ":backtrace: true" - end - - File.open(File.join(Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE), - 'w') do |fp| - fp.puts ":backtrace: false" - fp.puts ":bulk_threshold: 2048" - end - - util_config_file - - assert_equal 2048, @cfg.bulk_threshold - assert @cfg.backtrace - end - def util_config_file(args = @cfg_args) @cfg = Gem::ConfigFile.new args end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_dependency_installer.rb libgems-ruby-1.3.1/test/test_gem_dependency_installer.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_dependency_installer.rb 2008-06-19 18:20:19.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_dependency_installer.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/dependency_installer' @@ -360,7 +359,7 @@ Gem.source_index.gems.delete @a1.full_name Dir.chdir @tempdir do - e = assert_raise Gem::InstallError do + e = assert_raises Gem::InstallError do inst = Gem::DependencyInstaller.new :domain => :local inst.install 'b' end @@ -498,7 +497,7 @@ policy = Gem::Security::HighSecurity inst = Gem::DependencyInstaller.new :security_policy => policy - e = assert_raise Gem::Exception do + e = assert_raises Gem::Exception do inst.install 'b' end @@ -516,8 +515,8 @@ inst = Gem::DependencyInstaller.new :wrappers => false inst.install 'a' - assert_no_match(%r|This file was generated by RubyGems.|, - File.read(File.join(@gemhome, 'bin', 'a_bin'))) + refute_match(%r|This file was generated by RubyGems.|, + File.read(File.join(@gemhome, 'bin', 'a_bin'))) end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_dependency_list.rb libgems-ruby-1.3.1/test/test_gem_dependency_list.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_dependency_list.rb 2008-02-04 18:37:11.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_dependency_list.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,12 +1,9 @@ -#!/usr/bin/env ruby #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ - -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/dependency_list' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_dependency.rb libgems-ruby-1.3.1/test/test_gem_dependency.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_dependency.rb 2008-05-09 16:18:59.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_dependency.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/version' @@ -70,7 +69,7 @@ end def test_type_is_restricted - assert_raise(ArgumentError) do + assert_raises ArgumentError do Gem::Dependency.new("pkg", [:sometimes]) end end @@ -79,21 +78,21 @@ assert_equal @pkg1_0, @pkg1_0.dup assert_equal @pkg1_0.dup, @pkg1_0 - assert_not_equal @pkg1_0, @pkg1_1, "requirements different" - assert_not_equal @pkg1_1, @pkg1_0, "requirements different" + refute_equal @pkg1_0, @pkg1_1, "requirements different" + refute_equal @pkg1_1, @pkg1_0, "requirements different" - assert_not_equal @pkg1_0, @oth1_0, "names different" - assert_not_equal @oth1_0, @pkg1_0, "names different" + refute_equal @pkg1_0, @oth1_0, "names different" + refute_equal @oth1_0, @pkg1_0, "names different" - assert_not_equal @pkg1_0, Object.new - assert_not_equal Object.new, @pkg1_0 + refute_equal @pkg1_0, Object.new + refute_equal Object.new, @pkg1_0 end def test_equals2_type runtime = Gem::Dependency.new("pkg", []) development = Gem::Dependency.new("pkg", [], :development) - assert_not_equal(runtime, development) + refute_equal(runtime, development) end def test_equals_tilde @@ -123,18 +122,18 @@ assert_equal @pkg1_0.hash, @pkg1_0.dup.hash assert_equal @pkg1_0.dup.hash, @pkg1_0.hash - assert_not_equal @pkg1_0.hash, @pkg1_1.hash, "requirements different" - assert_not_equal @pkg1_1.hash, @pkg1_0.hash, "requirements different" + refute_equal @pkg1_0.hash, @pkg1_1.hash, "requirements different" + refute_equal @pkg1_1.hash, @pkg1_0.hash, "requirements different" - assert_not_equal @pkg1_0.hash, @oth1_0.hash, "names different" - assert_not_equal @oth1_0.hash, @pkg1_0.hash, "names different" + refute_equal @pkg1_0.hash, @oth1_0.hash, "names different" + refute_equal @oth1_0.hash, @pkg1_0.hash, "names different" end def test_hash_type runtime = Gem::Dependency.new("pkg", []) development = Gem::Dependency.new("pkg", [], :development) - assert_not_equal(runtime.hash, development.hash) + refute_equal(runtime.hash, development.hash) end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_digest.rb libgems-ruby-1.3.1/test/test_gem_digest.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_digest.rb 2007-03-26 22:44:47.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_digest.rb 2008-10-09 18:08:31.000000000 -0500 @@ -1,44 +1,46 @@ -#!/usr/bin/env ruby #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ -require "test/unit" +require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require "rubygems/digest/md5" require "rubygems/digest/sha1" require "rubygems/digest/sha2" -class TestRubygemsGemDigest < Test::Unit::TestCase +class TestRubygemsGemDigest < RubyGemTestCase + def test_sha256_hex_digest_works digester = Gem::SHA256.new assert_equal "b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78", digester.hexdigest("ABC") end - + def test_sha256_digest_works digester = Gem::SHA256.new - assert_equal "\265\324\004\\?Fo\251\037\342\314j\276y#*\032W\315\361\004\367\242nqn\n\036'\211\337x", + assert_equal "\265\324\004\\?Fo\251\037\342\314j\276y#*\032W\315\361\004\367\242nqn\n\036'\211\337x", digester.digest("ABC") end - + def test_sha1_hex_digest_works digester = Gem::SHA1.new assert_equal "3c01bdbb26f358bab27f267924aa2c9a03fcfdb8", digester.hexdigest("ABC") end - + def test_sha1_digest_works digester = Gem::SHA1.new assert_equal "<\001\275\273&\363X\272\262\177&y$\252,\232\003\374\375\270", digester.digest("ABC") end - + def test_md5_hex_digest_works digester = Gem::MD5.new assert_equal "902fbdd2b1df0c4f70b4a5d23525e932", digester.hexdigest("ABC") end - + def test_md5_digest_works digester = Gem::MD5.new assert_equal "\220/\275\322\261\337\fOp\264\245\3225%\3512", digester.digest("ABC") end -end \ No newline at end of file + +end + diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_doc_manager.rb libgems-ruby-1.3.1/test/test_gem_doc_manager.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_doc_manager.rb 2007-11-09 21:11:00.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_doc_manager.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/doc_manager' @@ -21,7 +20,7 @@ orig_mode = File.stat(@spec.installation_path).mode File.chmod 0, @spec.installation_path - assert_raise Gem::FilePermissionError do + assert_raises Gem::FilePermissionError do @manager.uninstall_doc end ensure diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_ext_configure_builder.rb libgems-ruby-1.3.1/test/test_gem_ext_configure_builder.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_ext_configure_builder.rb 2008-02-19 22:51:20.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_ext_configure_builder.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/ext' @@ -29,27 +28,27 @@ Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output end - expected = [ - "sh ./configure --prefix=#{@dest_path}", - "", "make", "ok\n", "make install", "ok\n" - ] - - assert_equal expected, output + assert_equal "sh ./configure --prefix=#{@dest_path}", output.shift + assert_equal "", output.shift + assert_equal "make", output.shift + assert_match(/^ok$/m, output.shift) + assert_equal "make install", output.shift + assert_match(/^ok$/m, output.shift) end def test_self_build_fail return if RUBY_PLATFORM =~ /mswin/ # HACK output = [] - error = assert_raise Gem::InstallError do + error = assert_raises Gem::InstallError do Dir.chdir @ext do Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output end end - shell_error_msg = %r{(\./configure: No such file or directory)|(Can't open \./configure)} + shell_error_msg = %r{(\./configure: .*)|(Can't open \./configure)} sh_prefix_configure = "sh ./configure --prefix=" - + expected = %r(configure failed: #{Regexp.escape sh_prefix_configure}#{Regexp.escape @dest_path} @@ -59,7 +58,7 @@ assert_match expected, error.message assert_equal "#{sh_prefix_configure}#{@dest_path}", output.shift - assert_match %r(#{shell_error_msg}\n), output.shift + assert_match %r(#{shell_error_msg}), output.shift assert_equal true, output.empty? end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_ext_ext_conf_builder.rb libgems-ruby-1.3.1/test/test_gem_ext_ext_conf_builder.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_ext_ext_conf_builder.rb 2007-11-09 21:11:05.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_ext_ext_conf_builder.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/ext' @@ -55,7 +54,7 @@ output = [] - error = assert_raise Gem::InstallError do + error = assert_raises Gem::InstallError do Dir.chdir @ext do Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output end @@ -103,7 +102,7 @@ end def test_class_make_no_Makefile - error = assert_raise Gem::InstallError do + error = assert_raises Gem::InstallError do Dir.chdir @ext do Gem::Ext::ExtConfBuilder.make @ext, ['output'] end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_ext_rake_builder.rb libgems-ruby-1.3.1/test/test_gem_ext_rake_builder.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_ext_rake_builder.rb 2007-11-09 21:11:06.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_ext_rake_builder.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,9 +1,7 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/ext' class TestGemExtRakeBuilder < RubyGemTestCase - def setup super @@ -26,19 +24,25 @@ output = [] realdir = nil # HACK /tmp vs. /private/tmp - Dir.chdir @ext do - realdir = Dir.pwd - Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', nil, @dest_path, output + build_rake_in do + Dir.chdir @ext do + realdir = Dir.pwd + Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', nil, @dest_path, output + end end + output = output.join "\n" + expected = [ - "#{Gem.ruby} mkrf_conf.rb", + "#{@@ruby} mkrf_conf.rb", "", - "rake RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}", + "#{@@rake} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}", "(in #{realdir})\n" ] - assert_equal expected, output + refute_match %r%^rake failed:%, output + assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output + assert_match %r%^#{Regexp.escape @@rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, output end def test_class_build_fail @@ -52,21 +56,25 @@ output = [] - error = assert_raise Gem::InstallError do - Dir.chdir @ext do - Gem::Ext::RakeBuilder.build "mkrf_conf.rb", nil, @dest_path, output + error = assert_raises Gem::InstallError do + build_rake_in do + Dir.chdir @ext do + Gem::Ext::RakeBuilder.build "mkrf_conf.rb", nil, @dest_path, output + end end end expected = <<-EOF.strip rake failed: -#{Gem.ruby} mkrf_conf.rb +#{@@ruby} mkrf_conf.rb -rake RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path} +#{@@rake} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path} EOF - assert_equal expected, error.message.split("\n")[0..4].join("\n") + assert_match %r%^rake failed:%, error.message + assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, error.message + assert_match %r%^#{Regexp.escape @@rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, error.message end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_format.rb libgems-ruby-1.3.1/test/test_gem_format.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_format.rb 2008-02-26 18:45:36.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_format.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require File.join(File.expand_path(File.dirname(__FILE__)), 'simple_gem') require 'rubygems/format' @@ -36,27 +35,27 @@ end def test_from_file_by_path_nonexistent - assert_raise Gem::Exception do + assert_raises Gem::Exception do Gem::Format.from_file_by_path '/nonexistent' end end def test_from_io_garbled - e = assert_raise Gem::Package::FormatError do + e = assert_raises Gem::Package::FormatError do # subtly bogus input Gem::Format.from_io(StringIO.new(@simple_gem.upcase)) end assert_equal 'No metadata found!', e.message - e = assert_raise Gem::Package::FormatError do + e = assert_raises Gem::Package::FormatError do # Totally bogus input Gem::Format.from_io(StringIO.new(@simple_gem.reverse)) end assert_equal 'No metadata found!', e.message - e = assert_raise Gem::Package::FormatError do + e = assert_raises Gem::Package::FormatError do # This was intentionally screws up YAML parsing. Gem::Format.from_io(StringIO.new(@simple_gem.gsub(/:/, "boom"))) end @@ -66,4 +65,3 @@ end - diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_gem_path_searcher.rb libgems-ruby-1.3.1/test/test_gem_gem_path_searcher.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_gem_path_searcher.rb 2008-05-23 19:18:24.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_gem_path_searcher.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,14 +1,9 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/gem_path_searcher' class Gem::GemPathSearcher attr_accessor :gemspecs attr_accessor :lib_dirs - - public :init_gemspecs - public :matching_file - public :lib_dirs_for end class TestGemGemPathSearcher < RubyGemTestCase @@ -40,6 +35,10 @@ assert_equal @foo1, @gps.find('foo') end + def test_find_all + assert_equal [@foo1], @gps.find_all('foo') + end + def test_init_gemspecs assert_equal [@bar2, @bar1, @foo2, @foo1], @gps.init_gemspecs end @@ -51,9 +50,17 @@ assert_equal expected, lib_dirs end - def test_matching_file - assert !@gps.matching_file(@foo1, 'bar') - assert @gps.matching_file(@foo1, 'foo') + def test_matching_file_eh + assert !@gps.matching_file?(@foo1, 'bar') + assert @gps.matching_file?(@foo1, 'foo') + end + + def test_matching_files + assert_equal [], @gps.matching_files(@foo1, 'bar') + + expected = File.join @foo1.full_gem_path, 'lib', 'foo.rb' + + assert_equal [expected], @gps.matching_files(@foo1, 'foo') end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_gem_runner.rb libgems-ruby-1.3.1/test/test_gem_gem_runner.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_gem_runner.rb 2007-11-09 23:51:38.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_gem_runner.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/gem_runner' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_indexer.rb libgems-ruby-1.3.1/test/test_gem_indexer.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_indexer.rb 2008-06-17 02:55:44.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_indexer.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/indexer' @@ -21,7 +20,6 @@ util_make_gems @d2_0 = quick_gem 'd', '2.0' - write_file File.join(*%W[gems #{@d2_0.original_name} lib code.rb]) do end util_build_gem @d2_0 gems = File.join(@tempdir, 'gems') @@ -38,6 +36,41 @@ @indexer.directory end + def test_build_indicies + spec = quick_gem 'd', '2.0' + spec.instance_variable_set :@original_platform, '' + + @indexer.make_temp_directories + + index = Gem::SourceIndex.new + index.add_spec spec + + use_ui @ui do + @indexer.build_indicies index + end + + specs_path = File.join @indexer.directory, "specs.#{@marshal_version}" + specs_dump = Gem.read_binary specs_path + specs = Marshal.load specs_dump + + expected = [ + ['d', Gem::Version.new('2.0'), 'ruby'], + ] + + assert_equal expected, specs, 'specs' + + latest_specs_path = File.join @indexer.directory, + "latest_specs.#{@marshal_version}" + latest_specs_dump = Gem.read_binary latest_specs_path + latest_specs = Marshal.load latest_specs_dump + + expected = [ + ['d', Gem::Version.new('2.0'), 'ruby'], + ] + + assert_equal expected, latest_specs, 'latest_specs' + end + def test_generate_index use_ui @ui do @indexer.generate_index @@ -183,8 +216,8 @@ assert_same specs[0].last, specs[1].last, 'identical platforms not identical' - assert_not_same specs[1][1], specs[5][1], - 'different versions not different' + refute_same specs[1][1], specs[5][1], + 'different versions not different' end def test_generate_index_latest_specs diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_installer.rb libgems-ruby-1.3.1/test/test_gem_installer.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_installer.rb 2008-06-18 18:05:12.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_installer.rb 2008-10-10 16:31:16.000000000 -0500 @@ -52,7 +52,7 @@ def test_build_extensions_extconf_bad @spec.extensions << 'extconf.rb' - e = assert_raise Gem::Installer::ExtensionBuildError do + e = assert_raises Gem::Installer::ExtensionBuildError do use_ui @ui do @installer.build_extensions end @@ -70,13 +70,16 @@ #{Gem.ruby}: No such file or directory -- extconf.rb (LoadError) EOF - assert_equal expected, File.read(gem_make_out) + assert_match %r%#{Regexp.escape Gem.ruby} extconf.rb%, + File.read(gem_make_out) + assert_match %r%#{Regexp.escape Gem.ruby}: No such file%, + File.read(gem_make_out) end def test_build_extensions_unsupported @spec.extensions << nil - e = assert_raise Gem::Installer::ExtensionBuildError do + e = assert_raises Gem::Installer::ExtensionBuildError do use_ui @ui do @installer.build_extensions end @@ -98,7 +101,7 @@ assert @installer.ensure_dependency(@spec, dep) dep = Gem::Dependency.new 'b', '> 2' - e = assert_raise Gem::InstallError do + e = assert_raises Gem::InstallError do @installer.ensure_dependency @spec, dep end @@ -139,7 +142,7 @@ def test_extract_files_bad_dest @installer.gem_dir = 'somedir' @installer.format = nil - e = assert_raise ArgumentError do + e = assert_raises ArgumentError do @installer.extract_files end @@ -154,7 +157,7 @@ @installer.format = format - e = assert_raise Gem::InstallError do + e = assert_raises Gem::InstallError do @installer.extract_files end @@ -172,7 +175,7 @@ @installer.format = format - e = assert_raise Gem::InstallError do + e = assert_raises Gem::InstallError do @installer.extract_files end @@ -339,8 +342,8 @@ assert_match %r|generated by RubyGems|, File.read(installed_exec) - assert_no_match %r|generated by RubyGems|, File.read(real_exec), - 'real executable overwritten' + refute_match %r|generated by RubyGems|, File.read(real_exec), + 'real executable overwritten' end def test_generate_bin_symlink @@ -515,6 +518,7 @@ spec = quick_gem 'a' do |s| s.platform = Gem::Platform.new 'mswin32' end gem = File.join @tempdir, "#{spec.full_name}.gem" + Dir.mkdir util_inst_bindir util_build_gem spec FileUtils.mv File.join(@gemhome, 'cache', "#{spec.full_name}.gem"), @tempdir @@ -525,10 +529,23 @@ end def test_install + Dir.mkdir util_inst_bindir util_setup_gem - use_ui @ui do - assert_equal @spec, @installer.install + cache_file = File.join @gemhome, 'cache', "#{@spec.full_name}.gem" + + Gem.pre_install do |installer| + assert !File.exist?(cache_file), 'cache file should not exist yet' + end + + Gem.post_install do |installer| + assert File.exist?(cache_file), 'cache file should exist' + end + + build_rake_in do + use_ui @ui do + assert_equal @spec, @installer.install + end end gemdir = File.join @gemhome, 'gems', @spec.full_name @@ -548,6 +565,9 @@ assert_equal spec_file, @spec.loaded_from assert File.exist?(spec_file) + + assert_same @installer, @pre_install_hook_arg + assert_same @installer, @post_install_hook_arg end def test_install_bad_gem @@ -561,7 +581,7 @@ gem_data = File.open gem, 'rb' do |fp| fp.read 1024 end File.open gem, 'wb' do |fp| fp.write gem_data end - e = assert_raise Gem::InstallError do + e = assert_raises Gem::InstallError do use_ui @ui do @installer = Gem::Installer.new gem @installer.install @@ -576,12 +596,37 @@ util_setup_gem use_ui @ui do - assert_raise Gem::InstallError do + assert_raises Gem::InstallError do @installer.install end end end + def test_install_check_dependencies_install_dir + gemhome2 = "#{@gemhome}2" + @spec.add_dependency 'b' + + b2 = quick_gem 'b', 2 + + FileUtils.mv @gemhome, gemhome2 + Gem.source_index.gems.delete b2.full_name + source_index = Gem::SourceIndex.from_gems_in File.join(gemhome2, + 'specifications') + + util_setup_gem + + @installer = Gem::Installer.new @gem, :install_dir => gemhome2, + :source_index => source_index + + build_rake_in do + use_ui @ui do + @installer.install + end + end + + assert File.exist?(File.join(gemhome2, 'gems', @spec.full_name)) + end + def test_install_force use_ui @ui do installer = Gem::Installer.new old_ruby_required, :force => true @@ -593,12 +638,15 @@ end def test_install_ignore_dependencies + Dir.mkdir util_inst_bindir @spec.add_dependency 'b', '> 5' util_setup_gem @installer.ignore_dependencies = true - use_ui @ui do - assert_equal @spec, @installer.install + build_rake_in do + use_ui @ui do + assert_equal @spec, @installer.install + end end gemdir = File.join @gemhome, 'gems', @spec.full_name @@ -635,38 +683,63 @@ "#{@spec.full_name}.gemspec")) end - def test_install_with_message - @spec.post_install_message = 'I am a shiny gem!' + unless win_platform? # File.chmod doesn't work + def test_install_user_local_fallback + Dir.mkdir util_inst_bindir + File.chmod 0755, @userhome + File.chmod 0000, util_inst_bindir + File.chmod 0000, Gem.dir + @spec.executables = ["executable"] + + build_rake_in do + use_ui @ui do + util_setup_gem + @installer.install + end + end - use_ui @ui do - Dir.chdir @tempdir do Gem::Builder.new(@spec).build end + assert File.exist?(File.join(Gem.user_dir, 'gems', + @spec.full_name, 'lib', 'code.rb')) + assert File.exist?(File.join(Gem.user_dir, 'bin', 'executable')) + ensure + File.chmod 0755, Gem.dir + File.chmod 0755, util_inst_bindir + end + + def test_install_bindir_read_only + Dir.mkdir util_inst_bindir + File.chmod 0755, @userhome + File.chmod 0000, util_inst_bindir + + build_rake_in do + use_ui @ui do + util_setup_gem + @installer.install + end + end - @installer.install + assert File.exist?(File.join(Gem.user_dir, 'bin', 'executable')) + ensure + File.chmod 0755, util_inst_bindir end - - assert_match %r|I am a shiny gem!|, @ui.output end - def test_install_writable - util_setup_gem + def test_install_with_message + @spec.post_install_message = 'I am a shiny gem!' - orig_mode = File.stat(Gem.dir).mode - File.chmod 0000, Gem.dir + use_ui @ui do + Dir.chdir @tempdir do Gem::Builder.new(@spec).build end - e = assert_raise Gem::FilePermissionError do @installer.install end - assert_equal "You don't have write permissions into the #{@gemhome} directory.", - e.message - ensure - File.chmod orig_mode, Gem.dir + assert_match %r|I am a shiny gem!|, @ui.output end def test_install_wrong_ruby_version use_ui @ui do installer = Gem::Installer.new old_ruby_required - e = assert_raise Gem::InstallError do + e = assert_raises Gem::InstallError do installer.install end assert_equal 'old_ruby_required requires Ruby version = 1.4.6', @@ -685,7 +758,7 @@ use_ui @ui do @installer = Gem::Installer.new gem - e = assert_raise Gem::InstallError do + e = assert_raises Gem::InstallError do @installer.install end assert_equal 'old_rubygems_required requires RubyGems version < 0', diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_install_update_options.rb libgems-ruby-1.3.1/test/test_gem_install_update_options.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_install_update_options.rb 2007-12-12 17:10:17.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_install_update_options.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,20 +1,20 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') +require File.join(File.expand_path(File.dirname(__FILE__)), + 'gem_installer_test_case') require 'rubygems/install_update_options' require 'rubygems/command' -class TestGemInstallUpdateOptions < RubyGemTestCase +class TestGemInstallUpdateOptions < GemInstallerTestCase def setup super @cmd = Gem::Command.new 'dummy', 'dummy' @cmd.extend Gem::InstallUpdateOptions + @cmd.add_install_update_options end def test_add_install_update_options - @cmd.add_install_update_options - args = %w[-i /install_to --rdoc --ri -E -f -t -w -P HighSecurity --ignore-dependencies --format-exec --include-dependencies] @@ -22,8 +22,6 @@ end def test_security_policy - @cmd.add_install_update_options - @cmd.handle_options %w[-P HighSecurity] assert_equal Gem::Security::HighSecurity, @cmd.options[:security_policy] @@ -32,9 +30,31 @@ def test_security_policy_unknown @cmd.add_install_update_options - assert_raise OptionParser::InvalidArgument do + assert_raises OptionParser::InvalidArgument do @cmd.handle_options %w[-P UnknownSecurity] end end + def test_user_install_enabled + @cmd.handle_options %w[--user-install] + + @installer = Gem::Installer.new @gem, @cmd.options + @installer.install + assert File.exist?(File.join(Gem.user_dir, 'gems')) + assert File.exist?(File.join(Gem.user_dir, 'gems', + @spec.full_name)) + end + + def test_user_install_disabled_read_only + @cmd.handle_options %w[--no-user-install] + + File.chmod 0755, @userhome + FileUtils.chmod 0000, @gemhome + + assert_raises(Gem::FilePermissionError) do + @installer = Gem::Installer.new @gem, @cmd.options + end + ensure + FileUtils.chmod 0755, @gemhome + end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_local_remote_options.rb libgems-ruby-1.3.1/test/test_gem_local_remote_options.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_local_remote_options.rb 2008-06-05 15:55:48.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_local_remote_options.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/local_remote_options' require 'rubygems/command' @@ -19,6 +18,18 @@ assert @cmd.handles?(args) end + def test_both_eh + assert_equal false, @cmd.both? + + @cmd.options[:domain] = :local + + assert_equal false, @cmd.both? + + @cmd.options[:domain] = :both + + assert_equal true, @cmd.both? + end + def test_local_eh assert_equal false, @cmd.local? @@ -74,7 +85,7 @@ s1 = 'htp://more-gems.example.com' - assert_raise OptionParser::InvalidArgument do + assert_raises OptionParser::InvalidArgument do @cmd.handle_options %W[--source #{s1}] end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._test_gem_package_tar_header.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._test_gem_package_tar_header.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._test_gem_package_tar_input.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._test_gem_package_tar_input.rb differ Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._test_gem_package_tar_output.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._test_gem_package_tar_output.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_package_tar_reader_entry.rb libgems-ruby-1.3.1/test/test_gem_package_tar_reader_entry.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_package_tar_reader_entry.rb 2008-03-28 19:32:28.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_package_tar_reader_entry.rb 2008-10-09 17:42:25.000000000 -0500 @@ -36,19 +36,19 @@ assert @entry.bytes_read - e = assert_raise IOError do @entry.eof? end + e = assert_raises IOError do @entry.eof? end assert_equal 'closed Gem::Package::TarReader::Entry', e.message - e = assert_raise IOError do @entry.getc end + e = assert_raises IOError do @entry.getc end assert_equal 'closed Gem::Package::TarReader::Entry', e.message - e = assert_raise IOError do @entry.pos end + e = assert_raises IOError do @entry.pos end assert_equal 'closed Gem::Package::TarReader::Entry', e.message - e = assert_raise IOError do @entry.read end + e = assert_raises IOError do @entry.read end assert_equal 'closed Gem::Package::TarReader::Entry', e.message - e = assert_raise IOError do @entry.rewind end + e = assert_raises IOError do @entry.rewind end assert_equal 'closed Gem::Package::TarReader::Entry', e.message end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/test/._test_gem_package_tar_reader.rb and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/test/._test_gem_package_tar_reader.rb differ diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_package_tar_writer.rb libgems-ruby-1.3.1/test/test_gem_package_tar_writer.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_package_tar_writer.rb 2008-03-02 15:47:36.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_package_tar_writer.rb 2008-10-09 17:42:25.000000000 -0500 @@ -61,7 +61,7 @@ end def test_add_file_simple_size - assert_raise Gem::Package::TarWriter::FileOverflow do + assert_raises Gem::Package::TarWriter::FileOverflow do @tar_writer.add_file_simple("lib/foo/bar", 0, 10) do |io| io.write "1" * 11 end @@ -69,7 +69,7 @@ end def test_add_file_unseekable - assert_raise Gem::Package::NonSeekableIO do + assert_raises Gem::Package::NonSeekableIO do Gem::Package::TarWriter.new(Object.new).add_file 'x', 0 end end @@ -79,27 +79,27 @@ assert_equal "\0" * 1024, @io.string - e = assert_raise IOError do + e = assert_raises IOError do @tar_writer.close end assert_equal 'closed Gem::Package::TarWriter', e.message - e = assert_raise IOError do + e = assert_raises IOError do @tar_writer.flush end assert_equal 'closed Gem::Package::TarWriter', e.message - e = assert_raise IOError do + e = assert_raises IOError do @tar_writer.add_file 'x', 0 end assert_equal 'closed Gem::Package::TarWriter', e.message - e = assert_raise IOError do + e = assert_raises IOError do @tar_writer.add_file_simple 'x', 0, 0 end assert_equal 'closed Gem::Package::TarWriter', e.message - e = assert_raise IOError do + e = assert_raises IOError do @tar_writer.mkdir 'x', 0 end assert_equal 'closed Gem::Package::TarWriter', e.message @@ -125,7 +125,7 @@ name = File.join 'a', 'b' * 100 assert_equal ['b' * 100, 'a'], @tar_writer.split_name(name) - assert_raise Gem::Package::TooLongFileName do + assert_raises Gem::Package::TooLongFileName do name = File.join 'a', 'b' * 101 @tar_writer.split_name name end @@ -135,14 +135,14 @@ name = File.join 'a' * 155, 'b' assert_equal ['b', 'a' * 155], @tar_writer.split_name(name) - assert_raise Gem::Package::TooLongFileName do + assert_raises Gem::Package::TooLongFileName do name = File.join 'a' * 156, 'b' @tar_writer.split_name name end end def test_split_name_too_long_total - assert_raise Gem::Package::TooLongFileName do + assert_raises Gem::Package::TooLongFileName do @tar_writer.split_name 'a' * 257 end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_platform.rb libgems-ruby-1.3.1/test/test_gem_platform.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_platform.rb 2007-12-19 18:01:15.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_platform.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,23 +1,9 @@ require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') -require 'test/unit' require 'rubygems/platform' require 'rbconfig' class TestGemPlatform < RubyGemTestCase - def test_self_const_missing - consts = [:DARWIN, :LINUX_586, :MSWIN32, :PPC_DARWIN, :WIN32, :X86_LINUX] - - consts.each do |const| - e = assert_raise NameError do - Gem::Platform.const_missing const - end - - assert_equal "#{const} has been removed, use CURRENT instead", - e.message - end - end - def test_self_local util_set_arch 'i686-darwin8.10.1' @@ -105,6 +91,12 @@ platform = Gem::Platform.new 'i386-mswin32-80' assert_equal expected, platform.to_a, 'i386-mswin32-80' + + expected = ['x86', 'solaris', '2.10'] + + platform = Gem::Platform.new 'i386-solaris-2.10' + + assert_equal expected, platform.to_a, 'i386-solaris-2.10' end def test_initialize_mswin32_vc6 @@ -154,8 +146,8 @@ other = Gem::Platform.new %w[cpu other_platform 1] assert_equal my, my - assert_not_equal my, other - assert_not_equal other, my + refute_equal my, other + refute_equal other, my end def test_equals3 @@ -212,10 +204,10 @@ # oddballs assert_match 'i386-mswin32-mq5.3', Gem::Platform.local assert_match 'i386-mswin32-mq6', Gem::Platform.local - deny_match 'win32-1.8.2-VC7', Gem::Platform.local - deny_match 'win32-1.8.4-VC6', Gem::Platform.local - deny_match 'win32-source', Gem::Platform.local - deny_match 'windows', Gem::Platform.local + refute_match 'win32-1.8.2-VC7', Gem::Platform.local + refute_match 'win32-1.8.4-VC6', Gem::Platform.local + refute_match 'win32-source', Gem::Platform.local + refute_match 'windows', Gem::Platform.local util_set_arch 'i686-linux' assert_match 'i486-linux', Gem::Platform.local @@ -243,17 +235,5 @@ assert_match 'sparc-solaris2.8-mq5.3', Gem::Platform.local end - def assert_match(pattern, platform, message = '') - full_message = build_message message, " expected to be =~\n.", - platform, pattern - assert_block(full_message) { platform =~ pattern } - end - - def deny_match(pattern, platform, message = '') - full_message = build_message message, " expected to be !~\n.", - platform, pattern - assert_block(full_message) { platform !~ pattern } - end - end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem.rb libgems-ruby-1.3.1/test/test_gem.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem.rb 2008-06-18 16:27:03.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem.rb 2008-10-09 17:42:25.000000000 -0500 @@ -3,6 +3,7 @@ require 'rubygems/gem_openssl' require 'rubygems/installer' require 'pathname' +require 'tmpdir' class TestGem < RubyGemTestCase @@ -44,7 +45,12 @@ def test_self_bindir_default_dir default = Gem.default_dir - bindir = (defined? RUBY_FRAMEWORK_VERSION) ? '/usr/bin' : Config::CONFIG['bindir'] + bindir = if defined?(RUBY_FRAMEWORK_VERSION) then + '/usr/bin' + else + Config::CONFIG['bindir'] + end + assert_equal bindir, Gem.bindir(default) assert_equal bindir, Gem.bindir(Pathname.new(default)) end @@ -59,8 +65,8 @@ assert_equal nil, Gem.instance_variable_get(:@gem_home) assert_equal nil, Gem.instance_variable_get(:@gem_path) - assert_not_equal searcher, Gem.searcher - assert_not_equal source_index.object_id, Gem.source_index.object_id + refute_equal searcher, Gem.searcher + refute_equal source_index.object_id, Gem.source_index.object_id end def test_self_configuration @@ -208,15 +214,45 @@ orig_Gem_ssl_available = Gem.ssl_available? Gem.ssl_available = true - assert_nothing_raised do Gem.ensure_ssl_available end + Gem.ensure_ssl_available Gem.ssl_available = false - e = assert_raise Gem::Exception do Gem.ensure_ssl_available end + e = assert_raises Gem::Exception do Gem.ensure_ssl_available end assert_equal 'SSL is not installed on this system', e.message ensure Gem.ssl_available = orig_Gem_ssl_available end + def test_self_find_files + foo1 = quick_gem 'foo', '1' do |s| + s.files << 'lib/foo/discover.rb' + end + + foo2 = quick_gem 'foo', '2' do |s| + s.files << 'lib/foo/discover.rb' + end + + path = File.join 'gems', foo1.full_name, 'lib', 'foo', 'discover.rb' + write_file(path) { |fp| fp.puts "# #{path}" } + + path = File.join 'gems', foo2.full_name, 'lib', 'foo', 'discover.rb' + write_file(path) { |fp| fp.puts "# #{path}" } + + @fetcher = Gem::FakeFetcher.new + Gem::RemoteFetcher.fetcher = @fetcher + + Gem.source_index = util_setup_spec_fetcher foo1, foo2 + + Gem.searcher = nil + + expected = [ + File.join(foo1.full_gem_path, 'lib', 'foo', 'discover.rb'), + File.join(foo2.full_gem_path, 'lib', 'foo', 'discover.rb'), + ] + + assert_equal expected, Gem.find_files('foo/discover').sort + end + def test_self_latest_load_paths util_make_gems @@ -260,36 +296,38 @@ unless win_platform? def test_self_path_APPLE_GEM_HOME Gem.clear_paths - Gem.const_set :APPLE_GEM_HOME, '/tmp/apple_gem_home' - - assert Gem.path.include?('/tmp/apple_gem_home') + apple_gem_home = File.join @tempdir, 'apple_gem_home' + Gem.const_set :APPLE_GEM_HOME, apple_gem_home + + assert Gem.path.include?(apple_gem_home) ensure Gem.send :remove_const, :APPLE_GEM_HOME end - + def test_self_path_APPLE_GEM_HOME_GEM_PATH Gem.clear_paths ENV['GEM_PATH'] = @gemhome - Gem.const_set :APPLE_GEM_HOME, '/tmp/apple_gem_home' - - assert !Gem.path.include?('/tmp/apple_gem_home') + apple_gem_home = File.join @tempdir, 'apple_gem_home' + Gem.const_set :APPLE_GEM_HOME, apple_gem_home + + assert !Gem.path.include?(apple_gem_home) ensure Gem.send :remove_const, :APPLE_GEM_HOME end end def test_self_path_ENV_PATH - Gem.clear_paths + Gem.send :set_paths, nil path_count = Gem.path.size - path_count -= 1 if defined? APPLE_GEM_HOME Gem.clear_paths - util_ensure_gem_dirs ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR) assert_equal @additional, Gem.path[0,2] - assert_equal path_count + @additional.size, Gem.path.size - assert_match Gem.dir, Gem.path.last + + assert_equal path_count + @additional.size, Gem.path.size, + "extra path components: #{Gem.path[2..-1].inspect}" + assert_equal Gem.dir, Gem.path.last end def test_self_path_duplicate @@ -337,6 +375,7 @@ file_name = File.expand_path __FILE__ prefix = File.dirname File.dirname(file_name) + prefix = File.dirname prefix if File.basename(prefix) == 'test' Gem::ConfigMap[:libdir] = prefix @@ -350,6 +389,7 @@ file_name = File.expand_path __FILE__ prefix = File.dirname File.dirname(file_name) + prefix = File.dirname prefix if File.basename(prefix) == 'test' Gem::ConfigMap[:sitelibdir] = prefix @@ -386,6 +426,44 @@ Gem.required_location("a", "code.rb", "= 2") end + def test_self_ruby_escaping_spaces_in_path + orig_ruby = Gem.ruby + orig_bindir = Gem::ConfigMap[:bindir] + orig_ruby_install_name = Gem::ConfigMap[:ruby_install_name] + orig_exe_ext = Gem::ConfigMap[:EXEEXT] + + Gem::ConfigMap[:bindir] = "C:/Ruby 1.8/bin" + Gem::ConfigMap[:ruby_install_name] = "ruby" + Gem::ConfigMap[:EXEEXT] = ".exe" + Gem.instance_variable_set("@ruby", nil) + + assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby + ensure + Gem.instance_variable_set("@ruby", orig_ruby) + Gem::ConfigMap[:bindir] = orig_bindir + Gem::ConfigMap[:ruby_install_name] = orig_ruby_install_name + Gem::ConfigMap[:EXEEXT] = orig_exe_ext + end + + def test_self_ruby_path_without_spaces + orig_ruby = Gem.ruby + orig_bindir = Gem::ConfigMap[:bindir] + orig_ruby_install_name = Gem::ConfigMap[:ruby_install_name] + orig_exe_ext = Gem::ConfigMap[:EXEEXT] + + Gem::ConfigMap[:bindir] = "C:/Ruby18/bin" + Gem::ConfigMap[:ruby_install_name] = "ruby" + Gem::ConfigMap[:EXEEXT] = ".exe" + Gem.instance_variable_set("@ruby", nil) + + assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby + ensure + Gem.instance_variable_set("@ruby", orig_ruby) + Gem::ConfigMap[:bindir] = orig_bindir + Gem::ConfigMap[:ruby_install_name] = orig_ruby_install_name + Gem::ConfigMap[:EXEEXT] = orig_exe_ext + end + def test_self_ruby_version version = RUBY_VERSION.dup version << ".#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL @@ -426,6 +504,11 @@ assert_equal @additional + [Gem.dir], Gem.path end + def test_self_user_dir + assert_equal File.join(@userhome, '.gem', Gem.ruby_engine, + Gem::ConfigMap[:ruby_version]), Gem.user_dir + end + def test_self_user_home if ENV['HOME'] then assert_equal ENV['HOME'], Gem.user_home @@ -434,6 +517,28 @@ end end + def test_self_user_home_user_drive_and_path + Gem.clear_paths + + # safe-keep env variables + orig_home, orig_user_profile = ENV['HOME'], ENV['USERPROFILE'] + orig_user_drive, orig_user_path = ENV['HOMEDRIVE'], ENV['HOMEPATH'] + + # prepare the environment + ENV.delete('HOME') + ENV.delete('USERPROFILE') + ENV['HOMEDRIVE'] = 'Z:' + ENV['HOMEPATH'] = '\\Users\\RubyUser' + + assert_equal "Z:\\Users\\RubyUser", Gem.user_home + + ensure + ENV['HOME'] = orig_home + ENV['USERPROFILE'] = orig_user_profile + ENV['USERDRIVE'] = orig_user_drive + ENV['USERPATH'] = orig_user_path + end + def util_ensure_gem_dirs Gem.ensure_gem_subdirectories @gemhome @additional.each do |dir| diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_remote_fetcher.rb libgems-ruby-1.3.1/test/test_gem_remote_fetcher.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_remote_fetcher.rb 2008-06-05 20:39:33.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_remote_fetcher.rb 2008-10-09 18:50:12.000000000 -0500 @@ -1,15 +1,14 @@ -#!/usr/bin/env ruby #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'webrick' require 'zlib' require 'rubygems/remote_fetcher' +require 'ostruct' # = Testing Proxy Settings # @@ -106,19 +105,29 @@ @a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end Gem::RemoteFetcher.fetcher = nil + + @fetcher = Gem::RemoteFetcher.fetcher + end + + def teardown + super + Gem.configuration[:http_proxy] = nil end def test_self_fetcher fetcher = Gem::RemoteFetcher.fetcher - assert_not_nil fetcher + refute_nil fetcher assert_kind_of Gem::RemoteFetcher, fetcher end def test_self_fetcher_with_proxy proxy_uri = 'http://proxy.example.com' Gem.configuration[:http_proxy] = proxy_uri + Gem::RemoteFetcher.fetcher = nil + fetcher = Gem::RemoteFetcher.fetcher - assert_not_nil fetcher + + refute_nil fetcher assert_kind_of Gem::RemoteFetcher, fetcher assert_equal proxy_uri, fetcher.instance_variable_get(:@proxy_uri).to_s end @@ -126,8 +135,11 @@ def test_self_fetcher_with_proxy_URI proxy_uri = URI.parse 'http://proxy.example.com' Gem.configuration[:http_proxy] = proxy_uri + Gem::RemoteFetcher.fetcher = nil + fetcher = Gem::RemoteFetcher.fetcher - assert_not_nil fetcher + refute_nil fetcher + assert_kind_of Gem::RemoteFetcher, fetcher assert_equal proxy_uri, fetcher.instance_variable_get(:@proxy_uri) end @@ -135,7 +147,7 @@ def test_fetch_size_bad_uri fetcher = Gem::RemoteFetcher.new nil - e = assert_raise ArgumentError do + e = assert_raises ArgumentError do fetcher.fetch_size 'gems.example.com/yaml' end @@ -145,23 +157,21 @@ def test_fetch_size_socket_error fetcher = Gem::RemoteFetcher.new nil def fetcher.connection_for(uri) - raise SocketError + raise SocketError, "tarded" end uri = 'http://gems.example.com/yaml' - e = assert_raise Gem::RemoteFetcher::FetchError do + e = assert_raises Gem::RemoteFetcher::FetchError do fetcher.fetch_size uri end - assert_equal "SocketError (SocketError)\n\tfetching size (#{uri})", - e.message + assert_equal "SocketError: tarded (#{uri})", e.message end def test_no_proxy use_ui @ui do - fetcher = Gem::RemoteFetcher.new nil - assert_data_from_server fetcher.fetch_path(@server_uri) - assert_equal SERVER_DATA.size, fetcher.fetch_size(@server_uri) + assert_data_from_server @fetcher.fetch_path(@server_uri) + assert_equal SERVER_DATA.size, @fetcher.fetch_size(@server_uri) end end @@ -238,6 +248,7 @@ install_dir = File.join @tempdir, 'more_gems' a1_cache_gem = File.join install_dir, 'cache', "#{@a1.full_name}.gem" + FileUtils.mkdir_p(File.dirname(a1_cache_gem)) actual = fetcher.download(@a1, 'http://gems.example.com', install_dir) assert_equal a1_cache_gem, actual @@ -247,7 +258,7 @@ assert File.exist?(a1_cache_gem) end - unless win_platform? then # File.chmod doesn't work + unless win_platform? # File.chmod doesn't work def test_download_local_read_only FileUtils.mv @a1_gem, @tempdir local_path = File.join @tempdir, "#{@a1.full_name}.gem" @@ -263,6 +274,19 @@ ensure File.chmod 0755, File.join(@gemhome, 'cache') end + + def test_download_read_only + File.chmod 0555, File.join(@gemhome, 'cache') + File.chmod 0555, File.join(@gemhome) + + fetcher = util_fuck_with_fetcher File.read(@a1_gem) + fetcher.download(@a1, 'http://gems.example.com') + assert File.exist?(File.join(Gem.user_dir, 'cache', + "#{@a1.full_name}.gem")) + ensure + File.chmod 0755, File.join(@gemhome) + File.chmod 0755, File.join(@gemhome, 'cache') + end end def test_download_platform_legacy @@ -292,7 +316,7 @@ def test_download_unsupported inst = Gem::RemoteFetcher.fetcher - e = assert_raise Gem::InstallError do + e = assert_raises Gem::InstallError do inst.download @a1, 'ftp://gems.rubyforge.org' end @@ -363,12 +387,34 @@ end end + def test_fetch_path_gzip + fetcher = Gem::RemoteFetcher.new nil + + def fetcher.open_uri_or_path(uri, mtime, head = nil) + Gem.gzip 'foo' + end + + assert_equal 'foo', fetcher.fetch_path(@uri + 'foo.gz') + end + + def test_fetch_path_gzip_unmodified + fetcher = Gem::RemoteFetcher.new nil + + def fetcher.open_uri_or_path(uri, mtime, head = nil) + nil + end + + assert_equal nil, fetcher.fetch_path(@uri + 'foo.gz', Time.at(0)) + end + def test_fetch_path_io_error fetcher = Gem::RemoteFetcher.new nil - def fetcher.open_uri_or_path(uri) raise EOFError; end + def fetcher.open_uri_or_path(uri, mtime, head = nil) + raise EOFError + end - e = assert_raise Gem::RemoteFetcher::FetchError do + e = assert_raises Gem::RemoteFetcher::FetchError do fetcher.fetch_path 'uri' end @@ -379,9 +425,11 @@ def test_fetch_path_socket_error fetcher = Gem::RemoteFetcher.new nil - def fetcher.open_uri_or_path(uri) raise SocketError; end + def fetcher.open_uri_or_path(uri, mtime, head = nil) + raise SocketError + end - e = assert_raise Gem::RemoteFetcher::FetchError do + e = assert_raises Gem::RemoteFetcher::FetchError do fetcher.fetch_path 'uri' end @@ -392,11 +440,11 @@ def test_fetch_path_system_call_error fetcher = Gem::RemoteFetcher.new nil - def fetcher.open_uri_or_path(uri); + def fetcher.open_uri_or_path(uri, mtime = nil, head = nil) raise Errno::ECONNREFUSED, 'connect(2)' end - e = assert_raise Gem::RemoteFetcher::FetchError do + e = assert_raises Gem::RemoteFetcher::FetchError do fetcher.fetch_path 'uri' end @@ -405,6 +453,16 @@ assert_equal 'uri', e.uri end + def test_fetch_path_unmodified + fetcher = Gem::RemoteFetcher.new nil + + def fetcher.open_uri_or_path(uri, mtime, head = nil) + nil + end + + assert_equal nil, fetcher.fetch_path(URI.parse(@gem_repo), Time.at(0)) + end + def test_get_proxy_from_env_empty orig_env_HTTP_PROXY = ENV['HTTP_PROXY'] orig_env_http_proxy = ENV['http_proxy'] @@ -462,7 +520,7 @@ def conn.request(req) unless defined? @requested then @requested = true - res = Net::HTTPRedirection.new nil, 301, nil + res = Net::HTTPMovedPermanently.new nil, 301, nil res.add_field 'Location', 'http://gems.example.com/real_path' res else @@ -475,9 +533,9 @@ conn = { 'gems.example.com:80' => conn } fetcher.instance_variable_set :@connections, conn - fetcher.send :open_uri_or_path, 'http://gems.example.com/redirect' do |io| - assert_equal 'real_path', io.read - end + data = fetcher.open_uri_or_path 'http://gems.example.com/redirect' + + assert_equal 'real_path', data end def test_open_uri_or_path_limited_redirects @@ -486,7 +544,7 @@ conn = Object.new def conn.started?() true end def conn.request(req) - res = Net::HTTPRedirection.new nil, 301, nil + res = Net::HTTPMovedPermanently.new nil, 301, nil res.add_field 'Location', 'http://gems.example.com/redirect' res end @@ -494,30 +552,44 @@ conn = { 'gems.example.com:80' => conn } fetcher.instance_variable_set :@connections, conn - e = assert_raise Gem::RemoteFetcher::FetchError do - fetcher.send :open_uri_or_path, 'http://gems.example.com/redirect' + e = assert_raises Gem::RemoteFetcher::FetchError do + fetcher.open_uri_or_path 'http://gems.example.com/redirect' end assert_equal 'too many redirects (http://gems.example.com/redirect)', e.message end - def test_zip - use_ui @ui do - self.class.enable_zip = true - fetcher = Gem::RemoteFetcher.new nil - assert_equal SERVER_DATA.size, fetcher.fetch_size(@server_uri), "probably not from proxy" - zip_data = fetcher.fetch_path(@server_z_uri) - assert zip_data.size < SERVER_DATA.size, "Zipped data should be smaller" - end + def test_request + uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}" + util_stub_connection_for :body => :junk, :code => 200 + + response = @fetcher.request uri, Net::HTTP::Get + + assert_equal 200, response.code + assert_equal :junk, response.body end - def test_no_zip - use_ui @ui do - self.class.enable_zip = false - fetcher = Gem::RemoteFetcher.new nil - assert_error { fetcher.fetch_path(@server_z_uri) } - end + def test_request_head + uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}" + util_stub_connection_for :body => '', :code => 200 + response = @fetcher.request uri, Net::HTTP::Head + + assert_equal 200, response.code + assert_equal '', response.body + end + + def test_request_unmodifed + uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}" + conn = util_stub_connection_for :body => '', :code => 304 + + t = Time.now + response = @fetcher.request uri, Net::HTTP::Head, t + + assert_equal 304, response.code + assert_equal '', response.body + + assert_equal t.rfc2822, conn.payload['if-modified-since'] end def test_yaml_error_on_size @@ -528,7 +600,17 @@ end end - private + def util_stub_connection_for hash + def @fetcher.connection= conn + @conn = conn + end + + def @fetcher.connection_for uri + @conn + end + + @fetcher.connection = Conn.new OpenStruct.new(hash) + end def assert_error(exception_class=Exception) got_exception = false @@ -548,6 +630,20 @@ assert_block("Data is not from proxy") { data =~ /0\.4\.2/ } end + class Conn + attr_accessor :payload + + def initialize(response) + @response = response + self.payload = nil + end + + def request(req) + self.payload = req + @response + end + end + class NilLog < WEBrick::Log def log(level, data) #Do nothing end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_requirement.rb libgems-ruby-1.3.1/test/test_gem_requirement.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_requirement.rb 2007-11-09 21:11:37.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_requirement.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/version' @@ -32,19 +31,19 @@ assert_equal @r1_2, @r1_2.dup assert_equal @r1_2.dup, @r1_2 - assert_not_equal @r1_3, @r1_2 - assert_not_equal @r1_2, @r1_3 + refute_equal @r1_3, @r1_2 + refute_equal @r1_2, @r1_3 - assert_not_equal Object.new, @r1_2 - assert_not_equal @r1_2, Object.new + refute_equal Object.new, @r1_2 + refute_equal @r1_2, Object.new end def test_hash assert_equal @r1_2.hash, @r1_2.dup.hash assert_equal @r1_2.dup.hash, @r1_2.hash - assert_not_equal @r1_2.hash, @r1_3.hash - assert_not_equal @r1_3.hash, @r1_2.hash + refute_equal @r1_2.hash, @r1_3.hash + refute_equal @r1_3.hash, @r1_2.hash end # We may get some old gems that have requirements in old formats. @@ -80,13 +79,13 @@ end def test_parse_illformed - e = assert_raise ArgumentError do + e = assert_raises ArgumentError do @r1_2.parse(nil) end assert_equal 'Illformed requirement [nil]', e.message - e = assert_raise ArgumentError do + e = assert_raises ArgumentError do @r1_2.parse('') end @@ -139,7 +138,7 @@ assert_equal false, r1_2.satisfied_by?(v1_2) assert_equal true, r1_2.satisfied_by?(v1_3) - assert_raise NoMethodError do + assert_raises NoMethodError do assert_equal true, r1_2.satisfied_by?(nil) end end @@ -154,7 +153,7 @@ assert_equal true, r1_2.satisfied_by?(v1_2) assert_equal true, r1_2.satisfied_by?(v1_3) - assert_raise NoMethodError do + assert_raises NoMethodError do assert_equal true, r1_2.satisfied_by?(nil) end end @@ -169,7 +168,7 @@ assert_equal true, r.satisfied_by?(v1_2) assert_equal false, r.satisfied_by?(v1_3) - assert_raise NoMethodError do + assert_raises NoMethodError do assert_equal true, r.satisfied_by?(nil) end end @@ -184,7 +183,7 @@ assert_equal false, r1_2.satisfied_by?(v1_2) assert_equal false, r1_2.satisfied_by?(v1_3) - assert_raise NoMethodError do + assert_raises NoMethodError do assert_equal true, r1_2.satisfied_by?(nil) end end @@ -199,7 +198,7 @@ assert_equal true, r1_2.satisfied_by?(v1_2) assert_equal false, r1_2.satisfied_by?(v1_3) - assert_raise NoMethodError do + assert_raises NoMethodError do assert_equal true, r1_2.satisfied_by?(nil) end end @@ -214,7 +213,7 @@ assert_equal true, r1_2.satisfied_by?(v1_2) assert_equal true, r1_2.satisfied_by?(v1_3) - assert_raise NoMethodError do + assert_raises NoMethodError do assert_equal true, r1_2.satisfied_by?(nil) end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_server.rb libgems-ruby-1.3.1/test/test_gem_server.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_server.rb 2008-06-15 16:48:31.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_server.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/server' require 'stringio' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_source_index.rb libgems-ruby-1.3.1/test/test_gem_source_index.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_source_index.rb 2008-06-17 18:02:26.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_source_index.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/source_index' require 'rubygems/config_file' @@ -64,6 +63,54 @@ assert_equal a1.author, spec.author end + def test_self_load_specification_utf_8 + spec_dir = File.join @gemhome, 'specifications' + + FileUtils.rm_r spec_dir + + FileUtils.mkdir_p spec_dir + + spec_file = File.join spec_dir, "utf-8.gemspec" + spec_data = <<-SPEC +Gem::Specification.new do |s| + s.name = %q{utf} + s.version = "8" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") + s.authors = ["\317\200"] + s.date = %q{2008-09-10} + s.description = %q{This is a test description} + s.email = %q{example@example.com} + s.has_rdoc = true + s.homepage = %q{http://example.com} + s.require_paths = ["lib"] + s.rubygems_version = %q{1.2.0} + s.summary = %q{this is a summary} + + if s.respond_to? :specification_version then + 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 + end +end + SPEC + + spec_data.force_encoding 'UTF-8' + + File.open spec_file, 'w' do |io| io.write spec_data end + + spec = Gem::SourceIndex.load_specification spec_file + + pi = "\317\200" + pi.force_encoding 'UTF-8' if pi.respond_to? :force_encoding + + assert_equal pi, spec.author + end if Gem.ruby_version > Gem::Version.new('1.9') + def test_self_load_specification_exception spec_dir = File.join @gemhome, 'specifications' @@ -102,7 +149,7 @@ end use_ui @ui do - assert_raise Interrupt do + assert_raises Interrupt do Gem::SourceIndex.load_specification(spec_file) end end @@ -144,7 +191,7 @@ end use_ui @ui do - assert_raise SystemExit do + assert_raises SystemExit do Gem::SourceIndex.load_specification(spec_file) end end @@ -184,7 +231,7 @@ @fetcher.data["#{@gem_repo}yaml.Z"] = proc { raise SocketError } @fetcher.data["#{@gem_repo}yaml"] = proc { raise SocketError } - e = assert_raise Gem::RemoteSourceException do + e = assert_raises Gem::RemoteSourceException do use_ui @ui do @source_index.fetch_bulk_index @uri end @@ -309,7 +356,7 @@ @fetcher.data["#{@gem_repo}quick/index.rz"] = proc { raise Exception } - e = assert_raise Gem::OperationNotSupportedError do + e = assert_raises Gem::OperationNotSupportedError do @source_index.fetch_quick_index @uri, true end @@ -437,6 +484,27 @@ assert_equal [], missing end + def test_find_name + assert_equal [@a1, @a2], @source_index.find_name('a') + assert_equal [@a2], @source_index.find_name('a', '= 2') + assert_equal [], @source_index.find_name('bogusstring') + assert_equal [], @source_index.find_name('a', '= 3') + + source_index = Gem::SourceIndex.new + source_index.add_spec @a1 + source_index.add_spec @a2 + + assert_equal [@a1], source_index.find_name(@a1.name, '= 1') + + r1 = Gem::Requirement.create '= 1' + assert_equal [@a1], source_index.find_name(@a1.name, r1) + end + + def test_find_name_empty_cache + empty_source_index = Gem::SourceIndex.new({}) + assert_equal [], empty_source_index.find_name("foo") + end + def test_latest_specs p1_ruby = quick_gem 'p', '1' p1_platform = quick_gem 'p', '1' do |spec| @@ -544,7 +612,7 @@ def test_refresh_bang_not_from_dir source_index = Gem::SourceIndex.new - e = assert_raise RuntimeError do + e = assert_raises RuntimeError do source_index.refresh! end @@ -573,28 +641,12 @@ end def test_search - assert_equal [@a1, @a2, @a_evil9], @source_index.search('a') - assert_equal [@a2], @source_index.search('a', '= 2') - - assert_equal [], @source_index.search('bogusstring') - assert_equal [], @source_index.search('a', '= 3') + requirement = Gem::Requirement.create '= 9' + with_version = Gem::Dependency.new(/^a/, requirement) + assert_equal [@a_evil9], @source_index.search(with_version) - source_index = Gem::SourceIndex.new - source_index.add_spec @a1 - source_index.add_spec @a2 - - assert_equal [@a1], source_index.search(@a1.name, '= 1') - - r1 = Gem::Requirement.create '= 1' - assert_equal [@a1], source_index.search(@a1.name, r1) - - dep = Gem::Dependency.new @a1.name, r1 - assert_equal [@a1], source_index.search(dep) - end - - def test_search_empty_cache - empty_source_index = Gem::SourceIndex.new({}) - assert_equal [], empty_source_index.search("foo") + with_default = Gem::Dependency.new(/^a/, Gem::Requirement.default) + assert_equal [@a1, @a2, @a_evil9], @source_index.search(with_default) end def test_search_platform diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_source_info_cache_entry.rb libgems-ruby-1.3.1/test/test_gem_source_info_cache_entry.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_source_info_cache_entry.rb 2008-06-05 15:45:31.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_source_info_cache_entry.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/source_info_cache_entry' @@ -56,7 +55,7 @@ end def test_refresh_bad_uri - assert_raise URI::BadURIError do + assert_raises URI::BadURIError do @sic_e.refresh 'gems.example.com', true end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_source_info_cache.rb libgems-ruby-1.3.1/test/test_gem_source_info_cache.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_source_info_cache.rb 2008-06-18 18:06:03.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_source_info_cache.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,11 +1,9 @@ -#!/usr/bin/env ruby #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/source_info_cache' @@ -49,7 +47,7 @@ Gem.sources.replace %W[#{@gem_repo}] use_ui @ui do - assert_not_nil Gem::SourceInfoCache.cache + refute_nil Gem::SourceInfoCache.cache assert_kind_of Gem::SourceInfoCache, Gem::SourceInfoCache.cache assert_equal Gem::SourceInfoCache.cache.object_id, Gem::SourceInfoCache.cache.object_id @@ -68,11 +66,11 @@ Gem.sources.replace %w[#{@gem_repo}] use_ui @ui do - assert_not_nil Gem::SourceInfoCache.cache + refute_nil Gem::SourceInfoCache.cache assert_kind_of Gem::SourceInfoCache, Gem::SourceInfoCache.cache assert_equal Gem::SourceInfoCache.cache.object_id, Gem::SourceInfoCache.cache.object_id - assert_no_match %r|Bulk updating|, @ui.output + refute_match %r|Bulk updating|, @ui.output end end @@ -147,7 +145,7 @@ def test_cache_data_none_writable FileUtils.chmod 0444, @sic.system_cache_file FileUtils.chmod 0444, @sic.user_cache_file - e = assert_raise RuntimeError do + e = assert_raises RuntimeError do @sic.cache_data end assert_equal 'unable to locate a writable cache file', e.message @@ -202,7 +200,7 @@ def test_cache_file_none_writable FileUtils.chmod 0444, @sic.system_cache_file FileUtils.chmod 0444, @sic.user_cache_file - e = assert_raise RuntimeError do + e = assert_raises RuntimeError do @sic.cache_file end assert_equal 'unable to locate a writable cache file', e.message @@ -224,7 +222,8 @@ @sic.set_cache_data @gem_repo => sice latest = @sic.latest_cache_data - gems = latest[@gem_repo].source_index.search('a').map { |s| s.full_name } + beginning_with_a = Gem::Dependency.new(/^a/, Gem::Requirement.default) + gems = latest[@gem_repo].source_index.search(beginning_with_a).map { |s| s.full_name } assert_equal %w[a-2 a_evil-9], gems end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_spec_fetcher.rb libgems-ruby-1.3.1/test/test_gem_spec_fetcher.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_spec_fetcher.rb 2008-06-18 18:05:44.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_spec_fetcher.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/spec_fetcher' @@ -67,7 +66,7 @@ end def test_fetch_legacy_repo - @fetcher.data["#{@gem_repo}specs.#{Gem.marshal_version}.gz"] = nil + @fetcher.data.delete "#{@gem_repo}specs.#{Gem.marshal_version}.gz" @fetcher.data["#{@gem_repo}yaml"] = '' util_setup_source_info_cache @a1, @a2 @@ -259,6 +258,16 @@ assert_equal specs, cached_specs end + def test_list_latest_all + specs = @sf.list false + + assert_equal [@latest_specs], specs.values + + specs = @sf.list true + + assert_equal [@specs], specs.values, 'specs file not loaded' + end + def test_load_specs specs = @sf.load_specs @uri, 'specs' @@ -294,9 +303,9 @@ Marshal.dump @latest_specs, io end - specs = @sf.load_specs @uri, 'specs' + latest_specs = @sf.load_specs @uri, 'latest_specs' - assert_equal @specs, specs + assert_equal @latest_specs, latest_specs end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_specification.rb libgems-ruby-1.3.1/test/test_gem_specification.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_specification.rb 2008-06-21 16:52:25.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_specification.rb 2008-10-09 18:06:37.000000000 -0500 @@ -5,7 +5,6 @@ #++ require 'stringio' -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/specification' @@ -336,8 +335,8 @@ def test_equals2 assert_equal @a1, @a1 assert_equal @a1, @a1.dup - assert_not_equal @a1, @a2 - assert_not_equal @a1, Object.new + refute_equal @a1, @a2 + refute_equal @a1, Object.new end # The cgikit specification was reported to be causing trouble in at least @@ -369,16 +368,16 @@ spec = @a1.dup spec.default_executable = 'xx' - assert_not_equal @a1, spec - assert_not_equal spec, @a1 + refute_equal @a1, spec + refute_equal spec, @a1 end def test_equals2_extensions spec = @a1.dup spec.extensions = 'xx' - assert_not_equal @a1, spec - assert_not_equal spec, @a1 + refute_equal @a1, spec + refute_equal spec, @a1 end def test_executables @@ -500,13 +499,13 @@ end def test_has_rdoc_eh - assert_equal true, @a1.has_rdoc? + assert @a1.has_rdoc? end def test_hash assert_equal @a1.hash, @a1.hash assert_equal @a1.hash, @a1.dup.hash - assert_not_equal @a1.hash, @a2.hash + refute_equal @a1.hash, @a2.hash end def test_lib_files @@ -634,7 +633,10 @@ ruby_code = @a2.to_ruby - expected = "Gem::Specification.new do |s| + expected = <<-SPEC +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| s.name = %q{a} s.version = \"2\" @@ -654,7 +656,7 @@ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION} - if current_version >= 3 then + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, [\"= 1\"]) else s.add_dependency(%q, [\"= 1\"]) @@ -663,7 +665,7 @@ s.add_dependency(%q, [\"= 1\"]) end end -" + SPEC assert_equal expected, ruby_code @@ -679,7 +681,10 @@ local = Gem::Platform.local expected_platform = "[#{local.cpu.inspect}, #{local.os.inspect}, #{local.version.inspect}]" - expected = "Gem::Specification.new do |s| + expected = <<-SPEC +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| s.name = %q{a} s.version = \"1\" s.platform = Gem::Platform.new(#{expected_platform}) @@ -706,7 +711,7 @@ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 - if current_version >= 3 then + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, [\"> 0.4\"]) s.add_runtime_dependency(%q, [\"> 0.0.0\"]) s.add_runtime_dependency(%q, [\"> 0.4\", \"<= 0.6\"]) @@ -721,7 +726,7 @@ s.add_dependency(%q, [\"> 0.4\", \"<= 0.6\"]) end end -" + SPEC assert_equal expected, ruby_code @@ -809,7 +814,7 @@ @a1.authors = [Object.new] - e = assert_raise Gem::InvalidSpecificationException do + e = assert_raises Gem::InvalidSpecificationException do @a1.validate end @@ -843,7 +848,7 @@ end def test_validate_empty - e = assert_raise Gem::InvalidSpecificationException do + e = assert_raises Gem::InvalidSpecificationException do Gem::Specification.new.validate end @@ -866,7 +871,7 @@ def test_validate_empty_require_paths @a1.require_paths = [] - e = assert_raise Gem::InvalidSpecificationException do + e = assert_raises Gem::InvalidSpecificationException do @a1.validate end @@ -926,7 +931,7 @@ def test_validate_rubygems_version @a1.rubygems_version = "3" - e = assert_raise Gem::InvalidSpecificationException do + e = assert_raises Gem::InvalidSpecificationException do @a1.validate end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_stream_ui.rb libgems-ruby-1.3.1/test/test_gem_stream_ui.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_stream_ui.rb 2007-11-09 21:11:57.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_stream_ui.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/user_interaction' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_uninstaller.rb libgems-ruby-1.3.1/test/test_gem_uninstaller.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_uninstaller.rb 2008-06-17 16:41:19.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_uninstaller.rb 2008-09-25 05:07:15.000000000 -0500 @@ -10,8 +10,10 @@ ui = MockGemUi.new util_setup_gem ui - use_ui ui do - @installer.install + build_rake_in do + use_ui ui do + @installer.install + end end end @@ -60,5 +62,26 @@ assert_equal true, uninstaller.path_ok?(@spec) end + def test_uninstall + uninstaller = Gem::Uninstaller.new @spec.name, :executables => true + + gem_dir = File.join @gemhome, 'gems', @spec.full_name + + Gem.pre_uninstall do + assert File.exist?(gem_dir), 'gem_dir should exist' + end + + Gem.post_uninstall do + assert !File.exist?(gem_dir), 'gem_dir should not exist' + end + + uninstaller.uninstall + + assert !File.exist?(gem_dir) + + assert_same uninstaller, @pre_uninstall_hook_arg + assert_same uninstaller, @post_uninstall_hook_arg + end + end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_validator.rb libgems-ruby-1.3.1/test/test_gem_validator.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_validator.rb 2008-06-17 18:51:59.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_validator.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require File.join(File.expand_path(File.dirname(__FILE__)), 'simple_gem') require 'rubygems/validator' @@ -26,7 +25,7 @@ end def test_verify_gem_file_empty - e = assert_raise Gem::VerificationError do + e = assert_raises Gem::VerificationError do @validator.verify_gem_file '' end @@ -35,7 +34,7 @@ def test_verify_gem_file_nonexistent file = '/nonexistent/nonexistent.gem' - e = assert_raise Gem::VerificationError do + e = assert_raises Gem::VerificationError do @validator.verify_gem_file file end @@ -47,7 +46,7 @@ end def test_verify_gem_empty - e = assert_raise Gem::VerificationError do + e = assert_raises Gem::VerificationError do @validator.verify_gem '' end @@ -55,7 +54,7 @@ end def test_verify_gem_invalid_checksum - e = assert_raise Gem::VerificationError do + e = assert_raises Gem::VerificationError do @validator.verify_gem @simple_gem.upcase end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_version_option.rb libgems-ruby-1.3.1/test/test_gem_version_option.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_version_option.rb 2007-11-09 21:12:04.000000000 -0600 +++ libgems-ruby-1.3.1/test/test_gem_version_option.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,4 +1,3 @@ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/command' require 'rubygems/version_option' diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_version.rb libgems-ruby-1.3.1/test/test_gem_version.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_gem_version.rb 2008-06-17 03:08:35.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_gem_version.rb 2008-10-09 18:06:37.000000000 -0500 @@ -4,7 +4,6 @@ # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/version' @@ -29,10 +28,10 @@ end def test_class_create_malformed - e = assert_raise ArgumentError do Gem::Version.create("junk") end + e = assert_raises ArgumentError do Gem::Version.create("junk") end assert_equal "Malformed version number string junk", e.message - e = assert_raise ArgumentError do Gem::Version.create("1.0\n2.0") end + e = assert_raises ArgumentError do Gem::Version.create("1.0\n2.0") end assert_equal "Malformed version number string 1.0\n2.0", e.message end @@ -90,8 +89,8 @@ assert_equal v, @v1_2 assert_equal @v1_2, v - assert_not_equal @v1_2, @v1_3 - assert_not_equal @v1_3, @v1_2 + refute_equal @v1_2, @v1_3 + refute_equal @v1_3, @v1_2 end def test_hash @@ -100,16 +99,16 @@ assert_equal v1_2.hash, @v1_2.hash - assert_not_equal v1_2_0.hash, @v1_2.hash + refute_equal v1_2_0.hash, @v1_2.hash - assert_not_equal @v1_2.hash, @v1_3.hash + refute_equal @v1_2.hash, @v1_3.hash end def test_illformed_requirements [ ">>> 1.3.5", "> blah" ].each do |rq| - assert_raises(ArgumentError, "req [#{rq}] should fail") { - Gem::Version::Requirement.new(rq) - } + assert_raises ArgumentError, "req [#{rq}] should fail" do + Gem::Version::Requirement.new rq + end end end diff -Nru libgems-ruby-1.3.0~RC1really1.2.0/test/test_kernel.rb libgems-ruby-1.3.1/test/test_kernel.rb --- libgems-ruby-1.3.0~RC1really1.2.0/test/test_kernel.rb 2008-06-04 19:48:20.000000000 -0500 +++ libgems-ruby-1.3.1/test/test_kernel.rb 2008-10-09 18:06:37.000000000 -0500 @@ -1,11 +1,9 @@ -#!/usr/bin/env ruby #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ -require 'test/unit' require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') require 'rubygems/package' @@ -48,7 +46,7 @@ def test_gem_conflicting assert gem('a', '= 1'), "Should load" - ex = assert_raise Gem::Exception do + ex = assert_raises Gem::Exception do gem 'a', '= 2' end Binary files /tmp/sVTZAMcgno/libgems-ruby-1.3.0~RC1really1.2.0/._TODO and /tmp/oLtvGqir5B/libgems-ruby-1.3.1/._TODO differ