зеркало из https://github.com/github/ruby.git
Update Rubygems 2.6.10
*2ee5bf9fd3
*be510dd409
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6219b68fb5
Коммит
5d43821536
|
@ -10,7 +10,7 @@ require 'rbconfig'
|
|||
require 'thread'
|
||||
|
||||
module Gem
|
||||
VERSION = '2.6.8'
|
||||
VERSION = "2.6.10"
|
||||
end
|
||||
|
||||
# Must be first since it unloads the prelude from 1.9.2
|
||||
|
|
|
@ -47,7 +47,7 @@ class Gem::Commands::SetupCommand < Gem::Command
|
|||
end
|
||||
|
||||
add_option '--[no-]document [TYPES]', Array,
|
||||
'Generate documentation for RubyGems.',
|
||||
'Generate documentation for RubyGems',
|
||||
'List the documentation types you wish to',
|
||||
'generate. For example: rdoc,ri' do |value, options|
|
||||
options[:document] = case value
|
||||
|
|
|
@ -44,7 +44,7 @@ module Kernel
|
|||
spec = Gem.find_unresolved_default_spec(path)
|
||||
if spec
|
||||
Gem.remove_unresolved_default_spec(spec)
|
||||
gem(spec.name)
|
||||
Kernel.send(:gem, spec.name)
|
||||
end
|
||||
|
||||
# If there are no unresolved deps, then we can use just try
|
||||
|
|
|
@ -48,9 +48,11 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|||
run cmd, results
|
||||
ensure
|
||||
if File.exist? 'mkmf.log'
|
||||
results << "To see why this extension failed to compile, please check" \
|
||||
" the mkmf.log which can be found here:\n"
|
||||
results << " " + File.join(dest_path, 'mkmf.log') + "\n"
|
||||
unless $?.success? then
|
||||
results << "To see why this extension failed to compile, please check" \
|
||||
" the mkmf.log which can be found here:\n"
|
||||
results << " " + File.join(dest_path, 'mkmf.log') + "\n"
|
||||
end
|
||||
FileUtils.mv 'mkmf.log', dest_path
|
||||
end
|
||||
siteconf.unlink
|
||||
|
|
|
@ -9,7 +9,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
|||
|
||||
def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil)
|
||||
if File.basename(extension) =~ /mkrf_conf/i then
|
||||
cmd = "#{Gem.ruby} #{File.basename extension}"
|
||||
cmd = "#{Gem.ruby} #{File.basename extension}".dup
|
||||
cmd << " #{args.join " "}" unless args.empty?
|
||||
run cmd, results
|
||||
end
|
||||
|
|
|
@ -119,6 +119,7 @@ module Gem::Resolver::Molinillo
|
|||
# {Vertex#successors}
|
||||
def ==(other)
|
||||
return false unless other
|
||||
return true if equal?(other)
|
||||
vertices.each do |name, vertex|
|
||||
other_vertex = other.vertex_named(name)
|
||||
return false unless other_vertex
|
||||
|
@ -134,6 +135,7 @@ module Gem::Resolver::Molinillo
|
|||
def add_child_vertex(name, payload, parent_names, requirement)
|
||||
root = !parent_names.delete(nil) { true }
|
||||
vertex = add_vertex(name, payload, root)
|
||||
vertex.explicit_requirements << requirement if root
|
||||
parent_names.each do |parent_name|
|
||||
parent_node = vertex_named(parent_name)
|
||||
add_edge(parent_node, vertex, requirement)
|
||||
|
@ -152,7 +154,7 @@ module Gem::Resolver::Molinillo
|
|||
# Detaches the {#vertex_named} `name` {Vertex} from the graph, recursively
|
||||
# removing any non-root vertices that were orphaned in the process
|
||||
# @param [String] name
|
||||
# @return [void]
|
||||
# @return [Array<Vertex>] the vertices which have been detached
|
||||
def detach_vertex_named(name)
|
||||
log.detach_vertex_named(self, name)
|
||||
end
|
||||
|
|
|
@ -14,16 +14,23 @@ module Gem::Resolver::Molinillo
|
|||
|
||||
# (see Action#up)
|
||||
def up(graph)
|
||||
return unless @vertex = graph.vertices.delete(name)
|
||||
return [] unless @vertex = graph.vertices.delete(name)
|
||||
|
||||
removed_vertices = [@vertex]
|
||||
@vertex.outgoing_edges.each do |e|
|
||||
v = e.destination
|
||||
v.incoming_edges.delete(e)
|
||||
graph.detach_vertex_named(v.name) unless v.root? || v.predecessors.any?
|
||||
if !v.root? && v.incoming_edges.empty?
|
||||
removed_vertices.concat graph.detach_vertex_named(v.name)
|
||||
end
|
||||
end
|
||||
|
||||
@vertex.incoming_edges.each do |e|
|
||||
v = e.origin
|
||||
v.outgoing_edges.delete(e)
|
||||
end
|
||||
|
||||
removed_vertices
|
||||
end
|
||||
|
||||
# (see Action#down)
|
||||
|
|
|
@ -81,6 +81,7 @@ module Gem::Resolver::Molinillo
|
|||
# @return [Boolean] whether the two vertices are equal, determined
|
||||
# by a recursive traversal of each {Vertex#successors}
|
||||
def ==(other)
|
||||
return true if equal?(other)
|
||||
shallow_eql?(other) &&
|
||||
successors.to_set == other.successors.to_set
|
||||
end
|
||||
|
@ -89,6 +90,7 @@ module Gem::Resolver::Molinillo
|
|||
# @return [Boolean] whether the two vertices are equal, determined
|
||||
# solely by {#name} and {#payload} equality
|
||||
def shallow_eql?(other)
|
||||
return true if equal?(other)
|
||||
other &&
|
||||
name == other.name &&
|
||||
payload == other.payload
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
module Gem::Resolver::Molinillo
|
||||
# The version of Gem::Resolver::Molinillo.
|
||||
VERSION = '0.5.3'.freeze
|
||||
VERSION = '0.5.5'.freeze
|
||||
end
|
||||
|
|
|
@ -194,18 +194,20 @@ module Gem::Resolver::Molinillo
|
|||
def state_index_for_unwind
|
||||
current_requirement = requirement
|
||||
existing_requirement = requirement_for_existing_name(name)
|
||||
until current_requirement.nil?
|
||||
current_state = find_state_for(current_requirement)
|
||||
return states.index(current_state) if state_any?(current_state)
|
||||
current_requirement = parent_of(current_requirement)
|
||||
index = -1
|
||||
[current_requirement, existing_requirement].each do |r|
|
||||
until r.nil?
|
||||
current_state = find_state_for(r)
|
||||
if state_any?(current_state)
|
||||
current_index = states.index(current_state)
|
||||
index = current_index if current_index > index
|
||||
break
|
||||
end
|
||||
r = parent_of(r)
|
||||
end
|
||||
end
|
||||
|
||||
until existing_requirement.nil?
|
||||
existing_state = find_state_for(existing_requirement)
|
||||
return states.index(existing_state) if state_any?(existing_state)
|
||||
existing_requirement = parent_of(existing_requirement)
|
||||
end
|
||||
-1
|
||||
index
|
||||
end
|
||||
|
||||
# @return [Object] the requirement that led to `requirement` being added
|
||||
|
@ -364,19 +366,17 @@ module Gem::Resolver::Molinillo
|
|||
if matching_deps.empty? && !succ.root? && succ.predecessors.to_a == [vertex]
|
||||
debug(depth) { "Removing orphaned spec #{succ.name} after swapping #{name}" }
|
||||
succ.requirements.each { |r| @parent_of.delete(r) }
|
||||
activated.detach_vertex_named(succ.name)
|
||||
|
||||
all_successor_names = succ.recursive_successors.map(&:name)
|
||||
|
||||
requirements.delete_if do |requirement|
|
||||
requirement_name = name_for(requirement)
|
||||
(requirement_name == succ.name) || all_successor_names.include?(requirement_name)
|
||||
removed_names = activated.detach_vertex_named(succ.name).map(&:name)
|
||||
requirements.delete_if do |r|
|
||||
# the only removed vertices are those with no other requirements,
|
||||
# so it's safe to delete only based upon name here
|
||||
removed_names.include?(name_for(r))
|
||||
end
|
||||
elsif !matching_deps.include?(outgoing_edge.requirement)
|
||||
activated.delete_edge(outgoing_edge)
|
||||
requirements.delete(outgoing_edge.requirement)
|
||||
end
|
||||
matching_deps.delete(outgoing_edge.requirement)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
require 'webrick'
|
||||
require 'zlib'
|
||||
require 'erb'
|
||||
require 'uri'
|
||||
|
||||
require 'rubygems'
|
||||
require 'rubygems/rdoc'
|
||||
|
@ -68,7 +69,7 @@ class Gem::Server
|
|||
<h1>Summary</h1>
|
||||
<p>There are <%=values["gem_count"]%> gems installed:</p>
|
||||
<p>
|
||||
<%= values["specs"].map { |v| "<a href\"##{u v["name"]}\">#{h v["name"]}</a>" }.join ', ' %>.
|
||||
<%= values["specs"].map { |v| "<a href=\"##{u v["name"]}\">#{h v["name"]}</a>" }.join ', ' %>.
|
||||
<h1>Gems</h1>
|
||||
|
||||
<dl>
|
||||
|
@ -81,20 +82,20 @@ class Gem::Server
|
|||
<b><%=h spec["name"]%> <%=h spec["version"]%></b>
|
||||
|
||||
<% if spec["ri_installed"] || spec["rdoc_installed"] then %>
|
||||
<a href="<%=u spec["doc_path"]%>">[rdoc]</a>
|
||||
<a href="<%=spec["doc_path"]%>">[rdoc]</a>
|
||||
<% else %>
|
||||
<span title="rdoc not installed">[rdoc]</span>
|
||||
<% end %>
|
||||
|
||||
<% if spec["homepage"] then %>
|
||||
<a href="<%=u spec["homepage"]%>" title="<%=h spec["homepage"]%>">[www]</a>
|
||||
<a href="<%=uri_encode spec["homepage"]%>" title="<%=h spec["homepage"]%>">[www]</a>
|
||||
<% else %>
|
||||
<span title="no homepage available">[www]</span>
|
||||
<% end %>
|
||||
|
||||
<% if spec["has_deps"] then %>
|
||||
- depends on
|
||||
<%= spec["dependencies"].map { |v| "<a href=\"##{u v["name"]}>#{h v["name"]}</a>" }.join ', ' %>.
|
||||
<%= spec["dependencies"].map { |v| "<a href=\"##{u v["name"]}\">#{h v["name"]}</a>" }.join ', ' %>.
|
||||
<% end %>
|
||||
</dt>
|
||||
<dd>
|
||||
|
@ -455,6 +456,12 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|||
end.max
|
||||
end
|
||||
|
||||
def uri_encode(str)
|
||||
str.gsub(URI::UNSAFE) do |match|
|
||||
match.each_byte.map { |c| sprintf('%%%02X', c.ord) }.join
|
||||
end
|
||||
end
|
||||
|
||||
def doc_root gem_name
|
||||
if have_rdoc_4_plus? then
|
||||
"/doc_root/#{u gem_name}/"
|
||||
|
|
|
@ -39,7 +39,12 @@ class Gem::StubSpecification < Gem::BasicSpecification
|
|||
def initialize data, extensions
|
||||
parts = data[PREFIX.length..-1].split(" ".freeze, 4)
|
||||
@name = parts[0].freeze
|
||||
@version = Gem::Version.new parts[1]
|
||||
@version = if Gem::Version.correct?(parts[1])
|
||||
Gem::Version.new(parts[1])
|
||||
else
|
||||
Gem::Version.new(0)
|
||||
end
|
||||
|
||||
@platform = Gem::Platform.new parts[2]
|
||||
@extensions = extensions
|
||||
@full_name = if platform == Gem::Platform::RUBY
|
||||
|
|
|
@ -204,8 +204,12 @@ class Gem::Version
|
|||
# series of digits or ASCII letters separated by dots.
|
||||
|
||||
def initialize version
|
||||
raise ArgumentError, "Malformed version number string #{version}" unless
|
||||
self.class.correct?(version)
|
||||
unless self.class.correct?(version)
|
||||
raise ArgumentError, "Malformed version number string #{version}"
|
||||
end
|
||||
|
||||
# If version is an empty string convert it to 0
|
||||
version = 0 if version =~ /\A\s*\Z/
|
||||
|
||||
@version = version.to_s.strip.gsub("-",".pre.")
|
||||
@segments = nil
|
||||
|
|
|
@ -1451,6 +1451,7 @@ class TestGem < Gem::TestCase
|
|||
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
||||
|
||||
out = `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
|
||||
out.sub!(/, "openssl-#{Gem::Version::VERSION_PATTERN}"/, "")
|
||||
|
||||
assert_equal '["a-1", "b-1", "c-1"]', out.strip
|
||||
end
|
||||
|
@ -1484,6 +1485,7 @@ class TestGem < Gem::TestCase
|
|||
out = Dir.chdir "sub1" do
|
||||
`#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
|
||||
end
|
||||
out.sub!(/, "openssl-#{Gem::Version::VERSION_PATTERN}"/, "")
|
||||
|
||||
Dir.rmdir "sub1"
|
||||
|
||||
|
|
|
@ -111,6 +111,29 @@ class TestGemExtExtConfBuilder < Gem::TestCase
|
|||
|
||||
assert_match(/^#{Gem.ruby}.* extconf.rb/, output[1])
|
||||
assert_match(File.join(@dest_path, 'mkmf.log'), output[4])
|
||||
assert_includes(output, "To see why this extension failed to compile, please check the mkmf.log which can be found here:\n")
|
||||
|
||||
assert_path_exists File.join @dest_path, 'mkmf.log'
|
||||
end
|
||||
|
||||
def test_class_build_extconf_success_without_warning
|
||||
if vc_windows? && !nmake_found?
|
||||
skip("test_class_build_extconf_fail skipped - nmake not found")
|
||||
end
|
||||
|
||||
File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
|
||||
extconf.puts "require 'mkmf'"
|
||||
extconf.puts "File.open('mkmf.log', 'w'){|f| f.write('a')}"
|
||||
extconf.puts "create_makefile 'foo'"
|
||||
end
|
||||
|
||||
output = []
|
||||
|
||||
Dir.chdir @ext do
|
||||
Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
|
||||
end
|
||||
|
||||
refute_includes(output, "To see why this extension failed to compile, please check the mkmf.log which can be found here:\n")
|
||||
|
||||
assert_path_exists File.join @dest_path, 'mkmf.log'
|
||||
end
|
||||
|
|
|
@ -14,14 +14,7 @@ class TestGemExtRakeBuilder < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_class_build
|
||||
File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
|
||||
mkrf_conf.puts <<-EO_MKRF
|
||||
File.open("Rakefile","w") do |f|
|
||||
f.puts "task :default"
|
||||
end
|
||||
EO_MKRF
|
||||
end
|
||||
|
||||
create_temp_mkrf_file('task :default')
|
||||
output = []
|
||||
realdir = nil # HACK /tmp vs. /private/tmp
|
||||
|
||||
|
@ -39,15 +32,31 @@ class TestGemExtRakeBuilder < Gem::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_class_build_fail
|
||||
File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
|
||||
mkrf_conf.puts <<-EO_MKRF
|
||||
File.open("Rakefile","w") do |f|
|
||||
f.puts "task :default do abort 'fail' end"
|
||||
end
|
||||
EO_MKRF
|
||||
end
|
||||
# https://github.com/rubygems/rubygems/pull/1819
|
||||
#
|
||||
# It should not fail with a non-empty args list either
|
||||
def test_class_build_with_args
|
||||
create_temp_mkrf_file('task :default')
|
||||
output = []
|
||||
realdir = nil # HACK /tmp vs. /private/tmp
|
||||
|
||||
build_rake_in do |rake|
|
||||
Dir.chdir @ext do
|
||||
realdir = Dir.pwd
|
||||
non_empty_args_list = ['']
|
||||
Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', nil, @dest_path, output, non_empty_args_list
|
||||
end
|
||||
|
||||
output = output.join "\n"
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
def test_class_build_fail
|
||||
create_temp_mkrf_file("task :default do abort 'fail' end")
|
||||
output = []
|
||||
|
||||
build_rake_in(false) do |rake|
|
||||
|
@ -60,6 +69,14 @@ class TestGemExtRakeBuilder < Gem::TestCase
|
|||
assert_match %r%^rake failed%, error.message
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def create_temp_mkrf_file(rakefile_content)
|
||||
File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
|
||||
mkrf_conf.puts <<-EO_MKRF
|
||||
File.open("Rakefile","w") do |f|
|
||||
f.puts "#{rakefile_content}"
|
||||
end
|
||||
EO_MKRF
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|||
fetcher = Gem::RemoteFetcher.new nil
|
||||
@fetcher = fetcher
|
||||
def fetcher.request(uri, request_class, last_modified = nil)
|
||||
raise SocketError, "tarded"
|
||||
raise SocketError, "oops"
|
||||
end
|
||||
|
||||
uri = 'http://gems.example.com/yaml'
|
||||
|
@ -171,7 +171,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|||
fetcher.fetch_size uri
|
||||
end
|
||||
|
||||
assert_equal "SocketError: tarded (#{uri})", e.message
|
||||
assert_equal "SocketError: oops (#{uri})", e.message
|
||||
end
|
||||
|
||||
def test_no_proxy
|
||||
|
|
|
@ -392,6 +392,22 @@ class TestGemServer < Gem::TestCase
|
|||
Marshal.load(Gem.gunzip(@res.body))
|
||||
end
|
||||
|
||||
def test_uri_encode
|
||||
url_safe = @server.uri_encode 'http://rubyonrails.org/">malicious_content</a>'
|
||||
assert_equal url_safe, 'http://rubyonrails.org/%22%3Emalicious_content%3C/a%3E'
|
||||
end
|
||||
|
||||
# Regression test for issue #1793: incorrect URL encoding.
|
||||
# Checking that no URLs have had '://' incorrectly encoded
|
||||
def test_regression_1793
|
||||
data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
|
||||
@req.parse data
|
||||
|
||||
@server.root @req, @res
|
||||
|
||||
refute_match %r|%3A%2F%2F|, @res.body
|
||||
end
|
||||
|
||||
def util_listen
|
||||
webrick = Object.new
|
||||
webrick.instance_variable_set :@listeners, []
|
||||
|
|
|
@ -1260,7 +1260,7 @@ dependencies: []
|
|||
s.version = '1'
|
||||
end
|
||||
|
||||
spec.instance_variable_set :@licenses, Object.new.singleton_class
|
||||
spec.instance_variable_set :@licenses, (class << (Object.new);self;end)
|
||||
spec.loaded_from = '/path/to/file'
|
||||
|
||||
e = assert_raises Gem::FormatException do
|
||||
|
|
|
@ -33,6 +33,20 @@ class TestStubSpecification < Gem::TestCase
|
|||
assert_equal %w[ext/stub_e/extconf.rb], stub.extensions
|
||||
end
|
||||
|
||||
def test_initialize_version
|
||||
stub = stub_with_version
|
||||
|
||||
assert_equal 'stub_v', stub.name
|
||||
assert_equal v(2), stub.version
|
||||
end
|
||||
|
||||
def test_initialize_with_empty_version
|
||||
stub = stub_without_version
|
||||
|
||||
assert_equal 'stub_v', stub.name
|
||||
assert_equal v(0), stub.version
|
||||
end
|
||||
|
||||
def test_initialize_missing_stubline
|
||||
stub = Gem::StubSpecification.gemspec_stub(BAR, @base_dir, @gems_dir)
|
||||
assert_equal "bar", stub.name
|
||||
|
@ -164,6 +178,53 @@ class TestStubSpecification < Gem::TestCase
|
|||
assert stub.to_spec.instance_variable_get :@ignored
|
||||
end
|
||||
|
||||
def stub_with_version
|
||||
spec = File.join @gemhome, 'specifications', 'stub_e-2.gemspec'
|
||||
open spec, 'w' do |io|
|
||||
io.write <<-STUB
|
||||
# -*- encoding: utf-8 -*-
|
||||
# stub: stub_v 2 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'stub_v'
|
||||
s.version = Gem::Version.new '2'
|
||||
end
|
||||
STUB
|
||||
|
||||
io.flush
|
||||
|
||||
stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, 'gems')
|
||||
|
||||
yield stub if block_given?
|
||||
|
||||
return stub
|
||||
end
|
||||
end
|
||||
|
||||
def stub_without_version
|
||||
spec = File.join @gemhome, 'specifications', 'stub-2.gemspec'
|
||||
open spec, 'w' do |io|
|
||||
io.write <<-STUB
|
||||
# -*- encoding: utf-8 -*-
|
||||
# stub: stub_v ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'stub_v'
|
||||
s.version = ""
|
||||
end
|
||||
STUB
|
||||
|
||||
io.flush
|
||||
|
||||
stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, 'gems')
|
||||
|
||||
yield stub if block_given?
|
||||
|
||||
return stub
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def stub_with_extension
|
||||
spec = File.join @gemhome, 'specifications', 'stub_e-2.gemspec'
|
||||
open spec, 'w' do |io|
|
||||
|
|
|
@ -91,6 +91,12 @@ class TestGemVersion < Gem::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_empty_version
|
||||
["", " ", " "].each do |empty|
|
||||
assert_equal "0", Gem::Version.new(empty).version
|
||||
end
|
||||
end
|
||||
|
||||
def test_prerelease
|
||||
assert_prerelease "1.2.0.a"
|
||||
assert_prerelease "2.9.b"
|
||||
|
|
|
@ -341,6 +341,31 @@ class TestGemRequire < Gem::TestCase
|
|||
Kernel::RUBYGEMS_ACTIVATION_MONITOR.exit
|
||||
end
|
||||
|
||||
def test_require_when_gem_defined
|
||||
default_gem_spec = new_default_spec("default", "2.0.0.0",
|
||||
nil, "default/gem.rb")
|
||||
install_default_specs(default_gem_spec)
|
||||
c = Class.new do
|
||||
def self.gem(*args)
|
||||
raise "received #gem with #{args.inspect}"
|
||||
end
|
||||
end
|
||||
assert c.send(:require, "default/gem")
|
||||
assert_equal %w(default-2.0.0.0), loaded_spec_names
|
||||
end
|
||||
|
||||
def test_require_default_when_gem_defined
|
||||
a = new_spec("a", "1", nil, "lib/a.rb")
|
||||
install_specs a
|
||||
c = Class.new do
|
||||
def self.gem(*args)
|
||||
raise "received #gem with #{args.inspect}"
|
||||
end
|
||||
end
|
||||
assert c.send(:require, "a")
|
||||
assert_equal %w(a-1), loaded_spec_names
|
||||
end
|
||||
|
||||
def silence_warnings
|
||||
old_verbose, $VERBOSE = $VERBOSE, false
|
||||
yield
|
||||
|
|
Загрузка…
Ссылка в новой задаче