brew vendor-gems: commit updates.
This commit is contained in:
parent
a76aa506f3
commit
00f3475012
@ -7,7 +7,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.5
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.7.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.13.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.5/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.6/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.2.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.2.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.0/lib"
|
||||
|
@ -137,10 +137,40 @@ module TZInfo
|
||||
def self.open_file(file_name, mode, opts, &block)
|
||||
File.open(file_name, mode, &block)
|
||||
end
|
||||
else
|
||||
elsif RUBY_VERSION =~ /\A1\.9\./
|
||||
def self.open_file(file_name, mode, opts, &block)
|
||||
File.open(file_name, mode, opts, &block)
|
||||
end
|
||||
else
|
||||
# Evaluate method as a string because **opts isn't valid syntax prior to
|
||||
# Ruby 2.0.
|
||||
eval(<<-EOF
|
||||
def self.open_file(file_name, mode, opts, &block)
|
||||
File.open(file_name, mode, **opts, &block)
|
||||
end
|
||||
EOF
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
# Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in
|
||||
# 3.0. Add a refinement to either silence the warning, or supply the method
|
||||
# if needed.
|
||||
old_verbose = $VERBOSE
|
||||
$VERBOSE = false
|
||||
begin
|
||||
o = Object.new
|
||||
if [:taint, :untaint, :tainted?].none? {|m| o.respond_to?(m) } || !o.taint.tainted?
|
||||
module UntaintExt
|
||||
refine Object do
|
||||
def untaint
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
ensure
|
||||
$VERBOSE = old_verbose
|
||||
end
|
||||
end
|
||||
end
|
@ -1,4 +1,6 @@
|
||||
module TZInfo
|
||||
using RubyCoreSupport::UntaintExt if RubyCoreSupport.const_defined?(:UntaintExt)
|
||||
|
||||
# A DataSource that loads data from the set of Ruby modules included in the
|
||||
# TZInfo::Data library (tzinfo-data gem).
|
||||
#
|
||||
@ -6,15 +8,30 @@ module TZInfo
|
||||
#
|
||||
# TZInfo::DataSource.set(:ruby)
|
||||
class RubyDataSource < DataSource
|
||||
# Base path for require.
|
||||
REQUIRE_PATH = File.join('tzinfo', 'data', 'definitions')
|
||||
|
||||
# Whether the timezone index has been loaded yet.
|
||||
@@timezone_index_loaded = false
|
||||
|
||||
# Whether the country index has been loaded yet.
|
||||
@@country_index_loaded = false
|
||||
|
||||
# Initializes a new RubyDataSource instance.
|
||||
def initialize
|
||||
tzinfo_data = File.join('tzinfo', 'data')
|
||||
begin
|
||||
require(tzinfo_data)
|
||||
|
||||
data_file = File.join('', 'tzinfo', 'data.rb')
|
||||
path = $".reverse_each.detect {|p| p.end_with?(data_file) }
|
||||
if path
|
||||
@base_path = File.join(File.dirname(path), 'data').untaint
|
||||
else
|
||||
@base_path = tzinfo_data
|
||||
end
|
||||
rescue LoadError
|
||||
@base_path = tzinfo_data
|
||||
end
|
||||
end
|
||||
|
||||
# Returns a TimezoneInfo instance for a given identifier.
|
||||
# Raises InvalidTimezoneIdentifier if the timezone is not found or the
|
||||
# identifier is invalid.
|
||||
@ -93,27 +110,17 @@ module TZInfo
|
||||
end
|
||||
|
||||
# Requires an index by its name.
|
||||
def self.require_index(name)
|
||||
def require_index(name)
|
||||
require_data(*['indexes', name])
|
||||
end
|
||||
|
||||
# Requires a file from tzinfo/data.
|
||||
def require_data(*file)
|
||||
self.class.require_data(*file)
|
||||
end
|
||||
|
||||
# Requires a file from tzinfo/data.
|
||||
def self.require_data(*file)
|
||||
require File.join('tzinfo', 'data', *file)
|
||||
require(File.join(@base_path, *file))
|
||||
end
|
||||
|
||||
# Loads in the index of timezones if it hasn't already been loaded.
|
||||
def load_timezone_index
|
||||
self.class.load_timezone_index
|
||||
end
|
||||
|
||||
# Loads in the index of timezones if it hasn't already been loaded.
|
||||
def self.load_timezone_index
|
||||
unless @@timezone_index_loaded
|
||||
require_index('timezones')
|
||||
@@timezone_index_loaded = true
|
||||
@ -122,11 +129,6 @@ module TZInfo
|
||||
|
||||
# Loads in the index of countries if it hasn't already been loaded.
|
||||
def load_country_index
|
||||
self.class.load_country_index
|
||||
end
|
||||
|
||||
# Loads in the index of countries if it hasn't already been loaded.
|
||||
def self.load_country_index
|
||||
unless @@country_index_loaded
|
||||
require_index('countries')
|
||||
@@country_index_loaded = true
|
@ -571,17 +571,21 @@ module TZInfo
|
||||
# version 2.0.0, %z will be passed to Time#strftime and DateTime#strftime
|
||||
# instead. Some of the formatting options may cease to be available
|
||||
# depending on the version of Ruby in use (for example, %:::z is only
|
||||
# supported by Time#strftime from MRI version 2.0.0 onwards.)
|
||||
# supported by Time#strftime from MRI version 2.0.0 onwards).
|
||||
def strftime(format, utc = Time.now.utc)
|
||||
utc = TimeOrDateTime.wrap(utc)
|
||||
period = period_for_utc(utc)
|
||||
local = period.to_local(utc)
|
||||
local = Time.at(local).utc unless local.kind_of?(Time) || local.kind_of?(DateTime)
|
||||
local_wrapped = period.to_local(utc)
|
||||
local = local_wrapped.to_orig
|
||||
local = local_wrapped.to_time unless local.kind_of?(Time) || local.kind_of?(DateTime)
|
||||
abbreviation = period.abbreviation.to_s.gsub(/%/, '%%')
|
||||
|
||||
format = format.gsub(/%(%*)(Z|:*z)/) do
|
||||
format = format.gsub(/%(%*)([sZ]|:*z)/) do
|
||||
if $1.length.odd?
|
||||
# Escaped literal percent or series of percents. Pass on to strftime.
|
||||
"#$1%#$2"
|
||||
elsif $2 == "s"
|
||||
"#$1#{utc.to_i}"
|
||||
elsif $2 == "Z"
|
||||
"#$1#{abbreviation}"
|
||||
else
|
@ -1,4 +1,12 @@
|
||||
module TZInfo
|
||||
# Use send as a workaround for an issue on JRuby 9.2.9.0 where using the
|
||||
# refinement causes calls to RubyCoreSupport.file_open to fail to pass the
|
||||
# block parameter.
|
||||
#
|
||||
# https://travis-ci.org/tzinfo/tzinfo/jobs/628812051#L1931
|
||||
# https://github.com/jruby/jruby/issues/6009
|
||||
send(:using, TZInfo::RubyCoreSupport::UntaintExt) if TZInfo::RubyCoreSupport.const_defined?(:UntaintExt)
|
||||
|
||||
# An InvalidZoneinfoDirectory exception is raised if the DataSource is
|
||||
# set to a specific zoneinfo path, which is not a valid zoneinfo directory
|
||||
# (i.e. a directory containing index files named iso3166.tab and zone.tab
|
@ -1,4 +1,6 @@
|
||||
module TZInfo
|
||||
using RubyCoreSupport::UntaintExt if RubyCoreSupport.const_defined?(:UntaintExt)
|
||||
|
||||
# An InvalidZoneinfoFile exception is raised if an attempt is made to load an
|
||||
# invalid zoneinfo file.
|
||||
class InvalidZoneinfoFile < StandardError
|
Loading…
x
Reference in New Issue
Block a user