* 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
This commit is contained in:
parent
b89e894399
commit
d9c32d62a0
@ -1,3 +1,9 @@
|
|||||||
|
Fri Feb 27 22:00:05 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
||||||
|
|
||||||
|
* lib/rubygems: Update to RubyGems 2.4.6 and HEAD(800f2e6).
|
||||||
|
Fixed #1159, #1171, #1173 on rubygems/rubygems
|
||||||
|
* test/rubygems: ditto.
|
||||||
|
|
||||||
Fri Feb 27 20:55:42 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
Fri Feb 27 20:55:42 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
||||||
|
|
||||||
* lib/rake: Update to rake (9237e74), typo fix and remove needless
|
* lib/rake: Update to rake (9237e74), typo fix and remove needless
|
||||||
|
@ -21,6 +21,11 @@ class Gem::Commands::PristineCommand < Gem::Command
|
|||||||
options[:all] = value
|
options[:all] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_option('--skip=gem_name',
|
||||||
|
'used on --all, skip if name == gem_name') do |value, options|
|
||||||
|
options[:skip] = value
|
||||||
|
end
|
||||||
|
|
||||||
add_option('--[no-]extensions',
|
add_option('--[no-]extensions',
|
||||||
'Restore gems with extensions',
|
'Restore gems with extensions',
|
||||||
'in addition to regular gems') do |value, options|
|
'in addition to regular gems') do |value, options|
|
||||||
@ -109,6 +114,11 @@ extensions will be restored.
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if spec.name == options[:skip]
|
||||||
|
say "Skipped #{spec.full_name}, it was given through options"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
if spec.bundled_gem_in_old_ruby?
|
if spec.bundled_gem_in_old_ruby?
|
||||||
say "Skipped #{spec.full_name}, it is bundled with old Ruby"
|
say "Skipped #{spec.full_name}, it is bundled with old Ruby"
|
||||||
next
|
next
|
||||||
|
@ -92,23 +92,6 @@ class Gem::Indexer
|
|||||||
@files = []
|
@files = []
|
||||||
end
|
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
|
# Build various indicies
|
||||||
|
|
||||||
@ -221,18 +204,8 @@ class Gem::Indexer
|
|||||||
spec = Gem::Package.new(gemfile).spec
|
spec = Gem::Package.new(gemfile).spec
|
||||||
spec.loaded_from = gemfile
|
spec.loaded_from = gemfile
|
||||||
|
|
||||||
# HACK: fuck this shit - borks all tests that use pl1
|
spec.abbreviate
|
||||||
# if File.basename(gemfile, ".gem") != spec.original_name then
|
spec.sanitize
|
||||||
# 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
|
spec
|
||||||
rescue SignalException
|
rescue SignalException
|
||||||
@ -380,38 +353,6 @@ class Gem::Indexer
|
|||||||
end
|
end
|
||||||
end
|
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.
|
# Perform an in-place update of the repository from newly added gems.
|
||||||
|
|
||||||
|
@ -366,8 +366,9 @@ EOM
|
|||||||
|
|
||||||
FileUtils.mkdir_p mkdir, mkdir_options
|
FileUtils.mkdir_p mkdir, mkdir_options
|
||||||
|
|
||||||
open destination, 'wb', entry.header.mode do |out|
|
open destination, 'wb' do |out|
|
||||||
out.write entry.read
|
out.write entry.read
|
||||||
|
FileUtils.chmod entry.header.mode, destination
|
||||||
end if entry.file?
|
end if entry.file?
|
||||||
|
|
||||||
verbose destination
|
verbose destination
|
||||||
|
@ -223,7 +223,7 @@ class Gem::RequestSet
|
|||||||
|
|
||||||
if options.fetch :lock, true then
|
if options.fetch :lock, true then
|
||||||
lockfile =
|
lockfile =
|
||||||
Gem::RequestSet::Lockfile.new self, gemdeps, gem_deps_api.dependencies
|
Gem::RequestSet::Lockfile.build self, gemdeps, gem_deps_api.dependencies
|
||||||
lockfile.write
|
lockfile.write
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ class Gem::RequestSet
|
|||||||
|
|
||||||
@git_set.root_dir = @install_dir
|
@git_set.root_dir = @install_dir
|
||||||
|
|
||||||
lock_file = "#{File.expand_path(path)}.lock"
|
lock_file = "#{File.expand_path(path)}.lock".untaint
|
||||||
begin
|
begin
|
||||||
tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file lock_file
|
tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file lock_file
|
||||||
parser = tokenizer.make_parser self, []
|
parser = tokenizer.make_parser self, []
|
||||||
|
@ -367,11 +367,11 @@ class Gem::RequestSet::GemDependencyAPI
|
|||||||
|
|
||||||
@dependencies[name] =
|
@dependencies[name] =
|
||||||
if requirements.empty? and not source_set then
|
if requirements.empty? and not source_set then
|
||||||
nil
|
Gem::Requirement.default
|
||||||
elsif source_set then
|
elsif source_set then
|
||||||
'!'
|
Gem::Requirement.source_set
|
||||||
else
|
else
|
||||||
requirements
|
Gem::Requirement.create requirements
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless gem_platforms options
|
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, [self_dep]
|
||||||
add_dependencies groups, spec.runtime_dependencies
|
add_dependencies groups, spec.runtime_dependencies
|
||||||
|
|
||||||
@dependencies[spec.name] = '!'
|
@dependencies[spec.name] = Gem::Requirement.source_set
|
||||||
|
|
||||||
spec.dependencies.each do |dep|
|
spec.dependencies.each do |dep|
|
||||||
@dependencies[dep.name] = dep.requirement
|
@dependencies[dep.name] = dep.requirement
|
||||||
|
@ -36,16 +36,41 @@ class Gem::RequestSet::Lockfile
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Creates a new Lockfile for the given +request_set+ and +gem_deps_file+
|
||||||
|
# location.
|
||||||
|
|
||||||
|
def self.build request_set, gem_deps_file, dependencies = nil
|
||||||
|
request_set.resolve
|
||||||
|
dependencies ||= requests_to_deps request_set.sorted_requests
|
||||||
|
new request_set, gem_deps_file, dependencies
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.requests_to_deps requests # :nodoc:
|
||||||
|
deps = {}
|
||||||
|
|
||||||
|
requests.each do |request|
|
||||||
|
spec = request.spec
|
||||||
|
name = request.name
|
||||||
|
requirement = request.request.dependency.requirement
|
||||||
|
|
||||||
|
deps[name] = if [Gem::Resolver::VendorSpecification,
|
||||||
|
Gem::Resolver::GitSpecification].include? spec.class then
|
||||||
|
Gem::Requirement.source_set
|
||||||
|
else
|
||||||
|
requirement
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
deps
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# The platforms for this Lockfile
|
# The platforms for this Lockfile
|
||||||
|
|
||||||
attr_reader :platforms
|
attr_reader :platforms
|
||||||
|
|
||||||
##
|
def initialize request_set, gem_deps_file, dependencies
|
||||||
# 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
|
@set = request_set
|
||||||
@dependencies = dependencies
|
@dependencies = dependencies
|
||||||
@gem_deps_file = File.expand_path(gem_deps_file)
|
@gem_deps_file = File.expand_path(gem_deps_file)
|
||||||
@ -59,41 +84,9 @@ class Gem::RequestSet::Lockfile
|
|||||||
def add_DEPENDENCIES out # :nodoc:
|
def add_DEPENDENCIES out # :nodoc:
|
||||||
out << "DEPENDENCIES"
|
out << "DEPENDENCIES"
|
||||||
|
|
||||||
dependencies =
|
out.concat @dependencies.sort_by { |name,| name }.map { |name, requirement|
|
||||||
if @dependencies then
|
" #{name}#{requirement.for_lockfile}"
|
||||||
@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
|
out << nil
|
||||||
end
|
end
|
||||||
@ -207,8 +200,6 @@ class Gem::RequestSet::Lockfile
|
|||||||
# The contents of the lock file.
|
# The contents of the lock file.
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
@set.resolve
|
|
||||||
|
|
||||||
out = []
|
out = []
|
||||||
|
|
||||||
groups = spec_groups
|
groups = spec_groups
|
||||||
|
@ -23,6 +23,8 @@ class Gem::Requirement
|
|||||||
"~>" => lambda { |v, r| v >= r && v.release < r.bump }
|
"~>" => lambda { |v, r| v >= r && v.release < r.bump }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
|
||||||
|
|
||||||
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|"
|
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|"
|
||||||
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*" # :nodoc:
|
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*" # :nodoc:
|
||||||
|
|
||||||
@ -54,6 +56,8 @@ class Gem::Requirement
|
|||||||
input
|
input
|
||||||
when Gem::Version, Array then
|
when Gem::Version, Array then
|
||||||
new input
|
new input
|
||||||
|
when '!' then
|
||||||
|
source_set
|
||||||
else
|
else
|
||||||
if input.respond_to? :to_str then
|
if input.respond_to? :to_str then
|
||||||
new [input.to_str]
|
new [input.to_str]
|
||||||
@ -70,6 +74,13 @@ class Gem::Requirement
|
|||||||
new '>= 0'
|
new '>= 0'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###
|
||||||
|
# A source set requirement, used for Gemfiles and lockfiles
|
||||||
|
|
||||||
|
def self.source_set # :nodoc:
|
||||||
|
SOURCE_SET_REQUIREMENT
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Parse +obj+, returning an <tt>[op, version]</tt> pair. +obj+ can
|
# Parse +obj+, returning an <tt>[op, version]</tt> pair. +obj+ can
|
||||||
# be a String or a Gem::Version.
|
# be a String or a Gem::Version.
|
||||||
|
@ -383,6 +383,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|||||||
attr_reader :description
|
attr_reader :description
|
||||||
|
|
||||||
##
|
##
|
||||||
|
# :category: Recommended gemspec attributes
|
||||||
|
#
|
||||||
# A contact email address (or addresses) for this gem
|
# A contact email address (or addresses) for this gem
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
@ -393,11 +395,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|||||||
attr_accessor :email
|
attr_accessor :email
|
||||||
|
|
||||||
##
|
##
|
||||||
|
# :category: Recommended gemspec attributes
|
||||||
|
#
|
||||||
# The URL of this gem's home page
|
# The URL of this gem's home page
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
#
|
#
|
||||||
# spec.homepage = 'http://rake.rubyforge.org'
|
# spec.homepage = 'https://github.com/ruby/rake'
|
||||||
|
|
||||||
attr_accessor :homepage
|
attr_accessor :homepage
|
||||||
|
|
||||||
@ -1321,6 +1325,50 @@ class Gem::Specification < Gem::BasicSpecification
|
|||||||
unresolved.delete self.name
|
unresolved.delete self.name
|
||||||
end
|
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.
|
||||||
|
|
||||||
|
def abbreviate
|
||||||
|
self.files = []
|
||||||
|
self.test_files = []
|
||||||
|
self.rdoc_options = []
|
||||||
|
self.extra_rdoc_files = []
|
||||||
|
self.cert_chain = []
|
||||||
|
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
|
||||||
|
self.summary = sanitize_string(summary)
|
||||||
|
self.description = sanitize_string(description)
|
||||||
|
self.post_install_message = sanitize_string(post_install_message)
|
||||||
|
self.authors = authors.collect { |a| sanitize_string(a) }
|
||||||
|
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
|
||||||
|
|
||||||
##
|
##
|
||||||
# Returns an array with bindir attached to each executable in the
|
# Returns an array with bindir attached to each executable in the
|
||||||
# +executables+ list
|
# +executables+ list
|
||||||
@ -2609,7 +2657,7 @@ http://opensource.org/licenses/alphabetical
|
|||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
|
|
||||||
%w[author description email homepage summary].each do |attribute|
|
%w[author email homepage summary].each do |attribute|
|
||||||
value = self.send attribute
|
value = self.send attribute
|
||||||
warning "no #{attribute} specified" if value.nil? or value.empty?
|
warning "no #{attribute} specified" if value.nil? or value.empty?
|
||||||
end
|
end
|
||||||
|
@ -1426,6 +1426,21 @@ Also, a list:
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# require dependencies that are not discoverable once GEM_HOME and GEM_PATH
|
||||||
|
# are wiped
|
||||||
|
begin
|
||||||
|
gem 'rake'
|
||||||
|
rescue Gem::LoadError
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'rake/packagetask'
|
||||||
|
|
||||||
|
begin
|
||||||
|
gem 'rdoc'
|
||||||
|
require 'rdoc'
|
||||||
|
rescue LoadError, Gem::LoadError
|
||||||
|
end
|
||||||
|
|
||||||
require 'rubygems/test_utilities'
|
require 'rubygems/test_utilities'
|
||||||
ENV['GEM_HOME'] = Dir.mktmpdir "home"
|
ENV['GEM_HOME'] = Dir.mktmpdir "home"
|
||||||
ENV['GEM_PATH'] = Dir.mktmpdir "path"
|
ENV['GEM_PATH'] = Dir.mktmpdir "path"
|
||||||
|
@ -43,11 +43,9 @@ module Gem::Text
|
|||||||
t = str2
|
t = str2
|
||||||
n = s.length
|
n = s.length
|
||||||
m = t.length
|
m = t.length
|
||||||
max = n/2
|
|
||||||
|
|
||||||
return m if (0 == n)
|
return m if (0 == n)
|
||||||
return n if (0 == m)
|
return n if (0 == m)
|
||||||
return n if (n - m).abs > max
|
|
||||||
|
|
||||||
d = (0..m).to_a
|
d = (0..m).to_a
|
||||||
x = nil
|
x = nil
|
||||||
|
@ -217,6 +217,7 @@ class Gem::Version
|
|||||||
# Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored.
|
# Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored.
|
||||||
|
|
||||||
def bump
|
def bump
|
||||||
|
@bump ||= begin
|
||||||
segments = self.segments.dup
|
segments = self.segments.dup
|
||||||
segments.pop while segments.any? { |s| String === s }
|
segments.pop while segments.any? { |s| String === s }
|
||||||
segments.pop if segments.size > 1
|
segments.pop if segments.size > 1
|
||||||
@ -224,6 +225,7 @@ class Gem::Version
|
|||||||
segments[-1] = segments[-1].succ
|
segments[-1] = segments[-1].succ
|
||||||
self.class.new segments.join(".")
|
self.class.new segments.join(".")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# A Version is only eql? to another version if it's specified to the
|
# A Version is only eql? to another version if it's specified to the
|
||||||
@ -291,11 +293,13 @@ class Gem::Version
|
|||||||
# Non-prerelease versions return themselves.
|
# Non-prerelease versions return themselves.
|
||||||
|
|
||||||
def release
|
def release
|
||||||
return self unless prerelease?
|
@release ||= if prerelease?
|
||||||
|
|
||||||
segments = self.segments.dup
|
segments = self.segments.dup
|
||||||
segments.pop while segments.any? { |s| String === s }
|
segments.pop while segments.any? { |s| String === s }
|
||||||
self.class.new segments.join('.')
|
self.class.new segments.join('.')
|
||||||
|
else
|
||||||
|
self
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def segments # :nodoc:
|
def segments # :nodoc:
|
||||||
|
@ -225,6 +225,28 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|||||||
assert_empty out, out.inspect
|
assert_empty out, out.inspect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_skip
|
||||||
|
a = util_spec 'a'
|
||||||
|
b = util_spec 'b'
|
||||||
|
|
||||||
|
install_gem a
|
||||||
|
install_gem b
|
||||||
|
|
||||||
|
@cmd.options[:args] = %w[a b]
|
||||||
|
@cmd.options[:skip] = 'a'
|
||||||
|
|
||||||
|
use_ui @ui do
|
||||||
|
@cmd.execute
|
||||||
|
end
|
||||||
|
|
||||||
|
out = @ui.output.split "\n"
|
||||||
|
|
||||||
|
assert_equal "Restoring gems to pristine condition...", out.shift
|
||||||
|
assert_equal "Skipped #{a.full_name}, it was given through options", out.shift
|
||||||
|
assert_equal "Restored #{b.full_name}", out.shift
|
||||||
|
assert_empty out, out.inspect
|
||||||
|
end
|
||||||
|
|
||||||
def test_execute_many_multi_repo
|
def test_execute_many_multi_repo
|
||||||
a = util_spec 'a'
|
a = util_spec 'a'
|
||||||
install_gem a
|
install_gem a
|
||||||
|
@ -88,7 +88,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
|
|
||||||
assert_equal %w[a], @gda.requires['a']
|
assert_equal %w[a], @gda.requires['a']
|
||||||
|
|
||||||
expected = { 'a' => nil }
|
expected = { 'a' => Gem::Requirement.default }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -112,7 +112,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
|
|
||||||
assert_equal %w[git/a master], @git_set.repositories['a']
|
assert_equal %w[git/a master], @git_set.repositories['a']
|
||||||
|
|
||||||
expected = { 'a' => '!' }
|
expected = { 'a' => Gem::Requirement.create('!') }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -125,7 +125,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
assert_equal %w[https://example@bitbucket.org/example/repository.git master],
|
assert_equal %w[https://example@bitbucket.org/example/repository.git master],
|
||||||
@git_set.repositories['a']
|
@git_set.repositories['a']
|
||||||
|
|
||||||
expected = { 'a' => '!' }
|
expected = { 'a' => Gem::Requirement.create('!') }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -138,7 +138,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
assert_equal %w[https://example@bitbucket.org/example/example.git master],
|
assert_equal %w[https://example@bitbucket.org/example/example.git master],
|
||||||
@git_set.repositories['a']
|
@git_set.repositories['a']
|
||||||
|
|
||||||
expected = { 'a' => '!' }
|
expected = { 'a' => Gem::Requirement.create('!') }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -193,7 +193,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
assert_equal %w[git://github.com/example/repository.git master],
|
assert_equal %w[git://github.com/example/repository.git master],
|
||||||
@git_set.repositories['a']
|
@git_set.repositories['a']
|
||||||
|
|
||||||
expected = { 'a' => '!' }
|
expected = { 'a' => Gem::Requirement.create('!') }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -206,7 +206,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
assert_equal %w[git://github.com/example/example.git master],
|
assert_equal %w[git://github.com/example/example.git master],
|
||||||
@git_set.repositories['a']
|
@git_set.repositories['a']
|
||||||
|
|
||||||
expected = { 'a' => '!' }
|
expected = { 'a' => Gem::Requirement.create('!') }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -224,7 +224,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
|
|
||||||
assert_empty @set.dependencies
|
assert_empty @set.dependencies
|
||||||
|
|
||||||
expected = { 'a' => nil }
|
expected = { 'a' => Gem::Requirement.default }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -246,7 +246,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
|
|
||||||
assert_equal "#{name}-#{version}", loaded.full_name
|
assert_equal "#{name}-#{version}", loaded.full_name
|
||||||
|
|
||||||
expected = { name => '!' }
|
expected = { name => Gem::Requirement.create('!') }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -405,7 +405,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
|
|
||||||
assert_equal [dep('a', '~> 1.0')], @set.dependencies
|
assert_equal [dep('a', '~> 1.0')], @set.dependencies
|
||||||
|
|
||||||
expected = { 'a' => ['~> 1.0'] }
|
expected = { 'a' => Gem::Requirement.create(['~> 1.0']) }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -415,7 +415,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
|
|
||||||
assert_equal [dep('b', '~> 1.0', '>= 1.0.2')], @set.dependencies
|
assert_equal [dep('b', '~> 1.0', '>= 1.0.2')], @set.dependencies
|
||||||
|
|
||||||
expected = { 'b' => ['~> 1.0', '>= 1.0.2'] }
|
expected = { 'b' => Gem::Requirement.create(['~> 1.0', '>= 1.0.2']) }
|
||||||
|
|
||||||
assert_equal expected, @gda.dependencies
|
assert_equal expected, @gda.dependencies
|
||||||
end
|
end
|
||||||
@ -485,7 +485,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||||||
assert_equal %w[a], @gda.requires['a']
|
assert_equal %w[a], @gda.requires['a']
|
||||||
|
|
||||||
expected = {
|
expected = {
|
||||||
'a' => '!',
|
'a' => Gem::Requirement.create('!'),
|
||||||
'b' => req('= 2'),
|
'b' => req('= 2'),
|
||||||
'c' => req('= 3'),
|
'c' => req('= 3'),
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,10 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|||||||
|
|
||||||
@gem_deps_file = 'gem.deps.rb'
|
@gem_deps_file = 'gem.deps.rb'
|
||||||
|
|
||||||
@lockfile = Gem::RequestSet::Lockfile.new @set, @gem_deps_file
|
end
|
||||||
|
|
||||||
|
def lockfile
|
||||||
|
Gem::RequestSet::Lockfile.build @set, @gem_deps_file
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_lockfile lockfile
|
def write_lockfile lockfile
|
||||||
@ -44,7 +47,7 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|||||||
|
|
||||||
out = []
|
out = []
|
||||||
|
|
||||||
@lockfile.add_DEPENDENCIES out
|
lockfile.add_DEPENDENCIES out
|
||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
'DEPENDENCIES',
|
'DEPENDENCIES',
|
||||||
@ -62,7 +65,7 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
dependencies = { 'a' => '~> 2.0' }
|
dependencies = { 'a' => Gem::Requirement.new('~> 2.0') }
|
||||||
|
|
||||||
@set.gem 'a'
|
@set.gem 'a'
|
||||||
@set.resolve
|
@set.resolve
|
||||||
@ -100,7 +103,7 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|||||||
|
|
||||||
out = []
|
out = []
|
||||||
|
|
||||||
@lockfile.add_GEM out, @lockfile.spec_groups
|
lockfile.add_GEM out, lockfile.spec_groups
|
||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
'GEM',
|
'GEM',
|
||||||
@ -131,7 +134,7 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|||||||
|
|
||||||
out = []
|
out = []
|
||||||
|
|
||||||
@lockfile.add_PLATFORMS out
|
lockfile.add_PLATFORMS out
|
||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
'PLATFORMS',
|
'PLATFORMS',
|
||||||
@ -144,11 +147,11 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_relative_path_from
|
def test_relative_path_from
|
||||||
path = @lockfile.relative_path_from '/foo', '/foo/bar'
|
path = lockfile.relative_path_from '/foo', '/foo/bar'
|
||||||
|
|
||||||
assert_equal File.expand_path('/foo'), path
|
assert_equal File.expand_path('/foo'), path
|
||||||
|
|
||||||
path = @lockfile.relative_path_from '/foo', '/foo'
|
path = lockfile.relative_path_from '/foo', '/foo'
|
||||||
|
|
||||||
assert_equal '.', path
|
assert_equal '.', path
|
||||||
end
|
end
|
||||||
@ -173,7 +176,7 @@ DEPENDENCIES
|
|||||||
a
|
a
|
||||||
LOCKFILE
|
LOCKFILE
|
||||||
|
|
||||||
assert_equal expected, @lockfile.to_s
|
assert_equal expected, lockfile.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_s_gem_dependency
|
def test_to_s_gem_dependency
|
||||||
@ -204,7 +207,7 @@ DEPENDENCIES
|
|||||||
c
|
c
|
||||||
LOCKFILE
|
LOCKFILE
|
||||||
|
|
||||||
assert_equal expected, @lockfile.to_s
|
assert_equal expected, lockfile.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_s_gem_dependency_non_default
|
def test_to_s_gem_dependency_non_default
|
||||||
@ -232,7 +235,7 @@ DEPENDENCIES
|
|||||||
b
|
b
|
||||||
LOCKFILE
|
LOCKFILE
|
||||||
|
|
||||||
assert_equal expected, @lockfile.to_s
|
assert_equal expected, lockfile.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_s_gem_dependency_requirement
|
def test_to_s_gem_dependency_requirement
|
||||||
@ -259,7 +262,7 @@ DEPENDENCIES
|
|||||||
b
|
b
|
||||||
LOCKFILE
|
LOCKFILE
|
||||||
|
|
||||||
assert_equal expected, @lockfile.to_s
|
assert_equal expected, lockfile.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_s_gem_path
|
def test_to_s_gem_path
|
||||||
@ -282,7 +285,7 @@ DEPENDENCIES
|
|||||||
a!
|
a!
|
||||||
LOCKFILE
|
LOCKFILE
|
||||||
|
|
||||||
assert_equal expected, @lockfile.to_s
|
assert_equal expected, lockfile.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_s_gem_path_absolute
|
def test_to_s_gem_path_absolute
|
||||||
@ -305,7 +308,7 @@ DEPENDENCIES
|
|||||||
a!
|
a!
|
||||||
LOCKFILE
|
LOCKFILE
|
||||||
|
|
||||||
assert_equal expected, @lockfile.to_s
|
assert_equal expected, lockfile.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_s_gem_platform
|
def test_to_s_gem_platform
|
||||||
@ -330,7 +333,7 @@ DEPENDENCIES
|
|||||||
a
|
a
|
||||||
LOCKFILE
|
LOCKFILE
|
||||||
|
|
||||||
assert_equal expected, @lockfile.to_s
|
assert_equal expected, lockfile.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_s_gem_source
|
def test_to_s_gem_source
|
||||||
@ -368,7 +371,7 @@ DEPENDENCIES
|
|||||||
b
|
b
|
||||||
LOCKFILE
|
LOCKFILE
|
||||||
|
|
||||||
assert_equal expected, @lockfile.to_s
|
assert_equal expected, lockfile.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_s_git
|
def test_to_s_git
|
||||||
@ -435,11 +438,11 @@ DEPENDENCIES
|
|||||||
c!
|
c!
|
||||||
LOCKFILE
|
LOCKFILE
|
||||||
|
|
||||||
assert_equal expected, @lockfile.to_s
|
assert_equal expected, lockfile.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_write
|
def test_write
|
||||||
@lockfile.write
|
lockfile.write
|
||||||
|
|
||||||
gem_deps_lock_file = "#{@gem_deps_file}.lock"
|
gem_deps_lock_file = "#{@gem_deps_file}.lock"
|
||||||
|
|
||||||
@ -458,7 +461,7 @@ DEPENDENCIES
|
|||||||
end
|
end
|
||||||
|
|
||||||
assert_raises Gem::UnsatisfiableDependencyError do
|
assert_raises Gem::UnsatisfiableDependencyError do
|
||||||
@lockfile.write
|
lockfile.write
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_path_exists gem_deps_lock_file
|
assert_path_exists gem_deps_lock_file
|
||||||
|
@ -2413,8 +2413,6 @@ duplicate dependency on b (>= 1.2.3), (~> 1.2) use:
|
|||||||
@a1.validate
|
@a1.validate
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_match "#{w}: no description specified\n", @ui.error, "error"
|
|
||||||
|
|
||||||
@ui = Gem::MockGemUi.new
|
@ui = Gem::MockGemUi.new
|
||||||
@a1.summary = "this is my summary"
|
@a1.summary = "this is my summary"
|
||||||
@a1.description = @a1.summary
|
@a1.description = @a1.summary
|
||||||
|
@ -64,6 +64,8 @@ Without the wrapping, the text might not look good in the RSS feed.
|
|||||||
def test_levenshtein_distance_remove
|
def test_levenshtein_distance_remove
|
||||||
assert_equal 3, levenshtein_distance("zentest", "zentestxxx")
|
assert_equal 3, levenshtein_distance("zentest", "zentestxxx")
|
||||||
assert_equal 3, levenshtein_distance("zentestxxx", "zentest")
|
assert_equal 3, levenshtein_distance("zentestxxx", "zentest")
|
||||||
|
assert_equal 13, levenshtein_distance("cat", "thundercatsarego")
|
||||||
|
assert_equal 13, levenshtein_distance("thundercatsarego", "cat")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_levenshtein_distance_replace
|
def test_levenshtein_distance_replace
|
||||||
|
Loading…
x
Reference in New Issue
Block a user