mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Import rubygems 1.6.2 (release candidate @ 2026fbb5)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
08c07a215d
commit
6e5f49770c
24 changed files with 196 additions and 64 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Mar 10 07:12:03 2011 Ryan Davis <ryand-ruby@zenspider.com>
|
||||||
|
|
||||||
|
* lib/rubygems*: Import rubygems 1.6.2 (release candidate @ 2026fbb5)
|
||||||
|
* test/rubygems: Ditto
|
||||||
|
* test/runner.rb: Added test to load path to fix test requires.
|
||||||
|
|
||||||
Thu Mar 10 03:00:43 2011 Tanaka Akira <akr@fsij.org>
|
Thu Mar 10 03:00:43 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/openssl/ossl_ssl.c: parenthesize macro arguments.
|
* ext/openssl/ossl_ssl.c: parenthesize macro arguments.
|
||||||
|
|
|
@ -124,7 +124,7 @@ require 'rbconfig'
|
||||||
# -The RubyGems Team
|
# -The RubyGems Team
|
||||||
|
|
||||||
module Gem
|
module Gem
|
||||||
VERSION = '1.6.0'
|
VERSION = '1.6.2'
|
||||||
|
|
||||||
##
|
##
|
||||||
# Raised when RubyGems is unable to load or activate a gem. Contains the
|
# Raised when RubyGems is unable to load or activate a gem. Contains the
|
||||||
|
@ -258,6 +258,7 @@ module Gem
|
||||||
# list of candidate gems, then we have a version conflict.
|
# list of candidate gems, then we have a version conflict.
|
||||||
existing_spec = @loaded_specs[dep.name]
|
existing_spec = @loaded_specs[dep.name]
|
||||||
|
|
||||||
|
# TODO: unless dep.matches_spec? existing_spec then
|
||||||
unless matches.any? { |spec| spec.version == existing_spec.version } then
|
unless matches.any? { |spec| spec.version == existing_spec.version } then
|
||||||
sources_message = sources.map { |spec| spec.full_name }
|
sources_message = sources.map { |spec| spec.full_name }
|
||||||
stack_message = @loaded_stacks[dep.name].map { |spec| spec.full_name }
|
stack_message = @loaded_stacks[dep.name].map { |spec| spec.full_name }
|
||||||
|
@ -1221,7 +1222,7 @@ module Gem
|
||||||
def self.cache # :nodoc:
|
def self.cache # :nodoc:
|
||||||
warn "#{Gem.location_of_caller.join ':'}:Warning: " \
|
warn "#{Gem.location_of_caller.join ':'}:Warning: " \
|
||||||
"Gem::cache is deprecated and will be removed on or after " \
|
"Gem::cache is deprecated and will be removed on or after " \
|
||||||
"August 2012. " \
|
"August 2011. " \
|
||||||
"Use Gem::source_index."
|
"Use Gem::source_index."
|
||||||
|
|
||||||
source_index
|
source_index
|
||||||
|
@ -1292,7 +1293,13 @@ end
|
||||||
# "#{ConfigMap[:datadir]}/#{package_name}".
|
# "#{ConfigMap[:datadir]}/#{package_name}".
|
||||||
|
|
||||||
def RbConfig.datadir(package_name)
|
def RbConfig.datadir(package_name)
|
||||||
require 'rbconfig/datadir' # TODO Deprecate after June 2010.
|
warn "#{Gem.location_of_caller.join ':'}:Warning: " \
|
||||||
|
"RbConfig.datadir is deprecated and will be removed on or after " \
|
||||||
|
"August 2011. " \
|
||||||
|
"Use Gem::datadir."
|
||||||
|
|
||||||
|
require 'rbconfig/datadir'
|
||||||
|
|
||||||
Gem.datadir(package_name) ||
|
Gem.datadir(package_name) ||
|
||||||
File.join(Gem::ConfigMap[:datadir], package_name)
|
File.join(Gem::ConfigMap[:datadir], package_name)
|
||||||
end
|
end
|
||||||
|
@ -1323,7 +1330,7 @@ end
|
||||||
##
|
##
|
||||||
# Enables the require hook for RubyGems.
|
# Enables the require hook for RubyGems.
|
||||||
|
|
||||||
require 'rubygems/custom_require' unless Gem::GEM_PRELUDE_SUCKAGE
|
require 'rubygems/custom_require'
|
||||||
|
|
||||||
Gem.clear_paths
|
Gem.clear_paths
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,12 @@ class Gem::Commands::OutdatedCommand < Gem::Command
|
||||||
|
|
||||||
locals.outdated.sort.each do |name|
|
locals.outdated.sort.each do |name|
|
||||||
local = locals.find_name(name).last
|
local = locals.find_name(name).last
|
||||||
|
|
||||||
dep = Gem::Dependency.new local.name, ">= #{local.version}"
|
dep = Gem::Dependency.new local.name, ">= #{local.version}"
|
||||||
remotes = Gem::SpecFetcher.fetcher.fetch dep
|
remotes = Gem::SpecFetcher.fetcher.fetch dep
|
||||||
remote = remotes.last.first
|
|
||||||
|
|
||||||
|
next if remotes.empty?
|
||||||
|
|
||||||
|
remote = remotes.last.first
|
||||||
say "#{local.name} (#{local.version} < #{remote.version})"
|
say "#{local.name} (#{local.version} < #{remote.version})"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -335,7 +335,7 @@ abort "#{deprecation_message}"
|
||||||
|
|
||||||
require 'rdoc/rdoc'
|
require 'rdoc/rdoc'
|
||||||
|
|
||||||
args << '--main' << 'README.rdoc'
|
args << '--main' << 'README.rdoc' << '--quiet'
|
||||||
args << '.'
|
args << '.'
|
||||||
args << 'README.rdoc' << 'UPGRADING.rdoc'
|
args << 'README.rdoc' << 'UPGRADING.rdoc'
|
||||||
args << 'LICENSE.txt' << 'GPL.txt' << 'History.txt'
|
args << 'LICENSE.txt' << 'GPL.txt' << 'History.txt'
|
||||||
|
|
|
@ -12,10 +12,16 @@
|
||||||
|
|
||||||
module Kernel
|
module Kernel
|
||||||
|
|
||||||
|
if defined?(gem_original_require) then
|
||||||
|
# Ruby ships with a custom_require, override its require
|
||||||
|
remove_method :require
|
||||||
|
else
|
||||||
##
|
##
|
||||||
# The Kernel#require from before RubyGems was loaded.
|
# The Kernel#require from before RubyGems was loaded.
|
||||||
|
|
||||||
alias gem_original_require require
|
alias gem_original_require require
|
||||||
|
private :gem_original_require
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# When RubyGems is required, Kernel#require is replaced with our own which
|
# When RubyGems is required, Kernel#require is replaced with our own which
|
||||||
|
@ -35,15 +41,20 @@ module Kernel
|
||||||
if Gem.unresolved_deps.empty? or Gem.loaded_path? path then
|
if Gem.unresolved_deps.empty? or Gem.loaded_path? path then
|
||||||
gem_original_require path
|
gem_original_require path
|
||||||
else
|
else
|
||||||
specs = Gem.searcher.find_in_unresolved path
|
spec = Gem.searcher.find_active path
|
||||||
unless specs.empty? then
|
|
||||||
specs = [specs.last]
|
unless spec then
|
||||||
|
found_specs = Gem.searcher.find_in_unresolved path
|
||||||
|
unless found_specs.empty? then
|
||||||
|
found_specs = [found_specs.last]
|
||||||
else
|
else
|
||||||
specs = Gem.searcher.find_in_unresolved_tree path
|
found_specs = Gem.searcher.find_in_unresolved_tree path
|
||||||
end
|
end
|
||||||
|
|
||||||
specs.each do |spec|
|
found_specs.each do |found_spec|
|
||||||
Gem.activate spec.name, spec.version # FIX: this is dumb
|
# FIX: this is dumb, activate a spec instead of name/version
|
||||||
|
Gem.activate found_spec.name, found_spec.version
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return gem_original_require path
|
return gem_original_require path
|
||||||
|
@ -57,7 +68,6 @@ module Kernel
|
||||||
end
|
end
|
||||||
|
|
||||||
private :require
|
private :require
|
||||||
private :gem_original_require
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Gem::DependencyInstaller
|
||||||
@installed_gems = []
|
@installed_gems = []
|
||||||
|
|
||||||
@install_dir = options[:install_dir] || Gem.dir
|
@install_dir = options[:install_dir] || Gem.dir
|
||||||
@cache_dir = options[:cache_dir] || Gem.cache_dir(@install_dir)
|
@cache_dir = options[:cache_dir] || @install_dir
|
||||||
|
|
||||||
# Set with any errors that SpecFetcher finds while search through
|
# Set with any errors that SpecFetcher finds while search through
|
||||||
# gemspecs for a dep
|
# gemspecs for a dep
|
||||||
|
|
|
@ -121,7 +121,7 @@ class Gem::DependencyList
|
||||||
def why_not_ok? quick = false
|
def why_not_ok? quick = false
|
||||||
unsatisfied = Hash.new { |h,k| h[k] = [] }
|
unsatisfied = Hash.new { |h,k| h[k] = [] }
|
||||||
source_index = Gem.source_index
|
source_index = Gem.source_index
|
||||||
@specs.each do |spec|
|
each do |spec|
|
||||||
spec.runtime_dependencies.each do |dep|
|
spec.runtime_dependencies.each do |dep|
|
||||||
inst = source_index.any? { |_, installed_spec|
|
inst = source_index.any? { |_, installed_spec|
|
||||||
dep.name == installed_spec.name and
|
dep.name == installed_spec.name and
|
||||||
|
|
|
@ -171,6 +171,7 @@ class Gem::DocManager
|
||||||
args << @spec.require_paths.clone
|
args << @spec.require_paths.clone
|
||||||
args << @spec.extra_rdoc_files
|
args << @spec.extra_rdoc_files
|
||||||
args << '--title' << "#{@spec.full_name} Documentation"
|
args << '--title' << "#{@spec.full_name} Documentation"
|
||||||
|
args << '--quiet'
|
||||||
args = args.flatten.map do |arg| arg.to_s end
|
args = args.flatten.map do |arg| arg.to_s end
|
||||||
|
|
||||||
if self.class.rdoc_version >= Gem::Version.new('2.4.0') then
|
if self.class.rdoc_version >= Gem::Version.new('2.4.0') then
|
||||||
|
|
|
@ -56,6 +56,14 @@ class Gem::GemPathSearcher
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_active(glob)
|
||||||
|
# HACK violation of encapsulation
|
||||||
|
@gemspecs.find do |spec|
|
||||||
|
# TODO: inverted responsibility
|
||||||
|
spec.loaded? and matching_file? spec, glob
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Works like #find, but finds all gemspecs matching +glob+.
|
# Works like #find, but finds all gemspecs matching +glob+.
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,9 @@ module Gem::GemcutterUtilities
|
||||||
# Add the --key option
|
# Add the --key option
|
||||||
|
|
||||||
def add_key_option
|
def add_key_option
|
||||||
add_option '-k', '--key KEYNAME', Symbol, 'Use the given API key' do |value,options|
|
add_option('-k', '--key KEYNAME', Symbol,
|
||||||
|
'Use the given API key',
|
||||||
|
'from ~/.gem/credentials') do |value,options|
|
||||||
options[:key] = value
|
options[:key] = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'rubygems/format'
|
require 'rubygems/format'
|
||||||
|
require 'time'
|
||||||
|
|
||||||
begin
|
begin
|
||||||
gem 'builder'
|
gem 'builder'
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Gem::MockGemUi < Gem::StreamUI
|
||||||
outs.extend TTY
|
outs.extend TTY
|
||||||
errs.extend TTY
|
errs.extend TTY
|
||||||
|
|
||||||
super ins, outs, errs
|
super ins, outs, errs, true
|
||||||
|
|
||||||
@terminated = false
|
@terminated = false
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,7 +76,8 @@ class Gem::SpecFetcher
|
||||||
# Returns the local directory to write +uri+ to.
|
# Returns the local directory to write +uri+ to.
|
||||||
|
|
||||||
def cache_dir(uri)
|
def cache_dir(uri)
|
||||||
escaped_path = uri.path.sub(%r[^/([a-z]):/]i, '/\\1-/') # Correct for windows paths
|
# Correct for windows paths
|
||||||
|
escaped_path = uri.path.sub(/^\/([a-z]):\//i, '/\\1-/')
|
||||||
File.join @dir, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
|
File.join @dir, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -86,8 +87,14 @@ class Gem::SpecFetcher
|
||||||
# false, all platforms are returned. If +prerelease+ is true,
|
# false, all platforms are returned. If +prerelease+ is true,
|
||||||
# prerelease versions are included.
|
# prerelease versions are included.
|
||||||
|
|
||||||
def fetch_with_errors(dependency, all = false, matching_platform = true, prerelease = false)
|
def fetch_with_errors(dependency,
|
||||||
specs_and_sources, errors = find_matching_with_errors dependency, all, matching_platform, prerelease
|
all = false,
|
||||||
|
matching_platform = true,
|
||||||
|
prerelease = false)
|
||||||
|
specs_and_sources, errors = find_matching_with_errors(dependency,
|
||||||
|
all,
|
||||||
|
matching_platform,
|
||||||
|
prerelease)
|
||||||
|
|
||||||
ss = specs_and_sources.map do |spec_tuple, source_uri|
|
ss = specs_and_sources.map do |spec_tuple, source_uri|
|
||||||
[fetch_spec(spec_tuple, URI.parse(source_uri)), source_uri]
|
[fetch_spec(spec_tuple, URI.parse(source_uri)), source_uri]
|
||||||
|
|
|
@ -463,7 +463,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
||||||
util_build_gem spec
|
util_build_gem spec
|
||||||
|
|
||||||
cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
|
cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
|
||||||
gems_dir = File.dirname cache_file
|
|
||||||
FileUtils.mkdir_p File.dirname cache_file
|
FileUtils.mkdir_p File.dirname cache_file
|
||||||
FileUtils.mv Gem.cache_gem("#{spec.original_name}.gem"), cache_file
|
FileUtils.mv Gem.cache_gem("#{spec.original_name}.gem"), cache_file
|
||||||
FileUtils.rm File.join(@gemhome, 'specifications', spec.spec_name)
|
FileUtils.rm File.join(@gemhome, 'specifications', spec.spec_name)
|
||||||
|
|
|
@ -138,10 +138,19 @@ class Gem::StreamUI
|
||||||
|
|
||||||
attr_reader :ins, :outs, :errs
|
attr_reader :ins, :outs, :errs
|
||||||
|
|
||||||
def initialize(in_stream, out_stream, err_stream=STDERR)
|
def initialize(in_stream, out_stream, err_stream=STDERR, usetty=true)
|
||||||
@ins = in_stream
|
@ins = in_stream
|
||||||
@outs = out_stream
|
@outs = out_stream
|
||||||
@errs = err_stream
|
@errs = err_stream
|
||||||
|
@usetty = usetty
|
||||||
|
end
|
||||||
|
|
||||||
|
def tty?
|
||||||
|
if RUBY_PLATFORM =~ /mingw|mswin/
|
||||||
|
@usetty
|
||||||
|
else
|
||||||
|
@usetty && @ins.tty?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -173,7 +182,7 @@ class Gem::StreamUI
|
||||||
# default.
|
# default.
|
||||||
|
|
||||||
def ask_yes_no(question, default=nil)
|
def ask_yes_no(question, default=nil)
|
||||||
unless @ins.tty? then
|
unless tty? then
|
||||||
if default.nil? then
|
if default.nil? then
|
||||||
raise Gem::OperationNotSupportedError,
|
raise Gem::OperationNotSupportedError,
|
||||||
"Not connected to a tty and no default specified"
|
"Not connected to a tty and no default specified"
|
||||||
|
@ -209,7 +218,7 @@ class Gem::StreamUI
|
||||||
# Ask a question. Returns an answer if connected to a tty, nil otherwise.
|
# Ask a question. Returns an answer if connected to a tty, nil otherwise.
|
||||||
|
|
||||||
def ask(question)
|
def ask(question)
|
||||||
return nil if not @ins.tty?
|
return nil if not tty?
|
||||||
|
|
||||||
@outs.print(question + " ")
|
@outs.print(question + " ")
|
||||||
@outs.flush
|
@outs.flush
|
||||||
|
@ -224,7 +233,7 @@ class Gem::StreamUI
|
||||||
# Ask for a password. Does not echo response to terminal.
|
# Ask for a password. Does not echo response to terminal.
|
||||||
|
|
||||||
def ask_for_password(question)
|
def ask_for_password(question)
|
||||||
return nil if not @ins.tty?
|
return nil if not tty?
|
||||||
|
|
||||||
require 'io/console'
|
require 'io/console'
|
||||||
|
|
||||||
|
@ -240,7 +249,7 @@ class Gem::StreamUI
|
||||||
# Ask for a password. Does not echo response to terminal.
|
# Ask for a password. Does not echo response to terminal.
|
||||||
|
|
||||||
def ask_for_password(question)
|
def ask_for_password(question)
|
||||||
return nil if not @ins.tty?
|
return nil if not tty?
|
||||||
|
|
||||||
@outs.print(question + " ")
|
@outs.print(question + " ")
|
||||||
@outs.flush
|
@outs.flush
|
||||||
|
@ -252,6 +261,8 @@ class Gem::StreamUI
|
||||||
# Asks for a password that works on windows. Ripped from the Heroku gem.
|
# Asks for a password that works on windows. Ripped from the Heroku gem.
|
||||||
|
|
||||||
def ask_for_password_on_windows
|
def ask_for_password_on_windows
|
||||||
|
return nil if not tty?
|
||||||
|
|
||||||
require "Win32API"
|
require "Win32API"
|
||||||
char = nil
|
char = nil
|
||||||
password = ''
|
password = ''
|
||||||
|
@ -273,6 +284,8 @@ class Gem::StreamUI
|
||||||
# Asks for a password that works on unix
|
# Asks for a password that works on unix
|
||||||
|
|
||||||
def ask_for_password_on_unix
|
def ask_for_password_on_unix
|
||||||
|
return nil if not tty?
|
||||||
|
|
||||||
system "stty -echo"
|
system "stty -echo"
|
||||||
password = @ins.gets
|
password = @ins.gets
|
||||||
password.chomp! if password
|
password.chomp! if password
|
||||||
|
@ -333,6 +346,10 @@ class Gem::StreamUI
|
||||||
# Return a progress reporter object chosen from the current verbosity.
|
# Return a progress reporter object chosen from the current verbosity.
|
||||||
|
|
||||||
def progress_reporter(*args)
|
def progress_reporter(*args)
|
||||||
|
if self.kind_of?(Gem::SilentUI)
|
||||||
|
return SilentProgressReporter.new(@outs, *args)
|
||||||
|
end
|
||||||
|
|
||||||
case Gem.configuration.verbose
|
case Gem.configuration.verbose
|
||||||
when nil, false
|
when nil, false
|
||||||
SilentProgressReporter.new(@outs, *args)
|
SilentProgressReporter.new(@outs, *args)
|
||||||
|
@ -435,6 +452,10 @@ class Gem::StreamUI
|
||||||
# Return a download reporter object chosen from the current verbosity
|
# Return a download reporter object chosen from the current verbosity
|
||||||
|
|
||||||
def download_reporter(*args)
|
def download_reporter(*args)
|
||||||
|
if self.kind_of?(Gem::SilentUI)
|
||||||
|
return SilentDownloadReporter.new(@outs, *args)
|
||||||
|
end
|
||||||
|
|
||||||
case Gem.configuration.verbose
|
case Gem.configuration.verbose
|
||||||
when nil, false
|
when nil, false
|
||||||
SilentDownloadReporter.new(@outs, *args)
|
SilentDownloadReporter.new(@outs, *args)
|
||||||
|
@ -518,7 +539,7 @@ end
|
||||||
|
|
||||||
class Gem::ConsoleUI < Gem::StreamUI
|
class Gem::ConsoleUI < Gem::StreamUI
|
||||||
def initialize
|
def initialize
|
||||||
super STDIN, STDOUT, STDERR
|
super STDIN, STDOUT, STDERR, true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -537,7 +558,7 @@ class Gem::SilentUI < Gem::StreamUI
|
||||||
writer = File.open('nul', 'w')
|
writer = File.open('nul', 'w')
|
||||||
end
|
end
|
||||||
|
|
||||||
super reader, writer, writer
|
super reader, writer, writer, false
|
||||||
end
|
end
|
||||||
|
|
||||||
def download_reporter(*args)
|
def download_reporter(*args)
|
||||||
|
|
|
@ -58,9 +58,9 @@ class TestGem < Gem::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_self_activate_via_require
|
def test_self_activate_via_require
|
||||||
a1 = new_spec "a", "1", "b" => "= 1"
|
new_spec "a", "1", "b" => "= 1"
|
||||||
b1 = new_spec "b", "1", nil, "lib/b/c.rb"
|
new_spec "b", "1", nil, "lib/b/c.rb"
|
||||||
b2 = new_spec "b", "2", nil, "lib/b/c.rb"
|
new_spec "b", "2", nil, "lib/b/c.rb"
|
||||||
|
|
||||||
Gem.activate "a", "= 1"
|
Gem.activate "a", "= 1"
|
||||||
require "b/c"
|
require "b/c"
|
||||||
|
@ -139,7 +139,7 @@ class TestGem < Gem::TestCase
|
||||||
c2 = new_spec "c", "2"
|
c2 = new_spec "c", "2"
|
||||||
d1 = new_spec "d", "1", nil, "lib/d.rb"
|
d1 = new_spec "d", "1", nil, "lib/d.rb"
|
||||||
|
|
||||||
install_specs a1, b1, b2, c1, c2
|
install_specs a1, b1, b2, c1, c2, d1
|
||||||
|
|
||||||
Gem.activate "a", "= 1"
|
Gem.activate "a", "= 1"
|
||||||
assert_equal %w(a-1), loaded_spec_names
|
assert_equal %w(a-1), loaded_spec_names
|
||||||
|
@ -161,7 +161,7 @@ class TestGem < Gem::TestCase
|
||||||
c1 = new_spec "c", "1", nil, "lib/d.rb"
|
c1 = new_spec "c", "1", nil, "lib/d.rb"
|
||||||
c2 = new_spec("c", "2", { "a" => "1" }, "lib/d.rb") # conflicts with a-2
|
c2 = new_spec("c", "2", { "a" => "1" }, "lib/d.rb") # conflicts with a-2
|
||||||
|
|
||||||
install_specs a1, b1, b2, c1, c2
|
install_specs a1, a2, b1, b2, c1, c2
|
||||||
|
|
||||||
Gem.activate "a", "= 2"
|
Gem.activate "a", "= 2"
|
||||||
assert_equal %w(a-2), loaded_spec_names
|
assert_equal %w(a-2), loaded_spec_names
|
||||||
|
@ -174,6 +174,46 @@ class TestGem < Gem::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_require_already_activated
|
||||||
|
save_loaded_features do
|
||||||
|
a1 = new_spec "a", "1", nil, "lib/d.rb"
|
||||||
|
|
||||||
|
install_specs a1 # , a2, b1, b2, c1, c2
|
||||||
|
|
||||||
|
Gem.activate "a", "= 1"
|
||||||
|
assert_equal %w(a-1), loaded_spec_names
|
||||||
|
assert_equal [], unresolved_names
|
||||||
|
|
||||||
|
assert require "d"
|
||||||
|
|
||||||
|
assert_equal %w(a-1), loaded_spec_names
|
||||||
|
assert_equal [], unresolved_names
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_require_already_activated_indirect_conflict
|
||||||
|
save_loaded_features do
|
||||||
|
a1 = new_spec "a", "1", "b" => "> 0"
|
||||||
|
a2 = new_spec "a", "2", "b" => "> 0"
|
||||||
|
b1 = new_spec "b", "1", "c" => ">= 1"
|
||||||
|
b2 = new_spec "b", "2", "c" => ">= 2"
|
||||||
|
c1 = new_spec "c", "1", nil, "lib/d.rb"
|
||||||
|
c2 = new_spec("c", "2", { "a" => "1" }, "lib/d.rb") # conflicts with a-2
|
||||||
|
|
||||||
|
install_specs a1, a2, b1, b2, c1, c2
|
||||||
|
|
||||||
|
Gem.activate "a", "= 1"
|
||||||
|
Gem.activate "c", "= 1"
|
||||||
|
assert_equal %w(a-1 c-1), loaded_spec_names
|
||||||
|
assert_equal ["b (> 0)"], unresolved_names
|
||||||
|
|
||||||
|
assert require "d"
|
||||||
|
|
||||||
|
assert_equal %w(a-1 c-1), loaded_spec_names
|
||||||
|
assert_equal ["b (> 0)"], unresolved_names
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_require_missing
|
def test_require_missing
|
||||||
save_loaded_features do
|
save_loaded_features do
|
||||||
assert_raises ::LoadError do
|
assert_raises ::LoadError do
|
||||||
|
@ -211,11 +251,11 @@ class TestGem < Gem::TestCase
|
||||||
# and should resolve using b-1.0
|
# and should resolve using b-1.0
|
||||||
|
|
||||||
def test_self_activate_over
|
def test_self_activate_over
|
||||||
a, _ = util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '= 1.0'
|
util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '= 1.0'
|
||||||
util_spec 'b', '1.0'
|
util_spec 'b', '1.0'
|
||||||
util_spec 'b', '1.1'
|
util_spec 'b', '1.1'
|
||||||
util_spec 'b', '2.0'
|
util_spec 'b', '2.0'
|
||||||
c, _ = util_spec 'c', '1.0', 'b' => '~> 1.0'
|
util_spec 'c', '1.0', 'b' => '~> 1.0'
|
||||||
|
|
||||||
Gem.activate "a"
|
Gem.activate "a"
|
||||||
|
|
||||||
|
|
|
@ -157,6 +157,24 @@ class TestGemDependencyList < Gem::TestCase
|
||||||
assert_equal exp, @deplist.why_not_ok?
|
assert_equal exp, @deplist.why_not_ok?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_why_not_ok_eh_old_dependency
|
||||||
|
a = new_spec 'a', '1',
|
||||||
|
'b' => '~> 1.0'
|
||||||
|
|
||||||
|
b0 = new_spec 'b', '1.0',
|
||||||
|
'd' => '>= 0'
|
||||||
|
|
||||||
|
b1 = new_spec 'b', '1.1'
|
||||||
|
|
||||||
|
util_clear_gems
|
||||||
|
|
||||||
|
@deplist.clear
|
||||||
|
|
||||||
|
@deplist.add a, b0, b1
|
||||||
|
|
||||||
|
assert_equal({}, @deplist.why_not_ok?)
|
||||||
|
end
|
||||||
|
|
||||||
def test_ok_eh_mismatch
|
def test_ok_eh_mismatch
|
||||||
a1 = quick_spec 'a', '1'
|
a1 = quick_spec 'a', '1'
|
||||||
a2 = quick_spec 'a', '2'
|
a2 = quick_spec 'a', '2'
|
||||||
|
|
|
@ -29,6 +29,8 @@ class TestGemIndexer < Gem::TestCase
|
||||||
@d2_0_b = quick_spec 'd', '2.0.b'
|
@d2_0_b = quick_spec 'd', '2.0.b'
|
||||||
util_build_gem @d2_0_b
|
util_build_gem @d2_0_b
|
||||||
|
|
||||||
|
@tempdir = File.join(@tempdir, 'indexer')
|
||||||
|
|
||||||
gems = File.join(@tempdir, 'gems')
|
gems = File.join(@tempdir, 'gems')
|
||||||
FileUtils.mkdir_p gems
|
FileUtils.mkdir_p gems
|
||||||
FileUtils.mv Dir[Gem.cache_gem('*.gem', @gemhome)], gems
|
FileUtils.mv Dir[Gem.cache_gem('*.gem', @gemhome)], gems
|
||||||
|
|
|
@ -187,7 +187,7 @@ load Gem.bin_path('a', 'executable', version)
|
||||||
assert_equal true, File.directory?(util_inst_bindir)
|
assert_equal true, File.directory?(util_inst_bindir)
|
||||||
installed_exec = File.join(util_inst_bindir, 'executable')
|
installed_exec = File.join(util_inst_bindir, 'executable')
|
||||||
assert_equal true, File.exist?(installed_exec)
|
assert_equal true, File.exist?(installed_exec)
|
||||||
assert_equal(0100755, File.stat(installed_exec).mode) unless win_platform?
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
||||||
|
|
||||||
wrapper = File.read installed_exec
|
wrapper = File.read installed_exec
|
||||||
assert_match %r|generated by RubyGems|, wrapper
|
assert_match %r|generated by RubyGems|, wrapper
|
||||||
|
@ -202,7 +202,7 @@ load Gem.bin_path('a', 'executable', version)
|
||||||
assert_equal true, File.directory?(util_inst_bindir)
|
assert_equal true, File.directory?(util_inst_bindir)
|
||||||
installed_exec = File.join(util_inst_bindir, 'executable')
|
installed_exec = File.join(util_inst_bindir, 'executable')
|
||||||
assert_equal true, File.exist?(installed_exec)
|
assert_equal true, File.exist?(installed_exec)
|
||||||
assert_equal(0100755, File.stat(installed_exec).mode) unless win_platform?
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
||||||
|
|
||||||
wrapper = File.read installed_exec
|
wrapper = File.read installed_exec
|
||||||
assert_match %r|generated by RubyGems|, wrapper
|
assert_match %r|generated by RubyGems|, wrapper
|
||||||
|
@ -255,7 +255,7 @@ load Gem.bin_path('a', 'executable', version)
|
||||||
|
|
||||||
installed_exec = File.join("#{@gemhome}2", 'bin', 'executable')
|
installed_exec = File.join("#{@gemhome}2", 'bin', 'executable')
|
||||||
assert_equal true, File.exist?(installed_exec)
|
assert_equal true, File.exist?(installed_exec)
|
||||||
assert_equal(0100755, File.stat(installed_exec).mode) unless win_platform?
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
||||||
|
|
||||||
wrapper = File.read installed_exec
|
wrapper = File.read installed_exec
|
||||||
assert_match %r|generated by RubyGems|, wrapper
|
assert_match %r|generated by RubyGems|, wrapper
|
||||||
|
@ -304,7 +304,7 @@ load Gem.bin_path('a', 'executable', version)
|
||||||
|
|
||||||
installed_exec = File.join @gemhome, 'bin', 'executable'
|
installed_exec = File.join @gemhome, 'bin', 'executable'
|
||||||
assert_equal true, File.exist?(installed_exec)
|
assert_equal true, File.exist?(installed_exec)
|
||||||
assert_equal 0100755, File.stat(installed_exec).mode unless win_platform?
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
||||||
|
|
||||||
wrapper = File.read installed_exec
|
wrapper = File.read installed_exec
|
||||||
assert_match %r|generated by RubyGems|, wrapper
|
assert_match %r|generated by RubyGems|, wrapper
|
||||||
|
@ -329,7 +329,7 @@ load Gem.bin_path('a', 'executable', version)
|
||||||
@installer.generate_bin
|
@installer.generate_bin
|
||||||
assert_equal true, File.directory?(util_inst_bindir)
|
assert_equal true, File.directory?(util_inst_bindir)
|
||||||
assert_equal true, File.exist?(installed_exec)
|
assert_equal true, File.exist?(installed_exec)
|
||||||
assert_equal(0100755, File.stat(installed_exec).mode) unless win_platform?
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
||||||
|
|
||||||
assert_match %r|generated by RubyGems|, File.read(installed_exec)
|
assert_match %r|generated by RubyGems|, File.read(installed_exec)
|
||||||
|
|
||||||
|
@ -1020,5 +1020,9 @@ load Gem.bin_path('a', 'executable', version)
|
||||||
@installer = util_installer @spec, gem, @gemhome
|
@installer = util_installer @spec, gem, @gemhome
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mask
|
||||||
|
0100755 & (~File.umask)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -193,11 +193,15 @@ class TestGemRequirement < Gem::TestCase
|
||||||
assert_satisfied_by " ", "> 0.a "
|
assert_satisfied_by " ", "> 0.a "
|
||||||
assert_satisfied_by "", " > 0.a"
|
assert_satisfied_by "", " > 0.a"
|
||||||
assert_satisfied_by "3.1", "< 3.2.rc1"
|
assert_satisfied_by "3.1", "< 3.2.rc1"
|
||||||
|
|
||||||
assert_satisfied_by "3.2.0", "> 3.2.0.rc1"
|
assert_satisfied_by "3.2.0", "> 3.2.0.rc1"
|
||||||
assert_satisfied_by "3.2.0.rc2", "> 3.2.0.rc1"
|
assert_satisfied_by "3.2.0.rc2", "> 3.2.0.rc1"
|
||||||
|
|
||||||
assert_satisfied_by "3.0.rc2", "< 3.0"
|
assert_satisfied_by "3.0.rc2", "< 3.0"
|
||||||
assert_satisfied_by "3.0.rc2", "< 3.0.0"
|
assert_satisfied_by "3.0.rc2", "< 3.0.0"
|
||||||
assert_satisfied_by "3.0.rc2", "< 3.0.1"
|
assert_satisfied_by "3.0.rc2", "< 3.0.1"
|
||||||
|
|
||||||
|
assert_satisfied_by "3.0.rc2", "> 0"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_illformed_requirements
|
def test_illformed_requirements
|
||||||
|
|
|
@ -414,9 +414,8 @@ class TestGemSpecFetcher < Gem::TestCase
|
||||||
|
|
||||||
def test_cache_dir_escapes_windows_paths
|
def test_cache_dir_escapes_windows_paths
|
||||||
uri = URI.parse("file:///C:/WINDOWS/Temp/gem_repo")
|
uri = URI.parse("file:///C:/WINDOWS/Temp/gem_repo")
|
||||||
cache_dir = @sf.cache_dir(uri)
|
cache_dir = @sf.cache_dir(uri).gsub(@sf.dir, '')
|
||||||
pos = (/\A[a-z]:/i =~ cache_dir) ? 2 : 0
|
assert cache_dir !~ /:/, "#{cache_dir} should not contain a :"
|
||||||
refute /:/ =~ cache_dir[pos..-1], "#{cache_dir} should not contain a :"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -371,14 +371,6 @@ end
|
||||||
assert_equal nil, @a1.default_executable
|
assert_equal nil, @a1.default_executable
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dependencies
|
|
||||||
rake = Gem::Dependency.new 'rake', '> 0.4'
|
|
||||||
jabber = Gem::Dependency.new 'jabber4r', '> 0.0.0'
|
|
||||||
pqa = Gem::Dependency.new 'pqa', ['> 0.4', '<= 0.6']
|
|
||||||
|
|
||||||
assert_equal [rake, jabber, pqa], @a1.dependencies
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_dependencies
|
def test_dependencies
|
||||||
util_setup_deps
|
util_setup_deps
|
||||||
assert_equal [@bonobo, @monkey], @gem.dependencies
|
assert_equal [@bonobo, @monkey], @gem.dependencies
|
||||||
|
|
|
@ -37,10 +37,12 @@ class TestGemStreamUI < Gem::TestCase
|
||||||
@in.extend IsTty
|
@in.extend IsTty
|
||||||
@out.extend IsTty
|
@out.extend IsTty
|
||||||
|
|
||||||
@sui = Gem::StreamUI.new @in, @out, @err
|
@sui = Gem::StreamUI.new @in, @out, @err, true
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ask
|
def test_ask
|
||||||
|
skip 'TTY detection broken on windows' if Gem.win_platform?
|
||||||
|
|
||||||
timeout(1) do
|
timeout(1) do
|
||||||
expected_answer = "Arthur, King of the Britons"
|
expected_answer = "Arthur, King of the Britons"
|
||||||
@in.string = "#{expected_answer}\n"
|
@in.string = "#{expected_answer}\n"
|
||||||
|
@ -50,6 +52,8 @@ class TestGemStreamUI < Gem::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ask_no_tty
|
def test_ask_no_tty
|
||||||
|
skip 'TTY handling is broken on windows' if Gem.win_platform?
|
||||||
|
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
timeout(0.1) do
|
timeout(0.1) do
|
||||||
|
@ -70,6 +74,8 @@ class TestGemStreamUI < Gem::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ask_for_password_no_tty
|
def test_ask_for_password_no_tty
|
||||||
|
skip 'TTY handling is broken on windows' if Gem.win_platform?
|
||||||
|
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
timeout(0.1) do
|
timeout(0.1) do
|
||||||
|
@ -79,6 +85,8 @@ class TestGemStreamUI < Gem::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ask_yes_no_no_tty_with_default
|
def test_ask_yes_no_no_tty_with_default
|
||||||
|
skip 'TTY handling is broken on windows' if Gem.win_platform?
|
||||||
|
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
timeout(0.1) do
|
timeout(0.1) do
|
||||||
|
@ -91,6 +99,8 @@ class TestGemStreamUI < Gem::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ask_yes_no_no_tty_without_default
|
def test_ask_yes_no_no_tty_without_default
|
||||||
|
skip 'TTY handling is broken on windows' if Gem.win_platform?
|
||||||
|
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
timeout(0.1) do
|
timeout(0.1) do
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'rbconfig'
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
|
||||||
src_testdir = File.dirname(File.expand_path(__FILE__))
|
src_testdir = File.dirname(File.expand_path(__FILE__))
|
||||||
srcdir = File.dirname(src_testdir)
|
$LOAD_PATH << src_testdir
|
||||||
|
|
||||||
require_relative 'profile_test_all' if ENV['RUBY_TEST_ALL_PROFILE'] == 'true'
|
require_relative 'profile_test_all' if ENV['RUBY_TEST_ALL_PROFILE'] == 'true'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue