mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rubygems: Update to RubyGems master cee6788. Changes:
Fix test failure on vc10-x64 Server on rubyci.org due to attempting to File.chmod where it is not supported. Continuing work on improved gem dependencies file (Gemfile) support. * test: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4fa08bbaf8
commit
05ca2faba2
11 changed files with 128 additions and 21 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Fri Oct 18 09:40:43 2013 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/rubygems: Update to RubyGems master cee6788. Changes:
|
||||
|
||||
Fix test failure on vc10-x64 Server on rubyci.org due to attempting
|
||||
to File.chmod where it is not supported.
|
||||
|
||||
Continuing work on improved gem dependencies file (Gemfile) support.
|
||||
|
||||
* test: ditto.
|
||||
|
||||
Fri Oct 18 06:02:49 2013 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/rubygems: Update to RubyGems master f738c67. Changes:
|
||||
|
|
|
@ -278,7 +278,7 @@ class Gem::DependencyInstaller
|
|||
# Gathers all dependencies necessary for the installation from local and
|
||||
# remote sources unless the ignore_dependencies was given.
|
||||
#--
|
||||
# TODO remove, no longer used
|
||||
# TODO remove at RubyGems 3
|
||||
|
||||
def gather_dependencies # :nodoc:
|
||||
specs = @available.all_specs
|
||||
|
|
|
@ -43,10 +43,10 @@ class Gem::DependencyResolver
|
|||
|
||||
##
|
||||
# Create DependencyResolver object which will resolve the tree starting
|
||||
# with +needed+ Depedency objects.
|
||||
# with +needed+ Dependency objects.
|
||||
#
|
||||
# +set+ is an object that provides where to look for specifications to
|
||||
# satisify the Dependencies. This defaults to IndexSet, which will query
|
||||
# satisfy the Dependencies. This defaults to IndexSet, which will query
|
||||
# rubygems.org.
|
||||
|
||||
def initialize needed, set = nil
|
||||
|
@ -119,15 +119,12 @@ class Gem::DependencyResolver
|
|||
end
|
||||
|
||||
def handle_conflict(dep, existing)
|
||||
# There is a conflict! We return the conflict
|
||||
# object which will be seen by the caller and be
|
||||
# handled at the right level.
|
||||
# There is a conflict! We return the conflict object which will be seen by
|
||||
# the caller and be handled at the right level.
|
||||
|
||||
# If the existing activation indicates that there
|
||||
# are other possibles for it, then issue the conflict
|
||||
# on the dep for the activation itself. Otherwise, issue
|
||||
# it on the requester's request itself.
|
||||
#
|
||||
# If the existing activation indicates that there are other possibles for
|
||||
# it, then issue the conflict on the dependency for the activation itself.
|
||||
# Otherwise, issue it on the requester's request itself.
|
||||
if existing.others_possible?
|
||||
conflict =
|
||||
Gem::DependencyResolver::DependencyConflict.new dep, existing
|
||||
|
@ -146,7 +143,7 @@ class Gem::DependencyResolver
|
|||
# +needed+ is a Gem::List of DependencyRequest objects that, well, need
|
||||
# to be satisfied.
|
||||
# +specs+ is the List of ActivationRequest that are being tested.
|
||||
# +dep+ is the DepedencyRequest that was used to generate this state.
|
||||
# +dep+ is the DependencyRequest that was used to generate this state.
|
||||
# +spec+ is the Specification for this state.
|
||||
# +possible+ is List of DependencyRequest objects that can be tried to
|
||||
# find a complete set.
|
||||
|
@ -307,4 +304,6 @@ require 'rubygems/dependency_resolver/index_set'
|
|||
require 'rubygems/dependency_resolver/index_specification'
|
||||
require 'rubygems/dependency_resolver/installed_specification'
|
||||
require 'rubygems/dependency_resolver/installer_set'
|
||||
require 'rubygems/dependency_resolver/vendor_set'
|
||||
require 'rubygems/dependency_resolver/vendor_specification'
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
##
|
||||
# A set of gems for installation sourced from remote sources and local .gem
|
||||
# files
|
||||
|
||||
class Gem::DependencyResolver::InstallerSet
|
||||
|
||||
##
|
||||
|
|
|
@ -36,6 +36,11 @@ class Gem::RequestSet
|
|||
|
||||
attr_accessor :soft_missing
|
||||
|
||||
##
|
||||
# The set of vendor gems imported via load_gemdeps.
|
||||
|
||||
attr_reader :vendor_set # :nodoc:
|
||||
|
||||
##
|
||||
# Creates a RequestSet for a list of Gem::Dependency objects, +deps+. You
|
||||
# can then #resolve and #install the resolved list of dependencies.
|
||||
|
@ -54,6 +59,7 @@ class Gem::RequestSet
|
|||
@soft_missing = false
|
||||
@sorted = nil
|
||||
@specs = nil
|
||||
@vendor_set = nil
|
||||
|
||||
yield self if block_given?
|
||||
end
|
||||
|
@ -69,7 +75,7 @@ class Gem::RequestSet
|
|||
# Add +deps+ Gem::Dependency objects to the set.
|
||||
|
||||
def import deps
|
||||
@dependencies += deps
|
||||
@dependencies.concat deps
|
||||
end
|
||||
|
||||
def install options, &block
|
||||
|
@ -143,6 +149,8 @@ class Gem::RequestSet
|
|||
# Load a dependency management file.
|
||||
|
||||
def load_gemdeps path
|
||||
@vendor_set = Gem::DependencyResolver::VendorSet.new
|
||||
|
||||
gf = Gem::RequestSet::GemDependencyAPI.new self, path
|
||||
gf.load
|
||||
end
|
||||
|
|
|
@ -8,6 +8,11 @@ class Gem::RequestSet::GemDependencyAPI
|
|||
|
||||
attr_reader :dependency_groups
|
||||
|
||||
##
|
||||
# A set of gems that are loaded via the +:path+ option to #gem
|
||||
|
||||
attr_reader :vendor_set # :nodoc:
|
||||
|
||||
##
|
||||
# Creates a new GemDependencyAPI that will add dependencies to the
|
||||
# Gem::RequestSet +set+ based on the dependency API description in +path+.
|
||||
|
@ -18,6 +23,7 @@ class Gem::RequestSet::GemDependencyAPI
|
|||
|
||||
@current_groups = nil
|
||||
@dependency_groups = Hash.new { |h, group| h[group] = [] }
|
||||
@vendor_set = @set.vendor_set
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -41,13 +47,20 @@ class Gem::RequestSet::GemDependencyAPI
|
|||
options = requirements.pop if requirements.last.kind_of?(Hash)
|
||||
options ||= {}
|
||||
|
||||
groups =
|
||||
(group = options.delete(:group) and Array(group)) ||
|
||||
options.delete(:groups) ||
|
||||
@current_groups
|
||||
if directory = options.delete(:path) then
|
||||
@vendor_set.add_vendor_gem name, directory
|
||||
end
|
||||
|
||||
if groups then
|
||||
groups.each do |group|
|
||||
group = options.delete :group
|
||||
all_groups = group ? Array(group) : []
|
||||
|
||||
groups = options.delete :groups
|
||||
all_groups |= groups if groups
|
||||
|
||||
all_groups |= @current_groups if @current_groups
|
||||
|
||||
unless all_groups.empty? then
|
||||
all_groups.each do |group|
|
||||
gem_arguments = [name, *requirements]
|
||||
gem_arguments << options unless options.empty?
|
||||
@dependency_groups[group] << gem_arguments
|
||||
|
|
|
@ -162,3 +162,5 @@ end
|
|||
require 'rubygems/source/installed'
|
||||
require 'rubygems/source/specific_file'
|
||||
require 'rubygems/source/local'
|
||||
require 'rubygems/source/vendor'
|
||||
|
||||
|
|
|
@ -1095,6 +1095,24 @@ Also, a list:
|
|||
Gem::Version.create string
|
||||
end
|
||||
|
||||
##
|
||||
# A vendor_gem is used with a gem dependencies file. The gem created here
|
||||
# has no files, just a gem specification for the given +name+ and +version+.
|
||||
|
||||
def vendor_gem name = 'a', version = 1
|
||||
directory = File.join 'vendor', name
|
||||
|
||||
vendor_spec = Gem::Specification.new name, version
|
||||
|
||||
FileUtils.mkdir_p directory
|
||||
|
||||
open File.join(directory, "#{name}.gemspec"), 'w' do |io|
|
||||
io.write vendor_spec.to_ruby
|
||||
end
|
||||
|
||||
return name, vendor_spec.version, directory
|
||||
end
|
||||
|
||||
class StaticSet
|
||||
def initialize(specs)
|
||||
@specs = specs
|
||||
|
|
|
@ -17,6 +17,30 @@ class TestGemRequestSet < Gem::TestCase
|
|||
assert_equal [Gem::Dependency.new("a", "=2")], rs.dependencies
|
||||
end
|
||||
|
||||
def test_import
|
||||
rs = Gem::RequestSet.new
|
||||
rs.gem 'a'
|
||||
|
||||
rs.import [dep('b')]
|
||||
|
||||
assert_equal [dep('a'), dep('b')], rs.dependencies
|
||||
end
|
||||
|
||||
def test_load_gemdeps
|
||||
rs = Gem::RequestSet.new
|
||||
|
||||
Tempfile.open 'gem.deps.rb' do |io|
|
||||
io.puts 'gem "a"'
|
||||
io.flush
|
||||
|
||||
rs.load_gemdeps io.path
|
||||
end
|
||||
|
||||
assert_equal [dep('a')], rs.dependencies
|
||||
|
||||
assert rs.vendor_set
|
||||
end
|
||||
|
||||
def test_resolve
|
||||
a = util_spec "a", "2", "b" => ">= 2"
|
||||
b = util_spec "b", "2"
|
||||
|
|
|
@ -10,7 +10,10 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||
|
||||
@set = Gem::RequestSet.new
|
||||
|
||||
@vendor_set = Gem::DependencyResolver::VendorSet.new
|
||||
|
||||
@gda = @GDA.new @set, 'gem.deps.rb'
|
||||
@gda.instance_variable_set :@vendor_set, @vendor_set
|
||||
end
|
||||
|
||||
def test_gem
|
||||
|
@ -44,6 +47,18 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||
assert_empty @set.dependencies
|
||||
end
|
||||
|
||||
def test_gem_path
|
||||
name, version, directory = vendor_gem
|
||||
|
||||
@gda.gem name, :path => directory
|
||||
|
||||
assert_equal [dep(name)], @set.dependencies
|
||||
|
||||
loaded = @vendor_set.load_spec(name, version, Gem::Platform::RUBY, nil)
|
||||
|
||||
assert_equal "#{name}-#{version}", loaded.full_name
|
||||
end
|
||||
|
||||
def test_gem_requirement
|
||||
@gda.gem 'a', '~> 1.0'
|
||||
|
||||
|
@ -80,6 +95,17 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|||
assert_empty @set.dependencies
|
||||
end
|
||||
|
||||
def test_group_multiple
|
||||
@gda.group :a do
|
||||
@gda.gem 'a', :group => :b, :groups => [:c, :d]
|
||||
end
|
||||
|
||||
assert_equal [['a']], @gda.dependency_groups[:a]
|
||||
assert_equal [['a']], @gda.dependency_groups[:b]
|
||||
assert_equal [['a']], @gda.dependency_groups[:c]
|
||||
assert_equal [['a']], @gda.dependency_groups[:d]
|
||||
end
|
||||
|
||||
def test_load
|
||||
Tempfile.open 'gem.deps.rb' do |io|
|
||||
io.write <<-GEM_DEPS
|
||||
|
|
|
@ -1175,8 +1175,10 @@ dependencies: []
|
|||
@ext.build_extensions
|
||||
end
|
||||
ensure
|
||||
FileUtils.chmod 0755, File.join(@ext.base_dir, 'extensions')
|
||||
FileUtils.chmod 0755, @ext.base_dir
|
||||
unless Gem.win_platform? then
|
||||
FileUtils.chmod 0755, File.join(@ext.base_dir, 'extensions')
|
||||
FileUtils.chmod 0755, @ext.base_dir
|
||||
end
|
||||
end
|
||||
|
||||
def test_build_extensions_no_extensions_dir_unwritable
|
||||
|
|
Loading…
Reference in a new issue