1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Normalize end alignment style with Bundler

https://github.com/rubygems/rubygems/commit/f7f504b24c
This commit is contained in:
David Rodríguez 2022-01-17 15:16:34 +01:00 committed by Hiroshi SHIBATA
parent a892e5599e
commit f04954d95c
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
30 changed files with 291 additions and 291 deletions

View file

@ -289,14 +289,14 @@ class Gem::BasicSpecification
def lib_dirs_glob
dirs = if self.raw_require_paths
if self.raw_require_paths.size > 1
"{#{self.raw_require_paths.join(',')}}"
else
self.raw_require_paths.first
end
else
"lib" # default value for require_paths for bundler/inline
end
if self.raw_require_paths.size > 1
"{#{self.raw_require_paths.join(',')}}"
else
self.raw_require_paths.first
end
else
"lib" # default value for require_paths for bundler/inline
end
"#{self.full_gem_path}/#{dirs}".dup.tap(&Gem::UNTAINT)
end

View file

@ -65,9 +65,9 @@ module Gem::BundlerVersionFinder
return unless gemfile
lockfile = case gemfile
when "gems.rb" then "gems.locked"
else "#{gemfile}.lock"
end.dup.tap(&Gem::UNTAINT)
when "gems.rb" then "gems.locked"
else "#{gemfile}.lock"
end.dup.tap(&Gem::UNTAINT)
return unless File.file?(lockfile)

View file

@ -398,10 +398,10 @@ class Gem::Command
version_to_expire = deprecation["rg_version_to_expire"]
deprecate_option_msg = if version_to_expire
"The \"#{option}\" option has been deprecated and will be removed in Rubygems #{version_to_expire}."
else
"The \"#{option}\" option has been deprecated and will be removed in future versions of Rubygems."
end
"The \"#{option}\" option has been deprecated and will be removed in Rubygems #{version_to_expire}."
else
"The \"#{option}\" option has been deprecated and will be removed in future versions of Rubygems."
end
extra_msg = deprecation["extra_msg"]

View file

@ -117,12 +117,12 @@ If no gems are named all gems in GEM_HOME are cleaned.
def get_candidate_gems
@candidate_gems = unless options[:args].empty?
options[:args].map do |gem_name|
Gem::Specification.find_all_by_name gem_name
end.flatten
else
Gem::Specification.to_a
end
options[:args].map do |gem_name|
Gem::Specification.find_all_by_name gem_name
end.flatten
else
Gem::Specification.to_a
end
end
def get_gems_to_cleanup

View file

@ -98,20 +98,20 @@ extensions will be restored.
def execute
specs = if options[:all]
Gem::Specification.map
Gem::Specification.map
# `--extensions` must be explicitly given to pristine only gems
# with extensions.
elsif options[:extensions_set] and
# `--extensions` must be explicitly given to pristine only gems
# with extensions.
elsif options[:extensions_set] and
options[:extensions] and options[:args].empty?
Gem::Specification.select do |spec|
spec.extensions and not spec.extensions.empty?
end
else
get_all_gem_names.sort.map do |gem_name|
Gem::Specification.find_all_by_name(gem_name, options[:version]).reverse
end.flatten
end
Gem::Specification.select do |spec|
spec.extensions and not spec.extensions.empty?
end
else
get_all_gem_names.sort.map do |gem_name|
Gem::Specification.find_all_by_name(gem_name, options[:version]).reverse
end.flatten
end
specs = specs.select{|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY }

View file

@ -52,14 +52,14 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
default_gem_server, push_host = get_hosts_for(gem_name)
@host = if @user_defined_host
options[:host]
elsif default_gem_server
default_gem_server
elsif push_host
push_host
else
options[:host]
end
options[:host]
elsif default_gem_server
default_gem_server
elsif push_host
push_host
else
options[:host]
end
sign_in @host, scope: get_push_scope

View file

@ -61,12 +61,12 @@ Use --overwrite to force rebuilding of documentation.
def execute
specs = if options[:all]
Gem::Specification.to_a
else
get_all_gem_names.map do |name|
Gem::Specification.find_by_name name, options[:version]
end.flatten.uniq
end
Gem::Specification.to_a
else
get_all_gem_names.map do |name|
Gem::Specification.find_by_name name, options[:version]
end.flatten.uniq
end
if specs.empty?
alert_error 'No matching gems found'

View file

@ -54,10 +54,10 @@ class Gem::Commands::SetupCommand < Gem::Command
'List the documentation types you wish to',
'generate. For example: rdoc,ri' do |value, options|
options[:document] = case value
when nil then %w[rdoc ri]
when false then []
else value
end
when nil then %w[rdoc ri]
when false then []
else value
end
end
add_option '--[no-]rdoc',
@ -666,10 +666,10 @@ abort "#{deprecation_message}"
def target_bin_path(bin_dir, bin_file)
bin_file_formatted = if options[:format_executable]
Gem.default_exec_format % bin_file
else
bin_file
end
Gem.default_exec_format % bin_file
else
bin_file
end
File.join bin_dir, bin_file_formatted
end

View file

@ -140,10 +140,10 @@ Specific fields in the specification can be extracted in YAML format:
s = s.send field if field
say case options[:format]
when :ruby then s.to_ruby
when :marshal then Marshal.dump s
else s.to_yaml
end
when :ruby then s.to_ruby
when :marshal then Marshal.dump s
else s.to_yaml
end
say "\n"
end

View file

@ -233,10 +233,10 @@ command to remove old versions.
up_ver = gems_to_update.first.version
target = if update_latest
up_ver
else
version
end
up_ver
else
version
end
return target, requirement
end

View file

@ -281,10 +281,10 @@ if you believe they were disclosed to a third party.
check_credentials_permissions
@api_keys = if File.exist? credentials_path
load_file(credentials_path)
else
@hash
end
load_file(credentials_path)
else
@hash
end
if @api_keys.key? :rubygems_api_key
@rubygems_api_key = @api_keys[:rubygems_api_key]

View file

@ -117,11 +117,11 @@ class Gem::Doctor
type = File.directory?(child) ? 'directory' : 'file'
action = if @dry_run
'Extra'
else
FileUtils.rm_r(child)
'Removed'
end
'Extra'
else
FileUtils.rm_r(child)
'Removed'
end
say "#{action} #{type} #{sub_directory}/#{File.basename(child)}"
end

View file

@ -42,11 +42,11 @@ class Gem::GemRunner
cmd.command_names.each do |command_name|
config_args = Gem.configuration[command_name]
config_args = case config_args
when String
config_args.split ' '
else
Array(config_args)
end
when String
config_args.split ' '
else
Array(config_args)
end
Gem::Command.add_specific_extra_args command_name, config_args
end

View file

@ -35,10 +35,10 @@ module Gem::InstallUpdateOptions
'List the documentation types you wish to',
'generate. For example: rdoc,ri') do |value, options|
options[:document] = case value
when nil then %w[ri]
when false then []
else value
end
when nil then %w[ri]
when false then []
else value
end
end
add_option(:"Install/Update", '--build-root DIR',

View file

@ -146,12 +146,12 @@ class Gem::Package
def self.new(gem, security_policy = nil)
gem = if gem.is_a?(Gem::Package::Source)
gem
elsif gem.respond_to? :read
Gem::Package::IOSource.new gem
else
Gem::Package::FileSource.new gem
end
gem
elsif gem.respond_to? :read
Gem::Package::IOSource.new gem
else
Gem::Package::FileSource.new gem
end
return super unless Gem::Package == self
return super unless gem.present?
@ -353,10 +353,10 @@ EOM
def digest(entry) # :nodoc:
algorithms = if @checksums
@checksums.keys
else
[Gem::Security::DIGEST_NAME].compact
end
@checksums.keys
else
[Gem::Security::DIGEST_NAME].compact
end
algorithms.each do |algorithm|
digester = Gem::Security.create_digest(algorithm)

View file

@ -78,9 +78,9 @@ class Gem::Platform
cpu = arch.shift
@cpu = case cpu
when /i\d86/ then 'x86'
else cpu
end
when /i\d86/ then 'x86'
else cpu
end
if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/ # for command-line
@os, @version = arch
@ -91,32 +91,32 @@ class Gem::Platform
@cpu, os = nil, cpu if os.nil? # legacy jruby
@os, @version = case os
when /aix(\d+)?/ then [ 'aix', $1 ]
when /cygwin/ then [ 'cygwin', nil ]
when /darwin(\d+)?/ then [ 'darwin', $1 ]
when /^macruby$/ then [ 'macruby', nil ]
when /freebsd(\d+)?/ then [ 'freebsd', $1 ]
when /hpux(\d+)?/ then [ 'hpux', $1 ]
when /^java$/, /^jruby$/ then [ 'java', nil ]
when /^java([\d.]*)/ then [ 'java', $1 ]
when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ]
when /^dotnet$/ then [ 'dotnet', nil ]
when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
when /linux-?((?!gnu)\w+)?/ then [ 'linux', $1 ]
when /mingw32/ then [ 'mingw32', nil ]
when /mingw-?(\w+)?/ then [ 'mingw', $1 ]
when /(mswin\d+)(\_(\d+))?/ then
os, version = $1, $3
@cpu = 'x86' if @cpu.nil? and os =~ /32$/
[os, version]
when /netbsdelf/ then [ 'netbsdelf', nil ]
when /openbsd(\d+\.\d+)?/ then [ 'openbsd', $1 ]
when /bitrig(\d+\.\d+)?/ then [ 'bitrig', $1 ]
when /solaris(\d+\.\d+)?/ then [ 'solaris', $1 ]
# test
when /^(\w+_platform)(\d+)?/ then [ $1, $2 ]
else [ 'unknown', nil ]
end
when /aix(\d+)?/ then [ 'aix', $1 ]
when /cygwin/ then [ 'cygwin', nil ]
when /darwin(\d+)?/ then [ 'darwin', $1 ]
when /^macruby$/ then [ 'macruby', nil ]
when /freebsd(\d+)?/ then [ 'freebsd', $1 ]
when /hpux(\d+)?/ then [ 'hpux', $1 ]
when /^java$/, /^jruby$/ then [ 'java', nil ]
when /^java([\d.]*)/ then [ 'java', $1 ]
when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ]
when /^dotnet$/ then [ 'dotnet', nil ]
when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
when /linux-?((?!gnu)\w+)?/ then [ 'linux', $1 ]
when /mingw32/ then [ 'mingw32', nil ]
when /mingw-?(\w+)?/ then [ 'mingw', $1 ]
when /(mswin\d+)(\_(\d+))?/ then
os, version = $1, $3
@cpu = 'x86' if @cpu.nil? and os =~ /32$/
[os, version]
when /netbsdelf/ then [ 'netbsdelf', nil ]
when /openbsd(\d+\.\d+)?/ then [ 'openbsd', $1 ]
when /bitrig(\d+\.\d+)?/ then [ 'bitrig', $1 ]
when /solaris(\d+\.\d+)?/ then [ 'solaris', $1 ]
# test
when /^(\w+_platform)(\d+)?/ then [ $1, $2 ]
else [ 'unknown', nil ]
end
when Gem::Platform then
@cpu = arch.cpu
@os = arch.os
@ -180,19 +180,19 @@ class Gem::Platform
when String then
# This data is from http://gems.rubyforge.org/gems/yaml on 19 Aug 2007
other = case other
when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ]
when /^i\d86-linux/ then ['x86', 'linux', nil ]
when 'java', 'jruby' then [nil, 'java', nil ]
when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ]
when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
when /mswin64(\_(\d+))?/ then ['x64', 'mswin64', $2 ]
when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
when /powerpc-darwin(\d)/ then ['powerpc', 'darwin', $1 ]
when /sparc-solaris2.8/ then ['sparc', 'solaris', '2.8' ]
when /universal-darwin(\d)/ then ['universal', 'darwin', $1 ]
else other
end
when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ]
when /^i\d86-linux/ then ['x86', 'linux', nil ]
when 'java', 'jruby' then [nil, 'java', nil ]
when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ]
when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
when /mswin64(\_(\d+))?/ then ['x64', 'mswin64', $2 ]
when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
when /powerpc-darwin(\d)/ then ['powerpc', 'darwin', $1 ]
when /sparc-solaris2.8/ then ['sparc', 'solaris', '2.8' ]
when /universal-darwin(\d)/ then ['universal', 'darwin', $1 ]
else other
end
other = Gem::Platform.new other
else

View file

@ -150,12 +150,12 @@ module Gem::QueryUtils
fetcher = Gem::SpecFetcher.fetcher
spec_tuples = if name.respond_to?(:source) && name.source.empty?
fetcher.detect(specs_type) { true }
else
fetcher.detect(specs_type) do |name_tuple|
name === name_tuple.name
end
end
fetcher.detect(specs_type) { true }
else
fetcher.detect(specs_type) do |name_tuple|
name === name_tuple.name
end
end
output_query_results(spec_tuples)
end

View file

@ -172,10 +172,10 @@ class Gem::RemoteFetcher
when nil then # TODO test for local overriding cache
source_path = if Gem.win_platform? && source_uri.scheme &&
!source_uri.path.include?(':')
"#{source_uri.scheme}:#{source_uri.path}"
else
source_uri.path
end
"#{source_uri.scheme}:#{source_uri.path}"
else
source_uri.path
end
source_path = Gem::UriFormatter.new(source_path).unescape

View file

@ -56,10 +56,10 @@ class Gem::RequestSet::Lockfile
deps[name] = if [Gem::Resolver::VendorSpecification,
Gem::Resolver::GitSpecification].include? spec.class
Gem::Requirement.source_set
else
requirement
end
Gem::Requirement.source_set
else
requirement
end
end
deps

View file

@ -81,12 +81,12 @@ class Gem::Source
return Gem::Resolver::IndexSet.new self if 'file' == uri.scheme
fetch_uri = if uri.host == "rubygems.org"
index_uri = uri.dup
index_uri.host = "index.rubygems.org"
index_uri
else
uri
end
index_uri = uri.dup
index_uri.host = "index.rubygems.org"
index_uri
else
uri
end
bundler_api_uri = enforce_trailing_slash(fetch_uri)

View file

@ -51,13 +51,13 @@ class Gem::SourceList
require "uri"
src = case obj
when URI
Gem::Source.new(obj)
when Gem::Source
obj
else
Gem::Source.new(URI.parse(obj))
end
when URI
Gem::Source.new(obj)
when Gem::Source
obj
else
Gem::Source.new(URI.parse(obj))
end
@sources << src unless @sources.include?(src)
src

View file

@ -191,10 +191,10 @@ class Gem::SpecFetcher
end
matches = if matches.empty? && type != :prerelease
suggest_gems_from_name gem_name, :prerelease
else
matches.uniq.sort_by {|name, dist| dist }
end
suggest_gems_from_name gem_name, :prerelease
else
matches.uniq.sort_by {|name, dist| dist }
end
matches.map {|name, dist| name }.uniq.first(num_results)
end
@ -216,27 +216,27 @@ class Gem::SpecFetcher
@sources.each_source do |source|
begin
names = case type
when :latest
tuples_for source, :latest
when :released
tuples_for source, :released
when :complete
names =
tuples_for(source, :prerelease, true) +
tuples_for(source, :released)
when :latest
tuples_for source, :latest
when :released
tuples_for source, :released
when :complete
names =
tuples_for(source, :prerelease, true) +
tuples_for(source, :released)
names.sort
when :abs_latest
names =
tuples_for(source, :prerelease, true) +
tuples_for(source, :latest)
names.sort
when :abs_latest
names =
tuples_for(source, :prerelease, true) +
tuples_for(source, :latest)
names.sort
when :prerelease
tuples_for(source, :prerelease)
else
raise Gem::Exception, "Unknown type - :#{type}"
end
names.sort
when :prerelease
tuples_for(source, :prerelease)
else
raise Gem::Exception, "Unknown type - :#{type}"
end
rescue Gem::RemoteFetcher::FetchError => e
errors << Gem::SourceFetchProblem.new(source, e)
else

View file

@ -162,15 +162,15 @@ class Gem::Specification < Gem::BasicSpecification
@@default_value.each do |k,v|
INITIALIZE_CODE_FOR_DEFAULTS[k] = case v
when [], {}, true, false, nil, Numeric, Symbol
v.inspect
when String
v.dump
when Numeric
"default_value(:#{k})"
else
"default_value(:#{k}).dup"
end
when [], {}, true, false, nil, Numeric, Symbol
v.inspect
when String
v.dump
when Numeric
"default_value(:#{k})"
else
"default_value(:#{k}).dup"
end
end
@@attributes = @@default_value.keys.sort_by {|s| s.to_s }
@ -1268,12 +1268,12 @@ class Gem::Specification < Gem::BasicSpecification
current_version = CURRENT_SPECIFICATION_VERSION
field_count = if spec.specification_version > current_version
spec.instance_variable_set :@specification_version,
current_version
MARSHAL_FIELDS[current_version]
else
MARSHAL_FIELDS[spec.specification_version]
end
spec.instance_variable_set :@specification_version,
current_version
MARSHAL_FIELDS[current_version]
else
MARSHAL_FIELDS[spec.specification_version]
end
if array.size < field_count
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
@ -1473,10 +1473,10 @@ class Gem::Specification < Gem::BasicSpecification
def add_dependency_with_type(dependency, type, requirements)
requirements = if requirements.empty?
Gem::Requirement.default
else
requirements.flatten
end
Gem::Requirement.default
else
requirements.flatten
end
unless dependency.respond_to?(:name) &&
dependency.respond_to?(:requirement)
@ -1684,18 +1684,18 @@ class Gem::Specification < Gem::BasicSpecification
# This is the cleanest, most-readable, faster-than-using-Date
# way to do it.
@date = case date
when String then
if DateTimeFormat =~ date
Time.utc($1.to_i, $2.to_i, $3.to_i)
else
raise(Gem::InvalidSpecificationException,
"invalid date format in specification: #{date.inspect}")
end
when Time, DateLike then
Time.utc(date.year, date.month, date.day)
else
TODAY
end
when String then
if DateTimeFormat =~ date
Time.utc($1.to_i, $2.to_i, $3.to_i)
else
raise(Gem::InvalidSpecificationException,
"invalid date format in specification: #{date.inspect}")
end
when Time, DateLike then
Time.utc(date.year, date.month, date.day)
else
TODAY
end
end
##
@ -1801,13 +1801,13 @@ class Gem::Specification < Gem::BasicSpecification
coder.add 'name', @name
coder.add 'version', @version
platform = case @original_platform
when nil, '' then
'ruby'
when String then
@original_platform
else
@original_platform.to_s
end
when nil, '' then
'ruby'
when String then
@original_platform
else
@original_platform.to_s
end
coder.add 'platform', platform
attributes = @@attributes.map(&:to_s) - %w[name version platform]
@ -2024,10 +2024,10 @@ class Gem::Specification < Gem::BasicSpecification
def base_dir
return Gem.dir unless loaded_from
@base_dir ||= if default_gem?
File.dirname File.dirname File.dirname loaded_from
else
File.dirname File.dirname loaded_from
end
File.dirname File.dirname File.dirname loaded_from
else
File.dirname File.dirname loaded_from
end
end
##
@ -2654,9 +2654,9 @@ class Gem::Specification < Gem::BasicSpecification
default = self.default_value attribute
value = case default
when Time, Numeric, Symbol, true, false, nil then default
else default.dup
end
when Time, Numeric, Symbol, true, false, nil then default
else default.dup
end
instance_variable_set "@#{attribute}", value
end

View file

@ -199,17 +199,17 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
base = segments.first 2
recommendation = if (op == '>' || op == '>=') && segments == [0]
" use a bounded requirement, such as '~> x.y'"
else
bugfix = if op == '>'
", '> #{dep_version}'"
elsif op == '>=' and base != segments
", '>= #{dep_version}'"
end
" use a bounded requirement, such as '~> x.y'"
else
bugfix = if op == '>'
", '> #{dep_version}'"
elsif op == '>=' and base != segments
", '>= #{dep_version}'"
end
" if #{dep.name} is semantically versioned, use:\n" \
" add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}"
end
" if #{dep.name} is semantically versioned, use:\n" \
" add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}"
end
warning_messages << ["open-ended dependency on #{dep} is not recommended", recommendation].join("\n") + "\n"
end
@ -332,11 +332,11 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
def validate_array_attribute(field)
val = @specification.send(field)
klass = case field
when :dependencies then
Gem::Dependency
else
String
end
when :dependencies then
Gem::Dependency
else
String
end
unless Array === val and val.all? {|x| x.kind_of?(klass) }
error "#{field} must be an Array of #{klass}"

View file

@ -36,18 +36,18 @@ class Gem::StubSpecification < Gem::BasicSpecification
parts = data[PREFIX.length..-1].split(" ".freeze, 4)
@name = parts[0].freeze
@version = if Gem::Version.correct?(parts[1])
Gem::Version.new(parts[1])
else
Gem::Version.new(0)
end
Gem::Version.new(parts[1])
else
Gem::Version.new(0)
end
@platform = Gem::Platform.new parts[2]
@extensions = extensions
@full_name = if platform == Gem::Platform::RUBY
"#{name}-#{version}"
else
"#{name}-#{version}-#{platform}"
end
"#{name}-#{version}"
else
"#{name}-#{version}-#{platform}"
end
path_list = parts.last
@require_paths = REQUIRE_PATH_LIST[path_list] || path_list.split("\0".freeze).map! do |x|
@ -116,10 +116,10 @@ class Gem::StubSpecification < Gem::BasicSpecification
stubline = file.readline.chomp
if stubline.start_with?(PREFIX)
extensions = if /\A#{PREFIX}/ =~ file.readline.chomp
$'.split "\0"
else
StubLine::NO_EXTENSIONS
end
$'.split "\0"
else
StubLine::NO_EXTENSIONS
end
@data = StubLine.new stubline, extensions
end
@ -185,9 +185,9 @@ class Gem::StubSpecification < Gem::BasicSpecification
def to_spec
@spec ||= if @data
loaded = Gem.loaded_specs[name]
loaded if loaded && loaded.version == version
end
loaded = Gem.loaded_specs[name]
loaded if loaded && loaded.version == version
end
@spec ||= Gem::Specification.load(loaded_from)
end

View file

@ -200,13 +200,13 @@ class Gem::Uninstaller
executables = executables.map {|exec| formatted_program_filename exec }
remove = if @force_executables.nil?
ask_yes_no("Remove executables:\n" +
"\t#{executables.join ', '}\n\n" +
"in addition to the gem?",
true)
else
@force_executables
end
ask_yes_no("Remove executables:\n" +
"\t#{executables.join ', '}\n\n" +
"in addition to the gem?",
true)
else
@force_executables
end
if remove
bin_dir = @bin_dir || Gem.bindir(spec.base_dir)

View file

@ -258,23 +258,23 @@ class Gem::StreamUI
end
default_answer = case default
when nil
'yn'
when true
'Yn'
else
'yN'
end
when nil
'yn'
when true
'Yn'
else
'yN'
end
result = nil
while result.nil? do
result = case ask "#{question} [#{default_answer}]"
when /^y/i then true
when /^n/i then false
when /^$/ then default
else nil
end
when /^y/i then true
when /^n/i then false
when /^$/ then default
else nil
end
end
return result

View file

@ -310,12 +310,12 @@ class Gem::Version
def release
@@release[self] ||= if prerelease?
segments = self.segments
segments.pop while segments.any? {|s| String === s }
self.class.new segments.join('.')
else
self
end
segments = self.segments
segments.pop while segments.any? {|s| String === s }
self.class.new segments.join('.')
else
self
end
end
def segments # :nodoc:

View file

@ -339,10 +339,10 @@ class Gem::TestCase < Test::Unit::TestCase
ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
@orig_ruby = if ENV['RUBY']
ruby = Gem.ruby
Gem.ruby = ENV['RUBY']
ruby
end
ruby = Gem.ruby
Gem.ruby = ENV['RUBY']
ruby
end
@git = ENV['GIT'] || (win_platform? ? 'git.exe' : 'git')

View file

@ -135,10 +135,10 @@ class Gem::FakeFetcher
def download(spec, source_uri, install_dir = Gem.dir)
name = File.basename spec.cache_file
path = if Dir.pwd == install_dir # see fetch_command
install_dir
else
File.join install_dir, "cache"
end
install_dir
else
File.join install_dir, "cache"
end
path = File.join path, name