diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-04-05 10:50:15 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-04-05 05:49:25 +0000 |
commit | a464951fc79271a87d09a13f8fd9965dda6e2e61 (patch) | |
tree | fd3610e162e702da9a20a52a14a5f4dc637074a0 | |
parent | cbeea5f3e6a5b5112ff5973c02c934ed415e2dc7 (diff) |
[rubygems/rubygems] Unify win_platform? to Gem.win_platform?
https://github.com/rubygems/rubygems/commit/b18a4ef076
24 files changed, 63 insertions, 77 deletions
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb index a7f7bafc24..4629a74040 100644 --- a/test/rubygems/helper.rb +++ b/test/rubygems/helper.rb @@ -414,7 +414,7 @@ class Gem::TestCase < Test::Unit::TestCase @orig_arch = RbConfig::CONFIG["arch"] - if win_platform? + if Gem.win_platform? util_set_arch "i386-mswin32" else util_set_arch "i686-darwin8.10.1" @@ -1132,20 +1132,6 @@ Also, a list: end ## - # Is this test being run on a Windows platform? - - def self.win_platform? - Gem.win_platform? - end - - ## - # see ::win_platform? - - def win_platform? - self.class.win_platform? - end - - ## # Returns whether or not we're on a version of Ruby built with VC++ (or # Borland) versus Cygwin, Mingw, etc. diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 5b6da8ba21..4494231a65 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -152,10 +152,10 @@ class TestGem < Gem::TestCase end def assert_self_install_permissions(format_executable: false) - mask = win_platform? ? 0700 : 0777 + mask = Gem.win_platform? ? 0700 : 0777 options = { :dir_mode => 0500, - :prog_mode => win_platform? ? 0410 : 0510, + :prog_mode => Gem.win_platform? ? 0410 : 0510, :data_mode => 0640, :wrappers => true, :format_executable => format_executable, @@ -192,7 +192,7 @@ class TestGem < Gem::TestCase "gems/foo-1/data/foo.txt" => data_mode, } # add Windows script - expected["bin/#{prog_name}.bat"] = mask.to_s(8) if win_platform? + expected["bin/#{prog_name}.bat"] = mask.to_s(8) if Gem.win_platform? result = {} Dir.chdir @gemhome do expected.each_key do |n| @@ -645,7 +645,7 @@ class TestGem < Gem::TestCase assert_equal 0750, File::Stat.new(@gemhome).mode & 0777 assert_equal 0750, File::Stat.new(File.join(@gemhome, "cache")).mode & 0777 - end unless win_platform? + end unless Gem.win_platform? def test_self_ensure_gem_directories_safe_permissions FileUtils.rm_r @gemhome @@ -659,7 +659,7 @@ class TestGem < Gem::TestCase assert_equal 0, File::Stat.new(File.join(@gemhome, "cache")).mode & 002 ensure File.umask old_umask - end unless win_platform? + end unless Gem.win_platform? def test_self_ensure_gem_directories_missing_parents gemdir = File.join @tempdir, "a/b/c/gemdir" @@ -677,7 +677,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 Gem.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" begin diff --git a/test/rubygems/test_gem_bundler_version_finder.rb b/test/rubygems/test_gem_bundler_version_finder.rb index 1de4809aec..6d88810493 100644 --- a/test/rubygems/test_gem_bundler_version_finder.rb +++ b/test/rubygems/test_gem_bundler_version_finder.rb @@ -79,7 +79,7 @@ class TestGemBundlerVersionFinder < Gem::TestCase end def test_deleted_directory - pend "Cannot perform this test on windows" if win_platform? + pend "Cannot perform this test on windows" if Gem.win_platform? pend "Cannot perform this test on Solaris" if RUBY_PLATFORM.include?("solaris") require "tmpdir" diff --git a/test/rubygems/test_gem_commands_cert_command.rb b/test/rubygems/test_gem_commands_cert_command.rb index 59390afd4d..65d0b0b6fb 100644 --- a/test/rubygems/test_gem_commands_cert_command.rb +++ b/test/rubygems/test_gem_commands_cert_command.rb @@ -500,7 +500,7 @@ Removed '/CN=alternate/DC=example' mask = 0100600 & (~File.umask) - assert_equal mask, File.stat(path).mode unless win_platform? + assert_equal mask, File.stat(path).mode unless Gem.win_platform? end def test_execute_sign_encrypted_key @@ -529,7 +529,7 @@ Removed '/CN=alternate/DC=example' mask = 0100600 & (~File.umask) - assert_equal mask, File.stat(path).mode unless win_platform? + assert_equal mask, File.stat(path).mode unless Gem.win_platform? end def test_execute_sign_default @@ -561,7 +561,7 @@ Removed '/CN=alternate/DC=example' mask = 0100600 & (~File.umask) - assert_equal mask, File.stat(path).mode unless win_platform? + assert_equal mask, File.stat(path).mode unless Gem.win_platform? end def test_execute_sign_default_encrypted_key @@ -593,7 +593,7 @@ Removed '/CN=alternate/DC=example' mask = 0100600 & (~File.umask) - assert_equal mask, File.stat(path).mode unless win_platform? + assert_equal mask, File.stat(path).mode unless Gem.win_platform? end def test_execute_sign_no_cert diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb index bcbcf8b54d..259beb6b0d 100644 --- a/test/rubygems/test_gem_commands_cleanup_command.rb +++ b/test/rubygems/test_gem_commands_cleanup_command.rb @@ -184,7 +184,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase assert_path_exist @a_1_1.gem_dir ensure FileUtils.chmod 0755, @gemhome - end unless win_platform? || Process.uid.zero? + end unless Gem.win_platform? || Process.uid.zero? def test_execute_dry_run @cmd.options[:args] = %w[a] diff --git a/test/rubygems/test_gem_commands_generate_index_command.rb b/test/rubygems/test_gem_commands_generate_index_command.rb index d16d82bdb3..7e719a5f60 100644 --- a/test/rubygems/test_gem_commands_generate_index_command.rb +++ b/test/rubygems/test_gem_commands_generate_index_command.rb @@ -35,7 +35,7 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase end def test_handle_options_directory - return if win_platform? + return if Gem.win_platform? refute_equal "/nonexistent", @cmd.options[:directory] @cmd.handle_options %w[--directory /nonexistent] @@ -44,7 +44,7 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase end def test_handle_options_directory_windows - return unless win_platform? + return unless Gem.win_platform? refute_equal "/nonexistent", @cmd.options[:directory] diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index 53ae0b2a04..2d26f36069 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -189,7 +189,7 @@ ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in a end def test_execute_no_user_install - pend "skipped on MS Windows (chmod has no effect)" if win_platform? + pend "skipped on MS Windows (chmod has no effect)" if Gem.win_platform? pend "skipped in root privilege" if Process.uid.zero? specs = spec_fetcher do |fetcher| diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb index b34591fd6a..be9be4b802 100644 --- a/test/rubygems/test_gem_commands_pristine_command.rb +++ b/test/rubygems/test_gem_commands_pristine_command.rb @@ -160,7 +160,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase ruby_exec = sprintf Gem.default_exec_format, "ruby" - bin_env = win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " " + bin_env = Gem.win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " " assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(gem_exec) end diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb index 02c6a1b957..978c9335ff 100644 --- a/test/rubygems/test_gem_commands_setup_command.rb +++ b/test/rubygems/test_gem_commands_setup_command.rb @@ -142,7 +142,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase ruby_exec = sprintf Gem.default_exec_format, "ruby" - bin_env = win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " " + bin_env = Gem.win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " " assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_gem_bin_path) assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_bundle_bin_path) assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_bundler_bin_path) diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb index 49cfce0b09..2dceb261dc 100644 --- a/test/rubygems/test_gem_commands_uninstall_command.rb +++ b/test/rubygems/test_gem_commands_uninstall_command.rb @@ -114,7 +114,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase def test_execute_removes_executable initial_install - if win_platform? + if Gem.win_platform? assert File.exist?(@executable) else assert File.symlink?(@executable) diff --git a/test/rubygems/test_gem_commands_unpack_command.rb b/test/rubygems/test_gem_commands_unpack_command.rb index 300b8409e5..e41b6bf2b9 100644 --- a/test/rubygems/test_gem_commands_unpack_command.rb +++ b/test/rubygems/test_gem_commands_unpack_command.rb @@ -152,7 +152,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase end def test_execute_sudo - pend "Cannot perform this test on windows (chmod)" if win_platform? + pend "Cannot perform this test on windows (chmod)" if Gem.win_platform? util_make_gems diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb index d6c8d220e3..c65b18af90 100644 --- a/test/rubygems/test_gem_config_file.rb +++ b/test/rubygems/test_gem_config_file.rb @@ -196,7 +196,7 @@ class TestGemConfigFile < Gem::TestCase end def test_check_credentials_permissions - pend "chmod not supported" if win_platform? + pend "chmod not supported" if Gem.win_platform? @cfg.rubygems_api_key = "x" @@ -335,7 +335,7 @@ if you believe they were disclosed to a third party. end def test_load_api_keys_bad_permission - pend "chmod not supported" if win_platform? + pend "chmod not supported" if Gem.win_platform? @cfg.rubygems_api_key = "x" @@ -369,7 +369,7 @@ if you believe they were disclosed to a third party. assert_equal expected, load_yaml_file(@cfg.credentials_path) - unless win_platform? + unless Gem.win_platform? stat = File.stat @cfg.credentials_path assert_equal 0600, stat.mode & 0600 @@ -377,7 +377,7 @@ if you believe they were disclosed to a third party. end def test_rubygems_api_key_equals_bad_permission - pend "chmod not supported" if win_platform? + pend "chmod not supported" if Gem.win_platform? @cfg.rubygems_api_key = "x" diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb index e9d0646881..1c30f6e59d 100644 --- a/test/rubygems/test_gem_dependency_installer.rb +++ b/test/rubygems/test_gem_dependency_installer.rb @@ -895,7 +895,7 @@ class TestGemDependencyInstaller < Gem::TestCase end # Wrappers don't work on mswin - unless win_platform? + unless Gem.win_platform? def test_install_no_wrappers util_setup_gems diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb index 1526eadcb6..9b136363d0 100644 --- a/test/rubygems/test_gem_install_update_options.rb +++ b/test/rubygems/test_gem_install_update_options.rb @@ -137,7 +137,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase util_build_gem @spec @gem = @spec.cache_file - if win_platform? + if Gem.win_platform? pend("test_user_install_disabled_read_only test skipped on MS Windows") elsif Process.uid.zero? pend("test_user_install_disabled_read_only test skipped in root privilege") diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index 95f825e170..8fdadbb2f7 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -213,7 +213,7 @@ gem 'other', version assert_empty @ui.error - return unless win_platform? + return unless Gem.win_platform? ENV["PATH"] = [orig_PATH, bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)].join(File::PATH_SEPARATOR) @@ -227,7 +227,7 @@ gem 'other', version end def test_check_that_user_bin_dir_is_in_path_tilde - pend "Tilde is PATH is not supported under MS Windows" if win_platform? + pend "Tilde is PATH is not supported under MS Windows" if Gem.win_platform? orig_PATH = ENV["PATH"] ENV["PATH"] = [ENV["PATH"], "~/bin"].join(File::PATH_SEPARATOR) @@ -241,7 +241,7 @@ gem 'other', version assert_empty @ui.error ensure - ENV["PATH"] = orig_PATH unless win_platform? + ENV["PATH"] = orig_PATH unless Gem.win_platform? end def test_check_that_user_bin_dir_is_in_path_not_in_path @@ -335,7 +335,7 @@ gem 'other', version assert_directory_exists util_inst_bindir installed_exec = File.join(util_inst_bindir, "executable") assert_path_exist installed_exec - assert_equal mask, File.stat(installed_exec).mode unless win_platform? + assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform? wrapper = File.read installed_exec assert_match %r{generated by RubyGems}, wrapper @@ -380,7 +380,7 @@ gem 'other', version assert_directory_exists util_inst_bindir installed_exec = File.join util_inst_bindir, "executable" assert_path_exist installed_exec - assert_equal mask, File.stat(installed_exec).mode unless win_platform? + assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform? wrapper = File.read installed_exec assert_match %r{generated by RubyGems}, wrapper @@ -439,7 +439,7 @@ gem 'other', version installed_exec = File.join("#{@gemhome}2", "bin", "executable") assert_path_exist installed_exec - assert_equal mask, File.stat(installed_exec).mode unless win_platform? + assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform? wrapper = File.read installed_exec assert_match %r{generated by RubyGems}, wrapper @@ -464,7 +464,7 @@ gem 'other', version Dir.mkdir util_inst_bindir - if win_platform? + if Gem.win_platform? pend("test_generate_bin_script_no_perms skipped on MS Windows") elsif Process.uid.zero? pend("test_generate_bin_script_no_perms skipped in root privilege") @@ -476,7 +476,7 @@ gem 'other', version end end ensure - FileUtils.chmod 0755, util_inst_bindir unless $DEBUG || win_platform? + FileUtils.chmod 0755, util_inst_bindir unless $DEBUG || Gem.win_platform? end def test_generate_bin_script_no_shebang @@ -496,7 +496,7 @@ gem 'other', version installed_exec = File.join @gemhome, "bin", "executable" assert_path_exist installed_exec - assert_equal mask, File.stat(installed_exec).mode unless win_platform? + assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform? wrapper = File.read installed_exec assert_match %r{generated by RubyGems}, wrapper @@ -523,7 +523,7 @@ gem 'other', version installer.generate_bin assert_directory_exists util_inst_bindir assert_path_exist installed_exec - assert_equal mask, File.stat(installed_exec).mode unless win_platform? + assert_equal mask, File.stat(installed_exec).mode unless Gem.win_platform? assert_match %r{generated by RubyGems}, File.read(installed_exec) @@ -568,7 +568,7 @@ gem 'other', version Dir.mkdir util_inst_bindir - if win_platform? + if Gem.win_platform? pend("test_generate_bin_symlink_no_perms skipped on MS Windows") elsif Process.uid.zero? pend("test_user_install_disabled_read_only test skipped in root privilege") @@ -580,7 +580,7 @@ gem 'other', version end end ensure - FileUtils.chmod 0755, util_inst_bindir unless $DEBUG || win_platform? + FileUtils.chmod 0755, util_inst_bindir unless $DEBUG || Gem.win_platform? end def test_generate_bin_symlink_update_newer @@ -987,7 +987,7 @@ gem 'other', version assert_path_exist exe exe_mode = File.stat(exe).mode & 0111 - assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform? + assert_equal 0111, exe_mode, "0%o" % exe_mode unless Gem.win_platform? assert_path_exist File.join gemdir, "lib", "code.rb" @@ -2118,7 +2118,7 @@ gem 'other', version end def get_bin_env - if win_platform? + if Gem.win_platform? "" else %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb index de12360e6e..cb1f9d4556 100644 --- a/test/rubygems/test_gem_package.rb +++ b/test/rubygems/test_gem_package.rb @@ -189,7 +189,7 @@ class TestGemPackage < Gem::Package::TarTestCase File.symlink("code.rb", "lib/code_sym.rb") File.symlink("../lib/code.rb", "lib/code_sym2.rb") rescue Errno::EACCES => e - if win_platform? + if Gem.win_platform? pend "symlink - must be admin with no UAC on Windows" else raise e @@ -482,7 +482,7 @@ class TestGemPackage < Gem::Package::TarTestCase mask = 0100666 & (~File.umask) assert_equal mask.to_s(8), File.stat(extracted).mode.to_s(8) unless - win_platform? + Gem.win_platform? end def test_extract_files_empty @@ -512,7 +512,7 @@ class TestGemPackage < Gem::Package::TarTestCase end def test_extract_file_permissions - pend "chmod not supported" if win_platform? + pend "chmod not supported" if Gem.win_platform? gem_with_long_permissions = File.expand_path("packages/Bluebie-legs-0.6.2.gem", __dir__) @@ -559,7 +559,7 @@ class TestGemPackage < Gem::Package::TarTestCase begin package.extract_tar_gz tgz_io, @destination rescue Errno::EACCES => e - if win_platform? + if Gem.win_platform? pend "symlink - must be admin with no UAC on Windows" else raise e @@ -612,7 +612,7 @@ class TestGemPackage < Gem::Package::TarTestCase destination_subdir = File.join @destination, "subdir" FileUtils.mkdir_p destination_subdir - expected_exceptions = win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError] + expected_exceptions = Gem.win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError] e = assert_raise(*expected_exceptions) do package.extract_tar_gz tgz_io, destination_subdir @@ -647,7 +647,7 @@ class TestGemPackage < Gem::Package::TarTestCase tar.add_symlink "link/dir", ".", 16_877 end - expected_exceptions = win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError] + expected_exceptions = Gem.win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError] e = assert_raise(*expected_exceptions) do package.extract_tar_gz tgz_io, destination_subdir diff --git a/test/rubygems/test_gem_package_old.rb b/test/rubygems/test_gem_package_old.rb index 25e5cebb99..9dba33fc60 100644 --- a/test/rubygems/test_gem_package_old.rb +++ b/test/rubygems/test_gem_package_old.rb @@ -41,7 +41,7 @@ unless Gem.java_platform? # jruby can't require the simple_gem file mask = 0100644 & (~File.umask) - assert_equal mask, File.stat(extracted).mode unless win_platform? + assert_equal mask, File.stat(extracted).mode unless Gem.win_platform? end def test_extract_files_security_policy diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb index 4509b6d56f..38bfc9bce4 100644 --- a/test/rubygems/test_gem_platform.rb +++ b/test/rubygems/test_gem_platform.rb @@ -212,7 +212,7 @@ class TestGemPlatform < Gem::TestCase end def test_to_s - if win_platform? + if Gem.win_platform? assert_equal "x86-mswin32-60", Gem::Platform.local.to_s else assert_equal "x86-darwin-8", Gem::Platform.local.to_s diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb index dd4c72d1dd..fa2d9e107d 100644 --- a/test/rubygems/test_gem_remote_fetcher.rb +++ b/test/rubygems/test_gem_remote_fetcher.rb @@ -354,7 +354,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== assert File.exist?(a1_cache_gem) end - unless win_platform? || Process.uid.zero? # File.chmod doesn't work + unless Gem.win_platform? || Process.uid.zero? # File.chmod doesn't work def test_download_local_read_only FileUtils.mv @a1_gem, @tempdir local_path = File.join @tempdir, @a1.file_name diff --git a/test/rubygems/test_gem_request_set_gem_dependency_api.rb b/test/rubygems/test_gem_request_set_gem_dependency_api.rb index caee4db6f1..cd925710cc 100644 --- a/test/rubygems/test_gem_request_set_gem_dependency_api.rb +++ b/test/rubygems/test_gem_request_set_gem_dependency_api.rb @@ -679,7 +679,7 @@ end end def test_platform_mswin - if win_platform? + if Gem.win_platform? util_set_arch "x86-mswin32-60" do @gda.platform :mswin do @gda.gem "a" @@ -740,7 +740,7 @@ end end def test_platforms - unless win_platform? + unless Gem.win_platform? util_set_arch "i686-darwin8.10.1" do @gda.platforms :ruby do @gda.gem "a" diff --git a/test/rubygems/test_gem_security_trust_dir.rb b/test/rubygems/test_gem_security_trust_dir.rb index b13cf42eeb..f398ab40f9 100644 --- a/test/rubygems/test_gem_security_trust_dir.rb +++ b/test/rubygems/test_gem_security_trust_dir.rb @@ -58,7 +58,7 @@ class TestGemSecurityTrustDir < Gem::TestCase mask = 0100600 & (~File.umask) - assert_equal mask, File.stat(trusted).mode unless win_platform? + assert_equal mask, File.stat(trusted).mode unless Gem.win_platform? assert_equal PUBLIC_CERT.to_pem, File.read(trusted) end @@ -73,7 +73,7 @@ class TestGemSecurityTrustDir < Gem::TestCase mask = 040700 & (~File.umask) mask |= 0200000 if RUBY_PLATFORM.include?("aix") - assert_equal mask, File.stat(@dest_dir).mode unless win_platform? + assert_equal mask, File.stat(@dest_dir).mode unless Gem.win_platform? end def test_verify_file @@ -94,6 +94,6 @@ class TestGemSecurityTrustDir < Gem::TestCase mask = 040700 & (~File.umask) mask |= 0200000 if RUBY_PLATFORM.include?("aix") - assert_equal mask, File.stat(@dest_dir).mode unless win_platform? + assert_equal mask, File.stat(@dest_dir).mode unless Gem.win_platform? end end if Gem::HAVE_OPENSSL diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index c0233b2002..74685606c0 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -1451,7 +1451,7 @@ dependencies: [] @ext.build_extensions assert_path_not_exist @ext.extension_dir ensure - unless $DEBUG || win_platform? || Process.uid.zero? || Gem.java_platform? + unless $DEBUG || Gem.win_platform? || Process.uid.zero? || Gem.java_platform? FileUtils.chmod 0755, File.join(@ext.base_dir, "extensions") FileUtils.chmod 0755, @ext.base_dir end @@ -1858,7 +1858,7 @@ dependencies: [] @a1.instance_variable_set :@new_platform, "mswin32" assert_equal "a-1-mswin32", @a1.full_name, "legacy" - return if win_platform? + return if Gem.win_platform? @a1 = Gem::Specification.new "a", 1 @a1.platform = "current" @@ -2380,7 +2380,7 @@ end expected = <<-SPEC # -*- encoding: utf-8 -*- -# stub: a 1 #{win_platform? ? "x86-mswin32-60" : "x86-darwin-8"} #{stub_require_paths} +# stub: a 1 #{Gem.win_platform? ? "x86-mswin32-60" : "x86-darwin-8"} #{stub_require_paths} # stub: #{extensions} Gem::Specification.new do |s| @@ -2897,7 +2897,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use: end def test_validate_empty_require_paths - if win_platform? + if Gem.win_platform? pend "test_validate_empty_require_paths skipped on MS Windows (symlink)" else util_setup_validate @@ -2913,7 +2913,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use: end def test_validate_files - pend "test_validate_files skipped on MS Windows (symlink)" if win_platform? + pend "test_validate_files skipped on MS Windows (symlink)" if Gem.win_platform? util_setup_validate @a1.files += ["lib", "lib2"] diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb index ecbc898ad7..212cf8c9a0 100644 --- a/test/rubygems/test_gem_uninstaller.rb +++ b/test/rubygems/test_gem_uninstaller.rb @@ -252,12 +252,12 @@ class TestGemUninstaller < Gem::InstallerTestCase gem_dir = File.join @gemhome, "gems", @spec.full_name Gem.pre_uninstall do - sleep(0.1) if win_platform? + sleep(0.1) if Gem.win_platform? assert File.exist?(gem_dir), "gem_dir should exist" end Gem.post_uninstall do - sleep(0.1) if win_platform? + sleep(0.1) if Gem.win_platform? refute File.exist?(gem_dir), "gem_dir should not exist" end diff --git a/test/rubygems/test_gem_util.rb b/test/rubygems/test_gem_util.rb index 348ecaecfe..7d5b950727 100644 --- a/test/rubygems/test_gem_util.rb +++ b/test/rubygems/test_gem_util.rb @@ -36,7 +36,7 @@ class TestGemUtil < Gem::TestCase end def test_traverse_parents_does_not_crash_on_permissions_error - pend "skipped on MS Windows (chmod has no effect)" if win_platform? || Gem.java_platform? + pend "skipped on MS Windows (chmod has no effect)" if Gem.win_platform? || Gem.java_platform? FileUtils.mkdir_p "d/e/f" # remove 'execute' permission from "e" directory and make it @@ -53,7 +53,7 @@ class TestGemUtil < Gem::TestCase assert_equal File.realpath("../..", @tempdir), paths[3] ensure # restore default permissions, allow the directory to be removed - FileUtils.chmod(0775, "d/e") unless win_platform? || Gem.java_platform? + FileUtils.chmod(0775, "d/e") unless Gem.win_platform? || Gem.java_platform? end def test_glob_files_in_dir |