Skip to content

Commit

Permalink
Updated rubygems to 2.4.5.
Browse files Browse the repository at this point in the history
RubyGems 2.4.5 installed

=== 2.4.5 / 2014-12-03

Bug fixes:

* Improved speed of requiring gems.  (Around 25% for a 60 gem test).  Pull
  request #1060 by unak.
* RubyGems no longer attempts to look up gems remotely with the --local flag.
  Pull request #1084 by Jeremy Evans.
* Executable stubs use the correct gem version when RUBYGEMS_GEMDEPS is
  active.  Issue #1072 by Michael Kaiser-Nyman.
* Fixed handling of pinned gems in lockfiles with versions.  Issue #1078 by
  Ian Ker-Seymer.
* Fixed handling of git@example:gem.git URIs.  Issue #1054 by Mogutan Mogu.
* Fixed handling of platforms retrieved from the dependencies API.  Issue
  #1058 and patch suggestion by tux-mind.
* RubyGems now suggests a copy-pasteable `gem pristine` command when
  extensions are missing.  Pull request #1057 by Shannon Skipper.
* Improved errors for long file names when packaging.  Pull request #1016 by
  Piotrek Bator.
* `gem pristine` now skips gems cannot be found remotely.  Pull request #1064
  by Tuomas Kareinen.
* `gem pristine` now caches gems to the proper directory.  Pull request #1064
  by Tuomas Kareinen.
* `gem pristine` now skips bundled gems properly.  Pull request #1064 by
  Tuomas Kareinen.
* Improved interoperability of Vagrant with RubyGems.  Pull request #1057 by
  Vít Ondruch.
* Renamed CONTRIBUTING to CONTRIBUTING.rdoc to allow markup.  Pull request
  #1090 by Roberto Miranda.
* Switched from #partition to #reject as only one collection is used.  Pull
  request #1074 by Tuomas Kareinen.
* Fixed installation of gems on systems using memory-mapped files.  Pull
  request #1038 by Justin Li.
* Fixed bug in Gem::Text#min3 where `a == b < c`.  Pull request #1026 by
  fortissimo1997.
* Fixed uninitialized variable warning in BasicSpecification.  Pull request
  #1019 by Piotr Szotkowski.
* Removed unneeded exception handling for cyclic dependencies.  Pull request
  #1043 by Jens Wille.
* Fixed grouped expression warning.  Pull request #1081 by André Arko.
* Fixed handling of platforms when writing lockfiles.

=== 2.4.4 / 2014-11-12
  • Loading branch information
brixen committed Dec 11, 2014
1 parent 033ec2d commit 891d9dc
Show file tree
Hide file tree
Showing 29 changed files with 206 additions and 75 deletions.
10 changes: 8 additions & 2 deletions library/rubygems.rb
Expand Up @@ -9,7 +9,7 @@
require 'thread'

module Gem
VERSION = '2.4.4'
VERSION = '2.4.5'
end

# Must be first since it unloads the prelude from 1.9.2
Expand Down Expand Up @@ -232,7 +232,13 @@ def self.bin_path(name, exec_name = nil, *requirements)
requirements = Gem::Requirement.default if
requirements.empty?

specs = Gem::Dependency.new(name, requirements).matching_specs(true)
dep = Gem::Dependency.new name, requirements

loaded = Gem.loaded_specs[name]

return loaded.bin_file exec_name if loaded && dep.matches_spec?(loaded)

specs = dep.matching_specs(true)

raise Gem::GemNotFoundException,
"can't find gem #{name} (#{requirements})" if specs.empty?
Expand Down
74 changes: 52 additions & 22 deletions library/rubygems/basic_specification.rb
Expand Up @@ -58,23 +58,28 @@ def base_dir
# 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
@contains_requirable_file ||= {}
@contains_requirable_file[file] ||=
begin
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 #{name} --version #{version}"
return false
end

suffixes = Gem.suffixes

full_require_paths.any? do |dir|
base = "#{dir}/#{file}"
suffixes.any? { |suf| File.file? "#{base}#{suf}" }
end
end ? :yes : :no
@contains_requirable_file[file] == :yes
end

def default_gem?
Expand Down Expand Up @@ -134,13 +139,38 @@ def full_name
# activated.

def full_require_paths
full_paths = raw_require_paths.map do |path|
File.join full_gem_path, path
end
@full_require_paths ||=
begin
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.unshift extension_dir unless @extensions.nil? || @extensions.empty?

full_paths
full_paths
end
end

##
# Full path of the target library file.
# If the file is not in this gem, return nil.

def to_fullpath path
if activated? then
@paths_map ||= {}
@paths_map[path] ||=
begin
fullpath = nil
suffixes = Gem.suffixes
full_require_paths.find do |dir|
suffixes.find do |suf|
File.file?(fullpath = "#{dir}/#{path}#{suf}")
end
end ? fullpath : nil
end
else
nil
end
end

##
Expand Down
1 change: 0 additions & 1 deletion library/rubygems/commands/contents_command.rb
Expand Up @@ -146,7 +146,6 @@ def gem_names # :nodoc:

def path_description spec_dirs # :nodoc:
if spec_dirs.empty? then
spec_dirs = Gem::Specification.dirs
"default gem paths"
else
"specified path"
Expand Down
16 changes: 15 additions & 1 deletion library/rubygems/commands/pristine_command.rb
Expand Up @@ -109,6 +109,11 @@ def execute
next
end

if spec.bundled_gem_in_old_ruby?
say "Skipped #{spec.full_name}, it is bundled with old Ruby"
next
end

unless spec.extensions.empty? or options[:extensions] then
say "Skipped #{spec.full_name}, it needs to compile an extension"
next
Expand All @@ -120,8 +125,17 @@ def execute
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
found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep

if found.empty?
say "Skipped #{spec.full_name}, it was not found from cache and remote sources"
next
end

spec_candidate, source = found.first
Gem::RemoteFetcher.fetcher.download spec_candidate, source.uri.to_s, spec.base_dir
end

env_shebang =
Expand Down
2 changes: 1 addition & 1 deletion library/rubygems/commands/uninstall_command.rb
Expand Up @@ -124,7 +124,7 @@ def execute
end

def uninstall_all
_, specs = Gem::Specification.partition { |spec| spec.default_gem? }
specs = Gem::Specification.reject { |spec| spec.default_gem? }

specs.each do |spec|
options[:version] = spec.version
Expand Down
2 changes: 0 additions & 2 deletions library/rubygems/commands/update_command.rb
Expand Up @@ -84,8 +84,6 @@ def check_update_arguments # :nodoc:
end

def execute
hig = {}

if options[:system] then
update_rubygems
return
Expand Down
9 changes: 8 additions & 1 deletion library/rubygems/core_ext/kernel_gem.rb
Expand Up @@ -55,7 +55,14 @@ def gem(gem_name, *requirements) # :doc:
gem_name = gem_name.name
end

spec = Gem::Dependency.new(gem_name, *requirements).to_spec
dep = Gem::Dependency.new(gem_name, *requirements)

loaded = Gem.loaded_specs[gem_name]

return false if loaded && dep.matches_spec?(loaded)

spec = dep.to_spec

Gem::LOADED_SPECS_MUTEX.synchronize {
spec.activate
} if spec
Expand Down
2 changes: 1 addition & 1 deletion library/rubygems/core_ext/kernel_require.rb
Expand Up @@ -66,7 +66,7 @@ def require path

begin
RUBYGEMS_ACTIVATION_MONITOR.exit
return gem_original_require(path)
return gem_original_require(spec.to_fullpath(path) || path)
end if spec

# Attempt to find +path+ in any unresolved gems...
Expand Down
2 changes: 1 addition & 1 deletion library/rubygems/dependency.rb
Expand Up @@ -281,7 +281,7 @@ def matching_specs platform_only = false
}
end

matches = matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
end

##
Expand Down
6 changes: 1 addition & 5 deletions library/rubygems/dependency_list.rb
Expand Up @@ -219,11 +219,7 @@ def tsort_each_child(node)
dependencies.each do |dep|
specs.each do |spec|
if spec.satisfies_requirement? dep then
begin
yield spec
rescue TSort::Cyclic
# do nothing
end
yield spec
break
end
end
Expand Down
2 changes: 1 addition & 1 deletion library/rubygems/ext/ext_conf_builder.rb
Expand Up @@ -49,7 +49,7 @@ def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil)
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
FileUtils.cp_r entries, lib_dir, :remove_destination => true
end

FileEntry.new(tmp_dest).traverse do |ent|
Expand Down
2 changes: 1 addition & 1 deletion library/rubygems/indexer.rb
Expand Up @@ -235,7 +235,7 @@ def map_gems_to_specs gems
sanitize spec

spec
rescue SignalException => e
rescue SignalException
alert_error "Received signal, exiting"
raise
rescue Exception => e
Expand Down
4 changes: 2 additions & 2 deletions library/rubygems/installer.rb
Expand Up @@ -421,8 +421,8 @@ def generate_bin # :nodoc:
next
end

mode = File.stat(bin_path).mode | 0111
FileUtils.chmod mode, bin_path
mode = File.stat(bin_path).mode
FileUtils.chmod mode | 0111, bin_path unless (mode | 0111) == mode

check_executable_overwrite filename

Expand Down
4 changes: 2 additions & 2 deletions library/rubygems/package/old.rb
Expand Up @@ -153,10 +153,10 @@ def spec

begin
@spec = Gem::Specification.from_yaml yaml
rescue yaml_error => e
rescue yaml_error
raise Gem::Exception, "Failed to parse gem specification out of gem file"
end
rescue ArgumentError => e
rescue ArgumentError
raise Gem::Exception, "Failed to parse gem specification out of gem file"
end

Expand Down
12 changes: 9 additions & 3 deletions library/rubygems/package/tar_writer.rb
Expand Up @@ -290,7 +290,9 @@ def mkdir(name, mode)
# 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 > 256
raise Gem::Package::TooLongFileName.new("File \"#{name}\" has a too long path (should be 256 or less)")
end

if name.bytesize <= 100 then
prefix = ""
Expand All @@ -308,8 +310,12 @@ def split_name(name) # :nodoc:
prefix = (parts + [nxt]).join "/"
name = newname

if name.bytesize > 100 or prefix.bytesize > 155 then
raise Gem::Package::TooLongFileName
if name.bytesize > 100
raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long name (should be 100 or less)")
end

if prefix.bytesize > 155 then
raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long base path (should be 155 or less)")
end
end

Expand Down
6 changes: 5 additions & 1 deletion library/rubygems/remote_fetcher.rb
Expand Up @@ -326,7 +326,7 @@ def fetch_size(uri) # TODO: phase this out

def correct_for_windows_path(path)
if path[0].chr == '/' && path[1].chr =~ /[a-z]/i && path[2].chr == ':'
path = path[1..-1]
path[1..-1]
else
path
end
Expand All @@ -352,6 +352,10 @@ def https?(uri)
uri.scheme.downcase == 'https'
end

def close_all
@pools.each_value {|pool| pool.close_all}
end

protected

# we have our own signing code here to avoid a dependency on the aws-sdk gem
Expand Down
6 changes: 5 additions & 1 deletion library/rubygems/request/connection_pools.rb
Expand Up @@ -28,6 +28,10 @@ def pool_for uri
end
end

def close_all
@pools.each_value {|pool| pool.close_all}
end

private

##
Expand Down Expand Up @@ -69,7 +73,7 @@ def net_http_args uri, proxy_uri
Gem::UriFormatter.new(proxy_uri.password).unescape,
]
elsif no_proxy? uri.host, no_proxy then
net_http_args += [nil, nil]
net_http_args + [nil, nil]
else
net_http_args
end
Expand Down
9 changes: 9 additions & 0 deletions library/rubygems/request/http_pool.rb
Expand Up @@ -23,6 +23,15 @@ def checkin connection
@queue.push connection
end

def close_all
until @queue.empty?
if connection = @queue.pop(true) and connection.started?
connection.finish
end
end
@queue.push(nil)
end

private

def make_connection
Expand Down
5 changes: 1 addition & 4 deletions library/rubygems/request_set.rb
Expand Up @@ -403,10 +403,7 @@ def tsort_each_child node # :nodoc:
"Unresolved dependency found during sorting - #{dep} (requested by #{node.spec.full_name})"
end

begin
yield match
rescue TSort::Cyclic
end
yield match
end
end

Expand Down

0 comments on commit 891d9dc

Please sign in to comment.