diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-01 21:50:14 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-01 21:50:14 +0000 |
commit | effdbf5936cc090a618e13c8f9a1b5412ebab2fa (patch) | |
tree | c8410a18cbbe7ad013470fc06fef0c75ce0fd230 /lib/rubygems/basic_specification.rb | |
parent | 9c4ef4b191a1e6b9abdbb21c7c709d1d0f2397e6 (diff) | |
download | ruby-effdbf5936cc090a618e13c8f9a1b5412ebab2fa.tar.gz |
* lib/rubygems: Update to RubyGems HEAD(c202db2).
this version contains many enhancements see http://git.io/vtNwF
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/basic_specification.rb')
-rw-r--r-- | lib/rubygems/basic_specification.rb | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb index e27b261d7e..78a45c1190 100644 --- a/lib/rubygems/basic_specification.rb +++ b/lib/rubygems/basic_specification.rb @@ -22,13 +22,17 @@ class Gem::BasicSpecification ## # The path this gemspec was loaded from. This attribute is not persisted. - attr_reader :loaded_from + attr_accessor :loaded_from ## # Allows correct activation of git: and path: gems. attr_writer :full_gem_path # :nodoc: + def initialize + internal_init + end + def self.default_specifications_dir File.join(Gem.default_dir, "specifications", "default") end @@ -141,7 +145,7 @@ class Gem::BasicSpecification @full_require_paths ||= begin full_paths = raw_require_paths.map do |path| - File.join full_gem_path, path + File.join full_gem_path, path.untaint end full_paths << extension_dir unless @extensions.nil? || @extensions.empty? @@ -189,13 +193,7 @@ class Gem::BasicSpecification @gems_dir ||= File.join(loaded_from && base_dir || Gem.dir, "gems") end - ## - # Set the path the Specification was loaded from. +path+ is converted to a - # String. - - def loaded_from= path - @loaded_from = path && path.to_s - + def internal_init # :nodoc: @extension_dir = nil @extensions_dir = nil @full_gem_path = nil @@ -264,6 +262,30 @@ class Gem::BasicSpecification end ## + # Return all files in this gem that match for +glob+. + + def matches_for_glob glob # TODO: rename? + # TODO: do we need these?? Kill it + glob = File.join(self.lib_dirs_glob, glob) + + Dir[glob].map { |f| f.untaint } # FIX our tests are broken, run w/ SAFE=1 + end + + ## + # Returns a string usable in Dir.glob to match all requirable paths + # for this spec. + + def lib_dirs_glob + dirs = if self.require_paths.size > 1 then + "{#{self.require_paths.join(',')}}" + else + self.require_paths.first + end + + "#{self.full_gem_path}/#{dirs}" + end + + ## # Return a Gem::Specification from this gem def to_spec |