* lib/rubygems: Update to RubyGems master 50a8210. Important changes

in this commit:

  RubyGems now automatically checks for gem.deps.rb or Gemfile when
  running ruby executables.  This behavior is similar to `bundle exec
  rake`.  This change may be reverted before Ruby 2.1.0 if too many bugs
  are found.

* test/rubygems:  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-11-21 23:27:30 +00:00
parent b1529a30e0
commit 5307d803f5
30 changed files with 714 additions and 196 deletions

View file

@ -36,9 +36,11 @@ class Gem::Source::Git < Gem::Source
attr_reader :need_submodules
##
# Creates a new git gem source for a gem with the given +name+ that will be
# loaded from +reference+ in +repository+. If +submodules+ is true,
# submodules will be checked out when the gem is installed.
# Creates a new git gem source for a gems from loaded from +repository+ at
# the given +reference+. The +name+ is only used to track the repository
# back to a gem dependencies file, it has no real significance as a git
# repository may contain multiple gems. If +submodules+ is true, submodules
# will be checked out when the gem is installed.
def initialize name, repository, reference, submodules = false
super(nil)
@ -125,34 +127,6 @@ class Gem::Source::Git < Gem::Source
File.join Gem.dir, 'bundler', 'gems', "#{@name}-#{dir_shortref}"
end
##
# Loads a Gem::Specification for +name+ from this git repository.
def load_spec name
cache
gemspec_reference = "#{@reference}:#{name}.gemspec"
Dir.chdir repo_cache_dir do
source = Gem::Util.popen @git, 'show', gemspec_reference
source.force_encoding Encoding::UTF_8 if Object.const_defined? :Encoding
source.untaint
begin
spec = eval source, binding, gemspec_reference
return spec if Gem::Specification === spec
warn "git gem specification for #{@repository} #{gemspec_reference} is not a Gem::Specification (#{spec.class} instead)."
rescue SignalException, SystemExit
raise
rescue SyntaxError, Exception
warn "invalid git gem specification for #{@repository} #{gemspec_reference}"
end
end
end
##
# The directory where the git gem's repository will be cached.
@ -164,12 +138,29 @@ class Gem::Source::Git < Gem::Source
# Converts the git reference for the repository into a commit hash.
def rev_parse # :nodoc:
# HACK no safe equivalent of ` exists on 1.8.7
Dir.chdir repo_cache_dir do
Gem::Util.popen(@git, 'rev-parse', @reference).strip
end
end
##
# Loads all gemspecs in the repository
def specs
checkout
Dir.chdir install_dir do
Dir['{,*,*/*}.gemspec'].map do |spec_file|
directory = File.dirname spec_file
file = File.basename spec_file
Dir.chdir directory do
Gem::Specification.load file
end
end.compact
end
end
##
# A hash for the git gem based on the git repository URI.