diff options
-rw-r--r-- | lib/rubygems/basic_specification.rb | 74 | ||||
-rw-r--r-- | lib/rubygems/commands/pristine_command.rb | 16 | ||||
-rw-r--r-- | lib/rubygems/commands/uninstall_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/core_ext/kernel_gem.rb | 9 | ||||
-rwxr-xr-x | lib/rubygems/core_ext/kernel_require.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/dependency_list.rb | 6 | ||||
-rw-r--r-- | lib/rubygems/ext/ext_conf_builder.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/installer.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/package/tar_writer.rb | 12 | ||||
-rw-r--r-- | lib/rubygems/request_set.rb | 5 | ||||
-rw-r--r-- | lib/rubygems/request_set/lockfile.rb | 29 | ||||
-rw-r--r-- | lib/rubygems/resolver/api_set.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/resolver/api_specification.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/resolver/installer_set.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/source.rb | 8 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 12 | ||||
-rw-r--r-- | lib/rubygems/stub_specification.rb | 16 | ||||
-rw-r--r-- | lib/rubygems/test_case.rb | 31 | ||||
-rw-r--r-- | lib/rubygems/text.rb | 4 |
19 files changed, 175 insertions, 63 deletions
@@ -58,23 +58,28 @@ class Gem::BasicSpecification # Return true if this spec can require +file+. def contains_requirable_file? file - if instance_variable_defined?(:@ignored) or - instance_variable_defined?('@ignored') then - return false - elsif missing_extensions? then - @ignored = true - - warn "Ignoring #{full_name} because its extensions are not built. " + - "Try: gem pristine #{full_name}" - return false - end - - suffixes = Gem.suffixes - - full_require_paths.any? do |dir| - base = "#{dir}/#{file}" - suffixes.any? { |suf| File.file? "#{base}#{suf}" } - end end def default_gem? @@ -134,13 +139,38 @@ class Gem::BasicSpecification # activated. def full_require_paths - full_paths = raw_require_paths.map do |path| - File.join full_gem_path, path - end - full_paths.unshift extension_dir unless @extensions.nil? || @extensions.empty? - full_paths end ## @@ -109,6 +109,11 @@ extensions will be restored. next end unless spec.extensions.empty? or options[:extensions] then say "Skipped #{spec.full_name}, it needs to compile an extension" next @@ -120,8 +125,17 @@ extensions will be restored. require 'rubygems/remote_fetcher' say "Cached gem for #{spec.full_name} not found, attempting to fetch..." dep = Gem::Dependency.new spec.name, spec.version - Gem::RemoteFetcher.fetcher.download_to_cache dep end env_shebang = @@ -124,7 +124,7 @@ that is a dependency of an existing gem. You can use the end def uninstall_all - _, specs = Gem::Specification.partition { |spec| spec.default_gem? } specs.each do |spec| options[:version] = spec.version @@ -55,7 +55,14 @@ module Kernel gem_name = gem_name.name end - spec = Gem::Dependency.new(gem_name, *requirements).to_spec Gem::LOADED_SPECS_MUTEX.synchronize { spec.activate } if spec @@ -66,7 +66,7 @@ module Kernel begin RUBYGEMS_ACTIVATION_MONITOR.exit - return gem_original_require(path) end if spec # Attempt to find +path+ in any unresolved gems... @@ -219,11 +219,7 @@ class Gem::DependencyList dependencies.each do |dep| specs.each do |spec| if spec.satisfies_requirement? dep then - begin - yield spec - rescue TSort::Cyclic - # do nothing - end break end end @@ -49,7 +49,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder FileUtils.mkdir_p lib_dir entries = Dir.entries(tmp_dest) - %w[. ..] entries = entries.map { |entry| File.join tmp_dest, entry } - FileUtils.cp_r entries, lib_dir end FileEntry.new(tmp_dest).traverse do |ent| @@ -421,8 +421,8 @@ class Gem::Installer next end - mode = File.stat(bin_path).mode | 0111 - FileUtils.chmod mode, bin_path check_executable_overwrite filename @@ -290,7 +290,9 @@ class Gem::Package::TarWriter # Splits +name+ into a name and prefix that can fit in the TarHeader def split_name(name) # :nodoc: - raise Gem::Package::TooLongFileName if name.bytesize > 256 if name.bytesize <= 100 then prefix = "" @@ -308,8 +310,12 @@ class Gem::Package::TarWriter prefix = (parts + [nxt]).join "/" name = newname - if name.bytesize > 100 or prefix.bytesize > 155 then - raise Gem::Package::TooLongFileName end end @@ -403,10 +403,7 @@ class Gem::RequestSet "Unresolved dependency found during sorting - #{dep} (requested by #{node.spec.full_name})" end - begin - yield match - rescue TSort::Cyclic - end end end @@ -200,6 +200,8 @@ class Gem::RequestSet::Lockfile platforms = @requests.map { |request| request.spec.platform }.uniq platforms.sort.each do |platform| out << " #{platform}" end @@ -277,14 +279,7 @@ class Gem::RequestSet::Lockfile when :bang then get :bang - spec = @set.sets.select { |set| - Gem::Resolver::GitSet === set or - Gem::Resolver::VendorSet === set - }.map { |set| - set.specs[name] - }.compact.first - - requirements << spec.version when :l_paren then get :l_paren @@ -300,6 +295,13 @@ class Gem::RequestSet::Lockfile end get :r_paren end @set.gem name, *requirements @@ -507,6 +509,17 @@ class Gem::RequestSet::Lockfile @tokens.first || [:EOF] end def skip type # :nodoc: get while not @tokens.empty? and peek.first == type end @@ -72,7 +72,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set @to_fetch += needed end - def prefetch_now needed, @to_fetch = @to_fetch, [] uri = @dep_uri + "?gems=#{needed.sort.join ','}" @@ -19,7 +19,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification @set = set @name = api_data[:name] @version = Gem::Version.new api_data[:number] - @platform = api_data[:platform] @dependencies = api_data[:dependencies].map do |name, ver| Gem::Dependency.new name, ver.split(/\s*,\s*/) end @@ -154,7 +154,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set end def prefetch(reqs) - @remote_set.prefetch(reqs) end def prerelease= allow_prerelease @@ -26,8 +26,12 @@ class Gem::Source # Creates a new Source which will use the index located at +uri+. def initialize(uri) - unless uri.kind_of? URI - uri = URI.parse(uri.to_s) end @uri = uri @@ -709,8 +709,6 @@ class Gem::Specification < Gem::BasicSpecification specs = {} Gem.loaded_specs.each_value{|s| specs[s] = true} @@all.each{|s| s.activated = true if specs[s]} - - _resort!(@@all) end @@all end @@ -1479,6 +1477,16 @@ class Gem::Specification < Gem::BasicSpecification end ## # Returns the full path to the cache directory containing this # spec's cached gem. @@ -42,6 +42,7 @@ class Gem::StubSpecification < Gem::BasicSpecification self.loaded_from = filename @data = nil @extensions = nil @spec = nil end @@ -49,8 +50,11 @@ class Gem::StubSpecification < Gem::BasicSpecification # True when this gem has been activated def activated? - loaded = Gem.loaded_specs[name] - loaded && loaded.version == version end def build_extensions # :nodoc: @@ -154,9 +158,11 @@ class Gem::StubSpecification < Gem::BasicSpecification # The full Gem::Specification for this gem, loaded from evalling its gemspec def to_spec - @spec ||= Gem.loaded_specs.values.find { |spec| - spec.name == @name and spec.version == @version - } @spec ||= Gem::Specification.load(loaded_from) @spec.ignored = @ignored if instance_variable_defined? :@ignored @@ -1035,6 +1035,37 @@ Also, a list: Zlib::Deflate.deflate data end ## # Is this test being run on a Windows platform? @@ -27,9 +27,9 @@ module Gem::Text end def min3 a, b, c # :nodoc: - if a < b && a < c a - elsif b < a && b < c b else c |