[rubygems/rubygems] Enable Style/ExtraSpacing and auto-correct

https://github.com/rubygems/rubygems/commit/6fa0b1b679
This commit is contained in:
David Rodríguez 2019-05-03 19:56:58 +02:00 committed by Hiroshi SHIBATA
parent c16815cca7
commit 061add792e
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2
30 changed files with 90 additions and 90 deletions

View File

@ -115,7 +115,7 @@ module Gem
# The default directory for binaries # The default directory for binaries
def self.default_bindir def self.default_bindir
if defined? RUBY_FRAMEWORK_VERSION # mac framework support if defined? RUBY_FRAMEWORK_VERSION # mac framework support
'/usr/bin' '/usr/bin'
else # generic install else # generic install
RbConfig::CONFIG['bindir'] RbConfig::CONFIG['bindir']

View File

@ -30,7 +30,7 @@ module Gem::InstallUpdateOptions
options[:bin_dir] = File.expand_path(value) options[:bin_dir] = File.expand_path(value)
end end
add_option(:"Install/Update", '--document [TYPES]', Array, add_option(:"Install/Update", '--document [TYPES]', Array,
'Generate documentation for installed gems', 'Generate documentation for installed gems',
'List the documentation types you wish to', 'List the documentation types you wish to',
'generate. For example: rdoc,ri') do |value, options| 'generate. For example: rdoc,ri') do |value, options|
@ -88,7 +88,7 @@ module Gem::InstallUpdateOptions
options[:ignore_dependencies] = value options[:ignore_dependencies] = value
end end
add_option(:"Install/Update", '--[no-]format-executable', add_option(:"Install/Update", '--[no-]format-executable',
'Make installed executable names match Ruby.', 'Make installed executable names match Ruby.',
'If Ruby is ruby18, foo_exec will be', 'If Ruby is ruby18, foo_exec will be',
'foo_exec18') do |value, options| 'foo_exec18') do |value, options|

View File

@ -56,7 +56,7 @@ class Gem::Platform
when String then when String then
arch = arch.split '-' arch = arch.split '-'
if arch.length > 2 and arch.last !~ /\d/ # reassemble x86-linux-gnu if arch.length > 2 and arch.last !~ /\d/ # reassemble x86-linux-gnu
extra = arch.pop extra = arch.pop
arch.last << "-#{extra}" arch.last << "-#{extra}"
end end
@ -68,7 +68,7 @@ class Gem::Platform
else cpu else cpu
end end
if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/ # for command-line if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/ # for command-line
@os, @version = arch @os, @version = arch
return return
end end

View File

@ -118,7 +118,7 @@ class Gem::RemoteFetcher
def download(spec, source_uri, install_dir = Gem.dir) def download(spec, source_uri, install_dir = Gem.dir)
cache_dir = cache_dir =
if Dir.pwd == install_dir # see fetch_command if Dir.pwd == install_dir # see fetch_command
install_dir install_dir
elsif File.writable? install_dir elsif File.writable? install_dir
File.join install_dir, "cache" File.join install_dir, "cache"

View File

@ -720,7 +720,7 @@ class Gem::Specification < Gem::BasicSpecification
# Deprecated: You must now specify the executable name to Gem.bin_path. # Deprecated: You must now specify the executable name to Gem.bin_path.
attr_writer :default_executable attr_writer :default_executable
deprecate :default_executable=, :none, 2018, 12 deprecate :default_executable=, :none, 2018, 12
## ##
# Allows deinstallation of gems with legacy platforms. # Allows deinstallation of gems with legacy platforms.
@ -733,7 +733,7 @@ class Gem::Specification < Gem::BasicSpecification
# Formerly used to set rubyforge project. # Formerly used to set rubyforge project.
attr_writer :rubyforge_project attr_writer :rubyforge_project
deprecate :rubyforge_project=, :none, 2019, 12 deprecate :rubyforge_project=, :none, 2019, 12
## ##
# The Gem::Specification version of this gemspec. # The Gem::Specification version of this gemspec.
@ -1725,7 +1725,7 @@ class Gem::Specification < Gem::BasicSpecification
end end
result result
end end
deprecate :default_executable, :none, 2018, 12 deprecate :default_executable, :none, 2018, 12
## ##
# The default value for specification attribute +name+ # The default value for specification attribute +name+
@ -1928,7 +1928,7 @@ class Gem::Specification < Gem::BasicSpecification
def has_rdoc # :nodoc: def has_rdoc # :nodoc:
true true
end end
deprecate :has_rdoc, :none, 2018, 12 deprecate :has_rdoc, :none, 2018, 12
## ##
# Deprecated and ignored. # Deprecated and ignored.
@ -1938,10 +1938,10 @@ class Gem::Specification < Gem::BasicSpecification
def has_rdoc=(ignored) # :nodoc: def has_rdoc=(ignored) # :nodoc:
@has_rdoc = true @has_rdoc = true
end end
deprecate :has_rdoc=, :none, 2018, 12 deprecate :has_rdoc=, :none, 2018, 12
alias :has_rdoc? :has_rdoc # :nodoc: alias :has_rdoc? :has_rdoc # :nodoc:
deprecate :has_rdoc?, :none, 2018, 12 deprecate :has_rdoc?, :none, 2018, 12
## ##
# True if this gem has files in test_files # True if this gem has files in test_files

View File

@ -8,7 +8,7 @@ class Gem::SpecificationPolicy
SPECIAL_CHARACTERS = /\A[#{Regexp.escape('.-_')}]+/.freeze # :nodoc: SPECIAL_CHARACTERS = /\A[#{Regexp.escape('.-_')}]+/.freeze # :nodoc:
VALID_URI_PATTERN = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}.freeze # :nodoc: VALID_URI_PATTERN = %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}.freeze # :nodoc:
METADATA_LINK_KEYS = %w[ METADATA_LINK_KEYS = %w[
bug_tracker_uri bug_tracker_uri
@ -281,7 +281,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
platform = @specification.platform platform = @specification.platform
case platform case platform
when Gem::Platform, Gem::Platform::RUBY # ok when Gem::Platform, Gem::Platform::RUBY # ok
else else
error "invalid platform #{platform.inspect}, see Gem::Platform" error "invalid platform #{platform.inspect}, see Gem::Platform"
end end

View File

@ -1024,7 +1024,7 @@ Also, a list:
spec_fetcher = Gem::SpecFetcher.fetcher spec_fetcher = Gem::SpecFetcher.fetcher
prerelease, all = all_specs.partition { |spec| spec.version.prerelease? } prerelease, all = all_specs.partition { |spec| spec.version.prerelease? }
latest = Gem::Specification._latest_specs all_specs latest = Gem::Specification._latest_specs all_specs
spec_fetcher.specs[@uri] = [] spec_fetcher.specs[@uri] = []

View File

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

View File

@ -187,7 +187,7 @@ class Gem::Version
# ver3 = Version.create(nil) # -> nil # ver3 = Version.create(nil) # -> nil
def self.create(input) def self.create(input)
if self === input # check yourself before you wreck yourself if self === input # check yourself before you wreck yourself
input input
elsif input.nil? elsif input.nil?
nil nil

View File

@ -649,7 +649,7 @@ class TestGem < Gem::TestCase
assert_directory_exists util_cache_dir assert_directory_exists util_cache_dir
end end
unless win_platform? || Process.uid.zero? # only for FS that support write protection unless win_platform? || Process.uid.zero? # only for FS that support write protection
def test_self_ensure_gem_directories_write_protected def test_self_ensure_gem_directories_write_protected
gemdir = File.join @tempdir, "egd" gemdir = File.join @tempdir, "egd"
FileUtils.rm_r gemdir rescue nil FileUtils.rm_r gemdir rescue nil

View File

@ -23,11 +23,11 @@ class TestGemCommandsSetupCommand < Gem::TestCase
FileUtils.mkdir_p 'bin' FileUtils.mkdir_p 'bin'
FileUtils.mkdir_p 'lib/rubygems/ssl_certs/rubygems.org' FileUtils.mkdir_p 'lib/rubygems/ssl_certs/rubygems.org'
File.open 'bin/gem', 'w' do File.open 'bin/gem', 'w' do
|io| io.puts '# gem' |io| io.puts '# gem'
end end
File.open 'lib/rubygems.rb', 'w' do |io| File.open 'lib/rubygems.rb', 'w' do |io|
io.puts '# rubygems.rb' io.puts '# rubygems.rb'
end end
@ -42,15 +42,15 @@ class TestGemCommandsSetupCommand < Gem::TestCase
FileUtils.mkdir_p 'bundler/exe' FileUtils.mkdir_p 'bundler/exe'
FileUtils.mkdir_p 'bundler/lib/bundler' FileUtils.mkdir_p 'bundler/lib/bundler'
File.open 'bundler/exe/bundle', 'w' do |io| File.open 'bundler/exe/bundle', 'w' do |io|
io.puts '# bundle' io.puts '# bundle'
end end
File.open 'bundler/lib/bundler.rb', 'w' do |io| File.open 'bundler/lib/bundler.rb', 'w' do |io|
io.puts '# bundler.rb' io.puts '# bundler.rb'
end end
File.open 'bundler/lib/bundler/b.rb', 'w' do |io| File.open 'bundler/lib/bundler/b.rb', 'w' do |io|
io.puts '# b.rb' io.puts '# b.rb'
end end
@ -63,7 +63,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
gemspec.bindir = "exe" gemspec.bindir = "exe"
gemspec.executables = ["bundle"] gemspec.executables = ["bundle"]
File.open 'bundler/bundler.gemspec', 'w' do |io| File.open 'bundler/bundler.gemspec', 'w' do |io|
io.puts gemspec.to_ruby io.puts gemspec.to_ruby
end end
@ -317,19 +317,19 @@ class TestGemCommandsSetupCommand < Gem::TestCase
FileUtils.mkdir_p lib_rubygems_defaults FileUtils.mkdir_p lib_rubygems_defaults
FileUtils.mkdir_p lib_bundler FileUtils.mkdir_p lib_bundler
File.open securerandom_rb, 'w' do |io| File.open securerandom_rb, 'w' do |io|
io.puts '# securerandom.rb' io.puts '# securerandom.rb'
end end
File.open old_builder_rb, 'w' do |io| File.open old_builder_rb, 'w' do |io|
io.puts '# builder.rb' io.puts '# builder.rb'
end end
File.open old_format_rb, 'w' do |io| File.open old_format_rb, 'w' do |io|
io.puts '# format.rb' io.puts '# format.rb'
end end
File.open old_bundler_c_rb, 'w' do |io| File.open old_bundler_c_rb, 'w' do |io|
io.puts '# c.rb' io.puts '# c.rb'
end end
@ -337,7 +337,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
io.puts '# jruby.rb' io.puts '# jruby.rb'
end end
File.open os_defaults_rb, 'w' do |io| File.open os_defaults_rb, 'w' do |io|
io.puts '# operating_system.rb' io.puts '# operating_system.rb'
end end

View File

@ -16,7 +16,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
def teardown def teardown
credentials_path = Gem.configuration.credentials_path credentials_path = Gem.configuration.credentials_path
File.delete(credentials_path) if File.exist?(credentials_path) File.delete(credentials_path) if File.exist?(credentials_path)
super super
end end

View File

@ -47,7 +47,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
end end
assert_match %r{Yanking gem from http://example}, @ui.output assert_match %r{Yanking gem from http://example}, @ui.output
assert_match %r{Successfully yanked}, @ui.output assert_match %r{Successfully yanked}, @ui.output
platform = Gem.platforms[1] platform = Gem.platforms[1]
body = @fetcher.last_request.body.split('&').sort body = @fetcher.last_request.body.split('&').sort
@ -78,7 +78,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
assert_match 'You have enabled multi-factor authentication. Please enter OTP code.', @otp_ui.output assert_match 'You have enabled multi-factor authentication. Please enter OTP code.', @otp_ui.output
assert_match 'Code: ', @otp_ui.output assert_match 'Code: ', @otp_ui.output
assert_match %r{Yanking gem from http://example}, @otp_ui.output assert_match %r{Yanking gem from http://example}, @otp_ui.output
assert_match %r{Successfully yanked}, @otp_ui.output assert_match %r{Successfully yanked}, @otp_ui.output
assert_equal '111111', @fetcher.last_request['OTP'] assert_equal '111111', @fetcher.last_request['OTP']
end end
@ -133,7 +133,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
end end
assert_match %r{Yanking gem from https://other.example}, @ui.output assert_match %r{Yanking gem from https://other.example}, @ui.output
assert_match %r{Successfully yanked}, @ui.output assert_match %r{Successfully yanked}, @ui.output
body = @fetcher.last_request.body.split('&').sort body = @fetcher.last_request.body.split('&').sort
assert_equal %w[gem_name=a version=1.0], body assert_equal %w[gem_name=a version=1.0], body

View File

@ -385,7 +385,7 @@ if you believe they were disclosed to a third party.
util_config_file util_config_file
# These should not be written out to the config file. # These should not be written out to the config file.
assert_equal false, @cfg.backtrace, 'backtrace' assert_equal false, @cfg.backtrace, 'backtrace'
assert_equal Gem::ConfigFile::DEFAULT_BULK_THRESHOLD, @cfg.bulk_threshold, assert_equal Gem::ConfigFile::DEFAULT_BULK_THRESHOLD, @cfg.bulk_threshold,
'bulk_threshold' 'bulk_threshold'
assert_equal true, @cfg.update_sources, 'update_sources' assert_equal true, @cfg.update_sources, 'update_sources'

View File

@ -148,7 +148,7 @@ class TestGemDependencyInstaller < Gem::TestCase
FileUtils.mv @a1_gem, @tempdir FileUtils.mv @a1_gem, @tempdir
FileUtils.mv @b1_gem, @tempdir FileUtils.mv @b1_gem, @tempdir
FileUtils.mv e1_gem, @tempdir FileUtils.mv e1_gem, @tempdir
inst = nil inst = nil
@ -239,7 +239,7 @@ class TestGemDependencyInstaller < Gem::TestCase
FileUtils.mv @a1_gem, @tempdir FileUtils.mv @a1_gem, @tempdir
FileUtils.mv a2_gem, @tempdir # not in index FileUtils.mv a2_gem, @tempdir # not in index
FileUtils.mv @b1_gem, @tempdir FileUtils.mv @b1_gem, @tempdir
FileUtils.mv a3_gem, @tempdir FileUtils.mv a3_gem, @tempdir
Dir.chdir @tempdir do Dir.chdir @tempdir do
Gem::DependencyInstaller.new.install 'a', req("= 2") Gem::DependencyInstaller.new.install 'a', req("= 2")

View File

@ -134,7 +134,7 @@ class TestGemDependencyList < Gem::TestCase
end end
def test_why_not_ok_eh def test_why_not_ok_eh
assert_equal({}, @deplist.why_not_ok?) assert_equal({}, @deplist.why_not_ok?)
@deplist.add @b2 @deplist.add @b2
@ -162,7 +162,7 @@ class TestGemDependencyList < Gem::TestCase
@deplist.add a, b0, b1 @deplist.add a, b0, b1
assert_equal({}, @deplist.why_not_ok?) assert_equal({}, @deplist.why_not_ok?)
end end
def test_ok_eh_mismatch def test_ok_eh_mismatch

View File

@ -151,7 +151,7 @@ class TestGemPackage < Gem::Package::TarTestCase
FileUtils.mkdir_p 'lib/empty' FileUtils.mkdir_p 'lib/empty'
File.open 'lib/code.rb', 'w' do |io| File.open 'lib/code.rb', 'w' do |io|
io.write '# lib/code.rb' io.write '# lib/code.rb'
end end
@ -185,7 +185,7 @@ class TestGemPackage < Gem::Package::TarTestCase
FileUtils.mkdir_p 'lib' FileUtils.mkdir_p 'lib'
File.open 'lib/code.rb', 'w' do |io| File.open 'lib/code.rb', 'w' do |io|
io.write '# lib/code.rb' io.write '# lib/code.rb'
end end
@ -536,11 +536,11 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar| tgz_io = util_tar_gz do |tar|
tar.add_file 'relative.rb', 0644 do |io| tar.add_file 'relative.rb', 0644 do |io|
io.write 'hi' io.write 'hi'
end end
tar.mkdir 'lib', 0755 tar.mkdir 'lib', 0755
tar.add_symlink 'lib/foo.rb', '../relative.rb', 0644 tar.add_symlink 'lib/foo.rb', '../relative.rb', 0644
end end
@ -635,7 +635,7 @@ class TestGemPackage < Gem::Package::TarTestCase
tar.add_file 'lib/foo.rb', 0644 do |io| tar.add_file 'lib/foo.rb', 0644 do |io|
io.write 'hi' io.write 'hi'
end end
tar.mkdir 'lib/foo', 0755 tar.mkdir 'lib/foo', 0755
end end
package.extract_tar_gz tgz_io, @destination package.extract_tar_gz tgz_io, @destination
@ -1097,7 +1097,7 @@ class TestGemPackage < Gem::Package::TarTestCase
$bad_name = vm $bad_name = vm
entry = Object.new entry = Object.new
def entry.full_name() $bad_name end def entry.full_name() $bad_name end
package = Gem::Package.new(@gem) package = Gem::Package.new(@gem)
package.instance_variable_set(:@files, []) package.instance_variable_set(:@files, [])

View File

@ -26,7 +26,7 @@ class TestGemPackageTask < Gem::TestCase
g.summary = 'summary' g.summary = 'summary'
end end
pkg = Gem::PackageTask.new(gem) do |p| pkg = Gem::PackageTask.new(gem) do |p|
p.package_files << "y" p.package_files << "y"
end end
@ -49,7 +49,7 @@ class TestGemPackageTask < Gem::TestCase
g.files = Rake::FileList["x"].resolve g.files = Rake::FileList["x"].resolve
g.platform = Gem::Platform::CURRENT g.platform = Gem::Platform::CURRENT
end end
pkg = Gem::PackageTask.new(gem) do |p| pkg = Gem::PackageTask.new(gem) do |p|
p.package_files << "y" p.package_files << "y"
end end
assert_equal ["x", "y"], pkg.package_files assert_equal ["x", "y"], pkg.package_files
@ -62,7 +62,7 @@ class TestGemPackageTask < Gem::TestCase
g.files = Rake::FileList["x"].resolve g.files = Rake::FileList["x"].resolve
g.platform = Gem::Platform::RUBY g.platform = Gem::Platform::RUBY
end end
pkg = Gem::PackageTask.new(gem) do |p| pkg = Gem::PackageTask.new(gem) do |p|
p.package_files << "y" p.package_files << "y"
end end
assert_equal ["x", "y"], pkg.package_files assert_equal ["x", "y"], pkg.package_files

View File

@ -1043,7 +1043,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@ssl_server_thread.kill.join @ssl_server_thread.kill.join
@ssl_server_thread = nil @ssl_server_thread = nil
end end
utils = WEBrick::Utils # TimeoutHandler is since 1.9 utils = WEBrick::Utils # TimeoutHandler is since 1.9
utils::TimeoutHandler.terminate if defined?(utils::TimeoutHandler.terminate) utils::TimeoutHandler.terminate if defined?(utils::TimeoutHandler.terminate)
end end

View File

@ -23,14 +23,14 @@ class TestGemResolverAPISet < Gem::TestCase
assert_equal URI('https://rubygemsserver.com/mygems/api/v1/dependencies'), set.dep_uri assert_equal URI('https://rubygemsserver.com/mygems/api/v1/dependencies'), set.dep_uri
assert_equal URI('https://rubygemsserver.com/mygems/'), set.uri assert_equal URI('https://rubygemsserver.com/mygems/'), set.uri
assert_equal Gem::Source.new(URI('https://rubygemsserver.com/mygems/')), set.source assert_equal Gem::Source.new(URI('https://rubygemsserver.com/mygems/')), set.source
end end
def test_initialize_uri def test_initialize_uri
set = @DR::APISet.new @dep_uri set = @DR::APISet.new @dep_uri
assert_equal URI("#{@gem_repo}api/v1/dependencies"), set.dep_uri assert_equal URI("#{@gem_repo}api/v1/dependencies"), set.dep_uri
assert_equal URI("#{@gem_repo}"), set.uri assert_equal URI("#{@gem_repo}"), set.uri
end end
def test_find_all def test_find_all

View File

@ -199,21 +199,21 @@ class TestGemSource < Gem::TestCase
installed = Gem::Source::Installed.new installed = Gem::Source::Installed.new
local = Gem::Source::Local.new local = Gem::Source::Local.new
assert_equal(0, remote.<=>(remote), 'remote <=> remote') assert_equal(0, remote.<=>(remote), 'remote <=> remote')
assert_equal(-1, remote.<=>(specific), 'remote <=> specific') assert_equal(-1, remote.<=>(specific), 'remote <=> specific')
assert_equal(1, specific.<=>(remote), 'specific <=> remote') assert_equal(1, specific.<=>(remote), 'specific <=> remote')
assert_equal(-1, remote.<=>(local), 'remote <=> local') assert_equal(-1, remote.<=>(local), 'remote <=> local')
assert_equal(1, local.<=>(remote), 'local <=> remote') assert_equal(1, local.<=>(remote), 'local <=> remote')
assert_equal(-1, remote.<=>(installed), 'remote <=> installed') assert_equal(-1, remote.<=>(installed), 'remote <=> installed')
assert_equal(1, installed.<=>(remote), 'installed <=> remote') assert_equal(1, installed.<=>(remote), 'installed <=> remote')
no_uri = @source.dup no_uri = @source.dup
no_uri.instance_variable_set :@uri, nil no_uri.instance_variable_set :@uri, nil
assert_equal(-1, remote.<=>(no_uri), 'remote <=> no_uri') assert_equal(-1, remote.<=>(no_uri), 'remote <=> no_uri')
end end
def test_spaceship_order_is_preserved_when_uri_differs def test_spaceship_order_is_preserved_when_uri_differs

View File

@ -211,13 +211,13 @@ class TestGemSourceGit < Gem::TestCase
assert_equal(0, git.<=>(git), 'git <=> git') assert_equal(0, git.<=>(git), 'git <=> git')
assert_equal(1, git.<=>(remote), 'git <=> remote') assert_equal(1, git.<=>(remote), 'git <=> remote')
assert_equal(-1, remote.<=>(git), 'remote <=> git') assert_equal(-1, remote.<=>(git), 'remote <=> git')
assert_equal(1, git.<=>(installed), 'git <=> installed') assert_equal(1, git.<=>(installed), 'git <=> installed')
assert_equal(-1, installed.<=>(git), 'installed <=> git') assert_equal(-1, installed.<=>(git), 'installed <=> git')
assert_equal(-1, git.<=>(vendor), 'git <=> vendor') assert_equal(-1, git.<=>(vendor), 'git <=> vendor')
assert_equal(1, vendor.<=>(git), 'vendor <=> git') assert_equal(1, vendor.<=>(git), 'vendor <=> git')
end end
def test_specs def test_specs

View File

@ -27,10 +27,10 @@ class TestGemSourceInstalled < Gem::TestCase
assert_equal(1, installed.<=>(specific), 'installed <=> specific') assert_equal(1, installed.<=>(specific), 'installed <=> specific')
assert_equal(1, git. <=>(installed), 'git <=> installed') assert_equal(1, git. <=>(installed), 'git <=> installed')
assert_equal(-1, installed.<=>(git), 'installed <=> git') assert_equal(-1, installed.<=>(git), 'installed <=> git')
assert_equal(1, vendor.<=>(installed), 'vendor <=> installed') assert_equal(1, vendor.<=>(installed), 'vendor <=> installed')
assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor') assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor')
end end
end end

View File

@ -93,16 +93,16 @@ class TestGemSourceLocal < Gem::TestCase
installed = Gem::Source::Installed.new installed = Gem::Source::Installed.new
local = Gem::Source::Local.new local = Gem::Source::Local.new
assert_equal(0, local.<=>(local), 'local <=> local') assert_equal(0, local.<=>(local), 'local <=> local')
assert_equal(-1, remote.<=>(local), 'remote <=> local') assert_equal(-1, remote.<=>(local), 'remote <=> local')
assert_equal(1, local.<=>(remote), 'local <=> remote') assert_equal(1, local.<=>(remote), 'local <=> remote')
assert_equal(1, installed.<=>(local), 'installed <=> local') assert_equal(1, installed.<=>(local), 'installed <=> local')
assert_equal(-1, local.<=>(installed), 'local <=> installed') assert_equal(-1, local.<=>(installed), 'local <=> installed')
assert_equal(-1, specific.<=>(local), 'specific <=> local') assert_equal(-1, specific.<=>(local), 'specific <=> local')
assert_equal(1, local.<=>(specific), 'local <=> specific') assert_equal(1, local.<=>(specific), 'local <=> specific')
end end
end end

View File

@ -66,8 +66,8 @@ class TestGemSourceLock < Gem::TestCase
installed = Gem::Source::Installed.new installed = Gem::Source::Installed.new
lock = Gem::Source::Lock.new installed lock = Gem::Source::Lock.new installed
assert_equal(1, lock.<=>(installed), 'lock <=> installed') assert_equal(1, lock.<=>(installed), 'lock <=> installed')
assert_equal(-1, installed.<=>(lock), 'installed <=> lock') assert_equal(-1, installed.<=>(lock), 'installed <=> lock')
end end
def test_spaceship_local def test_spaceship_local
@ -75,7 +75,7 @@ class TestGemSourceLock < Gem::TestCase
lock = Gem::Source::Lock.new local # nonsense lock = Gem::Source::Lock.new local # nonsense
assert_equal(1, lock.<=>(local), 'lock <=> local') assert_equal(1, lock.<=>(local), 'lock <=> local')
assert_equal(-1, local.<=>(lock), 'local <=> lock') assert_equal(-1, local.<=>(lock), 'local <=> lock')
end end
def test_spaceship_remote def test_spaceship_remote
@ -83,7 +83,7 @@ class TestGemSourceLock < Gem::TestCase
lock = Gem::Source::Lock.new remote lock = Gem::Source::Lock.new remote
assert_equal(1, lock.<=>(remote), 'lock <=> remote') assert_equal(1, lock.<=>(remote), 'lock <=> remote')
assert_equal(-1, remote.<=>(lock), 'remote <=> lock') assert_equal(-1, remote.<=>(lock), 'remote <=> lock')
end end
def test_spaceship_specific_file def test_spaceship_specific_file
@ -92,7 +92,7 @@ class TestGemSourceLock < Gem::TestCase
specific = Gem::Source::SpecificFile.new gem specific = Gem::Source::SpecificFile.new gem
lock = Gem::Source::Lock.new specific # nonsense lock = Gem::Source::Lock.new specific # nonsense
assert_equal(1, lock.<=>(specific), 'lock <=> specific') assert_equal(1, lock.<=>(specific), 'lock <=> specific')
assert_equal(-1, specific.<=>(lock), 'specific <=> lock') assert_equal(-1, specific.<=>(lock), 'specific <=> lock')
end end
@ -101,7 +101,7 @@ class TestGemSourceLock < Gem::TestCase
lock = Gem::Source::Lock.new vendor lock = Gem::Source::Lock.new vendor
assert_equal(1, lock.<=>(vendor), 'lock <=> vendor') assert_equal(1, lock.<=>(vendor), 'lock <=> vendor')
assert_equal(-1, vendor.<=>(lock), 'vendor <=> lock') assert_equal(-1, vendor.<=>(lock), 'vendor <=> lock')
end end
def test_uri def test_uri

View File

@ -46,16 +46,16 @@ class TestGemSourceSpecificFile < Gem::TestCase
installed = Gem::Source::Installed.new installed = Gem::Source::Installed.new
local = Gem::Source::Local.new local = Gem::Source::Local.new
assert_equal(0, specific.<=>(specific), 'specific <=> specific') assert_equal(0, specific.<=>(specific), 'specific <=> specific')
assert_equal(-1, remote.<=>(specific), 'remote <=> specific') assert_equal(-1, remote.<=>(specific), 'remote <=> specific')
assert_equal(1, specific.<=>(remote), 'specific <=> remote') assert_equal(1, specific.<=>(remote), 'specific <=> remote')
assert_equal(-1, specific.<=>(local), 'specific <=> local') assert_equal(-1, specific.<=>(local), 'specific <=> local')
assert_equal(1, local. <=>(specific), 'local <=> specific') assert_equal(1, local. <=>(specific), 'local <=> specific')
assert_equal(-1, specific. <=>(installed), 'specific <=> installed') assert_equal(-1, specific. <=>(installed), 'specific <=> installed')
assert_equal(1, installed.<=>(specific), 'installed <=> specific') assert_equal(1, installed.<=>(specific), 'installed <=> specific')
a2 = quick_gem 'a', '2' a2 = quick_gem 'a', '2'
util_build_gem a2 util_build_gem a2

View File

@ -19,13 +19,13 @@ class TestGemSourceVendor < Gem::TestCase
assert_equal(0, vendor.<=>(vendor), 'vendor <=> vendor') assert_equal(0, vendor.<=>(vendor), 'vendor <=> vendor')
assert_equal(1, vendor.<=>(remote), 'vendor <=> remote') assert_equal(1, vendor.<=>(remote), 'vendor <=> remote')
assert_equal(-1, remote.<=>(vendor), 'remote <=> vendor') assert_equal(-1, remote.<=>(vendor), 'remote <=> vendor')
assert_equal(1, vendor.<=>(git), 'vendor <=> git') assert_equal(1, vendor.<=>(git), 'vendor <=> git')
assert_equal(-1, git.<=>(vendor), 'git <=> vendor') assert_equal(-1, git.<=>(vendor), 'git <=> vendor')
assert_equal(1, vendor.<=>(installed), 'vendor <=> installed') assert_equal(1, vendor.<=>(installed), 'vendor <=> installed')
assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor') assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor')
end end
end end

View File

@ -322,7 +322,7 @@ class TestGemSpecFetcher < Gem::TestCase
specs, _ = @sf.available_specs(:prerelease) specs, _ = @sf.available_specs(:prerelease)
expected = Gem::NameTuple.from_list \ expected = Gem::NameTuple.from_list \
[['a', v('2.a'), Gem::Platform::RUBY]] [['a', v('2.a'), Gem::Platform::RUBY]]
assert_equal expected, specs[@source] assert_equal expected, specs[@source]
end end

View File

@ -246,7 +246,7 @@ end
a1 = util_spec "a", "1", "b" => "> 0" a1 = util_spec "a", "1", "b" => "> 0"
b1 = util_spec "b", "1", "c" => ">= 0" # unresolved b1 = util_spec "b", "1", "c" => ">= 0" # unresolved
b2 = util_spec "b", "2", "c" => ">= 0" b2 = util_spec "b", "2", "c" => ">= 0"
c1 = util_spec "c", "1", nil, "lib/c#{$$}.rb" # 1st level c1 = util_spec "c", "1", nil, "lib/c#{$$}.rb" # 1st level
c2 = util_spec "c", "2", nil, "lib/c#{$$}.rb" c2 = util_spec "c", "2", nil, "lib/c#{$$}.rb"
install_specs c1, c2, b1, b2, a1 install_specs c1, c2, b1, b2, a1
@ -264,7 +264,7 @@ end
a1 = util_spec "a", "1", "b" => "> 0" a1 = util_spec "a", "1", "b" => "> 0"
b1 = util_spec "b", "1", "c" => ">= 0" # unresolved b1 = util_spec "b", "1", "c" => ">= 0" # unresolved
b2 = util_spec "b", "2", "c" => ">= 0" b2 = util_spec "b", "2", "c" => ">= 0"
c1 = util_spec "c", "1", "d" => ">= 0" # 1st level c1 = util_spec "c", "1", "d" => ">= 0" # 1st level
c2 = util_spec "c", "2", "d" => ">= 0" c2 = util_spec "c", "2", "d" => ">= 0"
d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb" d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
@ -520,11 +520,11 @@ end
def test_self_activate_via_require_wtf def test_self_activate_via_require_wtf
save_loaded_features do save_loaded_features do
a1 = util_spec "a", "1", "b" => "> 0", "d" => "> 0" # this a1 = util_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/b#{$$}.rb" b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/b#{$$}.rb"
b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b#{$$}.rb" # this b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b#{$$}.rb" # this
c1 = util_spec "c", "1" c1 = util_spec "c", "1"
c2 = util_spec "c", "2" # this c2 = util_spec "c", "2" # this
d1 = util_spec "d", "1", { "c" => "< 2" }, "lib/d#{$$}.rb" d1 = util_spec "d", "1", { "c" => "< 2" }, "lib/d#{$$}.rb"
d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d#{$$}.rb" # this d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d#{$$}.rb" # this
@ -1187,7 +1187,7 @@ dependencies: []
# create user spec # create user spec
user_spec_dir = File.join Gem.user_dir, 'specifications' user_spec_dir = File.join Gem.user_dir, 'specifications'
FileUtils.mkdir_p(user_spec_dir) unless Dir.exist? user_spec_dir FileUtils.mkdir_p(user_spec_dir) unless Dir.exist? user_spec_dir
# dirs doesn't include user ? # dirs doesn't include user ?
Gem::Specification.dirs << user_spec_dir Gem::Specification.dirs << user_spec_dir

View File

@ -23,7 +23,7 @@ class TestGemText < Gem::TestCase
end end
def test_format_text_no_space def test_format_text_no_space
assert_equal "texttowr\nap", format_text("texttowrap", 8) assert_equal "texttowr\nap", format_text("texttowrap", 8)
end end
def test_format_text_trailing # for two spaces after . def test_format_text_trailing # for two spaces after .