diff options
49 files changed, 863 insertions, 329 deletions
@@ -1,3 +1,8 @@ Mon Aug 26 16:24:58 2013 Nobuyoshi Nakada <[email protected]> * parse.y (parser_nextc): warn carriage return in middle of line. @@ -8,7 +8,7 @@ require 'rbconfig' module Gem - VERSION = '2.1.0.rc.1' end # Must be first since it unloads the prelude from 1.9.2 @@ -36,9 +36,9 @@ require 'rubygems/errors' # # Further RubyGems documentation can be found at: # # * {RubyGems API}[http://rubygems.rubyforge.org/rdoc] (also available from # <tt>gem server</tt>) -# * {RubyGems Bookshelf}[http://docs.rubygems.org] # # == RubyGems Plugins # @@ -1048,16 +1048,14 @@ module Gem # def register_default_spec(spec) - new_format, prefix_pattern = nil - spec.files.each do |file| - if new_format == nil - new_format = spec.require_paths.any? {|path| file.start_with? path} - - prefix_group = spec.require_paths.map {|f| f + "/"}.join("|") - prefix_pattern = /^(#{prefix_group})/ - end if new_format file = file.sub(prefix_pattern, "") next unless $~ @@ -1,139 +1,143 @@ -module Gem - # BasicSpecification is an abstract class which implements some common code used by - # both Specification and StubSpecification. - class BasicSpecification - def self.default_specifications_dir - File.join(Gem.default_dir, "specifications", "default") - end - ## - # Name of the gem - def name - raise NotImplementedError - end - ## - # Version of the gem - def version - raise NotImplementedError - end - ## - # Platform of the gem - def platform - raise NotImplementedError - end - ## - # Require paths of the gem - def require_paths - raise NotImplementedError - end - ## - # True when the gem has been activated - def activated? - raise NotImplementedError end - ## - # Return a Gem::Specification from this gem - def to_spec - raise NotImplementedError - end - ## - # The filename of the gem specification - attr_reader :filename - ## - # Set the filename of the Specification was loaded from. +path+ is converted - # to a String. - def filename= path - @filename = path && path.to_s - @full_gem_path = nil - @gems_dir = nil - @base_dir = nil end - ## - # Return true if this spec can require +file+. - def contains_requirable_file? file - root = full_gem_path - suffixes = Gem.suffixes - require_paths.any? do |lib| - base = "#{root}/#{lib}/#{file}" - suffixes.any? { |suf| File.file? "#{base}#{suf}" } - end - end - ## - # The full path to the gem (install path + full name). - def full_gem_path - # TODO: This is a heavily used method by gems, so we'll need - # to aleast just alias it to #gem_dir rather than remove it. - @full_gem_path ||= find_full_gem_path - end - # :nodoc: - def find_full_gem_path - # TODO: also, shouldn't it default to full_name if it hasn't been written? - path = File.expand_path File.join(gems_dir, full_name) - path.untaint - path if File.directory? path - end - private :find_full_gem_path - ## - # Returns the full path to the gems directory containing this spec's - # gem directory. eg: /usr/local/lib/ruby/1.8/gems - def gems_dir - # TODO: this logic seems terribly broken, but tests fail if just base_dir - @gems_dir ||= File.join(filename && base_dir || Gem.dir, "gems") - end - ## - # Returns the full path to the base gem directory. - # - # eg: /usr/local/lib/ruby/gems/1.8 - - def base_dir - return Gem.dir unless filename - @base_dir ||= if default_gem? then - File.dirname File.dirname File.dirname filename - else - File.dirname File.dirname filename - end - end - def default_gem? - filename && - File.dirname(filename) == self.class.default_specifications_dir - end - ## - # 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. - - def full_name - if platform == Gem::Platform::RUBY or platform.nil? then - "#{name}-#{version}".untaint - else - "#{name}-#{version}-#{platform}".untaint - end - end end end @@ -15,6 +15,25 @@ class Gem::Commands::BuildCommand < Gem::Command "GEMSPEC_FILE gemspec file name to build a gem for" end def usage # :nodoc: "#{program_name} GEMSPEC_FILE" end @@ -79,6 +79,13 @@ class Gem::Commands::CheckCommand < Gem::Command '--gems --alien' end def usage # :nodoc: "#{program_name} [OPTIONS] [GEMNAME ...]" end @@ -6,7 +6,7 @@ class Gem::Commands::CleanupCommand < Gem::Command def initialize super 'cleanup', - 'Clean up old versions of installed gems in the local repository', :force => false, :install_dir => Gem.dir add_option('-n', '-d', '--dryrun', @@ -33,11 +33,11 @@ class Gem::Commands::CleanupCommand < Gem::Command def description # :nodoc: <<-EOF -The cleanup command removes old gems from GEM_HOME. If an older version is -installed elsewhere in GEM_PATH the cleanup command won't touch it. -Older gems that are required to satisify the dependencies of gems -are not removed. EOF end @@ -45,6 +45,14 @@ class Gem::Commands::ContentsCommand < Gem::Command "--no-lib-only --prefix" end def usage # :nodoc: "#{program_name} GEMNAME [GEMNAME ...]" end @@ -38,6 +38,17 @@ class Gem::Commands::DependencyCommand < Gem::Command "--local --version '#{Gem::Requirement.default}' --no-reverse-dependencies" end def usage # :nodoc: "#{program_name} GEMNAME" end @@ -21,6 +21,9 @@ class Gem::Commands::EnvironmentCommand < Gem::Command def description # :nodoc: <<-EOF The RubyGems environment can be controlled through command line arguments, gemrc files, environment variables and built-in defaults. @@ -28,6 +28,16 @@ class Gem::Commands::FetchCommand < Gem::Command "--version '#{Gem::Requirement.default}'" end def usage # :nodoc: "#{program_name} GEMNAME [GEMNAME ...]" end @@ -8,7 +8,7 @@ require 'rubygems/commands/query_command' class Gem::Commands::ListCommand < Gem::Commands::QueryCommand def initialize - super 'list', 'Display gems whose name starts with STRING' remove_option('--name-matches') end @@ -21,6 +21,17 @@ class Gem::Commands::ListCommand < Gem::Commands::QueryCommand "--local --no-details" end def usage # :nodoc: "#{program_name} [STRING]" end @@ -10,6 +10,12 @@ class Gem::Commands::MirrorCommand < Gem::Command end end def execute alert_error "Install the rubygems-mirror gem for the mirror command" end @@ -15,6 +15,15 @@ class Gem::Commands::OutdatedCommand < Gem::Command add_platform_option end def execute Gem::Specification.outdated_and_latest_version.each do |spec, remote_version| say "#{spec.name} (#{spec.version} < #{remote_version})" @@ -7,7 +7,14 @@ class Gem::Commands::OwnerCommand < Gem::Command include Gem::GemcutterUtilities def description # :nodoc: - 'Manage gem owners on RubyGems.org.' end def arguments # :nodoc: @@ -19,7 +26,7 @@ class Gem::Commands::OwnerCommand < Gem::Command end def initialize - super 'owner', description add_proxy_option add_key_option defaults.merge! :add => [], :remove => [] @@ -21,7 +21,8 @@ class Gem::Commands::PristineCommand < Gem::Command end add_option('--[no-]extensions', - 'Restore gems with extensions') do |value, options| options[:extensions] = value end @@ -49,23 +50,23 @@ class Gem::Commands::PristineCommand < Gem::Command def description # :nodoc: <<-EOF -The pristine command compares the installed gems with the contents of the -cached gem and restores any files that don't match the cached gem's copy. -If you have made modifications to your installed gems, the pristine command -will revert them. After all the gem's files have been checked all bin stubs -for the gem are regenerated. -If the cached gem cannot be found, you will need to use `gem install` to -revert the gem. -If --no-extensions is provided pristine will not attempt to restore gems -with extensions. EOF end def usage # :nodoc: - "#{program_name} [args]" end def execute @@ -8,7 +8,13 @@ class Gem::Commands::PushCommand < Gem::Command include Gem::GemcutterUtilities def description # :nodoc: - 'Push a gem up to RubyGems.org' end def arguments # :nodoc: @@ -20,7 +26,7 @@ class Gem::Commands::PushCommand < Gem::Command end def initialize - super 'push', description, :host => self.host add_proxy_option add_key_option @@ -61,6 +61,15 @@ class Gem::Commands::QueryCommand < Gem::Command "--local --name-matches // --no-details --versions --no-installed" end def execute exit_code = 0 @@ -45,8 +45,12 @@ class Gem::Commands::RdocCommand < Gem::Command def description # :nodoc: <<-DESC -The rdoc command builds RDoc and RI documentation for installed gems. Use ---overwrite to force rebuilding of documentation. DESC end @@ -4,7 +4,7 @@ require 'rubygems/commands/query_command' class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand def initialize - super 'search', 'Display all gems whose name contains STRING' remove_option '--name-matches' @@ -19,6 +19,19 @@ class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand "--remote --no-details" end def usage # :nodoc: "#{program_name} [STRING]" end @@ -97,6 +97,53 @@ Do you want to add this insecure source? '--list' end def list # :nodoc: say "*** CURRENT SOURCES ***" say @@ -50,6 +50,22 @@ FIELD name of gemspec field to show "--local --version '#{Gem::Requirement.default}' --yaml" end def usage # :nodoc: "#{program_name} [GEMFILE] [FIELD]" end @@ -5,6 +5,16 @@ class Gem::Commands::StaleCommand < Gem::Command super('stale', 'List gems along with access times') end def usage # :nodoc: "#{program_name}" end @@ -88,6 +88,16 @@ class Gem::Commands::UninstallCommand < Gem::Command "--user-install" end def usage # :nodoc: "#{program_name} GEMNAME [GEMNAME ...]" end @@ -104,15 +114,18 @@ class Gem::Commands::UninstallCommand < Gem::Command end def uninstall_all - install_dir = options[:install_dir] - dirs_to_be_emptied = Dir[File.join(install_dir, '*')] - dirs_to_be_emptied.delete_if { |dir| dir.end_with? 'build_info' } - dirs_to_be_emptied.each do |dir| - FileUtils.rm_rf Dir[File.join(dir, '*')] end - alert("Successfully uninstalled all gems in #{install_dir}") end def uninstall_specific @@ -34,6 +34,24 @@ class Gem::Commands::UnpackCommand < Gem::Command "--version '#{Gem::Requirement.default}'" end def usage # :nodoc: "#{program_name} GEMNAME" end @@ -52,6 +52,15 @@ class Gem::Commands::UpdateCommand < Gem::Command "--document --no-force --install-dir #{Gem.dir}" end def usage # :nodoc: "#{program_name} GEMNAME [GEMNAME ...]" end @@ -23,6 +23,17 @@ class Gem::Commands::WhichCommand < Gem::Command "--no-gems-first --no-all" end def execute found = false @@ -9,7 +9,21 @@ class Gem::Commands::YankCommand < Gem::Command include Gem::GemcutterUtilities def description # :nodoc: - 'Remove a specific gem version release from RubyGems.org' end def arguments # :nodoc: @@ -21,7 +35,7 @@ class Gem::Commands::YankCommand < Gem::Command end def initialize - super 'yank', description add_version_option("remove") add_platform_option("remove") @@ -8,6 +8,8 @@ require 'monitor' module Kernel if defined?(gem_original_require) then # Ruby ships with a custom_require, override its require remove_method :require @@ -33,10 +35,8 @@ module Kernel # The normal <tt>require</tt> functionality of returning false if # that file has already been loaded is preserved. - ACTIVATION_MONITOR = Monitor.new - def require path - ACTIVATION_MONITOR.enter spec = Gem.find_unresolved_default_spec(path) if spec @@ -118,7 +118,7 @@ module Kernel raise load_error ensure - ACTIVATION_MONITOR.exit end private :require @@ -134,4 +134,11 @@ module Gem def self.default_cert_path File.join Gem.user_home, ".gem", "gem-public_cert.pem" end end @@ -5,8 +5,7 @@ require 'rubygems/package' require 'rubygems/installer' require 'rubygems/spec_fetcher' require 'rubygems/user_interaction' -require 'rubygems/source/local' -require 'rubygems/source/specific_file' require 'rubygems/available_set' ## @@ -251,7 +250,6 @@ class Gem::DependencyInstaller def find_spec_by_name_and_version gem_name, version = Gem::Requirement.default, prerelease = false - set = Gem::AvailableSet.new if consider_local? @@ -269,7 +267,6 @@ class Gem::DependencyInstaller if set.empty? dep = Gem::Dependency.new gem_name, version - # HACK Dependency objects should be immutable dep.prerelease = true if prerelease set = find_gems_with_sources(dep) @@ -96,12 +96,15 @@ class Gem::PackageTask < Rake::PackageTask def define super - task :package => [:gem] - gem_file = File.basename gem_spec.cache_file gem_path = File.join package_dir, gem_file gem_dir = File.join package_dir, gem_spec.full_name desc "Build the gem file #{gem_file}" task :gem => [gem_path] @@ -213,6 +213,9 @@ class Gem::Security::Policy if @only_signed then raise Gem::Security::Exception, "unsigned gems are not allowed by the #{name} policy" else alert_warning "#{full_name} is not signed" end @@ -246,6 +249,8 @@ class Gem::Security::Policy if @only_trusted then check_trust chain, digester, trust_dir else alert_warning "#{subject signer} is not trusted for #{full_name}" end @@ -63,6 +63,22 @@ class Gem::Security::Signer end ## # Loads any missing issuers in the cert chain from the trusted certificates. # # If the issuer does not exist it is ignored as it will be checked later. @@ -89,7 +105,9 @@ class Gem::Security::Signer re_sign_key end - Gem::Security::SigningPolicy.verify @cert_chain, @key @key.sign @digest_algorithm.new, data end @@ -26,15 +26,17 @@ class Gem::Source def <=>(other) case other - when Gem::Source::Installed, Gem::Source::Local then -1 when Gem::Source then if !@uri return 0 unless other.uri - return -1 end - return 1 if !other.uri @uri.to_s <=> other.uri.to_s else @@ -158,3 +160,5 @@ class Gem::Source end require 'rubygems/source/installed' @@ -1,8 +1,8 @@ -require 'rubygems/source' - class Gem::Source::Local < Gem::Source def initialize - @uri = nil end ## @@ -22,7 +22,8 @@ class Gem::Source::Local < Gem::Source end def inspect # :nodoc: - "#<%s specs: %p>" % [self.class, @specs.keys] end def load_specs(type) @@ -25,4 +25,32 @@ class Gem::Source::SpecificFile < Gem::Source raise Gem::Exception, "Unable to download '#{spec.full_name}'" end end @@ -206,15 +206,19 @@ class Gem::Specification < Gem::BasicSpecification attr_reader :version ## - # Paths in the gem to add to <tt>$LOAD_PATH</tt> when this gem is activated. # # Usage: # # # If all library files are in the root directory... # spec.require_path = '.' - # - # # If you have 'lib' and 'ext' directories... - # spec.require_paths << 'ext' attr_accessor :require_paths @@ -228,7 +232,7 @@ class Gem::Specification < Gem::BasicSpecification ## # A short summary of this gem's description. Displayed in `gem list -d`. # - # The description should be more detailed than the summary. # # Usage: # @@ -241,21 +245,23 @@ class Gem::Specification < Gem::BasicSpecification # # This is usually Gem::Platform::RUBY or Gem::Platform::CURRENT. # - # Most gems contain pure Ruby code; they should simply leave the default value - # in place. Some gems contain C (or other) code to be compiled into a Ruby - # “extension”. The should leave the default value in place unless their code - # will only compile on a certain type of system. Some gems consist of - # pre-compiled code (“binary gems”). It’s especially important that they set - # the platform attribute appropriately. A shortcut is to set the platform to - # Gem::Platform::CURRENT, which will cause the gem builder to set the platform - # to the appropriate value for the system on which the build is being performed. # - # If this attribute is set to a non-default value, it will be included in the - # filename of the gem when it is built, e.g. fxruby-1.2.0-win32.gem. # # Usage: # - # spec.platform = Gem::Platform::Win32 def platform= platform if @original_platform.nil? or @@ -357,7 +363,7 @@ class Gem::Specification < Gem::BasicSpecification attr_reader :description ## - # A contact email for this gem # # Usage: # @@ -473,6 +479,8 @@ class Gem::Specification < Gem::BasicSpecification # Usage: # # spec.extensions << 'ext/rmagic/extconf.rb' def extensions @extensions ||= [] @@ -502,6 +510,8 @@ class Gem::Specification < Gem::BasicSpecification # This should just be the name of your license. The full # text of the license should be inside of the gem when you build it. # # Usage: # spec.license = 'MIT' @@ -538,15 +548,20 @@ class Gem::Specification < Gem::BasicSpecification end ## - # The version of Ruby required by this gem # # Usage: # - # # If it will work with 1.8.6 or greater... # spec.required_ruby_version = '>= 1.8.6' # - # # Hopefully by now: - # spec.required_ruby_version = '>= 1.9.2' def required_ruby_version= req @required_ruby_version = Gem::Requirement.create req @@ -554,7 +569,7 @@ class Gem::Specification < Gem::BasicSpecification ## # Lists the external (to RubyGems) requirements that must be met for this gem - # to work. It’s simply information for the user. # # Usage: # @@ -566,7 +581,7 @@ class Gem::Specification < Gem::BasicSpecification end ## - # A collection of unit test files. They will be loaded as unit tests when # the user requests a gem to be unit tested. # # Usage: @@ -592,7 +607,7 @@ class Gem::Specification < Gem::BasicSpecification # # Deprecated: It is neither supported nor functional. - attr_accessor :autorequire ## # Sets the default executable for this gem. @@ -615,9 +630,12 @@ class Gem::Specification < Gem::BasicSpecification # The RubyGems version required by this gem attr_reader :required_rubygems_version ## # The rubyforge project this gem lives under. i.e. RubyGems' # rubyforge_project is "rubygems". attr_accessor :rubyforge_project @@ -768,7 +786,7 @@ class Gem::Specification < Gem::BasicSpecification # -- wilsonb def self.all= specs - @@all = specs end ## @@ -1320,7 +1338,7 @@ class Gem::Specification < Gem::BasicSpecification end ## - # Singular reader for #authors def author val = authors and val.first @@ -1328,6 +1346,8 @@ class Gem::Specification < Gem::BasicSpecification ## # The list of author names who wrote this gem. def authors @authors ||= [] @@ -1407,7 +1427,9 @@ class Gem::Specification < Gem::BasicSpecification end ## - # The date this gem was created. Lazily defaults to TODAY. def date @date ||= TODAY @@ -1454,7 +1476,7 @@ class Gem::Specification < Gem::BasicSpecification # Deprecated: The name of the gem is assumed to be the name of the # executable now. See Gem.bin_path. - def default_executable if defined?(@default_executable) and @default_executable result = @default_executable elsif @executables and @executables.size == 1 @@ -1513,7 +1535,7 @@ class Gem::Specification < Gem::BasicSpecification end ## - # A long description of this gem def description= str @description = str.to_s @@ -1672,7 +1694,7 @@ class Gem::Specification < Gem::BasicSpecification # # Formerly used to indicate this gem was RDoc-capable. - def has_rdoc true end @@ -1681,11 +1703,11 @@ class Gem::Specification < Gem::BasicSpecification # # Formerly used to indicate this gem was RDoc-capable. - def has_rdoc= ignored @has_rdoc = true end - alias :has_rdoc? :has_rdoc ## # True if this gem has files in test_files @@ -1818,7 +1840,7 @@ class Gem::Specification < Gem::BasicSpecification @licenses ||= [] end - def filename= path super @bin_dir = nil @@ -1832,17 +1854,6 @@ class Gem::Specification < Gem::BasicSpecification end ## - # Path this gemspec was loaded from. This attribute is not persisted. - - alias loaded_from filename - - ## - # Set the location a Specification was loaded from. +obj+ is converted - # to a String. - - alias loaded_from= filename= - - ## # Sets the rubygems_version to the current RubyGems version. def mark_version @@ -1,119 +1,120 @@ -module Gem - # Gem::StubSpecification reads the stub: line from the gemspec - # This prevents us having to eval the entire gemspec in order to - # find out certain information. - class StubSpecification < BasicSpecification - # :nodoc: - PREFIX = "# stub: " - - OPEN_MODE = # :nodoc: - if Object.const_defined? :Encoding then - 'r:UTF-8:-' - else - 'r' - end - - # :nodoc: - class StubLine - attr_reader :parts - def initialize(data) - @parts = data[PREFIX.length..-1].split(" ") - end - def name - @parts[0] - end - def version - Gem::Version.new @parts[1] - end - def platform - Gem::Platform.new @parts[2] - end - def require_paths - @parts[3..-1].join(" ").split("\0") - end end - def initialize(filename) - self.filename = filename - @data = nil - @spec = nil end - ## - # Name of the gem - def name - @name ||= data.name - end - ## - # Version of the gem - def version - @version ||= data.version end - ## - # Platform of the gem - def platform - @platform ||= data.platform - end - ## - # Require paths of the gem - def require_paths - @require_paths ||= data.require_paths - end - ## - # The full Gem::Specification for this gem, loaded from evalling its gemspec - def to_spec - @spec ||= Gem::Specification.load(filename) - end - ## - # True when this gem has been activated - def activated? - loaded = Gem.loaded_specs[name] - loaded && loaded.version == version - end - ## - # Is this StubSpecification valid? i.e. have we found a stub line, OR does - # the filename contain a valid gemspec? - def valid? - data - end - private - - ## - # If the gemspec contains a stubline, returns a StubLine instance. Otherwise - # returns the full Gem::Specification. - - def data - unless @data - open filename, OPEN_MODE do |file| - begin - file.readline # discard encoding line - stubline = file.readline.chomp - @data = StubLine.new(stubline) if stubline.start_with?(PREFIX) - rescue EOFError - end - end - end - @data ||= to_spec - end end end @@ -785,7 +785,7 @@ Also, a list: @a_evil9 = quick_gem('a_evil', '9', &init) @b2 = quick_gem('b', '2', &init) @c1_2 = quick_gem('c', '1.2', &init) - @x = quick_gem('x', '1', &init) @dep_x = quick_gem('dep_x', '1') do |s| s.files = %w[lib/code.rb] s.require_paths = %w[lib] @@ -805,14 +805,15 @@ Also, a list: util_build_gem @a2_pre end - write_file File.join(*%W[gems #{@a1.original_name} lib code.rb]) - write_file File.join(*%W[gems #{@a2.original_name} lib code.rb]) - write_file File.join(*%W[gems #{@a3a.original_name} lib code.rb]) - write_file File.join(*%W[gems #{@b2.original_name} lib code.rb]) - write_file File.join(*%W[gems #{@c1_2.original_name} lib code.rb]) - write_file File.join(*%W[gems #{@pl1.original_name} lib code.rb]) - write_file File.join(*%W[gems #{@x.original_name} lib code.rb]) - write_file File.join(*%W[gems #{@dep_x.original_name} lib code.rb]) [@a1, @a2, @a3a, @a_evil9, @b2, @c1_2, @pl1, @x, @dep_x].each do |spec| util_build_gem spec @@ -1181,6 +1181,28 @@ class TestGem < Gem::TestCase assert_equal nil, Gem.find_unresolved_default_spec("README") end def with_plugin(path) test_plugin_path = File.expand_path("test/rubygems/plugin/#{path}", @@project_dir) @@ -191,21 +191,30 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase end def test_execute_all - ui = Gem::MockGemUi.new "y\n" - util_make_gems - util_setup_gem ui - assert Gem::Specification.find_all_by_name('a').length > 1 @cmd.options[:all] = true @cmd.options[:args] = [] - use_ui ui do @cmd.execute end - refute_includes Gem::Specification.all_names, 'a' end end @@ -4,16 +4,37 @@ require 'rubygems/package_task' class TestGemPackageTask < Gem::TestCase def test_gem_package gem = Gem::Specification.new do |g| g.name = "pkgr" g.version = "1.2.3" - g.files = Rake::FileList["x"].resolve end pkg = Gem::PackageTask.new(gem) do |p| p.package_files << "y" end - assert_equal ["x", "y"], pkg.package_files end def test_gem_package_with_current_platform @@ -351,6 +351,17 @@ class TestGemSecurityPolicy < Gem::TestCase end end def test_verify_not_enough_signatures Gem::Security.trust_dir.trust_cert PUBLIC_CERT @@ -84,6 +84,12 @@ class TestGemSecuritySigner < Gem::TestCase assert_equal ENCRYPTED_PRIVATE_KEY.to_s, signer.key.to_s end def test_load_cert_chain Gem::Security.trust_dir.trust_cert PUBLIC_CERT @@ -184,5 +184,28 @@ class TestGemSource < Gem::TestCase end end end @@ -0,0 +1,28 @@ @@ -66,18 +66,41 @@ class TestGemSourceLocal < Gem::TestCase assert_equal s, @a end def test_download path = @sl.download @a assert_equal File.expand_path(@a.file_name), path end - def test_compare - uri = URI.parse "http://gems.example/foo" - s = Gem::Source.new uri - assert_equal(-1, s <=> @sl) - assert_equal 0, @sl <=> @sl - assert_equal 1, @sl <=> s end end @@ -30,4 +30,42 @@ class TestGemSourceSpecificFile < Gem::TestCase def test_download assert_equal @a_gem, @sf.download(@a) end end @@ -445,6 +445,14 @@ end end end def test_self_attribute_names expected_value = %w[ authors @@ -1313,7 +1321,7 @@ dependencies: [] end def test_base_dir_not_loaded - @a1.instance_variable_set :@filename, nil assert_equal Gem.dir, @a1.base_dir end @@ -1322,7 +1330,7 @@ dependencies: [] default_dir = File.join Gem::Specification.default_specifications_dir, @a1.spec_name - @a1.instance_variable_set :@filename, default_dir assert_equal Gem.default_dir, @a1.base_dir end |