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