diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-27 13:00:45 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-27 13:00:45 +0000 |
commit | d9c32d62a06edf6bcfaf357e44173cefd92778ee () | |
tree | ba0a22afc2b02ca4c6eba226ff27c120595968a7 /lib | |
parent | b89e894399016def7979168d16eff9026012a710 (diff) |
* lib/rubygems: Update to RubyGems 2.4.6 and HEAD(800f2e6).
Fixed #1159, #1171, #1173 on rubygems/rubygems * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/rubygems/commands/pristine_command.rb | 10 | ||||
-rw-r--r-- | lib/rubygems/indexer.rb | 63 | ||||
-rw-r--r-- | lib/rubygems/package.rb | 3 | ||||
-rw-r--r-- | lib/rubygems/request_set.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/request_set/gem_dependency_api.rb | 8 | ||||
-rw-r--r-- | lib/rubygems/request_set/lockfile.rb | 75 | ||||
-rw-r--r-- | lib/rubygems/requirement.rb | 11 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 52 | ||||
-rw-r--r-- | lib/rubygems/test_case.rb | 15 | ||||
-rw-r--r-- | lib/rubygems/text.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/version.rb | 26 |
11 files changed, 144 insertions, 125 deletions
@@ -21,6 +21,11 @@ class Gem::Commands::PristineCommand < Gem::Command options[:all] = value end add_option('--[no-]extensions', 'Restore gems with extensions', 'in addition to regular gems') do |value, options| @@ -109,6 +114,11 @@ extensions will be restored. next end if spec.bundled_gem_in_old_ruby? say "Skipped #{spec.full_name}, it is bundled with old Ruby" next @@ -93,23 +93,6 @@ class Gem::Indexer end ## - # Abbreviate the spec for downloading. Abbreviated specs are only used for - # searching, downloading and related activities and do not need deployment - # specific information (e.g. list of files). So we abbreviate the spec, - # making it much smaller for quicker downloads. - #-- - # TODO move to Gem::Specification - - def abbreviate(spec) - spec.files = [] - spec.test_files = [] - spec.rdoc_options = [] - spec.extra_rdoc_files = [] - spec.cert_chain = [] - spec - end - - ## # Build various indicies def build_indicies @@ -221,18 +204,8 @@ class Gem::Indexer spec = Gem::Package.new(gemfile).spec spec.loaded_from = gemfile - # HACK: fuck this shit - borks all tests that use pl1 - # if File.basename(gemfile, ".gem") != spec.original_name then - # exp = spec.full_name - # exp << " (#{spec.original_name})" if - # spec.original_name != spec.full_name - # msg = "Skipping misnamed gem: #{gemfile} should be named #{exp}" - # alert_warning msg - # next - # end - - abbreviate spec - sanitize spec spec rescue SignalException @@ -381,38 +354,6 @@ class Gem::Indexer end ## - # Sanitize the descriptive fields in the spec. Sometimes non-ASCII - # characters will garble the site index. Non-ASCII characters will - # be replaced by their XML entity equivalent. - - def sanitize(spec) - spec.summary = sanitize_string(spec.summary) - 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 - - ## - # Sanitize a single string. - - def sanitize_string(string) - return string unless string - - # HACK the #to_s is in here because RSpec has an Array of Arrays of - # Strings for authors. Need a way to disallow bad values on gemspec - # generation. (Probably won't happen.) - string = string.to_s - - begin - Builder::XChar.encode string - rescue NameError, NoMethodError - string.to_xs - end - end - - ## # Perform an in-place update of the repository from newly added gems. def update_index @@ -366,8 +366,9 @@ EOM FileUtils.mkdir_p mkdir, mkdir_options - open destination, 'wb', entry.header.mode do |out| out.write entry.read end if entry.file? verbose destination @@ -223,7 +223,7 @@ class Gem::RequestSet if options.fetch :lock, true then lockfile = - Gem::RequestSet::Lockfile.new self, gemdeps, gem_deps_api.dependencies lockfile.write end @@ -275,7 +275,7 @@ class Gem::RequestSet @git_set.root_dir = @install_dir - lock_file = "#{File.expand_path(path)}.lock" begin tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file lock_file parser = tokenizer.make_parser self, [] @@ -367,11 +367,11 @@ class Gem::RequestSet::GemDependencyAPI @dependencies[name] = if requirements.empty? and not source_set then - nil elsif source_set then - '!' else - requirements end return unless gem_platforms options @@ -601,7 +601,7 @@ Gem dependencies file #{@path} requires #{name} more than once. add_dependencies groups, [self_dep] add_dependencies groups, spec.runtime_dependencies - @dependencies[spec.name] = '!' spec.dependencies.each do |dep| @dependencies[dep.name] = dep.requirement @@ -37,15 +37,40 @@ class Gem::RequestSet::Lockfile end ## - # The platforms for this Lockfile - attr_reader :platforms ## - # Creates a new Lockfile for the given +request_set+ and +gem_deps_file+ - # location. - def initialize request_set, gem_deps_file, dependencies = nil @set = request_set @dependencies = dependencies @gem_deps_file = File.expand_path(gem_deps_file) @@ -59,41 +84,9 @@ class Gem::RequestSet::Lockfile def add_DEPENDENCIES out # :nodoc: out << "DEPENDENCIES" - dependencies = - if @dependencies then - @dependencies.sort_by { |name,| name }.map do |name, requirement| - requirement_string = - if '!' == requirement then - requirement - else - Gem::Requirement.new(requirement).for_lockfile - end - - [name, requirement_string] - end - else - requests.sort_by { |r| r.name }.map do |request| - spec = request.spec - name = request.name - requirement = request.request.dependency.requirement - - requirement_string = - if [Gem::Resolver::VendorSpecification, - Gem::Resolver::GitSpecification].include? spec.class then - "!" - else - requirement.for_lockfile - end - - [name, requirement_string] - end - end - - dependencies = dependencies.map do |name, requirement_string| - " #{name}#{requirement_string}" - end - - out.concat dependencies out << nil end @@ -207,8 +200,6 @@ class Gem::RequestSet::Lockfile # The contents of the lock file. def to_s - @set.resolve - out = [] groups = spec_groups @@ -23,6 +23,8 @@ class Gem::Requirement "~>" => lambda { |v, r| v >= r && v.release < r.bump } } quoted = OPS.keys.map { |k| Regexp.quote k }.join "|" PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*" # :nodoc: @@ -54,6 +56,8 @@ class Gem::Requirement input when Gem::Version, Array then new input else if input.respond_to? :to_str then new [input.to_str] @@ -70,6 +74,13 @@ class Gem::Requirement new '>= 0' end ## # Parse +obj+, returning an <tt>[op, version]</tt> pair. +obj+ can # be a String or a Gem::Version. @@ -383,6 +383,8 @@ class Gem::Specification < Gem::BasicSpecification attr_reader :description ## # A contact email address (or addresses) for this gem # # Usage: @@ -393,11 +395,13 @@ class Gem::Specification < Gem::BasicSpecification attr_accessor :email ## # The URL of this gem's home page # # Usage: # - # spec.homepage = 'http://rake.rubyforge.org' attr_accessor :homepage @@ -1322,6 +1326,50 @@ class Gem::Specification < Gem::BasicSpecification end ## # Returns an array with bindir attached to each executable in the # +executables+ list @@ -2609,7 +2657,7 @@ http://opensource.org/licenses/alphabetical # Warnings - %w[author description email homepage summary].each do |attribute| value = self.send attribute warning "no #{attribute} specified" if value.nil? or value.empty? end @@ -1426,6 +1426,21 @@ Also, a list: end require 'rubygems/test_utilities' ENV['GEM_HOME'] = Dir.mktmpdir "home" ENV['GEM_PATH'] = Dir.mktmpdir "path" @@ -43,11 +43,9 @@ module Gem::Text t = str2 n = s.length m = t.length - max = n/2 return m if (0 == n) return n if (0 == m) - return n if (n - m).abs > max d = (0..m).to_a x = nil @@ -217,12 +217,14 @@ class Gem::Version # (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored. def bump - segments = self.segments.dup - segments.pop while segments.any? { |s| String === s } - segments.pop if segments.size > 1 - - segments[-1] = segments[-1].succ - self.class.new segments.join(".") end ## @@ -291,11 +293,13 @@ class Gem::Version # Non-prerelease versions return themselves. def release - return self unless prerelease? - - segments = self.segments.dup - segments.pop while segments.any? { |s| String === s } - self.class.new segments.join('.') end def segments # :nodoc: |