diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-21 23:27:30 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-21 23:27:30 +0000 |
commit | 5307d803f5cce7b14a6afd1d51f6d53ec85ca87d (patch) | |
tree | aac2997a9ff000fbf2f1f9f27077bb7b2403f2c9 /lib/rubygems/source/git.rb | |
parent | b1529a30e08040b717adef8ac1fa8be1c060e7e1 (diff) |
* 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
Diffstat (limited to 'lib/rubygems/source/git.rb')
-rw-r--r-- | lib/rubygems/source/git.rb | 55 |
1 files changed, 23 insertions, 32 deletions
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb index fdce03c59a..82690923ff 100644 --- a/lib/rubygems/source/git.rb +++ b/lib/rubygems/source/git.rb @@ -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) @@ -126,34 +128,6 @@ class Gem::Source::Git < Gem::Source 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. def repo_cache_dir # :nodoc: @@ -164,13 +138,30 @@ 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. def uri_hash # :nodoc: |