Skip to content

Commit

Permalink
Merge branch 'master' into codedb-ffi-io
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckremes committed Apr 5, 2016
2 parents 531eaa1 + 62e647d commit 5e3dc89
Show file tree
Hide file tree
Showing 219 changed files with 974 additions and 870 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -19,7 +19,7 @@ before_script:
- ./configure
script: rake ci
after_success:
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh release github website triggers docker; fi
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh release github website triggers; fi
branches:
only:
- master
Expand Down
13 changes: 0 additions & 13 deletions core/call_custom_cache.rb

This file was deleted.

4 changes: 0 additions & 4 deletions core/compiled_code.rb
Expand Up @@ -698,8 +698,4 @@ def to_s
end
end
end

# NOTE: Temporary alias for backwards compatibility. CompiledMethod is
# deprecated. Client code should use CompiledCode.
CompiledMethod = CompiledCode
end
5 changes: 0 additions & 5 deletions core/constant_scope.rb
Expand Up @@ -173,9 +173,4 @@ def const_set(name, value)
@module.const_set name, value
end
end

# NOTE: Temporary alias for backwards compatibility. StaticScope will
# eventually be deprecated in favor of ConstantScope.
StaticScope = ConstantScope
end

2 changes: 0 additions & 2 deletions core/deprecations.rb
Expand Up @@ -3,8 +3,6 @@ module Rubinius
# "Description" => "Alternative"
"Ruby 2.1 features that are incompatible with Ruby 2.2 are deprecated." =>
"Use Ruby 2.2 features if they are available.",
"Rubinius::CompiledMethod is deprecated." => "Use Rubinius::CompiledCode instead.",
"Rubinius::StaticScope is deprecated." => "Use Rubinius::ConstantScope instead.",
"Rubinius::KERNEL_PATH is deprecated." => "Use Rubinius::CORE_PATH instead.",
}
end
26 changes: 19 additions & 7 deletions core/gc.rb
Expand Up @@ -43,19 +43,27 @@ def garbage_collect
end

def self.count
data = stat
data[:"gc.young.count"] + data[:"gc.immix.count"]
if data = stat
data[:"gc.young.count"] + data[:"gc.immix.count"]
else
0
end
end

def self.time
data = stat
data[:"gc.young.ms"] +
data[:"gc.immix.stop.ms"] +
data[:"gc.large.sweep.us"] * 1_000
if data = stat
data[:"gc.young.ms"] +
data[:"gc.immix.stop.ms"] +
data[:"gc.large.sweep.us"] * 1_000
else
0
end
end

def self.stat
Rubinius::Metrics.data.to_hash
if Rubinius::Metrics.enabled?
return Rubinius::Metrics.data.to_hash
end
end

module Profiler
Expand Down Expand Up @@ -90,6 +98,10 @@ def self.report(out = $stdout)
end

def self.result
unless Rubinius::Metrics.enabled?
return "Rubinius::Metrics is disabled. GC::Profiler results are unavailable"
end

stats = GC.stat

out = <<-OUT
Expand Down
1 change: 0 additions & 1 deletion core/load_order.txt
Expand Up @@ -11,7 +11,6 @@ bignum.rb
binding.rb
block_environment.rb
byte_array.rb
call_custom_cache.rb
call_site.rb
capi.rb
channel.rb
Expand Down
6 changes: 6 additions & 0 deletions core/metrics.rb
@@ -1,5 +1,11 @@
module Rubinius
module Metrics
@enabled = false

def self.enabled?
!!@enabled
end

def self.data
@data ||= Data.new
end
Expand Down
2 changes: 1 addition & 1 deletion core/string.rb
Expand Up @@ -1388,7 +1388,7 @@ def sub(pattern, replacement=undefined)
ret.append(match.post_match)
tainted ||= val.tainted?
else
return self
ret = dup
end

ret.taint if tainted
Expand Down
2 changes: 1 addition & 1 deletion gems_list.txt
Expand Up @@ -14,7 +14,7 @@ rubinius-bridge-1.1.0.gem
rubinius-code-3.0.gem
rubinius-compiler-3.1.gem
rubinius-coverage-2.0.3.gem
rubinius-debugger-2.2.1.gem
rubinius-debugger-2.4.gem
rubinius-developer_tools-2.0.0.gem
rubinius-instructions-3.0.gem
rubinius-melbourne-3.4.gem
Expand Down
1 change: 1 addition & 0 deletions library/gauntlet_rubygems.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems'
require 'gauntlet'

Expand Down
85 changes: 74 additions & 11 deletions library/rubygems.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# -*- ruby -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
Expand All @@ -9,7 +10,7 @@
require 'thread'

module Gem
VERSION = '2.5.1'
VERSION = '2.6.2'
end

# Must be first since it unloads the prelude from 1.9.2
Expand Down Expand Up @@ -191,8 +192,13 @@ def self.try_activate path

begin
spec.activate
rescue Gem::LoadError # this could fail due to gem dep collisions, go lax
Gem::Specification.find_by_name(spec.name).activate
rescue Gem::LoadError => e # this could fail due to gem dep collisions, go lax
spec_by_name = Gem::Specification.find_by_name(spec.name)
if spec_by_name.nil?
raise e
else
spec_by_name.activate
end
end

return true
Expand Down Expand Up @@ -229,16 +235,20 @@ def self.bin_path(name, exec_name = nil, *requirements)
requirements = Gem::Requirement.default if
requirements.empty?

find_spec_for_exe(name, exec_name, requirements).bin_file exec_name
end

def self.find_spec_for_exe name, exec_name, requirements
dep = Gem::Dependency.new name, requirements

loaded = Gem.loaded_specs[name]

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

specs = dep.matching_specs(true)

raise Gem::GemNotFoundException,
"can't find gem #{name} (#{requirements})" if specs.empty?
"can't find gem #{dep}" if specs.empty?

specs = specs.find_all { |spec|
spec.executables.include? exec_name
Expand All @@ -249,6 +259,24 @@ def self.bin_path(name, exec_name = nil, *requirements)
raise Gem::GemNotFoundException, msg
end

spec
end
private_class_method :find_spec_for_exe

##
# Find the full path to the executable for gem +name+. If the +exec_name+
# is not given, the gem's default_executable is chosen, otherwise the
# specified executable's path is returned. +requirements+ allows
# you to specify specific gem versions.
#
# A side effect of this method is that it will activate the gem that
# contains the executable.
#
# This method should *only* be used in bin stub files.

def self.activate_bin_path name, exec_name, requirement # :nodoc:
spec = find_spec_for_exe name, exec_name, [requirement]
Gem::LOADED_SPECS_MUTEX.synchronize { spec.activate }
spec.bin_file exec_name
end

Expand Down Expand Up @@ -325,16 +353,38 @@ def self.deflate(data)
# lookup files.

def self.paths
@paths ||= Gem::PathSupport.new
@paths ||= Gem::PathSupport.new(ENV)
end

# Initialize the filesystem paths to use from +env+.
# +env+ is a hash-like object (typically ENV) that
# is queried for 'GEM_HOME', 'GEM_PATH', and 'GEM_SPEC_CACHE'
# Keys for the +env+ hash should be Strings, and values of the hash should
# be Strings or +nil+.

def self.paths=(env)
clear_paths
@paths = Gem::PathSupport.new env
target = {}
env.each_pair do |k,v|
case k
when 'GEM_HOME', 'GEM_PATH', 'GEM_SPEC_CACHE'
case v
when nil, String
target[k] = v
when Array
unless Gem::Deprecate.skip
warn <<-eowarn
Array values in the parameter are deprecated. Please use a String or nil.
An Array was passed in from #{caller[3]}
eowarn
end
target[k] = v.join File::PATH_SEPARATOR
end
else
target[k] = v
end
end
@paths = Gem::PathSupport.new ENV.to_hash.merge(target)
Gem::Specification.dirs = @paths.path
end

Expand Down Expand Up @@ -429,7 +479,9 @@ def self.find_files(glob, check_load_path=true)

files = find_files_from_load_path glob if check_load_path

files.concat Gem::Specification.stubs.map { |spec|
gem_specifications = @gemdeps ? Gem.loaded_specs.values : Gem::Specification.stubs

files.concat gem_specifications.map { |spec|
spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
}.flatten

Expand Down Expand Up @@ -811,6 +863,15 @@ def self.ruby_api_version
@ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup
end

def self.env_requirement(gem_name)
@env_requirements_by_name ||= {}
@env_requirements_by_name[gem_name] ||= begin
req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || '>= 0'.freeze
Gem::Requirement.create(req)
end
end
post_reset { @env_requirements_by_name = {} }

##
# Returns the latest release-version specification for the gem +name+.

Expand Down Expand Up @@ -938,9 +999,11 @@ def self.ui
# by the unit tests to provide environment isolation.

def self.use_paths(home, *paths)
paths = nil if paths == [nil]
paths = paths.first if Array === Array(paths).first
self.paths = { "GEM_HOME" => home, "GEM_PATH" => paths }
paths.flatten!
paths.compact!
hash = { "GEM_HOME" => home, "GEM_PATH" => paths.empty? ? home : paths.join(File::PATH_SEPARATOR) }
hash.delete_if { |_, v| v.nil? }
self.paths = hash
end

##
Expand Down
1 change: 1 addition & 0 deletions library/rubygems/available_set.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Gem::AvailableSet

include Enumerable
Expand Down
11 changes: 5 additions & 6 deletions library/rubygems/basic_specification.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
##
# BasicSpecification is an abstract class which implements some common code
# used by both Specification and StubSpecification.
Expand Down Expand Up @@ -94,7 +95,7 @@ def extension_dir
# Returns path to the extensions directory.

def extensions_dir
@extensions_dir ||= Gem.default_ext_dir_for(base_dir) ||
Gem.default_ext_dir_for(base_dir) ||
File.join(base_dir, 'extensions', Gem::Platform.local.to_s,
Gem.extension_api_version)
end
Expand Down Expand Up @@ -124,9 +125,9 @@ def full_gem_path

def full_name
if platform == Gem::Platform::RUBY or platform.nil? then
"#{name}-#{version}".untaint
"#{name}-#{version}".dup.untaint
else
"#{name}-#{version}-#{platform}".untaint
"#{name}-#{version}-#{platform}".dup.untaint
end
end

Expand Down Expand Up @@ -195,7 +196,6 @@ def gems_dir

def internal_init # :nodoc:
@extension_dir = nil
@extensions_dir = nil
@full_gem_path = nil
@gem_dir = nil
@ignored = nil
Expand Down Expand Up @@ -281,7 +281,7 @@ def lib_dirs_glob
self.require_paths.first
end

"#{self.full_gem_path}/#{dirs}".untaint
"#{self.full_gem_path}/#{dirs}".dup.untaint
end

##
Expand Down Expand Up @@ -325,4 +325,3 @@ def have_file? file, suffixes
end

end

0 comments on commit 5e3dc89

Please sign in to comment.