[rubygems/rubygems] Enable Style/ExtraSpacing
and auto-correct
https://github.com/rubygems/rubygems/commit/6fa0b1b679
This commit is contained in:
parent
c16815cca7
commit
061add792e
@ -115,7 +115,7 @@ module Gem
|
||||
# The default directory for binaries
|
||||
|
||||
def self.default_bindir
|
||||
if defined? RUBY_FRAMEWORK_VERSION # mac framework support
|
||||
if defined? RUBY_FRAMEWORK_VERSION # mac framework support
|
||||
'/usr/bin'
|
||||
else # generic install
|
||||
RbConfig::CONFIG['bindir']
|
||||
|
@ -30,7 +30,7 @@ module Gem::InstallUpdateOptions
|
||||
options[:bin_dir] = File.expand_path(value)
|
||||
end
|
||||
|
||||
add_option(:"Install/Update", '--document [TYPES]', Array,
|
||||
add_option(:"Install/Update", '--document [TYPES]', Array,
|
||||
'Generate documentation for installed gems',
|
||||
'List the documentation types you wish to',
|
||||
'generate. For example: rdoc,ri') do |value, options|
|
||||
@ -88,7 +88,7 @@ module Gem::InstallUpdateOptions
|
||||
options[:ignore_dependencies] = value
|
||||
end
|
||||
|
||||
add_option(:"Install/Update", '--[no-]format-executable',
|
||||
add_option(:"Install/Update", '--[no-]format-executable',
|
||||
'Make installed executable names match Ruby.',
|
||||
'If Ruby is ruby18, foo_exec will be',
|
||||
'foo_exec18') do |value, options|
|
||||
|
@ -56,7 +56,7 @@ class Gem::Platform
|
||||
when String then
|
||||
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
|
||||
arch.last << "-#{extra}"
|
||||
end
|
||||
@ -68,7 +68,7 @@ class Gem::Platform
|
||||
else cpu
|
||||
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
|
||||
return
|
||||
end
|
||||
|
@ -118,7 +118,7 @@ class Gem::RemoteFetcher
|
||||
|
||||
def download(spec, source_uri, install_dir = Gem.dir)
|
||||
cache_dir =
|
||||
if Dir.pwd == install_dir # see fetch_command
|
||||
if Dir.pwd == install_dir # see fetch_command
|
||||
install_dir
|
||||
elsif File.writable? install_dir
|
||||
File.join install_dir, "cache"
|
||||
|
@ -720,7 +720,7 @@ class Gem::Specification < Gem::BasicSpecification
|
||||
# Deprecated: You must now specify the executable name to Gem.bin_path.
|
||||
|
||||
attr_writer :default_executable
|
||||
deprecate :default_executable=, :none, 2018, 12
|
||||
deprecate :default_executable=, :none, 2018, 12
|
||||
|
||||
##
|
||||
# Allows deinstallation of gems with legacy platforms.
|
||||
@ -733,7 +733,7 @@ class Gem::Specification < Gem::BasicSpecification
|
||||
# Formerly used to set 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.
|
||||
@ -1725,7 +1725,7 @@ class Gem::Specification < Gem::BasicSpecification
|
||||
end
|
||||
result
|
||||
end
|
||||
deprecate :default_executable, :none, 2018, 12
|
||||
deprecate :default_executable, :none, 2018, 12
|
||||
|
||||
##
|
||||
# The default value for specification attribute +name+
|
||||
@ -1928,7 +1928,7 @@ class Gem::Specification < Gem::BasicSpecification
|
||||
def has_rdoc # :nodoc:
|
||||
true
|
||||
end
|
||||
deprecate :has_rdoc, :none, 2018, 12
|
||||
deprecate :has_rdoc, :none, 2018, 12
|
||||
|
||||
##
|
||||
# Deprecated and ignored.
|
||||
@ -1938,10 +1938,10 @@ class Gem::Specification < Gem::BasicSpecification
|
||||
def has_rdoc=(ignored) # :nodoc:
|
||||
@has_rdoc = true
|
||||
end
|
||||
deprecate :has_rdoc=, :none, 2018, 12
|
||||
deprecate :has_rdoc=, :none, 2018, 12
|
||||
|
||||
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
|
||||
|
@ -8,7 +8,7 @@ class Gem::SpecificationPolicy
|
||||
|
||||
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[
|
||||
bug_tracker_uri
|
||||
@ -281,7 +281,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
||||
platform = @specification.platform
|
||||
|
||||
case platform
|
||||
when Gem::Platform, Gem::Platform::RUBY # ok
|
||||
when Gem::Platform, Gem::Platform::RUBY # ok
|
||||
else
|
||||
error "invalid platform #{platform.inspect}, see Gem::Platform"
|
||||
end
|
||||
|
@ -1024,7 +1024,7 @@ Also, a list:
|
||||
|
||||
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
|
||||
|
||||
spec_fetcher.specs[@uri] = []
|
||||
|
@ -134,7 +134,7 @@ 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
|
||||
path = if Dir.pwd == install_dir # see fetch_command
|
||||
install_dir
|
||||
else
|
||||
File.join install_dir, "cache"
|
||||
|
@ -187,7 +187,7 @@ class Gem::Version
|
||||
# ver3 = Version.create(nil) # -> nil
|
||||
|
||||
def self.create(input)
|
||||
if self === input # check yourself before you wreck yourself
|
||||
if self === input # check yourself before you wreck yourself
|
||||
input
|
||||
elsif input.nil?
|
||||
nil
|
||||
|
@ -649,7 +649,7 @@ class TestGem < Gem::TestCase
|
||||
assert_directory_exists util_cache_dir
|
||||
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
|
||||
gemdir = File.join @tempdir, "egd"
|
||||
FileUtils.rm_r gemdir rescue nil
|
||||
|
@ -23,11 +23,11 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
||||
FileUtils.mkdir_p 'bin'
|
||||
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'
|
||||
end
|
||||
|
||||
File.open 'lib/rubygems.rb', 'w' do |io|
|
||||
File.open 'lib/rubygems.rb', 'w' do |io|
|
||||
io.puts '# rubygems.rb'
|
||||
end
|
||||
|
||||
@ -42,15 +42,15 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
||||
FileUtils.mkdir_p 'bundler/exe'
|
||||
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'
|
||||
end
|
||||
|
||||
File.open 'bundler/lib/bundler.rb', 'w' do |io|
|
||||
File.open 'bundler/lib/bundler.rb', 'w' do |io|
|
||||
io.puts '# bundler.rb'
|
||||
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'
|
||||
end
|
||||
|
||||
@ -63,7 +63,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
||||
gemspec.bindir = "exe"
|
||||
gemspec.executables = ["bundle"]
|
||||
|
||||
File.open 'bundler/bundler.gemspec', 'w' do |io|
|
||||
File.open 'bundler/bundler.gemspec', 'w' do |io|
|
||||
io.puts gemspec.to_ruby
|
||||
end
|
||||
|
||||
@ -317,19 +317,19 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
||||
FileUtils.mkdir_p lib_rubygems_defaults
|
||||
FileUtils.mkdir_p lib_bundler
|
||||
|
||||
File.open securerandom_rb, 'w' do |io|
|
||||
File.open securerandom_rb, 'w' do |io|
|
||||
io.puts '# securerandom.rb'
|
||||
end
|
||||
|
||||
File.open old_builder_rb, 'w' do |io|
|
||||
File.open old_builder_rb, 'w' do |io|
|
||||
io.puts '# builder.rb'
|
||||
end
|
||||
|
||||
File.open old_format_rb, 'w' do |io|
|
||||
File.open old_format_rb, 'w' do |io|
|
||||
io.puts '# format.rb'
|
||||
end
|
||||
|
||||
File.open old_bundler_c_rb, 'w' do |io|
|
||||
File.open old_bundler_c_rb, 'w' do |io|
|
||||
io.puts '# c.rb'
|
||||
end
|
||||
|
||||
@ -337,7 +337,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
||||
io.puts '# jruby.rb'
|
||||
end
|
||||
|
||||
File.open os_defaults_rb, 'w' do |io|
|
||||
File.open os_defaults_rb, 'w' do |io|
|
||||
io.puts '# operating_system.rb'
|
||||
end
|
||||
|
||||
|
@ -16,7 +16,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
|
||||
|
||||
def teardown
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -47,7 +47,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
|
||||
end
|
||||
|
||||
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]
|
||||
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 'Code: ', @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']
|
||||
end
|
||||
|
||||
@ -133,7 +133,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
|
||||
end
|
||||
|
||||
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
|
||||
assert_equal %w[gem_name=a version=1.0], body
|
||||
|
@ -385,7 +385,7 @@ if you believe they were disclosed to a third party.
|
||||
util_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,
|
||||
'bulk_threshold'
|
||||
assert_equal true, @cfg.update_sources, 'update_sources'
|
||||
|
@ -148,7 +148,7 @@ class TestGemDependencyInstaller < Gem::TestCase
|
||||
|
||||
FileUtils.mv @a1_gem, @tempdir
|
||||
FileUtils.mv @b1_gem, @tempdir
|
||||
FileUtils.mv e1_gem, @tempdir
|
||||
FileUtils.mv e1_gem, @tempdir
|
||||
|
||||
inst = nil
|
||||
|
||||
@ -239,7 +239,7 @@ class TestGemDependencyInstaller < Gem::TestCase
|
||||
FileUtils.mv @a1_gem, @tempdir
|
||||
FileUtils.mv a2_gem, @tempdir # not in index
|
||||
FileUtils.mv @b1_gem, @tempdir
|
||||
FileUtils.mv a3_gem, @tempdir
|
||||
FileUtils.mv a3_gem, @tempdir
|
||||
|
||||
Dir.chdir @tempdir do
|
||||
Gem::DependencyInstaller.new.install 'a', req("= 2")
|
||||
|
@ -134,7 +134,7 @@ class TestGemDependencyList < Gem::TestCase
|
||||
end
|
||||
|
||||
def test_why_not_ok_eh
|
||||
assert_equal({}, @deplist.why_not_ok?)
|
||||
assert_equal({}, @deplist.why_not_ok?)
|
||||
|
||||
@deplist.add @b2
|
||||
|
||||
@ -162,7 +162,7 @@ class TestGemDependencyList < Gem::TestCase
|
||||
|
||||
@deplist.add a, b0, b1
|
||||
|
||||
assert_equal({}, @deplist.why_not_ok?)
|
||||
assert_equal({}, @deplist.why_not_ok?)
|
||||
end
|
||||
|
||||
def test_ok_eh_mismatch
|
||||
|
@ -151,7 +151,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
||||
|
||||
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'
|
||||
end
|
||||
|
||||
@ -185,7 +185,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
||||
|
||||
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'
|
||||
end
|
||||
|
||||
@ -536,11 +536,11 @@ class TestGemPackage < Gem::Package::TarTestCase
|
||||
package = Gem::Package.new @gem
|
||||
|
||||
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'
|
||||
end
|
||||
|
||||
tar.mkdir 'lib', 0755
|
||||
tar.mkdir 'lib', 0755
|
||||
tar.add_symlink 'lib/foo.rb', '../relative.rb', 0644
|
||||
end
|
||||
|
||||
@ -635,7 +635,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
||||
tar.add_file 'lib/foo.rb', 0644 do |io|
|
||||
io.write 'hi'
|
||||
end
|
||||
tar.mkdir 'lib/foo', 0755
|
||||
tar.mkdir 'lib/foo', 0755
|
||||
end
|
||||
|
||||
package.extract_tar_gz tgz_io, @destination
|
||||
@ -1097,7 +1097,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
||||
$bad_name = vm
|
||||
|
||||
entry = Object.new
|
||||
def entry.full_name() $bad_name end
|
||||
def entry.full_name() $bad_name end
|
||||
|
||||
package = Gem::Package.new(@gem)
|
||||
package.instance_variable_set(:@files, [])
|
||||
|
@ -26,7 +26,7 @@ class TestGemPackageTask < Gem::TestCase
|
||||
g.summary = 'summary'
|
||||
end
|
||||
|
||||
pkg = Gem::PackageTask.new(gem) do |p|
|
||||
pkg = Gem::PackageTask.new(gem) do |p|
|
||||
p.package_files << "y"
|
||||
end
|
||||
|
||||
@ -49,7 +49,7 @@ class TestGemPackageTask < Gem::TestCase
|
||||
g.files = Rake::FileList["x"].resolve
|
||||
g.platform = Gem::Platform::CURRENT
|
||||
end
|
||||
pkg = Gem::PackageTask.new(gem) do |p|
|
||||
pkg = Gem::PackageTask.new(gem) do |p|
|
||||
p.package_files << "y"
|
||||
end
|
||||
assert_equal ["x", "y"], pkg.package_files
|
||||
@ -62,7 +62,7 @@ class TestGemPackageTask < Gem::TestCase
|
||||
g.files = Rake::FileList["x"].resolve
|
||||
g.platform = Gem::Platform::RUBY
|
||||
end
|
||||
pkg = Gem::PackageTask.new(gem) do |p|
|
||||
pkg = Gem::PackageTask.new(gem) do |p|
|
||||
p.package_files << "y"
|
||||
end
|
||||
assert_equal ["x", "y"], pkg.package_files
|
||||
|
@ -1043,7 +1043,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
||||
@ssl_server_thread.kill.join
|
||||
@ssl_server_thread = nil
|
||||
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)
|
||||
end
|
||||
|
||||
|
@ -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/'), 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
|
||||
|
||||
def test_initialize_uri
|
||||
set = @DR::APISet.new @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
|
||||
|
||||
def test_find_all
|
||||
|
@ -199,21 +199,21 @@ class TestGemSource < Gem::TestCase
|
||||
installed = Gem::Source::Installed.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, specific.<=>(remote), 'specific <=> remote')
|
||||
assert_equal(-1, remote.<=>(specific), 'remote <=> specific')
|
||||
assert_equal(1, specific.<=>(remote), 'specific <=> remote')
|
||||
|
||||
assert_equal(-1, remote.<=>(local), 'remote <=> local')
|
||||
assert_equal(1, local.<=>(remote), 'local <=> remote')
|
||||
assert_equal(-1, remote.<=>(local), 'remote <=> local')
|
||||
assert_equal(1, local.<=>(remote), 'local <=> remote')
|
||||
|
||||
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.instance_variable_set :@uri, nil
|
||||
|
||||
assert_equal(-1, remote.<=>(no_uri), 'remote <=> no_uri')
|
||||
assert_equal(-1, remote.<=>(no_uri), 'remote <=> no_uri')
|
||||
end
|
||||
|
||||
def test_spaceship_order_is_preserved_when_uri_differs
|
||||
|
@ -211,13 +211,13 @@ class TestGemSourceGit < Gem::TestCase
|
||||
assert_equal(0, git.<=>(git), 'git <=> git')
|
||||
|
||||
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, installed.<=>(git), 'installed <=> git')
|
||||
assert_equal(-1, installed.<=>(git), 'installed <=> git')
|
||||
|
||||
assert_equal(-1, git.<=>(vendor), 'git <=> vendor')
|
||||
assert_equal(1, vendor.<=>(git), 'vendor <=> git')
|
||||
assert_equal(-1, git.<=>(vendor), 'git <=> vendor')
|
||||
assert_equal(1, vendor.<=>(git), 'vendor <=> git')
|
||||
end
|
||||
|
||||
def test_specs
|
||||
|
@ -27,10 +27,10 @@ class TestGemSourceInstalled < Gem::TestCase
|
||||
assert_equal(1, installed.<=>(specific), 'installed <=> specific')
|
||||
|
||||
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, installed.<=>(vendor), 'installed <=> vendor')
|
||||
assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -93,16 +93,16 @@ class TestGemSourceLocal < Gem::TestCase
|
||||
installed = Gem::Source::Installed.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, local.<=>(remote), 'local <=> remote')
|
||||
assert_equal(-1, remote.<=>(local), 'remote <=> local')
|
||||
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, specific.<=>(local), 'specific <=> local')
|
||||
assert_equal(1, local.<=>(specific), 'local <=> specific')
|
||||
assert_equal(-1, specific.<=>(local), 'specific <=> local')
|
||||
assert_equal(1, local.<=>(specific), 'local <=> specific')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -66,8 +66,8 @@ class TestGemSourceLock < Gem::TestCase
|
||||
installed = Gem::Source::Installed.new
|
||||
lock = Gem::Source::Lock.new installed
|
||||
|
||||
assert_equal(1, lock.<=>(installed), 'lock <=> installed')
|
||||
assert_equal(-1, installed.<=>(lock), 'installed <=> lock')
|
||||
assert_equal(1, lock.<=>(installed), 'lock <=> installed')
|
||||
assert_equal(-1, installed.<=>(lock), 'installed <=> lock')
|
||||
end
|
||||
|
||||
def test_spaceship_local
|
||||
@ -75,7 +75,7 @@ class TestGemSourceLock < Gem::TestCase
|
||||
lock = Gem::Source::Lock.new local # nonsense
|
||||
|
||||
assert_equal(1, lock.<=>(local), 'lock <=> local')
|
||||
assert_equal(-1, local.<=>(lock), 'local <=> lock')
|
||||
assert_equal(-1, local.<=>(lock), 'local <=> lock')
|
||||
end
|
||||
|
||||
def test_spaceship_remote
|
||||
@ -83,7 +83,7 @@ class TestGemSourceLock < Gem::TestCase
|
||||
lock = Gem::Source::Lock.new remote
|
||||
|
||||
assert_equal(1, lock.<=>(remote), 'lock <=> remote')
|
||||
assert_equal(-1, remote.<=>(lock), 'remote <=> lock')
|
||||
assert_equal(-1, remote.<=>(lock), 'remote <=> lock')
|
||||
end
|
||||
|
||||
def test_spaceship_specific_file
|
||||
@ -92,7 +92,7 @@ class TestGemSourceLock < Gem::TestCase
|
||||
specific = Gem::Source::SpecificFile.new gem
|
||||
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')
|
||||
end
|
||||
|
||||
@ -101,7 +101,7 @@ class TestGemSourceLock < Gem::TestCase
|
||||
lock = Gem::Source::Lock.new vendor
|
||||
|
||||
assert_equal(1, lock.<=>(vendor), 'lock <=> vendor')
|
||||
assert_equal(-1, vendor.<=>(lock), 'vendor <=> lock')
|
||||
assert_equal(-1, vendor.<=>(lock), 'vendor <=> lock')
|
||||
end
|
||||
|
||||
def test_uri
|
||||
|
@ -46,16 +46,16 @@ class TestGemSourceSpecificFile < Gem::TestCase
|
||||
installed = Gem::Source::Installed.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, specific.<=>(remote), 'specific <=> remote')
|
||||
assert_equal(-1, remote.<=>(specific), 'remote <=> specific')
|
||||
assert_equal(1, specific.<=>(remote), 'specific <=> remote')
|
||||
|
||||
assert_equal(-1, specific.<=>(local), 'specific <=> local')
|
||||
assert_equal(1, local. <=>(specific), 'local <=> specific')
|
||||
|
||||
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'
|
||||
util_build_gem a2
|
||||
|
@ -19,13 +19,13 @@ class TestGemSourceVendor < Gem::TestCase
|
||||
assert_equal(0, vendor.<=>(vendor), 'vendor <=> vendor')
|
||||
|
||||
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, git.<=>(vendor), 'git <=> vendor')
|
||||
assert_equal(1, vendor.<=>(git), 'vendor <=> git')
|
||||
assert_equal(-1, git.<=>(vendor), 'git <=> vendor')
|
||||
|
||||
assert_equal(1, vendor.<=>(installed), 'vendor <=> installed')
|
||||
assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor')
|
||||
assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -322,7 +322,7 @@ class TestGemSpecFetcher < Gem::TestCase
|
||||
specs, _ = @sf.available_specs(:prerelease)
|
||||
|
||||
expected = Gem::NameTuple.from_list \
|
||||
[['a', v('2.a'), Gem::Platform::RUBY]]
|
||||
[['a', v('2.a'), Gem::Platform::RUBY]]
|
||||
|
||||
assert_equal expected, specs[@source]
|
||||
end
|
||||
|
@ -246,7 +246,7 @@ end
|
||||
a1 = util_spec "a", "1", "b" => "> 0"
|
||||
b1 = util_spec "b", "1", "c" => ">= 0" # unresolved
|
||||
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"
|
||||
|
||||
install_specs c1, c2, b1, b2, a1
|
||||
@ -264,7 +264,7 @@ end
|
||||
a1 = util_spec "a", "1", "b" => "> 0"
|
||||
b1 = util_spec "b", "1", "c" => ">= 0" # unresolved
|
||||
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"
|
||||
d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
|
||||
d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
|
||||
@ -520,11 +520,11 @@ end
|
||||
|
||||
def test_self_activate_via_require_wtf
|
||||
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"
|
||||
b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b#{$$}.rb" # this
|
||||
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"
|
||||
d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d#{$$}.rb" # this
|
||||
|
||||
@ -1187,7 +1187,7 @@ dependencies: []
|
||||
|
||||
# create user spec
|
||||
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 ?
|
||||
Gem::Specification.dirs << user_spec_dir
|
||||
|
||||
|
@ -23,7 +23,7 @@ class TestGemText < Gem::TestCase
|
||||
end
|
||||
|
||||
def test_format_text_no_space
|
||||
assert_equal "texttowr\nap", format_text("texttowrap", 8)
|
||||
assert_equal "texttowr\nap", format_text("texttowrap", 8)
|
||||
end
|
||||
|
||||
def test_format_text_trailing # for two spaces after .
|
||||
|
Loading…
x
Reference in New Issue
Block a user