Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby27/share/rubygems
File: rubygems.rb
# frozen_string_literal: true
[0] Fix | Delete
# -*- ruby -*-
[1] Fix | Delete
#--
[2] Fix | Delete
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
[3] Fix | Delete
# All rights reserved.
[4] Fix | Delete
# See LICENSE.txt for permissions.
[5] Fix | Delete
#++
[6] Fix | Delete
[7] Fix | Delete
require 'rbconfig'
[8] Fix | Delete
[9] Fix | Delete
module Gem
[10] Fix | Delete
VERSION = "3.1.6".freeze
[11] Fix | Delete
end
[12] Fix | Delete
[13] Fix | Delete
# Must be first since it unloads the prelude from 1.9.2
[14] Fix | Delete
require 'rubygems/compatibility'
[15] Fix | Delete
[16] Fix | Delete
require 'rubygems/defaults'
[17] Fix | Delete
require 'rubygems/deprecate'
[18] Fix | Delete
require 'rubygems/errors'
[19] Fix | Delete
[20] Fix | Delete
##
[21] Fix | Delete
# RubyGems is the Ruby standard for publishing and managing third party
[22] Fix | Delete
# libraries.
[23] Fix | Delete
#
[24] Fix | Delete
# For user documentation, see:
[25] Fix | Delete
#
[26] Fix | Delete
# * <tt>gem help</tt> and <tt>gem help [command]</tt>
[27] Fix | Delete
# * {RubyGems User Guide}[https://guides.rubygems.org/]
[28] Fix | Delete
# * {Frequently Asked Questions}[https://guides.rubygems.org/faqs]
[29] Fix | Delete
#
[30] Fix | Delete
# For gem developer documentation see:
[31] Fix | Delete
#
[32] Fix | Delete
# * {Creating Gems}[https://guides.rubygems.org/make-your-own-gem]
[33] Fix | Delete
# * Gem::Specification
[34] Fix | Delete
# * Gem::Version for version dependency notes
[35] Fix | Delete
#
[36] Fix | Delete
# Further RubyGems documentation can be found at:
[37] Fix | Delete
#
[38] Fix | Delete
# * {RubyGems Guides}[https://guides.rubygems.org]
[39] Fix | Delete
# * {RubyGems API}[https://www.rubydoc.info/github/rubygems/rubygems] (also available from
[40] Fix | Delete
# <tt>gem server</tt>)
[41] Fix | Delete
#
[42] Fix | Delete
# == RubyGems Plugins
[43] Fix | Delete
#
[44] Fix | Delete
# As of RubyGems 1.3.2, RubyGems will load plugins installed in gems or
[45] Fix | Delete
# $LOAD_PATH. Plugins must be named 'rubygems_plugin' (.rb, .so, etc) and
[46] Fix | Delete
# placed at the root of your gem's #require_path. Plugins are discovered via
[47] Fix | Delete
# Gem::find_files and then loaded.
[48] Fix | Delete
#
[49] Fix | Delete
# For an example plugin, see the {Graph gem}[https://github.com/seattlerb/graph]
[50] Fix | Delete
# which adds a `gem graph` command.
[51] Fix | Delete
#
[52] Fix | Delete
# == RubyGems Defaults, Packaging
[53] Fix | Delete
#
[54] Fix | Delete
# RubyGems defaults are stored in lib/rubygems/defaults.rb. If you're packaging
[55] Fix | Delete
# RubyGems or implementing Ruby you can change RubyGems' defaults.
[56] Fix | Delete
#
[57] Fix | Delete
# For RubyGems packagers, provide lib/rubygems/defaults/operating_system.rb
[58] Fix | Delete
# and override any defaults from lib/rubygems/defaults.rb.
[59] Fix | Delete
#
[60] Fix | Delete
# For Ruby implementers, provide lib/rubygems/defaults/#{RUBY_ENGINE}.rb and
[61] Fix | Delete
# override any defaults from lib/rubygems/defaults.rb.
[62] Fix | Delete
#
[63] Fix | Delete
# If you need RubyGems to perform extra work on install or uninstall, your
[64] Fix | Delete
# defaults override file can set pre/post install and uninstall hooks.
[65] Fix | Delete
# See Gem::pre_install, Gem::pre_uninstall, Gem::post_install,
[66] Fix | Delete
# Gem::post_uninstall.
[67] Fix | Delete
#
[68] Fix | Delete
# == Bugs
[69] Fix | Delete
#
[70] Fix | Delete
# You can submit bugs to the
[71] Fix | Delete
# {RubyGems bug tracker}[https://github.com/rubygems/rubygems/issues]
[72] Fix | Delete
# on GitHub
[73] Fix | Delete
#
[74] Fix | Delete
# == Credits
[75] Fix | Delete
#
[76] Fix | Delete
# RubyGems is currently maintained by Eric Hodel.
[77] Fix | Delete
#
[78] Fix | Delete
# RubyGems was originally developed at RubyConf 2003 by:
[79] Fix | Delete
#
[80] Fix | Delete
# * Rich Kilmer -- rich(at)infoether.com
[81] Fix | Delete
# * Chad Fowler -- chad(at)chadfowler.com
[82] Fix | Delete
# * David Black -- dblack(at)wobblini.net
[83] Fix | Delete
# * Paul Brannan -- paul(at)atdesk.com
[84] Fix | Delete
# * Jim Weirich -- jim(at)weirichhouse.org
[85] Fix | Delete
#
[86] Fix | Delete
# Contributors:
[87] Fix | Delete
#
[88] Fix | Delete
# * Gavin Sinclair -- gsinclair(at)soyabean.com.au
[89] Fix | Delete
# * George Marrows -- george.marrows(at)ntlworld.com
[90] Fix | Delete
# * Dick Davies -- rasputnik(at)hellooperator.net
[91] Fix | Delete
# * Mauricio Fernandez -- batsman.geo(at)yahoo.com
[92] Fix | Delete
# * Simon Strandgaard -- neoneye(at)adslhome.dk
[93] Fix | Delete
# * Dave Glasser -- glasser(at)mit.edu
[94] Fix | Delete
# * Paul Duncan -- pabs(at)pablotron.org
[95] Fix | Delete
# * Ville Aine -- vaine(at)cs.helsinki.fi
[96] Fix | Delete
# * Eric Hodel -- drbrain(at)segment7.net
[97] Fix | Delete
# * Daniel Berger -- djberg96(at)gmail.com
[98] Fix | Delete
# * Phil Hagelberg -- technomancy(at)gmail.com
[99] Fix | Delete
# * Ryan Davis -- ryand-ruby(at)zenspider.com
[100] Fix | Delete
# * Evan Phoenix -- evan(at)fallingsnow.net
[101] Fix | Delete
# * Steve Klabnik -- steve(at)steveklabnik.com
[102] Fix | Delete
#
[103] Fix | Delete
# (If your name is missing, PLEASE let us know!)
[104] Fix | Delete
#
[105] Fix | Delete
# == License
[106] Fix | Delete
#
[107] Fix | Delete
# See {LICENSE.txt}[rdoc-ref:lib/rubygems/LICENSE.txt] for permissions.
[108] Fix | Delete
#
[109] Fix | Delete
# Thanks!
[110] Fix | Delete
#
[111] Fix | Delete
# -The RubyGems Team
[112] Fix | Delete
[113] Fix | Delete
module Gem
[114] Fix | Delete
RUBYGEMS_DIR = File.dirname File.expand_path(__FILE__)
[115] Fix | Delete
[116] Fix | Delete
# Taint support is deprecated in Ruby 2.7.
[117] Fix | Delete
# This allows switching ".untaint" to ".tap(&Gem::UNTAINT)",
[118] Fix | Delete
# to avoid deprecation warnings in Ruby 2.7.
[119] Fix | Delete
UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc{}
[120] Fix | Delete
[121] Fix | Delete
##
[122] Fix | Delete
# An Array of Regexps that match windows Ruby platforms.
[123] Fix | Delete
[124] Fix | Delete
WIN_PATTERNS = [
[125] Fix | Delete
/bccwin/i,
[126] Fix | Delete
/cygwin/i,
[127] Fix | Delete
/djgpp/i,
[128] Fix | Delete
/mingw/i,
[129] Fix | Delete
/mswin/i,
[130] Fix | Delete
/wince/i,
[131] Fix | Delete
].freeze
[132] Fix | Delete
[133] Fix | Delete
GEM_DEP_FILES = %w[
[134] Fix | Delete
gem.deps.rb
[135] Fix | Delete
gems.rb
[136] Fix | Delete
Gemfile
[137] Fix | Delete
Isolate
[138] Fix | Delete
].freeze
[139] Fix | Delete
[140] Fix | Delete
##
[141] Fix | Delete
# Subdirectories in a gem repository
[142] Fix | Delete
[143] Fix | Delete
REPOSITORY_SUBDIRECTORIES = %w[
[144] Fix | Delete
build_info
[145] Fix | Delete
cache
[146] Fix | Delete
doc
[147] Fix | Delete
extensions
[148] Fix | Delete
gems
[149] Fix | Delete
specifications
[150] Fix | Delete
].freeze
[151] Fix | Delete
[152] Fix | Delete
##
[153] Fix | Delete
# Subdirectories in a gem repository for default gems
[154] Fix | Delete
[155] Fix | Delete
REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES = %w[
[156] Fix | Delete
gems
[157] Fix | Delete
specifications/default
[158] Fix | Delete
].freeze
[159] Fix | Delete
[160] Fix | Delete
##
[161] Fix | Delete
# Exception classes used in a Gem.read_binary +rescue+ statement
[162] Fix | Delete
[163] Fix | Delete
READ_BINARY_ERRORS = [Errno::EACCES, Errno::EROFS, Errno::ENOSYS, Errno::ENOTSUP].freeze
[164] Fix | Delete
[165] Fix | Delete
##
[166] Fix | Delete
# Exception classes used in Gem.write_binary +rescue+ statement
[167] Fix | Delete
[168] Fix | Delete
WRITE_BINARY_ERRORS = [Errno::ENOSYS, Errno::ENOTSUP].freeze
[169] Fix | Delete
[170] Fix | Delete
@@win_platform = nil
[171] Fix | Delete
[172] Fix | Delete
@configuration = nil
[173] Fix | Delete
@gemdeps = nil
[174] Fix | Delete
@loaded_specs = {}
[175] Fix | Delete
LOADED_SPECS_MUTEX = Mutex.new
[176] Fix | Delete
@path_to_default_spec_map = {}
[177] Fix | Delete
@platforms = []
[178] Fix | Delete
@ruby = nil
[179] Fix | Delete
@ruby_api_version = nil
[180] Fix | Delete
@sources = nil
[181] Fix | Delete
[182] Fix | Delete
@post_build_hooks ||= []
[183] Fix | Delete
@post_install_hooks ||= []
[184] Fix | Delete
@post_uninstall_hooks ||= []
[185] Fix | Delete
@pre_uninstall_hooks ||= []
[186] Fix | Delete
@pre_install_hooks ||= []
[187] Fix | Delete
@pre_reset_hooks ||= []
[188] Fix | Delete
@post_reset_hooks ||= []
[189] Fix | Delete
[190] Fix | Delete
@default_source_date_epoch = nil
[191] Fix | Delete
[192] Fix | Delete
##
[193] Fix | Delete
# Try to activate a gem containing +path+. Returns true if
[194] Fix | Delete
# activation succeeded or wasn't needed because it was already
[195] Fix | Delete
# activated. Returns false if it can't find the path in a gem.
[196] Fix | Delete
[197] Fix | Delete
def self.try_activate(path)
[198] Fix | Delete
# finds the _latest_ version... regardless of loaded specs and their deps
[199] Fix | Delete
# if another gem had a requirement that would mean we shouldn't
[200] Fix | Delete
# activate the latest version, then either it would already be activated
[201] Fix | Delete
# or if it was ambiguous (and thus unresolved) the code in our custom
[202] Fix | Delete
# require will try to activate the more specific version.
[203] Fix | Delete
[204] Fix | Delete
spec = Gem::Specification.find_by_path path
[205] Fix | Delete
return false unless spec
[206] Fix | Delete
return true if spec.activated?
[207] Fix | Delete
[208] Fix | Delete
begin
[209] Fix | Delete
spec.activate
[210] Fix | Delete
rescue Gem::LoadError => e # this could fail due to gem dep collisions, go lax
[211] Fix | Delete
spec_by_name = Gem::Specification.find_by_name(spec.name)
[212] Fix | Delete
if spec_by_name.nil?
[213] Fix | Delete
raise e
[214] Fix | Delete
else
[215] Fix | Delete
spec_by_name.activate
[216] Fix | Delete
end
[217] Fix | Delete
end
[218] Fix | Delete
[219] Fix | Delete
return true
[220] Fix | Delete
end
[221] Fix | Delete
[222] Fix | Delete
def self.needs
[223] Fix | Delete
rs = Gem::RequestSet.new
[224] Fix | Delete
[225] Fix | Delete
yield rs
[226] Fix | Delete
[227] Fix | Delete
finish_resolve rs
[228] Fix | Delete
end
[229] Fix | Delete
[230] Fix | Delete
def self.finish_resolve(request_set=Gem::RequestSet.new)
[231] Fix | Delete
request_set.import Gem::Specification.unresolved_deps.values
[232] Fix | Delete
request_set.import Gem.loaded_specs.values.map {|s| Gem::Dependency.new(s.name, s.version) }
[233] Fix | Delete
[234] Fix | Delete
request_set.resolve_current.each do |s|
[235] Fix | Delete
s.full_spec.activate
[236] Fix | Delete
end
[237] Fix | Delete
end
[238] Fix | Delete
[239] Fix | Delete
##
[240] Fix | Delete
# Find the full path to the executable for gem +name+. If the +exec_name+
[241] Fix | Delete
# is not given, an exception will be raised, otherwise the
[242] Fix | Delete
# specified executable's path is returned. +requirements+ allows
[243] Fix | Delete
# you to specify specific gem versions.
[244] Fix | Delete
[245] Fix | Delete
def self.bin_path(name, exec_name = nil, *requirements)
[246] Fix | Delete
# TODO: fails test_self_bin_path_bin_file_gone_in_latest
[247] Fix | Delete
# Gem::Specification.find_by_name(name, *requirements).bin_file exec_name
[248] Fix | Delete
[249] Fix | Delete
requirements = Gem::Requirement.default if
[250] Fix | Delete
requirements.empty?
[251] Fix | Delete
[252] Fix | Delete
find_spec_for_exe(name, exec_name, requirements).bin_file exec_name
[253] Fix | Delete
end
[254] Fix | Delete
[255] Fix | Delete
def self.find_spec_for_exe(name, exec_name, requirements)
[256] Fix | Delete
raise ArgumentError, "you must supply exec_name" unless exec_name
[257] Fix | Delete
[258] Fix | Delete
dep = Gem::Dependency.new name, requirements
[259] Fix | Delete
[260] Fix | Delete
loaded = Gem.loaded_specs[name]
[261] Fix | Delete
[262] Fix | Delete
return loaded if loaded && dep.matches_spec?(loaded)
[263] Fix | Delete
[264] Fix | Delete
specs = dep.matching_specs(true)
[265] Fix | Delete
[266] Fix | Delete
specs = specs.find_all do |spec|
[267] Fix | Delete
spec.executables.include? exec_name
[268] Fix | Delete
end if exec_name
[269] Fix | Delete
[270] Fix | Delete
unless spec = specs.first
[271] Fix | Delete
msg = "can't find gem #{dep} with executable #{exec_name}"
[272] Fix | Delete
if name == "bundler" && bundler_message = Gem::BundlerVersionFinder.missing_version_message
[273] Fix | Delete
msg = bundler_message
[274] Fix | Delete
end
[275] Fix | Delete
raise Gem::GemNotFoundException, msg
[276] Fix | Delete
end
[277] Fix | Delete
[278] Fix | Delete
spec
[279] Fix | Delete
end
[280] Fix | Delete
private_class_method :find_spec_for_exe
[281] Fix | Delete
[282] Fix | Delete
##
[283] Fix | Delete
# Find the full path to the executable for gem +name+. If the +exec_name+
[284] Fix | Delete
# is not given, an exception will be raised, otherwise the
[285] Fix | Delete
# specified executable's path is returned. +requirements+ allows
[286] Fix | Delete
# you to specify specific gem versions.
[287] Fix | Delete
#
[288] Fix | Delete
# A side effect of this method is that it will activate the gem that
[289] Fix | Delete
# contains the executable.
[290] Fix | Delete
#
[291] Fix | Delete
# This method should *only* be used in bin stub files.
[292] Fix | Delete
[293] Fix | Delete
def self.activate_bin_path(name, exec_name = nil, *requirements) # :nodoc:
[294] Fix | Delete
spec = find_spec_for_exe name, exec_name, requirements
[295] Fix | Delete
Gem::LOADED_SPECS_MUTEX.synchronize do
[296] Fix | Delete
spec.activate
[297] Fix | Delete
finish_resolve
[298] Fix | Delete
end
[299] Fix | Delete
spec.bin_file exec_name
[300] Fix | Delete
end
[301] Fix | Delete
[302] Fix | Delete
##
[303] Fix | Delete
# The mode needed to read a file as straight binary.
[304] Fix | Delete
[305] Fix | Delete
def self.binary_mode
[306] Fix | Delete
'rb'
[307] Fix | Delete
end
[308] Fix | Delete
[309] Fix | Delete
##
[310] Fix | Delete
# The path where gem executables are to be installed.
[311] Fix | Delete
[312] Fix | Delete
def self.bindir(install_dir=Gem.dir)
[313] Fix | Delete
return File.join install_dir, 'bin' unless
[314] Fix | Delete
install_dir.to_s == Gem.default_dir.to_s
[315] Fix | Delete
Gem.default_bindir
[316] Fix | Delete
end
[317] Fix | Delete
[318] Fix | Delete
##
[319] Fix | Delete
# Reset the +dir+ and +path+ values. The next time +dir+ or +path+
[320] Fix | Delete
# is requested, the values will be calculated from scratch. This is
[321] Fix | Delete
# mainly used by the unit tests to provide test isolation.
[322] Fix | Delete
[323] Fix | Delete
def self.clear_paths
[324] Fix | Delete
@paths = nil
[325] Fix | Delete
@user_home = nil
[326] Fix | Delete
Gem::Specification.reset
[327] Fix | Delete
Gem::Security.reset if defined?(Gem::Security)
[328] Fix | Delete
end
[329] Fix | Delete
[330] Fix | Delete
##
[331] Fix | Delete
# The path to standard location of the user's .gemrc file.
[332] Fix | Delete
[333] Fix | Delete
def self.config_file
[334] Fix | Delete
@config_file ||= File.join Gem.user_home, '.gemrc'
[335] Fix | Delete
end
[336] Fix | Delete
[337] Fix | Delete
##
[338] Fix | Delete
# The standard configuration object for gems.
[339] Fix | Delete
[340] Fix | Delete
def self.configuration
[341] Fix | Delete
@configuration ||= Gem::ConfigFile.new []
[342] Fix | Delete
end
[343] Fix | Delete
[344] Fix | Delete
##
[345] Fix | Delete
# Use the given configuration object (which implements the ConfigFile
[346] Fix | Delete
# protocol) as the standard configuration object.
[347] Fix | Delete
[348] Fix | Delete
def self.configuration=(config)
[349] Fix | Delete
@configuration = config
[350] Fix | Delete
end
[351] Fix | Delete
[352] Fix | Delete
##
[353] Fix | Delete
# The path to the data directory specified by the gem name. If the
[354] Fix | Delete
# package is not available as a gem, return nil.
[355] Fix | Delete
[356] Fix | Delete
def self.datadir(gem_name)
[357] Fix | Delete
spec = @loaded_specs[gem_name]
[358] Fix | Delete
return nil if spec.nil?
[359] Fix | Delete
spec.datadir
[360] Fix | Delete
end
[361] Fix | Delete
[362] Fix | Delete
##
[363] Fix | Delete
# A Zlib::Deflate.deflate wrapper
[364] Fix | Delete
[365] Fix | Delete
def self.deflate(data)
[366] Fix | Delete
require 'zlib'
[367] Fix | Delete
Zlib::Deflate.deflate data
[368] Fix | Delete
end
[369] Fix | Delete
[370] Fix | Delete
# Retrieve the PathSupport object that RubyGems uses to
[371] Fix | Delete
# lookup files.
[372] Fix | Delete
[373] Fix | Delete
def self.paths
[374] Fix | Delete
@paths ||= Gem::PathSupport.new(ENV)
[375] Fix | Delete
end
[376] Fix | Delete
[377] Fix | Delete
# Initialize the filesystem paths to use from +env+.
[378] Fix | Delete
# +env+ is a hash-like object (typically ENV) that
[379] Fix | Delete
# is queried for 'GEM_HOME', 'GEM_PATH', and 'GEM_SPEC_CACHE'
[380] Fix | Delete
# Keys for the +env+ hash should be Strings, and values of the hash should
[381] Fix | Delete
# be Strings or +nil+.
[382] Fix | Delete
[383] Fix | Delete
def self.paths=(env)
[384] Fix | Delete
clear_paths
[385] Fix | Delete
target = {}
[386] Fix | Delete
env.each_pair do |k,v|
[387] Fix | Delete
case k
[388] Fix | Delete
when 'GEM_HOME', 'GEM_PATH', 'GEM_SPEC_CACHE'
[389] Fix | Delete
case v
[390] Fix | Delete
when nil, String
[391] Fix | Delete
target[k] = v
[392] Fix | Delete
when Array
[393] Fix | Delete
unless Gem::Deprecate.skip
[394] Fix | Delete
warn <<-eowarn
[395] Fix | Delete
Array values in the parameter to `Gem.paths=` are deprecated.
[396] Fix | Delete
Please use a String or nil.
[397] Fix | Delete
An Array (#{env.inspect}) was passed in from #{caller[3]}
[398] Fix | Delete
eowarn
[399] Fix | Delete
end
[400] Fix | Delete
target[k] = v.join File::PATH_SEPARATOR
[401] Fix | Delete
end
[402] Fix | Delete
else
[403] Fix | Delete
target[k] = v
[404] Fix | Delete
end
[405] Fix | Delete
end
[406] Fix | Delete
@paths = Gem::PathSupport.new ENV.to_hash.merge(target)
[407] Fix | Delete
Gem::Specification.dirs = @paths.path
[408] Fix | Delete
end
[409] Fix | Delete
[410] Fix | Delete
##
[411] Fix | Delete
# The path where gems are to be installed.
[412] Fix | Delete
#--
[413] Fix | Delete
# FIXME deprecate these once everything else has been done -ebh
[414] Fix | Delete
[415] Fix | Delete
def self.dir
[416] Fix | Delete
paths.home
[417] Fix | Delete
end
[418] Fix | Delete
[419] Fix | Delete
def self.path
[420] Fix | Delete
paths.path
[421] Fix | Delete
end
[422] Fix | Delete
[423] Fix | Delete
def self.spec_cache_dir
[424] Fix | Delete
paths.spec_cache_dir
[425] Fix | Delete
end
[426] Fix | Delete
[427] Fix | Delete
##
[428] Fix | Delete
# Quietly ensure the Gem directory +dir+ contains all the proper
[429] Fix | Delete
# subdirectories. If we can't create a directory due to a permission
[430] Fix | Delete
# problem, then we will silently continue.
[431] Fix | Delete
#
[432] Fix | Delete
# If +mode+ is given, missing directories are created with this mode.
[433] Fix | Delete
#
[434] Fix | Delete
# World-writable directories will never be created.
[435] Fix | Delete
[436] Fix | Delete
def self.ensure_gem_subdirectories(dir = Gem.dir, mode = nil)
[437] Fix | Delete
ensure_subdirectories(dir, mode, REPOSITORY_SUBDIRECTORIES)
[438] Fix | Delete
end
[439] Fix | Delete
[440] Fix | Delete
##
[441] Fix | Delete
# Quietly ensure the Gem directory +dir+ contains all the proper
[442] Fix | Delete
# subdirectories for handling default gems. If we can't create a
[443] Fix | Delete
# directory due to a permission problem, then we will silently continue.
[444] Fix | Delete
#
[445] Fix | Delete
# If +mode+ is given, missing directories are created with this mode.
[446] Fix | Delete
#
[447] Fix | Delete
# World-writable directories will never be created.
[448] Fix | Delete
[449] Fix | Delete
def self.ensure_default_gem_subdirectories(dir = Gem.dir, mode = nil)
[450] Fix | Delete
ensure_subdirectories(dir, mode, REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES)
[451] Fix | Delete
end
[452] Fix | Delete
[453] Fix | Delete
def self.ensure_subdirectories(dir, mode, subdirs) # :nodoc:
[454] Fix | Delete
old_umask = File.umask
[455] Fix | Delete
File.umask old_umask | 002
[456] Fix | Delete
[457] Fix | Delete
require 'fileutils'
[458] Fix | Delete
[459] Fix | Delete
options = {}
[460] Fix | Delete
[461] Fix | Delete
options[:mode] = mode if mode
[462] Fix | Delete
[463] Fix | Delete
subdirs.each do |name|
[464] Fix | Delete
subdir = File.join dir, name
[465] Fix | Delete
next if File.exist? subdir
[466] Fix | Delete
FileUtils.mkdir_p subdir, **options rescue nil
[467] Fix | Delete
end
[468] Fix | Delete
ensure
[469] Fix | Delete
File.umask old_umask
[470] Fix | Delete
end
[471] Fix | Delete
[472] Fix | Delete
##
[473] Fix | Delete
# The extension API version of ruby. This includes the static vs non-static
[474] Fix | Delete
# distinction as extensions cannot be shared between the two.
[475] Fix | Delete
[476] Fix | Delete
def self.extension_api_version # :nodoc:
[477] Fix | Delete
if 'no' == RbConfig::CONFIG['ENABLE_SHARED']
[478] Fix | Delete
"#{ruby_api_version}-static"
[479] Fix | Delete
else
[480] Fix | Delete
ruby_api_version
[481] Fix | Delete
end
[482] Fix | Delete
end
[483] Fix | Delete
[484] Fix | Delete
##
[485] Fix | Delete
# Returns a list of paths matching +glob+ that can be used by a gem to pick
[486] Fix | Delete
# up features from other gems. For example:
[487] Fix | Delete
#
[488] Fix | Delete
# Gem.find_files('rdoc/discover').each do |path| load path end
[489] Fix | Delete
#
[490] Fix | Delete
# if +check_load_path+ is true (the default), then find_files also searches
[491] Fix | Delete
# $LOAD_PATH for files as well as gems.
[492] Fix | Delete
#
[493] Fix | Delete
# Note that find_files will return all files even if they are from different
[494] Fix | Delete
# versions of the same gem. See also find_latest_files
[495] Fix | Delete
[496] Fix | Delete
def self.find_files(glob, check_load_path=true)
[497] Fix | Delete
files = []
[498] Fix | Delete
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function