summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler.rb1
-rw-r--r--lib/bundler/cli/common.rb1
-rw-r--r--lib/bundler/definition.rb43
-rw-r--r--lib/bundler/dsl.rb4
-rw-r--r--lib/bundler/index.rb22
-rw-r--r--lib/bundler/lazy_specification.rb21
-rw-r--r--lib/bundler/man/bundle-add.12
-rw-r--r--lib/bundler/man/bundle-binstubs.12
-rw-r--r--lib/bundler/man/bundle-cache.12
-rw-r--r--lib/bundler/man/bundle-check.12
-rw-r--r--lib/bundler/man/bundle-clean.12
-rw-r--r--lib/bundler/man/bundle-config.116
-rw-r--r--lib/bundler/man/bundle-config.1.ronn11
-rw-r--r--lib/bundler/man/bundle-doctor.12
-rw-r--r--lib/bundler/man/bundle-exec.14
-rw-r--r--lib/bundler/man/bundle-exec.1.ronn2
-rw-r--r--lib/bundler/man/bundle-gem.12
-rw-r--r--lib/bundler/man/bundle-info.12
-rw-r--r--lib/bundler/man/bundle-init.12
-rw-r--r--lib/bundler/man/bundle-inject.17
-rw-r--r--lib/bundler/man/bundle-inject.1.ronn4
-rw-r--r--lib/bundler/man/bundle-install.12
-rw-r--r--lib/bundler/man/bundle-list.12
-rw-r--r--lib/bundler/man/bundle-lock.12
-rw-r--r--lib/bundler/man/bundle-open.12
-rw-r--r--lib/bundler/man/bundle-outdated.12
-rw-r--r--lib/bundler/man/bundle-platform.12
-rw-r--r--lib/bundler/man/bundle-pristine.12
-rw-r--r--lib/bundler/man/bundle-remove.12
-rw-r--r--lib/bundler/man/bundle-show.12
-rw-r--r--lib/bundler/man/bundle-update.12
-rw-r--r--lib/bundler/man/bundle-viz.15
-rw-r--r--lib/bundler/man/bundle-viz.1.ronn2
-rw-r--r--lib/bundler/man/bundle.16
-rw-r--r--lib/bundler/man/bundle.1.ronn4
-rw-r--r--lib/bundler/man/gemfile.526
-rw-r--r--lib/bundler/man/gemfile.5.ronn39
-rw-r--r--lib/bundler/remote_specification.rb9
-rw-r--r--lib/bundler/resolver.rb11
-rw-r--r--lib/bundler/rubygems_gem_installer.rb31
-rw-r--r--lib/bundler/settings.rb1
-rw-r--r--lib/bundler/spec_set.rb50
-rw-r--r--lib/bundler/version.rb2
-rw-r--r--lib/rubygems.rb117
-rw-r--r--lib/rubygems/basic_specification.rb4
-rw-r--r--lib/rubygems/command.rb38
-rw-r--r--lib/rubygems/command_manager.rb18
-rw-r--r--lib/rubygems/commands/build_command.rb16
-rw-r--r--lib/rubygems/commands/cert_command.rb64
-rw-r--r--lib/rubygems/commands/check_command.rb40
-rw-r--r--lib/rubygems/commands/cleanup_command.rb32
-rw-r--r--lib/rubygems/commands/contents_command.rb24
-rw-r--r--lib/rubygems/commands/dependency_command.rb24
-rw-r--r--lib/rubygems/commands/environment_command.rb10
-rw-r--r--lib/rubygems/commands/fetch_command.rb12
-rw-r--r--lib/rubygems/commands/generate_index_command.rb30
-rw-r--r--lib/rubygems/commands/help_command.rb6
-rw-r--r--lib/rubygems/commands/info_command.rb6
-rw-r--r--lib/rubygems/commands/install_command.rb26
-rw-r--r--lib/rubygems/commands/list_command.rb6
-rw-r--r--lib/rubygems/commands/lock_command.rb8
-rw-r--r--lib/rubygems/commands/mirror_command.rb6
-rw-r--r--lib/rubygems/commands/open_command.rb18
-rw-r--r--lib/rubygems/commands/outdated_command.rb10
-rw-r--r--lib/rubygems/commands/owner_command.rb22
-rw-r--r--lib/rubygems/commands/pristine_command.rb62
-rw-r--r--lib/rubygems/commands/push_command.rb16
-rw-r--r--lib/rubygems/commands/query_command.rb16
-rw-r--r--lib/rubygems/commands/rdoc_command.rb34
-rw-r--r--lib/rubygems/commands/search_command.rb6
-rw-r--r--lib/rubygems/commands/server_command.rb6
-rw-r--r--lib/rubygems/commands/setup_command.rb194
-rw-r--r--lib/rubygems/commands/signin_command.rb18
-rw-r--r--lib/rubygems/commands/signout_command.rb14
-rw-r--r--lib/rubygems/commands/sources_command.rb38
-rw-r--r--lib/rubygems/commands/specification_command.rb22
-rw-r--r--lib/rubygems/commands/stale_command.rb4
-rw-r--r--lib/rubygems/commands/uninstall_command.rb72
-rw-r--r--lib/rubygems/commands/unpack_command.rb24
-rw-r--r--lib/rubygems/commands/update_command.rb86
-rw-r--r--lib/rubygems/commands/which_command.rb12
-rw-r--r--lib/rubygems/commands/yank_command.rb22
-rw-r--r--lib/rubygems/config_file.rb28
-rw-r--r--lib/rubygems/core_ext/kernel_gem.rb2
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb2
-rw-r--r--lib/rubygems/core_ext/kernel_warn.rb2
-rw-r--r--lib/rubygems/core_ext/tcpsocket_init.rb2
-rw-r--r--lib/rubygems/defaults.rb30
-rw-r--r--lib/rubygems/dependency.rb8
-rw-r--r--lib/rubygems/dependency_installer.rb16
-rw-r--r--lib/rubygems/dependency_list.rb4
-rw-r--r--lib/rubygems/doctor.rb32
-rw-r--r--lib/rubygems/errors.rb4
-rw-r--r--lib/rubygems/exceptions.rb8
-rw-r--r--lib/rubygems/ext.rb14
-rw-r--r--lib/rubygems/ext/build_error.rb2
-rw-r--r--lib/rubygems/ext/builder.rb32
-rw-r--r--lib/rubygems/ext/cargo_builder.rb14
-rw-r--r--lib/rubygems/ext/cmake_builder.rb4
-rw-r--r--lib/rubygems/ext/configure_builder.rb2
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb12
-rw-r--r--lib/rubygems/ext/rake_builder.rb6
-rw-r--r--lib/rubygems/gem_runner.rb10
-rw-r--r--lib/rubygems/gemcutter_utilities.rb57
-rw-r--r--lib/rubygems/indexer.rb48
-rw-r--r--lib/rubygems/install_default_message.rb4
-rw-r--r--lib/rubygems/install_message.rb4
-rw-r--r--lib/rubygems/install_update_options.rb110
-rw-r--r--lib/rubygems/installer.rb54
-rw-r--r--lib/rubygems/installer_uninstaller_utils.rb4
-rw-r--r--lib/rubygems/local_remote_options.rb38
-rw-r--r--lib/rubygems/mock_gem_ui.rb4
-rw-r--r--lib/rubygems/name_tuple.rb2
-rw-r--r--lib/rubygems/optparse.rb2
-rw-r--r--lib/rubygems/package.rb70
-rw-r--r--lib/rubygems/package/file_source.rb4
-rw-r--r--lib/rubygems/package/old.rb16
-rw-r--r--lib/rubygems/package/tar_header.rb66
-rw-r--r--lib/rubygems/package/tar_reader.rb2
-rw-r--r--lib/rubygems/package/tar_reader/entry.rb4
-rw-r--r--lib/rubygems/package/tar_writer.rb12
-rw-r--r--lib/rubygems/package_task.rb8
-rw-r--r--lib/rubygems/platform.rb84
-rw-r--r--lib/rubygems/psych_tree.rb2
-rw-r--r--lib/rubygems/query_utils.rb54
-rw-r--r--lib/rubygems/rdoc.rb4
-rw-r--r--lib/rubygems/remote_fetcher.rb38
-rw-r--r--lib/rubygems/request.rb42
-rw-r--r--lib/rubygems/request/connection_pools.rb4
-rw-r--r--lib/rubygems/request_set.rb28
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb30
-rw-r--r--lib/rubygems/request_set/lockfile.rb10
-rw-r--r--lib/rubygems/request_set/lockfile/parser.rb28
-rw-r--r--lib/rubygems/request_set/lockfile/tokenizer.rb4
-rw-r--r--lib/rubygems/requirement.rb10
-rw-r--r--lib/rubygems/resolver.rb70
-rw-r--r--lib/rubygems/resolver/activation_request.rb6
-rw-r--r--lib/rubygems/resolver/api_set.rb8
-rw-r--r--lib/rubygems/resolver/api_specification.rb4
-rw-r--r--lib/rubygems/resolver/best_set.rb4
-rw-r--r--lib/rubygems/resolver/conflict.rb14
-rw-r--r--lib/rubygems/resolver/dependency_request.rb4
-rw-r--r--lib/rubygems/resolver/git_set.rb4
-rw-r--r--lib/rubygems/resolver/git_specification.rb6
-rw-r--r--lib/rubygems/resolver/index_set.rb6
-rw-r--r--lib/rubygems/resolver/index_specification.rb6
-rw-r--r--lib/rubygems/resolver/installed_specification.rb4
-rw-r--r--lib/rubygems/resolver/installer_set.rb8
-rw-r--r--lib/rubygems/resolver/local_specification.rb4
-rw-r--r--lib/rubygems/resolver/lock_set.rb6
-rw-r--r--lib/rubygems/resolver/lock_specification.rb6
-rw-r--r--lib/rubygems/resolver/molinillo.rb2
-rw-r--r--lib/rubygems/resolver/specification.rb2
-rw-r--r--lib/rubygems/resolver/vendor_set.rb2
-rw-r--r--lib/rubygems/s3_uri_signer.rb12
-rw-r--r--lib/rubygems/safe_yaml.rb4
-rw-r--r--lib/rubygems/security.rb54
-rw-r--r--lib/rubygems/security/policies.rb22
-rw-r--r--lib/rubygems/security/policy.rb24
-rw-r--r--lib/rubygems/security/signer.rb8
-rw-r--r--lib/rubygems/security/trust_dir.rb6
-rw-r--r--lib/rubygems/security_option.rb10
-rw-r--r--lib/rubygems/source.rb30
-rw-r--r--lib/rubygems/source/git.rb34
-rw-r--r--lib/rubygems/source/installed.rb2
-rw-r--r--lib/rubygems/source/local.rb4
-rw-r--r--lib/rubygems/source/specific_file.rb2
-rw-r--r--lib/rubygems/spec_fetcher.rb16
-rw-r--r--lib/rubygems/specification.rb75
-rw-r--r--lib/rubygems/specification_policy.rb26
-rw-r--r--lib/rubygems/stub_specification.rb10
-rw-r--r--lib/rubygems/tsort.rb2
-rw-r--r--lib/rubygems/uninstaller.rb28
-rw-r--r--lib/rubygems/uri.rb8
-rw-r--r--lib/rubygems/uri_formatter.rb2
-rw-r--r--lib/rubygems/user_interaction.rb48
-rw-r--r--lib/rubygems/util.rb20
-rw-r--r--lib/rubygems/util/licenses.rb6
-rw-r--r--lib/rubygems/validator.rb10
-rw-r--r--lib/rubygems/version.rb8
-rw-r--r--lib/rubygems/version_option.rb6
-rw-r--r--spec/bundler/bundler/gem_helper_spec.rb5
-rw-r--r--spec/bundler/cache/git_spec.rb20
-rw-r--r--spec/bundler/commands/info_spec.rb4
-rw-r--r--spec/bundler/commands/install_spec.rb50
-rw-r--r--spec/bundler/commands/open_spec.rb2
-rw-r--r--spec/bundler/commands/pristine_spec.rb2
-rw-r--r--spec/bundler/commands/remove_spec.rb2
-rw-r--r--spec/bundler/commands/show_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb36
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb39
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb2
-rw-r--r--spec/bundler/install/gems/fund_spec.rb27
-rw-r--r--spec/bundler/install/git_spec.rb8
-rw-r--r--spec/bundler/install/yanked_spec.rb10
-rw-r--r--spec/bundler/lock/lockfile_spec.rb6
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb6
-rw-r--r--spec/bundler/plugins/source/example_spec.rb6
-rw-r--r--spec/bundler/resolver/basic_spec.rb2
-rw-r--r--spec/bundler/runtime/platform_spec.rb1
-rw-r--r--spec/bundler/runtime/setup_spec.rb15
-rw-r--r--spec/bundler/support/builders.rb6
-rw-r--r--spec/bundler/support/hax.rb2
-rw-r--r--spec/bundler/support/indexes.rb1
-rw-r--r--spec/bundler/update/git_spec.rb10
-rw-r--r--test/rubygems/helper.rb254
-rw-r--r--test/rubygems/installer_test_case.rb26
-rw-r--r--test/rubygems/package/tar_test_case.rb4
-rw-r--r--test/rubygems/plugin/exception/rubygems_plugin.rb2
-rw-r--r--test/rubygems/plugin/standarderror/rubygems_plugin.rb2
-rw-r--r--test/rubygems/rubygems_plugin.rb4
-rw-r--r--test/rubygems/specifications/rubyforge-0.0.1.gemspec8
-rw-r--r--test/rubygems/test_bundled_ca.rb20
-rw-r--r--test/rubygems/test_config.rb6
-rw-r--r--test/rubygems/test_deprecate.rb6
-rw-r--r--test/rubygems/test_exit.rb4
-rw-r--r--test/rubygems/test_gem.rb684
-rw-r--r--test/rubygems/test_gem_available_set.rb42
-rw-r--r--test/rubygems/test_gem_bundler_version_finder.rb2
-rw-r--r--test/rubygems/test_gem_command.rb88
-rw-r--r--test/rubygems/test_gem_command_manager.rb58
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb126
-rw-r--r--test/rubygems/test_gem_commands_cert_command.rb196
-rw-r--r--test/rubygems/test_gem_commands_check_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb80
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb54
-rw-r--r--test/rubygems/test_gem_commands_dependency_command.rb72
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb32
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb74
-rw-r--r--test/rubygems/test_gem_commands_generate_index_command.rb14
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb26
-rw-r--r--test/rubygems/test_gem_commands_info_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb262
-rw-r--r--test/rubygems/test_gem_commands_list_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_lock_command.rb20
-rw-r--r--test/rubygems/test_gem_commands_mirror.rb4
-rw-r--r--test/rubygems/test_gem_commands_open_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_outdated_command.rb18
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb82
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb184
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb108
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb146
-rw-r--r--test/rubygems/test_gem_commands_search_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_server_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb204
-rw-r--r--test/rubygems/test_gem_commands_signin_command.rb76
-rw-r--r--test/rubygems/test_gem_commands_signout_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb57
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb64
-rw-r--r--test/rubygems/test_gem_commands_stale_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb150
-rw-r--r--test/rubygems/test_gem_commands_unpack_command.rb62
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb178
-rw-r--r--test/rubygems/test_gem_commands_which_command.rb12
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb80
-rw-r--r--test/rubygems/test_gem_config_file.rb154
-rw-r--r--test/rubygems/test_gem_dependency.rb146
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb330
-rw-r--r--test/rubygems/test_gem_dependency_list.rb94
-rw-r--r--test/rubygems/test_gem_dependency_resolution_error.rb8
-rw-r--r--test/rubygems/test_gem_doctor.rb52
-rw-r--r--test/rubygems/test_gem_ext_builder.rb118
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder.rb52
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock12
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml2
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb16
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec2
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock12
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml2
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb16
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb6
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder_unit.rb46
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb30
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb26
-rw-r--r--test/rubygems/test_gem_ext_ext_conf_builder.rb103
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb30
-rw-r--r--test/rubygems/test_gem_gem_runner.rb14
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb132
-rw-r--r--test/rubygems/test_gem_impossible_dependencies_error.rb8
-rw-r--r--test/rubygems/test_gem_indexer.rb96
-rw-r--r--test/rubygems/test_gem_install_update_options.rb32
-rw-r--r--test/rubygems/test_gem_installer.rb594
-rw-r--r--test/rubygems/test_gem_local_remote_options.rb20
-rw-r--r--test/rubygems/test_gem_name_tuple.rb8
-rw-r--r--test/rubygems/test_gem_package.rb412
-rw-r--r--test/rubygems/test_gem_package_old.rb26
-rw-r--r--test/rubygems/test_gem_package_tar_header.rb84
-rw-r--r--test/rubygems/test_gem_package_tar_reader.rb14
-rw-r--r--test/rubygems/test_gem_package_tar_reader_entry.rb20
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb152
-rw-r--r--test/rubygems/test_gem_package_task.rb36
-rw-r--r--test/rubygems/test_gem_path_support.rb28
-rw-r--r--test/rubygems/test_gem_platform.rb454
-rw-r--r--test/rubygems/test_gem_rdoc.rb28
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb298
-rw-r--r--test/rubygems/test_gem_request.rb110
-rw-r--r--test/rubygems/test_gem_request_connection_pools.rb58
-rw-r--r--test/rubygems/test_gem_request_set.rb198
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb410
-rw-r--r--test/rubygems/test_gem_request_set_lockfile.rb172
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_parser.rb112
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_tokenizer.rb124
-rw-r--r--test/rubygems/test_gem_requirement.rb76
-rw-r--r--test/rubygems/test_gem_resolver.rb196
-rw-r--r--test/rubygems/test_gem_resolver_activation_request.rb12
-rw-r--r--test/rubygems/test_gem_resolver_api_set.rb66
-rw-r--r--test/rubygems/test_gem_resolver_api_specification.rb94
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb44
-rw-r--r--test/rubygems/test_gem_resolver_composed_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_conflict.rb24
-rw-r--r--test/rubygems/test_gem_resolver_dependency_request.rb30
-rw-r--r--test/rubygems/test_gem_resolver_git_set.rb42
-rw-r--r--test/rubygems/test_gem_resolver_git_specification.rb42
-rw-r--r--test/rubygems/test_gem_resolver_index_set.rb24
-rw-r--r--test/rubygems/test_gem_resolver_index_specification.rb30
-rw-r--r--test/rubygems/test_gem_resolver_installed_specification.rb10
-rw-r--r--test/rubygems/test_gem_resolver_installer_set.rb68
-rw-r--r--test/rubygems/test_gem_resolver_local_specification.rb14
-rw-r--r--test/rubygems/test_gem_resolver_lock_set.rb24
-rw-r--r--test/rubygems/test_gem_resolver_lock_specification.rb34
-rw-r--r--test/rubygems/test_gem_resolver_requirement_list.rb2
-rw-r--r--test/rubygems/test_gem_resolver_specification.rb16
-rw-r--r--test/rubygems/test_gem_resolver_vendor_set.rb12
-rw-r--r--test/rubygems/test_gem_resolver_vendor_specification.rb20
-rw-r--r--test/rubygems/test_gem_security.rb134
-rw-r--r--test/rubygems/test_gem_security_policy.rb124
-rw-r--r--test/rubygems/test_gem_security_signer.rb56
-rw-r--r--test/rubygems/test_gem_security_trust_dir.rb8
-rw-r--r--test/rubygems/test_gem_silent_ui.rb70
-rw-r--r--test/rubygems/test_gem_source.rb88
-rw-r--r--test/rubygems/test_gem_source_fetch_problem.rb18
-rw-r--r--test/rubygems/test_gem_source_git.rb118
-rw-r--r--test/rubygems/test_gem_source_installed.rb32
-rw-r--r--test/rubygems/test_gem_source_list.rb10
-rw-r--r--test/rubygems/test_gem_source_local.rb28
-rw-r--r--test/rubygems/test_gem_source_lock.rb62
-rw-r--r--test/rubygems/test_gem_source_specific_file.rb34
-rw-r--r--test/rubygems/test_gem_source_subpath_problem.rb14
-rw-r--r--test/rubygems/test_gem_source_vendor.rb26
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb144
-rw-r--r--test/rubygems/test_gem_specification.rb869
-rw-r--r--test/rubygems/test_gem_stream_ui.rb38
-rw-r--r--test/rubygems/test_gem_stub_specification.rb64
-rw-r--r--test/rubygems/test_gem_text.rb2
-rw-r--r--test/rubygems/test_gem_uninstaller.rb224
-rw-r--r--test/rubygems/test_gem_unsatisfiable_dependency_error.rb6
-rw-r--r--test/rubygems/test_gem_uri.rb8
-rw-r--r--test/rubygems/test_gem_uri_formatter.rb28
-rw-r--r--test/rubygems/test_gem_util.rb46
-rw-r--r--test/rubygems/test_gem_validator.rb16
-rw-r--r--test/rubygems/test_gem_version.rb26
-rw-r--r--test/rubygems/test_gem_version_option.rb30
-rw-r--r--test/rubygems/test_kernel.rb62
-rw-r--r--test/rubygems/test_project_sanity.rb2
-rw-r--r--test/rubygems/test_remote_fetch_error.rb12
-rw-r--r--test/rubygems/test_require.rb84
-rw-r--r--test/rubygems/test_rubygems.rb16
-rw-r--r--test/rubygems/utilities.rb34
-rw-r--r--tool/bundler/dev_gems.rb.lock2
-rw-r--r--tool/bundler/rubocop_gems.rb.lock2
-rw-r--r--tool/bundler/standard_gems.rb.lock2
-rw-r--r--tool/bundler/test_gems.rb.lock2
362 files changed, 7866 insertions, 7628 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index c99114ae64..7df22ab3a5 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -53,6 +53,7 @@ module Bundler
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
autoload :Graph, File.expand_path("bundler/graph", __dir__)
+ autoload :IncompleteSpecification, File.expand_path("bundler/incomplete_specification", __dir__)
autoload :Index, File.expand_path("bundler/index", __dir__)
autoload :Injector, File.expand_path("bundler/injector", __dir__)
autoload :Installer, File.expand_path("bundler/installer", __dir__)
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index b547619c6a..0d83a1c07e 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -15,6 +15,7 @@ module Bundler
end
def self.output_fund_metadata_summary
+ return if Bundler.settings["ignore_funding_requests"]
definition = Bundler.definition
current_dependencies = definition.requested_dependencies
current_specs = definition.specs
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 0580860845..d55ee29ebc 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -138,13 +138,13 @@ module Bundler
@unlock[:gems] ||= @dependencies.map(&:name)
else
eager_unlock = expand_dependencies(@unlock[:gems] || [], true)
- @unlock[:gems] = @locked_specs.for(eager_unlock, false, false).map(&:name)
+ @unlock[:gems] = @locked_specs.for(eager_unlock, false, platforms).map(&:name)
end
@dependency_changes = converge_dependencies
@local_changes = converge_locals
- @locked_specs_incomplete_for_platform = !@locked_specs.for(requested_dependencies & expand_dependencies(locked_dependencies), true, true)
+ @reresolve = nil
@requires = compute_requires
end
@@ -279,11 +279,8 @@ module Bundler
end
end
else
- last_resolve = converge_locked_specs
- # Run a resolve against the locally available gems
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
- expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
- Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
+ @reresolve = reresolve
end
end
@@ -468,7 +465,7 @@ module Bundler
private :sources
def nothing_changed?
- !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@locked_specs_incomplete_for_platform
+ !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes
end
def unlocking?
@@ -477,8 +474,14 @@ module Bundler
private
+ def reresolve
+ last_resolve = converge_locked_specs
+ expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
+ Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
+ end
+
def filter_specs(specs, deps)
- SpecSet.new(specs).for(expand_dependencies(deps, true), false, false)
+ SpecSet.new(specs).for(expand_dependencies(deps, true), false, platforms)
end
def materialize(dependencies)
@@ -495,7 +498,22 @@ module Bundler
"removed in order to install."
end
- raise GemNotFound, "Could not find #{missing_specs.map(&:full_name).join(", ")} in any of the sources"
+ missing_specs_list = missing_specs.group_by(&:source).map do |source, missing_specs_for_source|
+ "#{missing_specs_for_source.map(&:full_name).join(", ")} in #{source}"
+ end
+
+ raise GemNotFound, "Could not find #{missing_specs_list.join(" nor ")}"
+ end
+
+ if @reresolve.nil?
+ incomplete_specs = specs.incomplete_specs
+
+ if incomplete_specs.any?
+ Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
+ @unlock[:gems].concat(incomplete_specs.map(&:name))
+ @resolve = reresolve
+ specs = resolve.materialize(dependencies)
+ end
end
unless specs["bundler"].any?
@@ -545,7 +563,6 @@ module Bundler
[@new_platform, "you added a new platform to your gemfile"],
[@path_changes, "the gemspecs for path gems changed"],
[@local_changes, "the gemspecs for git local gems changed"],
- [@locked_specs_incomplete_for_platform, "the lockfile does not have all gems needed for the current platform"],
].select(&:first).map(&:last).join(", ")
end
@@ -721,7 +738,7 @@ module Bundler
# if we won't need the source (according to the lockfile),
# don't error if the path/git source isn't available
next if specs.
- for(requested_dependencies, false, true).
+ for(requested_dependencies, false).
none? {|locked_spec| locked_spec.source == s.source }
raise
@@ -789,7 +806,9 @@ module Bundler
end
def requested_groups
- groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
+ values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
+ values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
+ values
end
def lockfiles_equal?(current, proposed, preserve_unknown_sections)
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 8b2d0ac97c..385fdd4383 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -465,12 +465,12 @@ module Bundler
def multiple_global_source_warning
if Bundler.feature_flag.bundler_3_mode?
- msg = "This Gemfile contains multiple primary sources. " \
+ msg = "This Gemfile contains multiple global sources. " \
"Each source after the first must include a block to indicate which gems " \
"should come from that source"
raise GemfileEvalError, msg
else
- Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
+ Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple global sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source."
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index 5bc24fc0b2..00c7a9e00d 100644
--- a/lib/bundler/index.rb
+++ b/lib/bundler/index.rb
@@ -56,17 +56,17 @@ module Bundler
# Search this index's specs, and any source indexes that this index knows
# about, returning all of the results.
- def search(query, base = nil)
- sort_specs(unsorted_search(query, base))
+ def search(query)
+ sort_specs(unsorted_search(query))
end
- def unsorted_search(query, base)
- results = local_search(query, base)
+ def unsorted_search(query)
+ results = local_search(query)
seen = results.map(&:full_name).uniq unless @sources.empty?
@sources.each do |source|
- source.unsorted_search(query, base).each do |spec|
+ source.unsorted_search(query).each do |spec|
next if seen.include?(spec.full_name)
seen << spec.full_name
@@ -89,12 +89,12 @@ module Bundler
self.class.sort_specs(specs)
end
- def local_search(query, base = nil)
+ def local_search(query)
case query
when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query)
when String then specs_by_name(query)
- when Gem::Dependency then search_by_dependency(query, base)
- when DepProxy then search_by_dependency(query.dep, base)
+ when Gem::Dependency then search_by_dependency(query)
+ when DepProxy then search_by_dependency(query.dep)
else
raise "You can't search for a #{query.inspect}."
end
@@ -185,11 +185,9 @@ module Bundler
@specs[name].values
end
- def search_by_dependency(dependency, base = nil)
- @cache[base || false] ||= {}
- @cache[base || false][dependency] ||= begin
+ def search_by_dependency(dependency)
+ @cache[dependency] ||= begin
specs = specs_by_name(dependency.name)
- specs += base if base
found = specs.select do |spec|
next true if spec.source.is_a?(Source::Gemspec)
dependency.matches_spec?(spec)
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index ddfa100411..21e75d2126 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -19,7 +19,7 @@ module Bundler
end
def full_name
- if platform == Gem::Platform::RUBY || platform.nil?
+ if platform == Gem::Platform::RUBY
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
@@ -61,7 +61,7 @@ module Bundler
def to_lock
out = String.new
- if platform == Gem::Platform::RUBY || platform.nil?
+ if platform == Gem::Platform::RUBY
out << " #{name} (#{version})\n"
else
out << " #{name} (#{version}-#{platform})\n"
@@ -75,7 +75,17 @@ module Bundler
out
end
- def __materialize__
+ def materialize_for_installation
+ __materialize__(ruby_platform_materializes_to_ruby_platform? ? platform : Bundler.local_platform)
+ end
+
+ def materialize_for_resolution
+ return self unless Gem::Platform.match_spec?(self)
+
+ __materialize__(platform)
+ end
+
+ def __materialize__(platform)
@specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
source.gemspec.tap {|s| s.source = source }
else
@@ -84,10 +94,9 @@ module Bundler
else
ruby_platform_materializes_to_ruby_platform? ? self : Dependency.new(name, version)
end
- platform_object = ruby_platform_materializes_to_ruby_platform? ? Gem::Platform.new(platform) : Gem::Platform.local
candidates = source.specs.search(search_object)
same_platform_candidates = candidates.select do |spec|
- MatchPlatform.platforms_match?(spec.platform, platform_object)
+ MatchPlatform.platforms_match?(spec.platform, platform)
end
installable_candidates = same_platform_candidates.select do |spec|
spec.is_a?(StubSpecification) ||
@@ -105,7 +114,7 @@ module Bundler
end
def to_s
- @__to_s ||= if platform == Gem::Platform::RUBY || platform.nil?
+ @__to_s ||= if platform == Gem::Platform::RUBY
"#{name} (#{version})"
else
"#{name} (#{version}-#{platform})"
diff --git a/lib/bundler/man/bundle-add.1 b/lib/bundler/man/bundle-add.1
index 1a77124861..20430a78a0 100644
--- a/lib/bundler/man/bundle-add.1
+++ b/lib/bundler/man/bundle-add.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-ADD" "1" "June 2022" "" ""
+.TH "BUNDLE\-ADD" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
diff --git a/lib/bundler/man/bundle-binstubs.1 b/lib/bundler/man/bundle-binstubs.1
index d8312c391d..9c57c7c9c5 100644
--- a/lib/bundler/man/bundle-binstubs.1
+++ b/lib/bundler/man/bundle-binstubs.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-BINSTUBS" "1" "June 2022" "" ""
+.TH "BUNDLE\-BINSTUBS" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
diff --git a/lib/bundler/man/bundle-cache.1 b/lib/bundler/man/bundle-cache.1
index 935477a3de..4903015881 100644
--- a/lib/bundler/man/bundle-cache.1
+++ b/lib/bundler/man/bundle-cache.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-CACHE" "1" "June 2022" "" ""
+.TH "BUNDLE\-CACHE" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
diff --git a/lib/bundler/man/bundle-check.1 b/lib/bundler/man/bundle-check.1
index 0f38d17bd3..5be7886274 100644
--- a/lib/bundler/man/bundle-check.1
+++ b/lib/bundler/man/bundle-check.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-CHECK" "1" "June 2022" "" ""
+.TH "BUNDLE\-CHECK" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
diff --git a/lib/bundler/man/bundle-clean.1 b/lib/bundler/man/bundle-clean.1
index e0b2aac549..2bb95ed2de 100644
--- a/lib/bundler/man/bundle-clean.1
+++ b/lib/bundler/man/bundle-clean.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-CLEAN" "1" "June 2022" "" ""
+.TH "BUNDLE\-CLEAN" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
diff --git a/lib/bundler/man/bundle-config.1 b/lib/bundler/man/bundle-config.1
index 4156d0c039..b5cee57f29 100644
--- a/lib/bundler/man/bundle-config.1
+++ b/lib/bundler/man/bundle-config.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-CONFIG" "1" "June 2022" "" ""
+.TH "BUNDLE\-CONFIG" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options
@@ -74,6 +74,10 @@ Creates a directory (defaults to \fB~/bin\fR) and place any executables from the
In deployment mode, Bundler will \'roll\-out\' the bundle for \fBproduction\fR use\. Please check carefully if you want to have this option enabled in \fBdevelopment\fR or \fBtest\fR environments\.
.
.TP
+\fBonly\fR
+A space\-separated list of groups to install only gems of the specified groups\.
+.
+.TP
\fBpath\fR
The location to install the specified gems to\. This defaults to Rubygems\' setting\. Bundler shares this location with Rubygems, \fBgem install \.\.\.\fR will have gem installed there, too\. Therefore, gems installed without a \fB\-\-path \.\.\.\fR setting will show up by calling \fBgem list\fR\. Accordingly, gems installed to other locations will not get listed\.
.
@@ -205,6 +209,9 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBglobal_gem_cache\fR (\fBBUNDLE_GLOBAL_GEM_CACHE\fR): Whether Bundler should cache all gems globally, rather than locally to the installing Ruby installation\.
.
.IP "\(bu" 4
+\fBignore_funding_requests\fR (\fBBUNDLE_IGNORE_FUNDING_REQUESTS\fR): When set, no funding requests will be printed\.
+.
+.IP "\(bu" 4
\fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\.
.
.IP "\(bu" 4
@@ -220,6 +227,9 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBno_prune\fR (\fBBUNDLE_NO_PRUNE\fR): Whether Bundler should leave outdated gems unpruned when caching\.
.
.IP "\(bu" 4
+\fBonly\fR (\fBBUNDLE_ONLY\fR): A space\-separated list of groups to install only gems of the specified groups\.
+.
+.IP "\(bu" 4
\fBpath\fR (\fBBUNDLE_PATH\fR): The location on disk where all gems in your bundle will be located regardless of \fB$GEM_HOME\fR or \fB$GEM_PATH\fR values\. Bundle gems not found in this location will be installed by \fBbundle install\fR\. Defaults to \fBGem\.dir\fR\. When \-\-deployment is used, defaults to vendor/bundle\.
.
.IP "\(bu" 4
@@ -342,13 +352,13 @@ bundle config set \-\-global mirror\.SOURCE_URL MIRROR_URL
.IP "" 0
.
.P
-For example, to use a mirror of rubygems\.org hosted at rubygems\-mirror\.org:
+For example, to use a mirror of https://rubygems\.org hosted at https://example\.org:
.
.IP "" 4
.
.nf
-bundle config set \-\-global mirror\.http://rubygems\.org http://rubygems\-mirror\.org
+bundle config set \-\-global mirror\.https://rubygems\.org https://example\.org
.
.fi
.
diff --git a/lib/bundler/man/bundle-config.1.ronn b/lib/bundler/man/bundle-config.1.ronn
index 7d1cb271a9..e2af773141 100644
--- a/lib/bundler/man/bundle-config.1.ronn
+++ b/lib/bundler/man/bundle-config.1.ronn
@@ -74,6 +74,9 @@ The options that can be configured are:
`production` use. Please check carefully if you want to have this option
enabled in `development` or `test` environments.
+* `only`:
+ A space-separated list of groups to install only gems of the specified groups.
+
* `path`:
The location to install the specified gems to. This defaults to Rubygems'
setting. Bundler shares this location with Rubygems, `gem install ...` will
@@ -204,6 +207,8 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`):
Whether Bundler should cache all gems globally, rather than locally to the
installing Ruby installation.
+* `ignore_funding_requests` (`BUNDLE_IGNORE_FUNDING_REQUESTS`):
+ When set, no funding requests will be printed.
* `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`):
When set, no post install messages will be printed. To silence a single gem,
use dot notation like `ignore_messages.httparty true`.
@@ -216,6 +221,8 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
Whether `bundle package` should skip installing gems.
* `no_prune` (`BUNDLE_NO_PRUNE`):
Whether Bundler should leave outdated gems unpruned when caching.
+* `only` (`BUNDLE_ONLY`):
+ A space-separated list of groups to install only gems of the specified groups.
* `path` (`BUNDLE_PATH`):
The location on disk where all gems in your bundle will be located regardless
of `$GEM_HOME` or `$GEM_PATH` values. Bundle gems not found in this location
@@ -321,9 +328,9 @@ mirror to fetch gems.
bundle config set --global mirror.SOURCE_URL MIRROR_URL
-For example, to use a mirror of rubygems.org hosted at rubygems-mirror.org:
+For example, to use a mirror of https://rubygems.org hosted at https://example.org:
- bundle config set --global mirror.http://rubygems.org http://rubygems-mirror.org
+ bundle config set --global mirror.https://rubygems.org https://example.org
Each mirror also provides a fallback timeout setting. If the mirror does not
respond within the fallback timeout, Bundler will try to use the original
diff --git a/lib/bundler/man/bundle-doctor.1 b/lib/bundler/man/bundle-doctor.1
index 5e76db89c2..6aad9858db 100644
--- a/lib/bundler/man/bundle-doctor.1
+++ b/lib/bundler/man/bundle-doctor.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-DOCTOR" "1" "June 2022" "" ""
+.TH "BUNDLE\-DOCTOR" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-doctor\fR \- Checks the bundle for common problems
diff --git a/lib/bundler/man/bundle-exec.1 b/lib/bundler/man/bundle-exec.1
index 16ad1c2a74..210dd178e8 100644
--- a/lib/bundler/man/bundle-exec.1
+++ b/lib/bundler/man/bundle-exec.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-EXEC" "1" "June 2022" "" ""
+.TH "BUNDLE\-EXEC" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-exec\fR \- Execute a command in the context of the bundle
@@ -155,7 +155,7 @@ You can find a list of all the gems containing gem plugins by running
.
.nf
-ruby \-rrubygems \-e "puts Gem\.find_files(\'rubygems_plugin\.rb\')"
+ruby \-e "puts Gem\.find_files(\'rubygems_plugin\.rb\')"
.
.fi
.
diff --git a/lib/bundler/man/bundle-exec.1.ronn b/lib/bundler/man/bundle-exec.1.ronn
index dec3c7cb82..5f5e78ed12 100644
--- a/lib/bundler/man/bundle-exec.1.ronn
+++ b/lib/bundler/man/bundle-exec.1.ronn
@@ -145,7 +145,7 @@ their plugins.
You can find a list of all the gems containing gem plugins
by running
- ruby -rrubygems -e "puts Gem.find_files('rubygems_plugin.rb')"
+ ruby -e "puts Gem.find_files('rubygems_plugin.rb')"
At the very least, you should remove all but the newest
version of each gem plugin, and also remove all gem plugins
diff --git a/lib/bundler/man/bundle-gem.1 b/lib/bundler/man/bundle-gem.1
index eb66e2d41d..0fb6f7d0ab 100644
--- a/lib/bundler/man/bundle-gem.1
+++ b/lib/bundler/man/bundle-gem.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-GEM" "1" "June 2022" "" ""
+.TH "BUNDLE\-GEM" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
diff --git a/lib/bundler/man/bundle-info.1 b/lib/bundler/man/bundle-info.1
index be1a9e1dcd..d3bad843b8 100644
--- a/lib/bundler/man/bundle-info.1
+++ b/lib/bundler/man/bundle-info.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-INFO" "1" "June 2022" "" ""
+.TH "BUNDLE\-INFO" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-info\fR \- Show information for the given gem in your bundle
diff --git a/lib/bundler/man/bundle-init.1 b/lib/bundler/man/bundle-init.1
index 24f1f7543b..0b3abfeefc 100644
--- a/lib/bundler/man/bundle-init.1
+++ b/lib/bundler/man/bundle-init.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-INIT" "1" "June 2022" "" ""
+.TH "BUNDLE\-INIT" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory
diff --git a/lib/bundler/man/bundle-inject.1 b/lib/bundler/man/bundle-inject.1
index 2dbcd6e376..53f2eaae0a 100644
--- a/lib/bundler/man/bundle-inject.1
+++ b/lib/bundler/man/bundle-inject.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-INJECT" "1" "June 2022" "" ""
+.TH "BUNDLE\-INJECT" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
@@ -30,4 +30,7 @@ bundle inject \'rack\' \'> 0\'
.IP "" 0
.
.P
-This will inject the \'rack\' gem with a version greater than 0 in your [\fBGemfile(5)\fR][Gemfile(5)] and Gemfile\.lock
+This will inject the \'rack\' gem with a version greater than 0 in your [\fBGemfile(5)\fR][Gemfile(5)] and Gemfile\.lock\.
+.
+.P
+The \fBbundle inject\fR command was deprecated in Bundler 2\.1 and will be removed in Bundler 3\.0\.
diff --git a/lib/bundler/man/bundle-inject.1.ronn b/lib/bundler/man/bundle-inject.1.ronn
index f454341896..95704eddad 100644
--- a/lib/bundler/man/bundle-inject.1.ronn
+++ b/lib/bundler/man/bundle-inject.1.ronn
@@ -19,4 +19,6 @@ Example:
bundle inject 'rack' '> 0'
This will inject the 'rack' gem with a version greater than 0 in your
-[`Gemfile(5)`][Gemfile(5)] and Gemfile.lock
+[`Gemfile(5)`][Gemfile(5)] and Gemfile.lock.
+
+The `bundle inject` command was deprecated in Bundler 2.1 and will be removed in Bundler 3.0.
diff --git a/lib/bundler/man/bundle-install.1 b/lib/bundler/man/bundle-install.1
index e8184fd510..c742efd142 100644
--- a/lib/bundler/man/bundle-install.1
+++ b/lib/bundler/man/bundle-install.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-INSTALL" "1" "June 2022" "" ""
+.TH "BUNDLE\-INSTALL" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
diff --git a/lib/bundler/man/bundle-list.1 b/lib/bundler/man/bundle-list.1
index 5bc3f43943..3a9cc9a237 100644
--- a/lib/bundler/man/bundle-list.1
+++ b/lib/bundler/man/bundle-list.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-LIST" "1" "June 2022" "" ""
+.TH "BUNDLE\-LIST" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-list\fR \- List all the gems in the bundle
diff --git a/lib/bundler/man/bundle-lock.1 b/lib/bundler/man/bundle-lock.1
index 2934b44171..ac03c5478e 100644
--- a/lib/bundler/man/bundle-lock.1
+++ b/lib/bundler/man/bundle-lock.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-LOCK" "1" "June 2022" "" ""
+.TH "BUNDLE\-LOCK" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
diff --git a/lib/bundler/man/bundle-open.1 b/lib/bundler/man/bundle-open.1
index c4e58fb854..be6c5af248 100644
--- a/lib/bundler/man/bundle-open.1
+++ b/lib/bundler/man/bundle-open.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-OPEN" "1" "June 2022" "" ""
+.TH "BUNDLE\-OPEN" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
diff --git a/lib/bundler/man/bundle-outdated.1 b/lib/bundler/man/bundle-outdated.1
index ee865b3e97..fc3d5e8caf 100644
--- a/lib/bundler/man/bundle-outdated.1
+++ b/lib/bundler/man/bundle-outdated.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-OUTDATED" "1" "June 2022" "" ""
+.TH "BUNDLE\-OUTDATED" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-outdated\fR \- List installed gems with newer versions available
diff --git a/lib/bundler/man/bundle-platform.1 b/lib/bundler/man/bundle-platform.1
index aab17a429a..344ad93083 100644
--- a/lib/bundler/man/bundle-platform.1
+++ b/lib/bundler/man/bundle-platform.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-PLATFORM" "1" "June 2022" "" ""
+.TH "BUNDLE\-PLATFORM" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-platform\fR \- Displays platform compatibility information
diff --git a/lib/bundler/man/bundle-pristine.1 b/lib/bundler/man/bundle-pristine.1
index a0a5ac1a9b..44e5a83a01 100644
--- a/lib/bundler/man/bundle-pristine.1
+++ b/lib/bundler/man/bundle-pristine.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-PRISTINE" "1" "June 2022" "" ""
+.TH "BUNDLE\-PRISTINE" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
diff --git a/lib/bundler/man/bundle-remove.1 b/lib/bundler/man/bundle-remove.1
index f6055716c7..29ec246018 100644
--- a/lib/bundler/man/bundle-remove.1
+++ b/lib/bundler/man/bundle-remove.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-REMOVE" "1" "June 2022" "" ""
+.TH "BUNDLE\-REMOVE" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-remove\fR \- Removes gems from the Gemfile
diff --git a/lib/bundler/man/bundle-show.1 b/lib/bundler/man/bundle-show.1
index 14db8075f6..227b1c8a1e 100644
--- a/lib/bundler/man/bundle-show.1
+++ b/lib/bundler/man/bundle-show.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-SHOW" "1" "June 2022" "" ""
+.TH "BUNDLE\-SHOW" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
diff --git a/lib/bundler/man/bundle-update.1 b/lib/bundler/man/bundle-update.1
index b7e2b78812..7d0988bfa5 100644
--- a/lib/bundler/man/bundle-update.1
+++ b/lib/bundler/man/bundle-update.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-UPDATE" "1" "June 2022" "" ""
+.TH "BUNDLE\-UPDATE" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-update\fR \- Update your gems to the latest available versions
diff --git a/lib/bundler/man/bundle-viz.1 b/lib/bundler/man/bundle-viz.1
index 68ea9e7e42..f6f51cde0e 100644
--- a/lib/bundler/man/bundle-viz.1
+++ b/lib/bundler/man/bundle-viz.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-VIZ" "1" "June 2022" "" ""
+.TH "BUNDLE\-VIZ" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
@@ -15,6 +15,9 @@
.P
The associated gems must also be installed via \fBbundle install(1)\fR \fIbundle\-install\.1\.html\fR\.
.
+.P
+\fBviz\fR command was deprecated in Bundler 2\.2\. Use bundler\-graph plugin \fIhttps://github\.com/rubygems/bundler\-graph\fR instead\.
+.
.SH "OPTIONS"
.
.TP
diff --git a/lib/bundler/man/bundle-viz.1.ronn b/lib/bundler/man/bundle-viz.1.ronn
index 701df5415e..f220256943 100644
--- a/lib/bundler/man/bundle-viz.1.ronn
+++ b/lib/bundler/man/bundle-viz.1.ronn
@@ -16,6 +16,8 @@ bundle-viz(1) -- Generates a visual dependency graph for your Gemfile
The associated gems must also be installed via [`bundle install(1)`](bundle-install.1.html).
+`viz` command was deprecated in Bundler 2.2. Use [bundler-graph plugin](https://github.com/rubygems/bundler-graph) instead.
+
## OPTIONS
* `--file`, `-f`:
diff --git a/lib/bundler/man/bundle.1 b/lib/bundler/man/bundle.1
index 31d1c12962..c46c37c708 100644
--- a/lib/bundler/man/bundle.1
+++ b/lib/bundler/man/bundle.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE" "1" "June 2022" "" ""
+.TH "BUNDLE" "1" "July 2022" "" ""
.
.SH "NAME"
\fBbundle\fR \- Ruby Dependency Management
@@ -93,7 +93,7 @@ Open an installed gem in the editor
Generate a lockfile for your dependencies
.
.TP
-\fBbundle viz(1)\fR \fIbundle\-viz\.1\.html\fR
+\fBbundle viz(1)\fR \fIbundle\-viz\.1\.html\fR (deprecated)
Generate a visual representation of your dependencies
.
.TP
@@ -130,7 +130,7 @@ These commands are obsolete and should no longer be used:
\fBbundle cache(1)\fR
.
.IP "\(bu" 4
-\fBbundle show(1)\fR
+\fBbundle inject(1)\fR
.
.IP "" 0
diff --git a/lib/bundler/man/bundle.1.ronn b/lib/bundler/man/bundle.1.ronn
index 5b1712394a..fa247ab365 100644
--- a/lib/bundler/man/bundle.1.ronn
+++ b/lib/bundler/man/bundle.1.ronn
@@ -76,7 +76,7 @@ We divide `bundle` subcommands into primary commands and utilities:
* [`bundle lock(1)`](bundle-lock.1.html):
Generate a lockfile for your dependencies
-* [`bundle viz(1)`](bundle-viz.1.html):
+* [`bundle viz(1)`](bundle-viz.1.html) (deprecated):
Generate a visual representation of your dependencies
* [`bundle init(1)`](bundle-init.1.html):
@@ -108,4 +108,4 @@ and execute it, passing down any extra arguments to it.
These commands are obsolete and should no longer be used:
* `bundle cache(1)`
-* `bundle show(1)`
+* `bundle inject(1)`
diff --git a/lib/bundler/man/gemfile.5 b/lib/bundler/man/gemfile.5
index bf1b8b1c74..63a16ca3ff 100644
--- a/lib/bundler/man/gemfile.5
+++ b/lib/bundler/man/gemfile.5
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "GEMFILE" "5" "June 2022" "" ""
+.TH "GEMFILE" "5" "July 2022" "" ""
.
.SH "NAME"
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
@@ -15,8 +15,8 @@ Place the \fBGemfile\fR in the root of the directory containing the associated c
.SH "SYNTAX"
A \fBGemfile\fR is evaluated as Ruby code, in a context which makes available a number of methods used to describe the gem requirements\.
.
-.SH "GLOBAL SOURCES"
-At the top of the \fBGemfile\fR, add a line for the \fBRubygems\fR source that contains the gems listed in the \fBGemfile\fR\.
+.SH "GLOBAL SOURCE"
+At the top of the \fBGemfile\fR, add a single line for the \fBRubyGems\fR source that contains the gems listed in the \fBGemfile\fR\.
.
.IP "" 4
.
@@ -29,10 +29,16 @@ source "https://rubygems\.org"
.IP "" 0
.
.P
-It is possible, but not recommended as of Bundler 1\.7, to add multiple global \fBsource\fR lines\. Each of these \fBsource\fRs \fBMUST\fR be a valid Rubygems repository\.
+You can add only one global source\. In Bundler 1\.13, adding multiple global sources was deprecated\. The \fBsource\fR \fBMUST\fR be a valid RubyGems repository\.
.
.P
-Sources are checked for gems following the heuristics described in \fISOURCE PRIORITY\fR\. If a gem is found in more than one global source, Bundler will print a warning after installing the gem indicating which source was used, and listing the other sources where the gem is available\. A specific source can be selected for gems that need to use a non\-standard repository, suppressing this warning, by using the \fI\fB:source\fR option\fR or a \fI\fBsource\fR block\fR\.
+To use more than one source of RubyGems, you should use \fI\fBsource\fR block\fR\.
+.
+.P
+A source is checked for gems following the heuristics described in \fISOURCE PRIORITY\fR\.
+.
+.P
+\fBNote about a behavior of the feature deprecated in Bundler 1\.13\fR: If a gem is found in more than one global source, Bundler will print a warning after installing the gem indicating which source was used, and listing the other sources where the gem is available\. A specific source can be selected for gems that need to use a non\-standard repository, suppressing this warning, by using the \fI\fB:source\fR option\fR or \fBsource\fR block\.
.
.SS "CREDENTIALS"
Some gem sources require a username and password\. Use bundle config(1) \fIbundle\-config\.1\.html\fR to set the username and password for any of the sources that need it\. The command must be run once on each computer that will install the Gemfile, but this keeps the credentials from being stored in plain text in version control\.
@@ -356,7 +362,7 @@ The platform specific variant does not yet support a newer ruby (and thus has a
.IP "" 0
.
.SS "SOURCE"
-You can select an alternate Rubygems repository for a gem using the \':source\' option\.
+You can select an alternate RubyGems repository for a gem using the \':source\' option\.
.
.IP "" 4
.
@@ -369,13 +375,13 @@ gem "some_internal_gem", source: "https://gems\.example\.com"
.IP "" 0
.
.P
-This forces the gem to be loaded from this source and ignores any global sources declared at the top level of the file\. If the gem does not exist in this source, it will not be installed\.
+This forces the gem to be loaded from this source and ignores the global source declared at the top level of the file\. If the gem does not exist in this source, it will not be installed\.
.
.P
-Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on global sources using the ordering described in \fISOURCE PRIORITY\fR\.
+Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on the global source\.
.
.P
-Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in \fIGLOBAL SOURCES (#source)\fR\.
+\fBNote about a behavior of the feature deprecated in Bundler 1\.13\fR: Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in \fIGLOBAL SOURCE\fR\.
.
.P
Using the \fB:source\fR option for an individual gem will also make that source available as a possible global source for any other gems which do not specify explicit sources\. Thus, when adding gems with explicit sources, it is recommended that you also ensure all other gems in the Gemfile are using explicit sources\.
@@ -730,7 +736,7 @@ The source explicitly attached to the gem (using \fB:source\fR, \fB:path\fR, or
For implicit gems (dependencies of explicit gems), any source, git, or path repository declared on the parent\. This results in bundler prioritizing the ActiveSupport gem from the Rails git repository over ones from \fBrubygems\.org\fR
.
.IP "3." 4
-The sources specified via global \fBsource\fR lines, searching each source in your \fBGemfile\fR from last added to first added\.
+If neither of the above conditions are met, the global source will be used\. If multiple global sources are specified, they will be prioritized from last to first, but this is deprecated since Bundler 1\.13, so Bundler prints a warning and will abort with an error in the future\.
.
.IP "" 0
diff --git a/lib/bundler/man/gemfile.5.ronn b/lib/bundler/man/gemfile.5.ronn
index e23e1d49df..c2f9141c65 100644
--- a/lib/bundler/man/gemfile.5.ronn
+++ b/lib/bundler/man/gemfile.5.ronn
@@ -15,23 +15,28 @@ directory as the `Rakefile`.
A `Gemfile` is evaluated as Ruby code, in a context which makes available
a number of methods used to describe the gem requirements.
-## GLOBAL SOURCES
+## GLOBAL SOURCE
-At the top of the `Gemfile`, add a line for the `Rubygems` source that contains
-the gems listed in the `Gemfile`.
+At the top of the `Gemfile`, add a single line for the `RubyGems` source that
+contains the gems listed in the `Gemfile`.
source "https://rubygems.org"
-It is possible, but not recommended as of Bundler 1.7, to add multiple global
-`source` lines. Each of these `source`s `MUST` be a valid Rubygems repository.
+You can add only one global source. In Bundler 1.13, adding multiple global
+sources was deprecated. The `source` `MUST` be a valid RubyGems repository.
-Sources are checked for gems following the heuristics described in
-[SOURCE PRIORITY][]. If a gem is found in more than one global source, Bundler
+To use more than one source of RubyGems, you should use [`source` block
+](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS).
+
+A source is checked for gems following the heuristics described in
+[SOURCE PRIORITY][].
+
+**Note about a behavior of the feature deprecated in Bundler 1.13**:
+If a gem is found in more than one global source, Bundler
will print a warning after installing the gem indicating which source was used,
and listing the other sources where the gem is available. A specific source can
be selected for gems that need to use a non-standard repository, suppressing
-this warning, by using the [`:source` option](#SOURCE) or a
-[`source` block](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS).
+this warning, by using the [`:source` option](#SOURCE) or `source` block.
### CREDENTIALS
@@ -247,22 +252,22 @@ This can be handy (assuming the pure ruby variant works fine) when:
### SOURCE
-You can select an alternate Rubygems repository for a gem using the ':source'
+You can select an alternate RubyGems repository for a gem using the ':source'
option.
gem "some_internal_gem", source: "https://gems.example.com"
-This forces the gem to be loaded from this source and ignores any global sources
+This forces the gem to be loaded from this source and ignores the global source
declared at the top level of the file. If the gem does not exist in this source,
it will not be installed.
Bundler will search for child dependencies of this gem by first looking in the
source selected for the parent, but if they are not found there, it will fall
-back on global sources using the ordering described in [SOURCE PRIORITY][].
+back on the global source.
+**Note about a behavior of the feature deprecated in Bundler 1.13**:
Selecting a specific source repository this way also suppresses the ambiguous
-gem warning described above in
-[GLOBAL SOURCES (#source)](#GLOBAL-SOURCES).
+gem warning described above in [GLOBAL SOURCE](#GLOBAL-SOURCE).
Using the `:source` option for an individual gem will also make that source
available as a possible global source for any other gems which do not specify
@@ -535,5 +540,7 @@ bundler uses the following priority order:
repository declared on the parent. This results in bundler prioritizing the
ActiveSupport gem from the Rails git repository over ones from
`rubygems.org`
- 3. The sources specified via global `source` lines, searching each source in
- your `Gemfile` from last added to first added.
+ 3. If neither of the above conditions are met, the global source will be used.
+ If multiple global sources are specified, they will be prioritized from
+ last to first, but this is deprecated since Bundler 1.13, so Bundler prints
+ a warning and will abort with an error in the future.
diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb
index 4e966b820a..b5d7e3a6c9 100644
--- a/lib/bundler/remote_specification.rb
+++ b/lib/bundler/remote_specification.rb
@@ -16,7 +16,8 @@ module Bundler
def initialize(name, version, platform, spec_fetcher)
@name = name
@version = Gem::Version.create version
- @platform = platform
+ @original_platform = platform || Gem::Platform::RUBY
+ @platform = Gem::Platform.new(platform)
@spec_fetcher = spec_fetcher
@dependencies = nil
end
@@ -35,10 +36,10 @@ module Bundler
end
def full_name
- if platform == Gem::Platform::RUBY || platform.nil?
+ if @original_platform == Gem::Platform::RUBY
"#{@name}-#{@version}"
else
- "#{@name}-#{@version}-#{platform}"
+ "#{@name}-#{@version}-#{@original_platform}"
end
end
@@ -105,7 +106,7 @@ module Bundler
end
def _remote_specification
- @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform])
+ @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @original_platform])
@_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \
" missing from the server! Try installing with `--full-index` as a workaround.")
end
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 972a4c254d..40bc247b32 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -22,17 +22,16 @@ module Bundler
metadata_requirements, regular_requirements = requirements.partition {|dep| dep.name.end_with?("\0") }
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
result = resolver.start(requirements)
- SpecSet.new(SpecSet.new(result).for(regular_requirements))
+ SpecSet.new(SpecSet.new(result).for(regular_requirements, false, platforms))
end
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
@source_requirements = source_requirements
@metadata_requirements = metadata_requirements
- @base = base
@resolver = Molinillo::Resolver.new(self, self)
@search_for = {}
@base_dg = Molinillo::DependencyGraph.new
- @base.each do |ls|
+ @base = base.materialized_for_resolution do |ls|
dep = Dependency.new(ls.name, ls.version)
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
end
@@ -111,7 +110,7 @@ module Bundler
dependency = dependency_proxy.dep
name = dependency.name
@search_for[dependency_proxy] ||= begin
- results = results_for(dependency, @base[name])
+ results = results_for(dependency) + @base[name].select {|spec| requirement_satisfied_by?(dependency, nil, spec) }
if vertex = @base_dg.vertex_named(name)
locked_requirement = vertex.payload.requirement
@@ -176,8 +175,8 @@ module Bundler
@source_requirements[name] || @source_requirements[:default]
end
- def results_for(dependency, base)
- index_for(dependency).search(dependency, base)
+ def results_for(dependency)
+ index_for(dependency).search(dependency)
end
def name_for(dependency)
diff --git a/lib/bundler/rubygems_gem_installer.rb b/lib/bundler/rubygems_gem_installer.rb
index df2dcdb454..13c2d25882 100644
--- a/lib/bundler/rubygems_gem_installer.rb
+++ b/lib/bundler/rubygems_gem_installer.rb
@@ -25,7 +25,7 @@ module Bundler
extract_files
- build_extensions
+ build_extensions if spec.extensions.any?
write_build_info_file
run_post_build_hooks
@@ -66,26 +66,26 @@ module Bundler
def build_extensions
extension_cache_path = options[:bundler_extension_cache_path]
- unless extension_cache_path && extension_dir = spec.extension_dir
- require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25")
+ extension_dir = spec.extension_dir
+ unless extension_cache_path && extension_dir
+ prepare_extension_build(extension_dir)
return super
end
- extension_dir = Pathname.new(extension_dir)
build_complete = SharedHelpers.filesystem_access(extension_cache_path.join("gem.build_complete"), :read, &:file?)
if build_complete && !options[:force]
- SharedHelpers.filesystem_access(extension_dir.parent, &:mkpath)
+ SharedHelpers.filesystem_access(File.dirname(extension_dir)) do |p|
+ FileUtils.mkpath p
+ end
SharedHelpers.filesystem_access(extension_cache_path) do
- FileUtils.cp_r extension_cache_path, spec.extension_dir
+ FileUtils.cp_r extension_cache_path, extension_dir
end
else
- require "shellwords" # compensate missing require in rubygems before version 3.2.25
+ prepare_extension_build(extension_dir)
super
- if extension_dir.directory? # not made for gems without extensions
- SharedHelpers.filesystem_access(extension_cache_path.parent, &:mkpath)
- SharedHelpers.filesystem_access(extension_cache_path) do
- FileUtils.cp_r extension_dir, extension_cache_path
- end
+ SharedHelpers.filesystem_access(extension_cache_path.parent, &:mkpath)
+ SharedHelpers.filesystem_access(extension_cache_path) do
+ FileUtils.cp_r extension_dir, extension_cache_path
end
end
end
@@ -100,6 +100,13 @@ module Bundler
private
+ def prepare_extension_build(extension_dir)
+ SharedHelpers.filesystem_access(extension_dir, :create) do
+ FileUtils.mkdir_p extension_dir
+ end
+ require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25")
+ end
+
def strict_rm_rf(dir)
Bundler.rm_rf dir
rescue Errno::ENOTEMPTY => e
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 398c66055a..cf5675274e 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -57,6 +57,7 @@ module Bundler
].freeze
ARRAY_KEYS = %w[
+ only
with
without
].freeze
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 3ff7342981..a7a95e49bc 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -11,30 +11,27 @@ module Bundler
@specs = specs
end
- def for(dependencies, check = false, match_current_platform = false)
- # dep.name => [list, of, deps]
- handled = Hash.new {|h, k| h[k] = [] }
- deps = dependencies.dup
+ def for(dependencies, check = false, platforms = [nil])
+ handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h
+ deps = dependencies.product(platforms).map {|dep, platform| [dep.name, platform && dep.force_ruby_platform ? Gem::Platform::RUBY : platform] }
specs = []
loop do
break unless dep = deps.shift
- next if handled[dep.name].any? {|d| match_current_platform || d.__platform == dep.__platform } || dep.name == "bundler"
+ next if handled.key?(dep)
- # use a hash here to ensure constant lookup time in the `any?` call above
- handled[dep.name] << dep
+ handled[dep] = true
- specs_for_dep = specs_for_dependency(dep, match_current_platform)
+ specs_for_dep = specs_for_dependency(*dep)
if specs_for_dep.any?
specs.concat(specs_for_dep)
specs_for_dep.first.dependencies.each do |d|
next if d.type == :development
- d = DepProxy.get_proxy(Dependency.new(d.name, d.requirement), dep.__platform) unless match_current_platform
- deps << d
+ deps << [d.name, dep[1]]
end
elsif check
- return false
+ specs << IncompleteSpecification.new(*dep)
end
end
@@ -42,9 +39,7 @@ module Bundler
specs << spec
end
- specs.uniq! unless match_current_platform
-
- check ? true : specs
+ specs
end
def [](key)
@@ -71,12 +66,12 @@ module Bundler
end
def materialize(deps)
- materialized = self.for(deps, false, true)
+ materialized = self.for(deps, true).uniq
materialized.map! do |s|
next s unless s.is_a?(LazySpecification)
s.source.local!
- s.__materialize__ || s
+ s.materialize_for_installation || s
end
SpecSet.new(materialized)
end
@@ -89,16 +84,29 @@ module Bundler
next s unless s.is_a?(LazySpecification)
s.source.local!
s.source.remote!
- spec = s.__materialize__
+ spec = s.materialize_for_installation
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
spec
end
end
+ def materialized_for_resolution
+ materialized = @specs.map do |s|
+ spec = s.materialize_for_resolution
+ yield spec if spec
+ spec
+ end.compact
+ SpecSet.new(materialized)
+ end
+
def missing_specs
@specs.select {|s| s.is_a?(LazySpecification) }
end
+ def incomplete_specs
+ @specs.select {|s| s.is_a?(IncompleteSpecification) }
+ end
+
def merge(set)
arr = sorted.dup
set.each do |set_spec|
@@ -173,12 +181,12 @@ module Bundler
@specs.sort_by(&:name).each {|s| yield s }
end
- def specs_for_dependency(dep, match_current_platform)
- specs_for_name = lookup[dep.name]
- if match_current_platform
+ def specs_for_dependency(name, platform)
+ specs_for_name = lookup[name]
+ if platform.nil?
GemHelpers.select_best_platform_match(specs_for_name.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
else
- specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, dep.force_ruby_platform ? Gem::Platform::RUBY : dep.__platform)
+ specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, platform)
specs_for_name_and_platform.any? ? specs_for_name_and_platform : specs_for_name
end
end
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index 700187452d..f01d90b943 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
- VERSION = "2.3.18".freeze
+ VERSION = "2.3.19".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 4fdc061e83..8d15c46080 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -5,18 +5,18 @@
# See LICENSE.txt for permissions.
#++
-require 'rbconfig'
+require "rbconfig"
module Gem
- VERSION = "3.3.18".freeze
+ VERSION = "3.3.19".freeze
end
# Must be first since it unloads the prelude from 1.9.2
-require_relative 'rubygems/compatibility'
+require_relative "rubygems/compatibility"
-require_relative 'rubygems/defaults'
-require_relative 'rubygems/deprecate'
-require_relative 'rubygems/errors'
+require_relative "rubygems/defaults"
+require_relative "rubygems/deprecate"
+require_relative "rubygems/errors"
##
# RubyGems is the Ruby standard for publishing and managing third party
@@ -117,11 +117,11 @@ module Gem
# Taint support is deprecated in Ruby 2.7.
# This allows switching ".untaint" to ".tap(&Gem::UNTAINT)",
# to avoid deprecation warnings in Ruby 2.7.
- UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc {}
+ UNTAINT = RUBY_VERSION < "2.7" ? :untaint.to_sym : proc {}
# When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn
KERNEL_WARN_IGNORES_INTERNAL_ENTRIES = RUBY_ENGINE == "truffleruby" ||
- (RUBY_ENGINE == "ruby" && RUBY_VERSION >= '3.0')
+ (RUBY_ENGINE == "ruby" && RUBY_VERSION >= "3.0")
##
# An Array of Regexps that match windows Ruby platforms.
@@ -293,14 +293,14 @@ module Gem
# The mode needed to read a file as straight binary.
def self.binary_mode
- 'rb'
+ "rb"
end
##
# The path where gem executables are to be installed.
def self.bindir(install_dir=Gem.dir)
- return File.join install_dir, 'bin' unless
+ return File.join install_dir, "bin" unless
install_dir.to_s == Gem.default_dir.to_s
Gem.default_bindir
end
@@ -309,7 +309,7 @@ module Gem
# The path were rubygems plugins are to be installed.
def self.plugindir(install_dir=Gem.dir)
- File.join install_dir, 'plugins'
+ File.join install_dir, "plugins"
end
##
@@ -353,7 +353,7 @@ module Gem
# A Zlib::Deflate.deflate wrapper
def self.deflate(data)
- require 'zlib'
+ require "zlib"
Zlib::Deflate.deflate data
end
@@ -375,7 +375,7 @@ module Gem
target = {}
env.each_pair do |k,v|
case k
- when 'GEM_HOME', 'GEM_PATH', 'GEM_SPEC_CACHE'
+ when "GEM_HOME", "GEM_PATH", "GEM_SPEC_CACHE"
case v
when nil, String
target[k] = v
@@ -442,8 +442,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
old_umask = File.umask
File.umask old_umask | 002
- require 'fileutils'
-
options = {}
options[:mode] = mode if mode
@@ -451,6 +449,9 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
subdirs.each do |name|
subdir = File.join dir, name
next if File.exist? subdir
+
+ require "fileutils"
+
begin
FileUtils.mkdir_p subdir, **options
rescue SystemCallError
@@ -465,7 +466,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# distinction as extensions cannot be shared between the two.
def self.extension_api_version # :nodoc:
- if 'no' == RbConfig::CONFIG['ENABLE_SHARED']
+ if "no" == RbConfig::CONFIG["ENABLE_SHARED"]
"#{ruby_api_version}-static"
else
ruby_api_version
@@ -575,7 +576,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
return i if path.instance_variable_defined?(:@gem_prelude_index)
end
- index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir']
+ index = $LOAD_PATH.index RbConfig::CONFIG["sitelibdir"]
index || 0
end
@@ -606,10 +607,10 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.load_yaml
return if @yaml_loaded
- require 'psych'
- require_relative 'rubygems/psych_tree'
+ require "psych"
+ require_relative "rubygems/psych_tree"
- require_relative 'rubygems/safe_yaml'
+ require_relative "rubygems/safe_yaml"
@yaml_loaded = true
end
@@ -740,9 +741,9 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.prefix
prefix = File.dirname RUBYGEMS_DIR
- if prefix != File.expand_path(RbConfig::CONFIG['sitelibdir']) and
- prefix != File.expand_path(RbConfig::CONFIG['libdir']) and
- 'lib' == File.basename(RUBYGEMS_DIR)
+ if prefix != File.expand_path(RbConfig::CONFIG["sitelibdir"]) and
+ prefix != File.expand_path(RbConfig::CONFIG["libdir"]) and
+ "lib" == File.basename(RUBYGEMS_DIR)
prefix
end
end
@@ -758,11 +759,11 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Safely read a file in binary mode on all platforms.
def self.read_binary(path)
- open_file(path, 'rb+') do |io|
+ open_file(path, "rb+") do |io|
io.read
end
rescue Errno::EACCES, Errno::EROFS
- open_file(path, 'rb') do |io|
+ open_file(path, "rb") do |io|
io.read
end
end
@@ -770,7 +771,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
##
# Safely write a file in binary mode on all platforms.
def self.write_binary(path, data)
- open_file(path, 'wb') do |io|
+ open_file(path, "wb") do |io|
io.write data
end
end
@@ -815,13 +816,13 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Returns a String containing the API compatibility version of Ruby
def self.ruby_api_version
- @ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup
+ @ruby_api_version ||= RbConfig::CONFIG["ruby_version"].dup
end
def self.env_requirement(gem_name)
@env_requirements_by_name ||= {}
@env_requirements_by_name[gem_name] ||= begin
- req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || '>= 0'.freeze
+ req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || ">= 0".freeze
Gem::Requirement.create(req)
end
end
@@ -844,7 +845,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Returns the latest release version of RubyGems.
def self.latest_rubygems_version
- latest_version_for('rubygems-update') or
+ latest_version_for("rubygems-update") or
raise "Can't find 'rubygems-update' in any repo. Check `gem source list`."
end
@@ -939,8 +940,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Suffixes for require-able paths.
def self.suffixes
- @suffixes ||= ['',
- '.rb',
+ @suffixes ||= ["",
+ ".rb",
*%w[DLEXT DLEXT2].map do |key|
val = RbConfig::CONFIG[key]
next unless val and not val.empty?
@@ -969,7 +970,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# Lazily loads DefaultUserInteraction and returns the default UI.
def self.ui
- require_relative 'rubygems/user_interaction'
+ require_relative "rubygems/user_interaction"
Gem::DefaultUserInteraction.ui
end
@@ -991,7 +992,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.win_platform?
if @@win_platform.nil?
- ruby_platform = RbConfig::CONFIG['host_os']
+ ruby_platform = RbConfig::CONFIG["host_os"]
@@win_platform = !!WIN_PATTERNS.find {|r| ruby_platform =~ r }
end
@@ -1017,7 +1018,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.load_plugin_files(plugins) # :nodoc:
plugins.each do |plugin|
-
# Skip older versions of the GemCutter plugin: Its commands are in
# RubyGems proper now.
@@ -1071,7 +1071,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.use_gemdeps(path = nil)
raise_exception = path
- path ||= ENV['RUBYGEMS_GEMDEPS']
+ path ||= ENV["RUBYGEMS_GEMDEPS"]
return unless path
path = path.dup
@@ -1096,7 +1096,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
end
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path)
- require_relative 'rubygems/user_interaction'
+ require_relative "rubygems/user_interaction"
require "bundler"
begin
Gem::DefaultUserInteraction.use_ui(ui) do
@@ -1293,33 +1293,34 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/".freeze
- autoload :BundlerVersionFinder, File.expand_path('rubygems/bundler_version_finder', __dir__)
- autoload :ConfigFile, File.expand_path('rubygems/config_file', __dir__)
- autoload :Dependency, File.expand_path('rubygems/dependency', __dir__)
- autoload :DependencyList, File.expand_path('rubygems/dependency_list', __dir__)
- autoload :Installer, File.expand_path('rubygems/installer', __dir__)
- autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__)
- autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__)
- autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__)
- autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__)
- autoload :Resolver, File.expand_path('rubygems/resolver', __dir__)
- autoload :Source, File.expand_path('rubygems/source', __dir__)
- autoload :SourceList, File.expand_path('rubygems/source_list', __dir__)
- autoload :SpecFetcher, File.expand_path('rubygems/spec_fetcher', __dir__)
- autoload :SpecificationPolicy, File.expand_path('rubygems/specification_policy', __dir__)
- autoload :Util, File.expand_path('rubygems/util', __dir__)
- autoload :Version, File.expand_path('rubygems/version', __dir__)
+ autoload :BundlerVersionFinder, File.expand_path("rubygems/bundler_version_finder", __dir__)
+ autoload :ConfigFile, File.expand_path("rubygems/config_file", __dir__)
+ autoload :Dependency, File.expand_path("rubygems/dependency", __dir__)
+ autoload :DependencyList, File.expand_path("rubygems/dependency_list", __dir__)
+ autoload :Installer, File.expand_path("rubygems/installer", __dir__)
+ autoload :Licenses, File.expand_path("rubygems/util/licenses", __dir__)
+ autoload :NameTuple, File.expand_path("rubygems/name_tuple", __dir__)
+ autoload :PathSupport, File.expand_path("rubygems/path_support", __dir__)
+ autoload :RequestSet, File.expand_path("rubygems/request_set", __dir__)
+ autoload :Requirement, File.expand_path("rubygems/requirement", __dir__)
+ autoload :Resolver, File.expand_path("rubygems/resolver", __dir__)
+ autoload :Source, File.expand_path("rubygems/source", __dir__)
+ autoload :SourceList, File.expand_path("rubygems/source_list", __dir__)
+ autoload :SpecFetcher, File.expand_path("rubygems/spec_fetcher", __dir__)
+ autoload :SpecificationPolicy, File.expand_path("rubygems/specification_policy", __dir__)
+ autoload :Util, File.expand_path("rubygems/util", __dir__)
+ autoload :Version, File.expand_path("rubygems/version", __dir__)
end
-require_relative 'rubygems/exceptions'
-require_relative 'rubygems/specification'
+require_relative "rubygems/exceptions"
+require_relative "rubygems/specification"
# REFACTOR: This should be pulled out into some kind of hacks file.
begin
##
# Defaults the operating system (or packager) wants to provide for RubyGems.
- require 'rubygems/defaults/operating_system'
+ require "rubygems/defaults/operating_system"
rescue LoadError
# Ignored
rescue StandardError => e
@@ -1344,6 +1345,6 @@ end
# Loads the default specs.
Gem::Specification.load_defaults
-require_relative 'rubygems/core_ext/kernel_gem'
-require_relative 'rubygems/core_ext/kernel_require'
-require_relative 'rubygems/core_ext/kernel_warn'
+require_relative "rubygems/core_ext/kernel_gem"
+require_relative "rubygems/core_ext/kernel_require"
+require_relative "rubygems/core_ext/kernel_warn"
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index b3b63b51aa..526a5069c2 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -47,7 +47,7 @@ class Gem::BasicSpecification
# directory.
def gem_build_complete_path # :nodoc:
- File.join extension_dir, 'gem.build_complete'
+ File.join extension_dir, "gem.build_complete"
end
##
@@ -103,7 +103,7 @@ class Gem::BasicSpecification
def extensions_dir
Gem.default_ext_dir_for(base_dir) ||
- File.join(base_dir, 'extensions', Gem::Platform.local.to_s,
+ File.join(base_dir, "extensions", Gem::Platform.local.to_s,
Gem.extension_api_version)
end
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index f74cb419f9..9fc3360fa1 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -5,9 +5,9 @@
# See LICENSE.txt for permissions.
#++
-require_relative 'optparse'
-require_relative 'requirement'
-require_relative 'user_interaction'
+require_relative "optparse"
+require_relative "requirement"
+require_relative "user_interaction"
##
# Base class for all Gem commands. When creating a new gem command, define
@@ -76,7 +76,7 @@ class Gem::Command
when Array
@extra_args = value
when String
- @extra_args = value.split(' ')
+ @extra_args = value.split(" ")
end
end
@@ -556,7 +556,7 @@ class Gem::Command
def configure_options(header, option_list)
return if option_list.nil? or option_list.empty?
- header = header.to_s.empty? ? '' : "#{header} "
+ header = header.to_s.empty? ? "" : "#{header} "
@parser.separator " #{header}Options:"
option_list.each do |args, handler|
@@ -565,7 +565,7 @@ class Gem::Command
end
end
- @parser.separator ''
+ @parser.separator ""
end
##
@@ -578,13 +578,13 @@ class Gem::Command
# ----------------------------------------------------------------
# Add the options common to all commands.
- add_common_option('-h', '--help',
- 'Get help on this command') do |value, options|
+ add_common_option("-h", "--help",
+ "Get help on this command") do |value, options|
options[:help] = true
end
- add_common_option('-V', '--[no-]verbose',
- 'Set the verbose level of output') do |value, options|
+ add_common_option("-V", "--[no-]verbose",
+ "Set the verbose level of output") do |value, options|
# Set us to "really verbose" so the progress meter works
if Gem.configuration.verbose and value
Gem.configuration.verbose = 1
@@ -593,7 +593,7 @@ class Gem::Command
end
end
- add_common_option('-q', '--quiet', 'Silence command progress meter') do |value, options|
+ add_common_option("-q", "--quiet", "Silence command progress meter") do |value, options|
Gem.configuration.verbose = false
end
@@ -606,20 +606,20 @@ class Gem::Command
# commands. Both options are actually handled before the other
# options get parsed.
- add_common_option('--config-file FILE',
- 'Use this config file instead of default') do
+ add_common_option("--config-file FILE",
+ "Use this config file instead of default") do
end
- add_common_option('--backtrace',
- 'Show stack backtrace on errors') do
+ add_common_option("--backtrace",
+ "Show stack backtrace on errors") do
end
- add_common_option('--debug',
- 'Turn on Ruby debugging') do
+ add_common_option("--debug",
+ "Turn on Ruby debugging") do
end
- add_common_option('--norc',
- 'Avoid loading any .gemrc file') do
+ add_common_option("--norc",
+ "Avoid loading any .gemrc file") do
end
# :stopdoc:
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index e421f89884..9d49138ae7 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -5,9 +5,9 @@
# See LICENSE.txt for permissions.
#++
-require_relative 'command'
-require_relative 'user_interaction'
-require_relative 'text'
+require_relative "command"
+require_relative "user_interaction"
+require_relative "text"
##
# The command manager registers and installs all the individual sub-commands
@@ -73,9 +73,9 @@ class Gem::CommandManager
].freeze
ALIAS_COMMANDS = {
- 'i' => 'install',
- 'login' => 'signin',
- 'logout' => 'signout',
+ "i" => "install",
+ "login" => "signin",
+ "logout" => "signout",
}.freeze
##
@@ -104,7 +104,7 @@ class Gem::CommandManager
# Register all the subcommands supported by the gem command.
def initialize
- require 'timeout'
+ require "timeout"
@commands = {}
BUILTIN_COMMANDS.each do |name|
@@ -169,10 +169,10 @@ class Gem::CommandManager
end
case args.first
- when '-h', '--help' then
+ when "-h", "--help" then
say Gem::Command::HELP
terminate_interaction 0
- when '-v', '--version' then
+ when "-v", "--version" then
say Gem::VERSION
terminate_interaction 0
when /^-/ then
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index 6d1a057dfa..accbd7e97d 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -1,29 +1,29 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../package'
-require_relative '../version_option'
+require_relative "../command"
+require_relative "../package"
+require_relative "../version_option"
class Gem::Commands::BuildCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'build', 'Build a gem from a gemspec'
+ super "build", "Build a gem from a gemspec"
add_platform_option
- add_option '--force', 'skip validation of the spec' do |value, options|
+ add_option "--force", "skip validation of the spec" do |value, options|
options[:force] = true
end
- add_option '--strict', 'consider warnings as errors when validating the spec' do |value, options|
+ add_option "--strict", "consider warnings as errors when validating the spec" do |value, options|
options[:strict] = true
end
- add_option '-o', '--output FILE', 'output gem with the given filename' do |value, options|
+ add_option "-o", "--output FILE", "output gem with the given filename" do |value, options|
options[:output] = value
end
- add_option '-C PATH', 'Run as if gem build was started in <PATH> instead of the current working directory.' do |value, options|
+ add_option "-C PATH", "Run as if gem build was started in <PATH> instead of the current working directory." do |value, options|
options[:build_path] = value
end
end
diff --git a/lib/rubygems/commands/cert_command.rb b/lib/rubygems/commands/cert_command.rb
index b59564d575..56bf5ce689 100644
--- a/lib/rubygems/commands/cert_command.rb
+++ b/lib/rubygems/commands/cert_command.rb
@@ -1,69 +1,69 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../security'
+require_relative "../command"
+require_relative "../security"
class Gem::Commands::CertCommand < Gem::Command
def initialize
- super 'cert', 'Manage RubyGems certificates and signing settings',
+ super "cert", "Manage RubyGems certificates and signing settings",
:add => [], :remove => [], :list => [], :build => [], :sign => []
- add_option('-a', '--add CERT',
- 'Add a trusted certificate.') do |cert_file, options|
+ add_option("-a", "--add CERT",
+ "Add a trusted certificate.") do |cert_file, options|
options[:add] << open_cert(cert_file)
end
- add_option('-l', '--list [FILTER]',
- 'List trusted certificates where the',
- 'subject contains FILTER') do |filter, options|
- filter ||= ''
+ add_option("-l", "--list [FILTER]",
+ "List trusted certificates where the",
+ "subject contains FILTER") do |filter, options|
+ filter ||= ""
options[:list] << filter
end
- add_option('-r', '--remove FILTER',
- 'Remove trusted certificates where the',
- 'subject contains FILTER') do |filter, options|
+ add_option("-r", "--remove FILTER",
+ "Remove trusted certificates where the",
+ "subject contains FILTER") do |filter, options|
options[:remove] << filter
end
- add_option('-b', '--build EMAIL_ADDR',
- 'Build private key and self-signed',
- 'certificate for EMAIL_ADDR') do |email_address, options|
+ add_option("-b", "--build EMAIL_ADDR",
+ "Build private key and self-signed",
+ "certificate for EMAIL_ADDR") do |email_address, options|
options[:build] << email_address
end
- add_option('-C', '--certificate CERT',
- 'Signing certificate for --sign') do |cert_file, options|
+ add_option("-C", "--certificate CERT",
+ "Signing certificate for --sign") do |cert_file, options|
options[:issuer_cert] = open_cert(cert_file)
options[:issuer_cert_file] = cert_file
end
- add_option('-K', '--private-key KEY',
- 'Key for --sign or --build') do |key_file, options|
+ add_option("-K", "--private-key KEY",
+ "Key for --sign or --build") do |key_file, options|
options[:key] = open_private_key(key_file)
end
- add_option('-A', '--key-algorithm ALGORITHM',
- 'Select which key algorithm to use for --build') do |algorithm, options|
+ add_option("-A", "--key-algorithm ALGORITHM",
+ "Select which key algorithm to use for --build") do |algorithm, options|
options[:key_algorithm] = algorithm
end
- add_option('-s', '--sign CERT',
- 'Signs CERT with the key from -K',
- 'and the certificate from -C') do |cert_file, options|
+ add_option("-s", "--sign CERT",
+ "Signs CERT with the key from -K",
+ "and the certificate from -C") do |cert_file, options|
raise Gem::OptionParser::InvalidArgument, "#{cert_file}: does not exist" unless
File.file? cert_file
options[:sign] << cert_file
end
- add_option('-d', '--days NUMBER_OF_DAYS',
- 'Days before the certificate expires') do |days, options|
+ add_option("-d", "--days NUMBER_OF_DAYS",
+ "Days before the certificate expires") do |days, options|
options[:expiration_length_days] = days.to_i
end
- add_option('-R', '--re-sign',
- 'Re-signs the certificate from -C with the key from -K') do |resign, options|
+ add_option("-R", "--re-sign",
+ "Re-signs the certificate from -C with the key from -K") do |resign, options|
options[:resign] = resign
end
end
@@ -93,7 +93,7 @@ class Gem::Commands::CertCommand < Gem::Command
def open_private_key(key_file)
check_openssl
- passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
+ passphrase = ENV["GEM_PRIVATE_KEY_PASSPHRASE"]
key = OpenSSL::PKey.read File.read(key_file), passphrase
raise Gem::OptionParser::InvalidArgument,
"#{key_file}: private key not found" unless key.private?
@@ -166,10 +166,10 @@ class Gem::Commands::CertCommand < Gem::Command
def build_key # :nodoc:
return options[:key] if options[:key]
- passphrase = ask_for_password 'Passphrase for your Private Key:'
+ passphrase = ask_for_password "Passphrase for your Private Key:"
say "\n"
- passphrase_confirmation = ask_for_password 'Please repeat the passphrase for your Private Key:'
+ passphrase_confirmation = ask_for_password "Please repeat the passphrase for your Private Key:"
say "\n"
raise Gem::CommandLineError,
@@ -260,7 +260,7 @@ For further reading on signing gems see `ri Gem::Security`.
def load_default_key
key_file = File.join Gem.default_key_path
key = File.read key_file
- passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
+ passphrase = ENV["GEM_PRIVATE_KEY_PASSPHRASE"]
options[:key] = OpenSSL::PKey.read key, passphrase
rescue Errno::ENOENT
diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb
index 3b6b97ae3b..4d1f8782b1 100644
--- a/lib/rubygems/commands/check_command.rb
+++ b/lib/rubygems/commands/check_command.rb
@@ -1,44 +1,44 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../version_option'
-require_relative '../validator'
-require_relative '../doctor'
+require_relative "../command"
+require_relative "../version_option"
+require_relative "../validator"
+require_relative "../doctor"
class Gem::Commands::CheckCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'check', 'Check a gem repository for added or missing files',
+ super "check", "Check a gem repository for added or missing files",
:alien => true, :doctor => false, :dry_run => false, :gems => true
- add_option('-a', '--[no-]alien',
+ add_option("-a", "--[no-]alien",
'Report "unmanaged" or rogue files in the',
- 'gem repository') do |value, options|
+ "gem repository") do |value, options|
options[:alien] = value
end
- add_option('--[no-]doctor',
- 'Clean up uninstalled gems and broken',
- 'specifications') do |value, options|
+ add_option("--[no-]doctor",
+ "Clean up uninstalled gems and broken",
+ "specifications") do |value, options|
options[:doctor] = value
end
- add_option('--[no-]dry-run',
- 'Do not remove files, only report what',
- 'would be removed') do |value, options|
+ add_option("--[no-]dry-run",
+ "Do not remove files, only report what",
+ "would be removed") do |value, options|
options[:dry_run] = value
end
- add_option('--[no-]gems',
- 'Check installed gems for problems') do |value, options|
+ add_option("--[no-]gems",
+ "Check installed gems for problems") do |value, options|
options[:gems] = value
end
- add_version_option 'check'
+ add_version_option "check"
end
def check_gems
- say 'Checking gems...'
+ say "Checking gems..."
say
gems = get_all_gem_names rescue []
@@ -57,7 +57,7 @@ class Gem::Commands::CheckCommand < Gem::Command
end
def doctor
- say 'Checking for files from uninstalled gems...'
+ say "Checking for files from uninstalled gems..."
say
Gem.path.each do |gem_repo|
@@ -72,11 +72,11 @@ class Gem::Commands::CheckCommand < Gem::Command
end
def arguments # :nodoc:
- 'GEMNAME name of gem to check'
+ "GEMNAME name of gem to check"
end
def defaults_str # :nodoc:
- '--gems --alien'
+ "--gems --alien"
end
def description # :nodoc:
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index dc181e4de0..7f143999eb 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -1,35 +1,35 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../dependency_list'
-require_relative '../uninstaller'
+require_relative "../command"
+require_relative "../dependency_list"
+require_relative "../uninstaller"
class Gem::Commands::CleanupCommand < Gem::Command
def initialize
- super 'cleanup',
- 'Clean up old versions of installed gems',
+ super "cleanup",
+ "Clean up old versions of installed gems",
:force => false, :install_dir => Gem.dir,
:check_dev => true
- add_option('-n', '-d', '--dry-run',
- 'Do not uninstall gems') do |value, options|
+ add_option("-n", "-d", "--dry-run",
+ "Do not uninstall gems") do |value, options|
options[:dryrun] = true
end
- add_option(:Deprecated, '--dryrun',
- 'Do not uninstall gems') do |value, options|
+ add_option(:Deprecated, "--dryrun",
+ "Do not uninstall gems") do |value, options|
options[:dryrun] = true
end
- deprecate_option('--dryrun', extra_msg: 'Use --dry-run instead')
+ deprecate_option("--dryrun", extra_msg: "Use --dry-run instead")
- add_option('-D', '--[no-]check-development',
- 'Check development dependencies while uninstalling',
- '(default: true)') do |value, options|
+ add_option("-D", "--[no-]check-development",
+ "Check development dependencies while uninstalling",
+ "(default: true)") do |value, options|
options[:check_dev] = value
end
- add_option('--[no-]user-install',
- 'Cleanup in user\'s home directory instead',
- 'of GEM_HOME.') do |value, options|
+ add_option("--[no-]user-install",
+ "Cleanup in user's home directory instead",
+ "of GEM_HOME.") do |value, options|
options[:user_install] = value
end
diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
index 716022c458..3dd0b16265 100644
--- a/lib/rubygems/commands/contents_command.rb
+++ b/lib/rubygems/commands/contents_command.rb
@@ -1,39 +1,39 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../version_option'
+require_relative "../command"
+require_relative "../version_option"
class Gem::Commands::ContentsCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'contents', 'Display the contents of the installed gems',
+ super "contents", "Display the contents of the installed gems",
:specdirs => [], :lib_only => false, :prefix => true,
:show_install_dir => false
add_version_option
- add_option('--all',
+ add_option("--all",
"Contents for all gems") do |all, options|
options[:all] = all
end
- add_option('-s', '--spec-dir a,b,c', Array,
+ add_option("-s", "--spec-dir a,b,c", Array,
"Search for gems under specific paths") do |spec_dirs, options|
options[:specdirs] = spec_dirs
end
- add_option('-l', '--[no-]lib-only',
+ add_option("-l", "--[no-]lib-only",
"Only return files in the Gem's lib_dirs") do |lib_only, options|
options[:lib_only] = lib_only
end
- add_option('--[no-]prefix',
+ add_option("--[no-]prefix",
"Don't include installed path prefix") do |prefix, options|
options[:prefix] = prefix
end
- add_option('--[no-]show-install-dir',
- 'Show only the gem install dir') do |show, options|
+ add_option("--[no-]show-install-dir",
+ "Show only the gem install dir") do |show, options|
options[:show_install_dir] = show
end
@@ -105,11 +105,11 @@ prefix or only the files that are requireable.
case file
when /\A#{spec.bindir}\//
# $' is POSTMATCH
- [RbConfig::CONFIG['bindir'], $']
+ [RbConfig::CONFIG["bindir"], $']
when /\.so\z/
- [RbConfig::CONFIG['archdir'], file]
+ [RbConfig::CONFIG["archdir"], file]
else
- [RbConfig::CONFIG['rubylibdir'], file]
+ [RbConfig::CONFIG["rubylibdir"], file]
end
end
end
diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb
index d2fed022fe..c9ddc9af0a 100644
--- a/lib/rubygems/commands/dependency_command.rb
+++ b/lib/rubygems/commands/dependency_command.rb
@@ -1,28 +1,28 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../local_remote_options'
-require_relative '../version_option'
+require_relative "../command"
+require_relative "../local_remote_options"
+require_relative "../version_option"
class Gem::Commands::DependencyCommand < Gem::Command
include Gem::LocalRemoteOptions
include Gem::VersionOption
def initialize
- super 'dependency',
- 'Show the dependencies of an installed gem',
+ super "dependency",
+ "Show the dependencies of an installed gem",
:version => Gem::Requirement.default, :domain => :local
add_version_option
add_platform_option
add_prerelease_option
- add_option('-R', '--[no-]reverse-dependencies',
- 'Include reverse dependencies in the output') do
+ add_option("-R", "--[no-]reverse-dependencies",
+ "Include reverse dependencies in the output") do
|value, options|
options[:reverse_dependencies] = value
end
- add_option('-p', '--pipe',
+ add_option("-p", "--pipe",
"Pipe Format (name --version ver)") do |value, options|
options[:pipe_format] = value
end
@@ -134,7 +134,7 @@ use with other commands.
def ensure_local_only_reverse_dependencies # :nodoc:
if options[:reverse_dependencies] and remote? and not local?
- alert_error 'Only reverse dependencies for local gems are supported.'
+ alert_error "Only reverse dependencies for local gems are supported."
terminate_interaction 1
end
end
@@ -142,7 +142,7 @@ use with other commands.
def ensure_specs(specs) # :nodoc:
return unless specs.empty?
- patterns = options[:args].join ','
+ patterns = options[:args].join ","
say "No gems found matching #{patterns} (#{options[:version]})" if
Gem.configuration.verbose
@@ -151,10 +151,10 @@ use with other commands.
def print_dependencies(spec, level = 0) # :nodoc:
response = String.new
- response << ' ' * level + "Gem #{spec.full_name}\n"
+ response << " " * level + "Gem #{spec.full_name}\n"
unless spec.dependencies.empty?
spec.dependencies.sort_by {|dep| dep.name }.each do |dep|
- response << ' ' * level + " #{dep}\n"
+ response << " " * level + " #{dep}\n"
end
end
response
diff --git a/lib/rubygems/commands/environment_command.rb b/lib/rubygems/commands/environment_command.rb
index b6b3d3812c..d95e1d0dbb 100644
--- a/lib/rubygems/commands/environment_command.rb
+++ b/lib/rubygems/commands/environment_command.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require_relative '../command'
+require_relative "../command"
class Gem::Commands::EnvironmentCommand < Gem::Command
def initialize
- super 'environment', 'Display information about the RubyGems environment'
+ super "environment", "Display information about the RubyGems environment"
end
def arguments # :nodoc:
@@ -16,7 +16,7 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
platform display the supported gem platforms
<omitted> display everything
EOF
- return args.gsub(/^\s+/, '')
+ return args.gsub(/^\s+/, "")
end
def description # :nodoc:
@@ -141,7 +141,7 @@ lib/rubygems/defaults/operating_system.rb
out << " - GEM CONFIGURATION:\n"
Gem.configuration.each do |name, value|
- value = value.gsub(/./, '*') if name == 'gemcutter_key'
+ value = value.gsub(/./, "*") if name == "gemcutter_key"
out << " - #{name.inspect} => #{value.inspect}\n"
end
@@ -152,7 +152,7 @@ lib/rubygems/defaults/operating_system.rb
out << " - SHELL PATH:\n"
- shell_path = ENV['PATH'].split(File::PATH_SEPARATOR)
+ shell_path = ENV["PATH"].split(File::PATH_SEPARATOR)
add_path out, shell_path
out
diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb
index c8ecb0d48c..582563ba81 100644
--- a/lib/rubygems/commands/fetch_command.rb
+++ b/lib/rubygems/commands/fetch_command.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../local_remote_options'
-require_relative '../version_option'
+require_relative "../command"
+require_relative "../local_remote_options"
+require_relative "../version_option"
class Gem::Commands::FetchCommand < Gem::Command
include Gem::LocalRemoteOptions
@@ -13,7 +13,7 @@ class Gem::Commands::FetchCommand < Gem::Command
:version => Gem::Requirement.default,
}
- super 'fetch', 'Download a gem and place it in the current directory', defaults
+ super "fetch", "Download a gem and place it in the current directory", defaults
add_bulk_threshold_option
add_proxy_option
@@ -24,13 +24,13 @@ class Gem::Commands::FetchCommand < Gem::Command
add_platform_option
add_prerelease_option
- add_option '--[no-]suggestions', 'Suggest alternates when gems are not found' do |value, options|
+ add_option "--[no-]suggestions", "Suggest alternates when gems are not found" do |value, options|
options[:suggest_alternate] = value
end
end
def arguments # :nodoc:
- 'GEMNAME name of gem to download'
+ "GEMNAME name of gem to download"
end
def defaults_str # :nodoc:
diff --git a/lib/rubygems/commands/generate_index_command.rb b/lib/rubygems/commands/generate_index_command.rb
index 87200dab91..8bb24c9ce3 100644
--- a/lib/rubygems/commands/generate_index_command.rb
+++ b/lib/rubygems/commands/generate_index_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../indexer'
+require_relative "../command"
+require_relative "../indexer"
##
# Generates a index files for use as a gem server.
@@ -9,27 +9,27 @@ require_relative '../indexer'
class Gem::Commands::GenerateIndexCommand < Gem::Command
def initialize
- super 'generate_index',
- 'Generates the index files for a gem server directory',
- :directory => '.', :build_modern => true
+ super "generate_index",
+ "Generates the index files for a gem server directory",
+ :directory => ".", :build_modern => true
- add_option '-d', '--directory=DIRNAME',
- 'repository base dir containing gems subdir' do |dir, options|
+ add_option "-d", "--directory=DIRNAME",
+ "repository base dir containing gems subdir" do |dir, options|
options[:directory] = File.expand_path dir
end
- add_option '--[no-]modern',
- 'Generate indexes for RubyGems',
- '(always true)' do |value, options|
+ add_option "--[no-]modern",
+ "Generate indexes for RubyGems",
+ "(always true)" do |value, options|
options[:build_modern] = value
end
- deprecate_option('--modern', version: '4.0', extra_msg: 'Modern indexes (specs, latest_specs, and prerelease_specs) are always generated, so this option is not needed.')
- deprecate_option('--no-modern', version: '4.0', extra_msg: 'The `--no-modern` option is currently ignored. Modern indexes (specs, latest_specs, and prerelease_specs) are always generated.')
+ deprecate_option("--modern", version: "4.0", extra_msg: "Modern indexes (specs, latest_specs, and prerelease_specs) are always generated, so this option is not needed.")
+ deprecate_option("--no-modern", version: "4.0", extra_msg: "The `--no-modern` option is currently ignored. Modern indexes (specs, latest_specs, and prerelease_specs) are always generated.")
- add_option '--update',
- 'Update modern indexes with gems added',
- 'since the last update' do |value, options|
+ add_option "--update",
+ "Update modern indexes with gems added",
+ "since the last update" do |value, options|
options[:update] = value
end
end
diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb
index 7f3383c9f3..8bfb4458ff 100644
--- a/lib/rubygems/commands/help_command.rb
+++ b/lib/rubygems/commands/help_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative '../command'
+require_relative "../command"
class Gem::Commands::HelpCommand < Gem::Command
# :stopdoc:
@@ -280,7 +280,7 @@ platform.
# :startdoc:
def initialize
- super 'help', "Provide help on the 'gem' command"
+ super "help", "Provide help on the 'gem' command"
@command_manager = Gem::CommandManager.instance
end
@@ -326,7 +326,7 @@ platform.
desc_width = @command_manager.command_names.map {|n| n.size }.max + 4
summary_width = 80 - margin_width - desc_width
- wrap_indent = ' ' * (margin_width + desc_width)
+ wrap_indent = " " * (margin_width + desc_width)
format = "#{' ' * margin_width}%-#{desc_width}s%s"
@command_manager.command_names.each do |cmd_name|
diff --git a/lib/rubygems/commands/info_command.rb b/lib/rubygems/commands/info_command.rb
index 3f2dd4ae0b..ced7751ff5 100644
--- a/lib/rubygems/commands/info_command.rb
+++ b/lib/rubygems/commands/info_command.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../query_utils'
+require_relative "../command"
+require_relative "../query_utils"
class Gem::Commands::InfoCommand < Gem::Command
include Gem::QueryUtils
@@ -13,7 +13,7 @@ class Gem::Commands::InfoCommand < Gem::Command
add_query_options
- remove_option('-d')
+ remove_option("-d")
defaults[:details] = true
defaults[:exact] = true
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 87563accb0..690f90c2e4 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -1,10 +1,10 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../install_update_options'
-require_relative '../dependency_installer'
-require_relative '../local_remote_options'
-require_relative '../validator'
-require_relative '../version_option'
+require_relative "../command"
+require_relative "../install_update_options"
+require_relative "../dependency_installer"
+require_relative "../local_remote_options"
+require_relative "../validator"
+require_relative "../version_option"
##
# Gem installer command line tool
@@ -29,7 +29,7 @@ class Gem::Commands::InstallCommand < Gem::Command
defaults.merge!(install_update_options)
- super 'install', 'Install a gem into the local repository', defaults
+ super "install", "Install a gem into the local repository", defaults
add_install_update_options
add_local_remote_options
@@ -157,7 +157,7 @@ You can use `i` command instead of `install`.
@installed_specs = []
- ENV.delete 'GEM_PATH' if options[:install_dir].nil?
+ ENV.delete "GEM_PATH" if options[:install_dir].nil?
check_install_dir
check_version
@@ -172,7 +172,7 @@ You can use `i` command instead of `install`.
end
def install_from_gemdeps # :nodoc:
- require_relative '../request_set'
+ require_relative "../request_set"
rs = Gem::RequestSet.new
specs = rs.install_from_gemdeps options do |req, inst|
@@ -247,11 +247,11 @@ You can use `i` command instead of `install`.
def load_hooks # :nodoc:
if options[:install_as_default]
- require_relative '../install_default_message'
+ require_relative "../install_default_message"
else
- require_relative '../install_message'
+ require_relative "../install_message"
end
- require_relative '../rdoc'
+ require_relative "../rdoc"
end
def show_install_errors(errors) # :nodoc:
@@ -270,7 +270,7 @@ You can use `i` command instead of `install`.
def show_installed # :nodoc:
return if @installed_specs.empty?
- gems = @installed_specs.length == 1 ? 'gem' : 'gems'
+ gems = @installed_specs.length == 1 ? "gem" : "gems"
say "#{@installed_specs.length} #{gems} installed"
end
end
diff --git a/lib/rubygems/commands/list_command.rb b/lib/rubygems/commands/list_command.rb
index 010d968f9c..011873b99c 100644
--- a/lib/rubygems/commands/list_command.rb
+++ b/lib/rubygems/commands/list_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../query_utils'
+require_relative "../command"
+require_relative "../query_utils"
##
# Searches for gems starting with the supplied argument.
@@ -9,7 +9,7 @@ class Gem::Commands::ListCommand < Gem::Command
include Gem::QueryUtils
def initialize
- super 'list', 'Display local gems whose name matches REGEXP',
+ super "list", "Display local gems whose name matches REGEXP",
:domain => :local, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default
diff --git a/lib/rubygems/commands/lock_command.rb b/lib/rubygems/commands/lock_command.rb
index cb6229a2cb..da636492c9 100644
--- a/lib/rubygems/commands/lock_command.rb
+++ b/lib/rubygems/commands/lock_command.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-require_relative '../command'
+require_relative "../command"
class Gem::Commands::LockCommand < Gem::Command
def initialize
- super 'lock', 'Generate a lockdown list of gems',
+ super "lock", "Generate a lockdown list of gems",
:strict => false
- add_option '-s', '--[no-]strict',
- 'fail if unable to satisfy a dependency' do |strict, options|
+ add_option "-s", "--[no-]strict",
+ "fail if unable to satisfy a dependency" do |strict, options|
options[:strict] = strict
end
end
diff --git a/lib/rubygems/commands/mirror_command.rb b/lib/rubygems/commands/mirror_command.rb
index 7daa47e2f0..b633cd3d81 100644
--- a/lib/rubygems/commands/mirror_command.rb
+++ b/lib/rubygems/commands/mirror_command.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require_relative '../command'
+require_relative "../command"
unless defined? Gem::Commands::MirrorCommand
class Gem::Commands::MirrorCommand < Gem::Command
def initialize
- super('mirror', 'Mirror all gem files (requires rubygems-mirror)')
+ super("mirror", "Mirror all gem files (requires rubygems-mirror)")
begin
- Gem::Specification.find_by_name('rubygems-mirror').activate
+ Gem::Specification.find_by_name("rubygems-mirror").activate
rescue Gem::LoadError
# no-op
end
diff --git a/lib/rubygems/commands/open_command.rb b/lib/rubygems/commands/open_command.rb
index 1e616fd68f..d5283f72dd 100644
--- a/lib/rubygems/commands/open_command.rb
+++ b/lib/rubygems/commands/open_command.rb
@@ -1,18 +1,18 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../version_option'
+require_relative "../command"
+require_relative "../version_option"
class Gem::Commands::OpenCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'open', 'Open gem sources in editor'
+ super "open", "Open gem sources in editor"
- add_option('-e', '--editor COMMAND', String,
+ add_option("-e", "--editor COMMAND", String,
"Prepends COMMAND to gem path. Could be used to specify editor.") do |command, options|
options[:editor] = command || get_env_editor
end
- add_option('-v', '--version VERSION', String,
+ add_option("-v", "--version VERSION", String,
"Opens specific gem version") do |version|
options[:version] = version
end
@@ -40,10 +40,10 @@ class Gem::Commands::OpenCommand < Gem::Command
end
def get_env_editor
- ENV['GEM_EDITOR'] ||
- ENV['VISUAL'] ||
- ENV['EDITOR'] ||
- 'vi'
+ ENV["GEM_EDITOR"] ||
+ ENV["VISUAL"] ||
+ ENV["EDITOR"] ||
+ "vi"
end
def execute
diff --git a/lib/rubygems/commands/outdated_command.rb b/lib/rubygems/commands/outdated_command.rb
index 162d338320..1785194389 100644
--- a/lib/rubygems/commands/outdated_command.rb
+++ b/lib/rubygems/commands/outdated_command.rb
@@ -1,15 +1,15 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../local_remote_options'
-require_relative '../spec_fetcher'
-require_relative '../version_option'
+require_relative "../command"
+require_relative "../local_remote_options"
+require_relative "../spec_fetcher"
+require_relative "../version_option"
class Gem::Commands::OutdatedCommand < Gem::Command
include Gem::LocalRemoteOptions
include Gem::VersionOption
def initialize
- super 'outdated', 'Display all gems that need updates'
+ super "outdated", "Display all gems that need updates"
add_local_remote_options
add_platform_option
diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb
index 42b0d79135..4a0f7aa3e4 100644
--- a/lib/rubygems/commands/owner_command.rb
+++ b/lib/rubygems/commands/owner_command.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../local_remote_options'
-require_relative '../gemcutter_utilities'
-require_relative '../text'
+require_relative "../command"
+require_relative "../local_remote_options"
+require_relative "../gemcutter_utilities"
+require_relative "../text"
class Gem::Commands::OwnerCommand < Gem::Command
include Gem::Text
@@ -34,23 +34,23 @@ permission to.
end
def initialize
- super 'owner', 'Manage gem owners of a gem on the push server'
+ super "owner", "Manage gem owners of a gem on the push server"
add_proxy_option
add_key_option
add_otp_option
defaults.merge! :add => [], :remove => []
- add_option '-a', '--add NEW_OWNER', 'Add an owner by user identifier' do |value, options|
+ add_option "-a", "--add NEW_OWNER", "Add an owner by user identifier" do |value, options|
options[:add] << value
end
- add_option '-r', '--remove OLD_OWNER', 'Remove an owner by user identifier' do |value, options|
+ add_option "-r", "--remove OLD_OWNER", "Remove an owner by user identifier" do |value, options|
options[:remove] << value
end
- add_option '-h', '--host HOST',
- 'Use another gemcutter-compatible host',
- ' (e.g. https://rubygems.org)' do |value, options|
+ add_option "-h", "--host HOST",
+ "Use another gemcutter-compatible host",
+ " (e.g. https://rubygems.org)" do |value, options|
options[:host] = value
end
end
@@ -108,7 +108,7 @@ permission to.
def send_owner_request(method, name, owner)
rubygems_api_request method, "api/v1/gems/#{name}/owners", scope: get_owner_scope(method: method) do |request|
- request.set_form_data 'email' => owner
+ request.set_form_data "email" => owner
request.add_field "Authorization", api_key
end
end
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index 030c1bffce..d4dadf0736 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -1,67 +1,67 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../package'
-require_relative '../installer'
-require_relative '../version_option'
+require_relative "../command"
+require_relative "../package"
+require_relative "../installer"
+require_relative "../version_option"
class Gem::Commands::PristineCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'pristine',
- 'Restores installed gems to pristine condition from files located in the gem cache',
+ super "pristine",
+ "Restores installed gems to pristine condition from files located in the gem cache",
:version => Gem::Requirement.default,
:extensions => true,
:extensions_set => false,
:all => false
- add_option('--all',
- 'Restore all installed gems to pristine',
- 'condition') do |value, options|
+ add_option("--all",
+ "Restore all installed gems to pristine",
+ "condition") do |value, options|
options[:all] = value
end
- add_option('--skip=gem_name',
- 'used on --all, skip if name == gem_name') do |value, options|
+ add_option("--skip=gem_name",
+ "used on --all, skip if name == gem_name") do |value, options|
options[:skip] ||= []
options[:skip] << value
end
- add_option('--[no-]extensions',
- 'Restore gems with extensions',
- 'in addition to regular gems') do |value, options|
+ add_option("--[no-]extensions",
+ "Restore gems with extensions",
+ "in addition to regular gems") do |value, options|
options[:extensions_set] = true
options[:extensions] = value
end
- add_option('--only-executables',
- 'Only restore executables') do |value, options|
+ add_option("--only-executables",
+ "Only restore executables") do |value, options|
options[:only_executables] = value
end
- add_option('--only-plugins',
- 'Only restore plugins') do |value, options|
+ add_option("--only-plugins",
+ "Only restore plugins") do |value, options|
options[:only_plugins] = value
end
- add_option('-E', '--[no-]env-shebang',
- 'Rewrite executables with a shebang',
- 'of /usr/bin/env') do |value, options|
+ add_option("-E", "--[no-]env-shebang",
+ "Rewrite executables with a shebang",
+ "of /usr/bin/env") do |value, options|
options[:env_shebang] = value
end
- add_option('-i', '--install-dir DIR',
- 'Gem repository to get binstubs and plugins installed') do |value, options|
+ add_option("-i", "--install-dir DIR",
+ "Gem repository to get binstubs and plugins installed") do |value, options|
options[:install_dir] = File.expand_path(value)
end
- add_option('-n', '--bindir DIR',
- 'Directory where executables are',
- 'located') do |value, options|
+ add_option("-n", "--bindir DIR",
+ "Directory where executables are",
+ "located") do |value, options|
options[:bin_dir] = File.expand_path(value)
end
- add_version_option('restore to', 'pristine condition')
+ add_version_option("restore to", "pristine condition")
end
def arguments # :nodoc:
@@ -69,7 +69,7 @@ class Gem::Commands::PristineCommand < Gem::Command
end
def defaults_str # :nodoc:
- '--extensions'
+ "--extensions"
end
def description # :nodoc:
@@ -143,7 +143,7 @@ extensions will be restored.
gem = spec.cache_file
unless File.exist? gem or options[:only_executables] or options[:only_plugins]
- require_relative '../remote_fetcher'
+ require_relative "../remote_fetcher"
say "Cached gem for #{spec.full_name} not found, attempting to fetch..."
@@ -163,8 +163,8 @@ extensions will be restored.
if options.include? :env_shebang
options[:env_shebang]
else
- install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS['install']
- install_defaults.to_s['--env-shebang']
+ install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS["install"]
+ install_defaults.to_s["--env-shebang"]
end
bin_dir = options[:bin_dir] if options[:bin_dir]
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb
index 4d0d5a9f4b..46b65f4e15 100644
--- a/lib/rubygems/commands/push_command.rb
+++ b/lib/rubygems/commands/push_command.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../local_remote_options'
-require_relative '../gemcutter_utilities'
-require_relative '../package'
+require_relative "../command"
+require_relative "../local_remote_options"
+require_relative "../gemcutter_utilities"
+require_relative "../package"
class Gem::Commands::PushCommand < Gem::Command
include Gem::LocalRemoteOptions
@@ -29,7 +29,7 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
end
def initialize
- super 'push', 'Push a gem up to the gem server', :host => self.host
+ super "push", "Push a gem up to the gem server", :host => self.host
@user_defined_host = false
@@ -37,9 +37,9 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
add_key_option
add_otp_option
- add_option('--host HOST',
- 'Push to another gemcutter-compatible host',
- ' (e.g. https://rubygems.org)') do |value, options|
+ add_option("--host HOST",
+ "Push to another gemcutter-compatible host",
+ " (e.g. https://rubygems.org)") do |value, options|
options[:host] = value
@user_defined_host = true
end
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 442c4b19bb..c6315acf8c 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../query_utils'
-require_relative '../deprecate'
+require_relative "../command"
+require_relative "../query_utils"
+require_relative "../deprecate"
class Gem::Commands::QueryCommand < Gem::Command
extend Gem::Deprecate
@@ -17,15 +17,15 @@ class Gem::Commands::QueryCommand < Gem::Command
alert_warning message unless Gem::Deprecate.skip
end
- def initialize(name = 'query',
- summary = 'Query gem information in local or remote repositories')
+ def initialize(name = "query",
+ summary = "Query gem information in local or remote repositories")
super name, summary,
:domain => :local, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default
- add_option('-n', '--name-matches REGEXP',
- 'Name of gem(s) to query on matches the',
- 'provided REGEXP') do |value, options|
+ add_option("-n", "--name-matches REGEXP",
+ "Name of gem(s) to query on matches the",
+ "provided REGEXP") do |value, options|
options[:name] = /#{value}/i
end
diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb
index 7c5d6212f5..17ad6f836b 100644
--- a/lib/rubygems/commands/rdoc_command.rb
+++ b/lib/rubygems/commands/rdoc_command.rb
@@ -1,35 +1,35 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../version_option'
-require_relative '../rdoc'
-require 'fileutils'
+require_relative "../command"
+require_relative "../version_option"
+require_relative "../rdoc"
+require "fileutils"
class Gem::Commands::RdocCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'rdoc', 'Generates RDoc for pre-installed gems',
+ super "rdoc", "Generates RDoc for pre-installed gems",
:version => Gem::Requirement.default,
:include_rdoc => false, :include_ri => true, :overwrite => false
- add_option('--all',
- 'Generate RDoc/RI documentation for all',
- 'installed gems') do |value, options|
+ add_option("--all",
+ "Generate RDoc/RI documentation for all",
+ "installed gems") do |value, options|
options[:all] = value
end
- add_option('--[no-]rdoc',
- 'Generate RDoc HTML') do |value, options|
+ add_option("--[no-]rdoc",
+ "Generate RDoc HTML") do |value, options|
options[:include_rdoc] = value
end
- add_option('--[no-]ri',
- 'Generate RI data') do |value, options|
+ add_option("--[no-]ri",
+ "Generate RI data") do |value, options|
options[:include_ri] = value
end
- add_option('--[no-]overwrite',
- 'Overwrite installed documents') do |value, options|
+ add_option("--[no-]overwrite",
+ "Overwrite installed documents") do |value, options|
options[:overwrite] = value
end
@@ -69,7 +69,7 @@ Use --overwrite to force rebuilding of documentation.
end
if specs.empty?
- alert_error 'No matching gems found'
+ alert_error "No matching gems found"
terminate_interaction 1
end
@@ -79,8 +79,8 @@ Use --overwrite to force rebuilding of documentation.
doc.force = options[:overwrite]
if options[:overwrite]
- FileUtils.rm_rf File.join(spec.doc_dir, 'ri')
- FileUtils.rm_rf File.join(spec.doc_dir, 'rdoc')
+ FileUtils.rm_rf File.join(spec.doc_dir, "ri")
+ FileUtils.rm_rf File.join(spec.doc_dir, "rdoc")
end
begin
diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb
index 75d99986f9..3f8f7e13f2 100644
--- a/lib/rubygems/commands/search_command.rb
+++ b/lib/rubygems/commands/search_command.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../query_utils'
+require_relative "../command"
+require_relative "../query_utils"
class Gem::Commands::SearchCommand < Gem::Command
include Gem::QueryUtils
def initialize
- super 'search', 'Display remote gems whose name matches REGEXP',
+ super "search", "Display remote gems whose name matches REGEXP",
:domain => :remote, :details => false, :versions => true,
:installed => nil, :version => Gem::Requirement.default
diff --git a/lib/rubygems/commands/server_command.rb b/lib/rubygems/commands/server_command.rb
index f8cad3b5db..56be07c79d 100644
--- a/lib/rubygems/commands/server_command.rb
+++ b/lib/rubygems/commands/server_command.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require_relative '../command'
+require_relative "../command"
unless defined? Gem::Commands::ServerCommand
class Gem::Commands::ServerCommand < Gem::Command
def initialize
- super('server', 'Starts up a web server that hosts the RDoc (requires rubygems-server)')
+ super("server", "Starts up a web server that hosts the RDoc (requires rubygems-server)")
begin
- Gem::Specification.find_by_name('rubygems-server').activate
+ Gem::Specification.find_by_name("rubygems-server").activate
rescue Gem::LoadError
# no-op
end
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 35b500936d..1ed889a713 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative '../command'
+require_relative "../command"
##
# Installs RubyGems itself. This command is ordinarily only available from a
@@ -12,47 +12,47 @@ class Gem::Commands::SetupCommand < Gem::Command
ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
def initialize
- super 'setup', 'Install RubyGems',
+ super "setup", "Install RubyGems",
:format_executable => false, :document => %w[ri],
:force => true,
- :site_or_vendor => 'sitelibdir',
- :destdir => '', :prefix => '', :previous_version => '',
+ :site_or_vendor => "sitelibdir",
+ :destdir => "", :prefix => "", :previous_version => "",
:regenerate_binstubs => true,
:regenerate_plugins => true
- add_option '--previous-version=VERSION',
- 'Previous version of RubyGems',
- 'Used for changelog processing' do |version, options|
+ add_option "--previous-version=VERSION",
+ "Previous version of RubyGems",
+ "Used for changelog processing" do |version, options|
options[:previous_version] = version
end
- add_option '--prefix=PREFIX',
- 'Prefix path for installing RubyGems',
- 'Will not affect gem repository location' do |prefix, options|
+ add_option "--prefix=PREFIX",
+ "Prefix path for installing RubyGems",
+ "Will not affect gem repository location" do |prefix, options|
options[:prefix] = File.expand_path prefix
end
- add_option '--destdir=DESTDIR',
- 'Root directory to install RubyGems into',
- 'Mainly used for packaging RubyGems' do |destdir, options|
+ add_option "--destdir=DESTDIR",
+ "Root directory to install RubyGems into",
+ "Mainly used for packaging RubyGems" do |destdir, options|
options[:destdir] = File.expand_path destdir
end
- add_option '--[no-]vendor',
- 'Install into vendorlibdir not sitelibdir' do |vendor, options|
- options[:site_or_vendor] = vendor ? 'vendorlibdir' : 'sitelibdir'
+ add_option "--[no-]vendor",
+ "Install into vendorlibdir not sitelibdir" do |vendor, options|
+ options[:site_or_vendor] = vendor ? "vendorlibdir" : "sitelibdir"
end
- add_option '--[no-]format-executable',
- 'Makes `gem` match ruby',
- 'If Ruby is ruby18, gem will be gem18' do |value, options|
+ add_option "--[no-]format-executable",
+ "Makes `gem` match ruby",
+ "If Ruby is ruby18, gem will be gem18" do |value, options|
options[:format_executable] = value
end
- add_option '--[no-]document [TYPES]', Array,
- 'Generate documentation for RubyGems',
- 'List the documentation types you wish to',
- 'generate. For example: rdoc,ri' do |value, options|
+ add_option "--[no-]document [TYPES]", Array,
+ "Generate documentation for RubyGems",
+ "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 []
@@ -60,46 +60,46 @@ class Gem::Commands::SetupCommand < Gem::Command
end
end
- add_option '--[no-]rdoc',
- 'Generate RDoc documentation for RubyGems' do |value, options|
+ add_option "--[no-]rdoc",
+ "Generate RDoc documentation for RubyGems" do |value, options|
if value
- options[:document] << 'rdoc'
+ options[:document] << "rdoc"
else
- options[:document].delete 'rdoc'
+ options[:document].delete "rdoc"
end
options[:document].uniq!
end
- add_option '--[no-]ri',
- 'Generate RI documentation for RubyGems' do |value, options|
+ add_option "--[no-]ri",
+ "Generate RI documentation for RubyGems" do |value, options|
if value
- options[:document] << 'ri'
+ options[:document] << "ri"
else
- options[:document].delete 'ri'
+ options[:document].delete "ri"
end
options[:document].uniq!
end
- add_option '--[no-]regenerate-binstubs',
- 'Regenerate gem binstubs' do |value, options|
+ add_option "--[no-]regenerate-binstubs",
+ "Regenerate gem binstubs" do |value, options|
options[:regenerate_binstubs] = value
end
- add_option '--[no-]regenerate-plugins',
- 'Regenerate gem plugins' do |value, options|
+ add_option "--[no-]regenerate-plugins",
+ "Regenerate gem plugins" do |value, options|
options[:regenerate_plugins] = value
end
- add_option '-f', '--[no-]force',
- 'Forcefully overwrite binstubs' do |value, options|
+ add_option "-f", "--[no-]force",
+ "Forcefully overwrite binstubs" do |value, options|
options[:force] = value
end
- add_option('-E', '--[no-]env-shebang',
- 'Rewrite executables with a shebang',
- 'of /usr/bin/env') do |value, options|
+ add_option("-E", "--[no-]env-shebang",
+ "Rewrite executables with a shebang",
+ "of /usr/bin/env") do |value, options|
options[:env_shebang] = value
end
@@ -107,7 +107,7 @@ class Gem::Commands::SetupCommand < Gem::Command
end
def check_ruby_version
- required_version = Gem::Requirement.new '>= 2.3.0'
+ required_version = Gem::Requirement.new ">= 2.3.0"
unless required_version.satisfied_by? Gem.ruby_version
alert_error "Expected Ruby version #{required_version}, is #{Gem.ruby_version}"
@@ -149,7 +149,7 @@ By default, this RubyGems will install gem as:
check_ruby_version
- require 'fileutils'
+ require "fileutils"
if Gem.configuration.really_verbose
extend FileUtils::Verbose
else
@@ -194,7 +194,7 @@ By default, this RubyGems will install gem as:
end
if options[:previous_version].empty?
- options[:previous_version] = Gem::VERSION.sub(/[0-9]+$/, '0')
+ options[:previous_version] = Gem::VERSION.sub(/[0-9]+$/, "0")
end
options[:previous_version] = Gem::Version.new(options[:previous_version])
@@ -216,7 +216,7 @@ By default, this RubyGems will install gem as:
end
if documentation_success
- if options[:document].include? 'rdoc'
+ if options[:document].include? "rdoc"
say "Rdoc documentation was installed. You may now invoke:"
say " gem server"
say "and then peruse beautifully formatted documentation for your gems"
@@ -227,7 +227,7 @@ By default, this RubyGems will install gem as:
say
end
- if options[:document].include? 'ri'
+ if options[:document].include? "ri"
say "Ruby Interactive (ri) documentation was installed. ri is kind of like man "
say "pages for Ruby libraries. You may access it like this:"
say " ri Classname"
@@ -244,14 +244,14 @@ By default, this RubyGems will install gem as:
def install_executables(bin_dir)
prog_mode = options[:prog_mode] || 0755
- executables = { 'gem' => 'bin' }
+ executables = { "gem" => "bin" }
executables.each do |tool, path|
say "Installing #{tool} executable" if @verbose
Dir.chdir path do
bin_file = "gem"
- require 'tmpdir'
+ require "tmpdir"
dest_file = target_bin_path(bin_dir, bin_file)
bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}"
@@ -260,7 +260,7 @@ By default, this RubyGems will install gem as:
bin = File.readlines bin_file
bin[0] = shebang
- File.open bin_tmp_file, 'w' do |fp|
+ File.open bin_tmp_file, "w" do |fp|
fp.puts bin.join
end
@@ -275,7 +275,7 @@ By default, this RubyGems will install gem as:
begin
bin_cmd_file = File.join Dir.tmpdir, "#{bin_file}.bat"
- File.open bin_cmd_file, 'w' do |file|
+ File.open bin_cmd_file, "w" do |file|
file.puts <<-TEXT
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@@ -296,7 +296,7 @@ By default, this RubyGems will install gem as:
def shebang
if options[:env_shebang]
- ruby_name = RbConfig::CONFIG['ruby_install_name']
+ ruby_name = RbConfig::CONFIG["ruby_install_name"]
@env_path ||= ENV_PATHS.find {|env_path| File.executable? env_path }
"#!#{@env_path} #{ruby_name}\n"
else
@@ -305,8 +305,8 @@ By default, this RubyGems will install gem as:
end
def install_lib(lib_dir)
- libs = { 'RubyGems' => 'lib' }
- libs['Bundler'] = 'bundler/lib'
+ libs = { "RubyGems" => "lib" }
+ libs["Bundler"] = "bundler/lib"
libs.each do |tool, path|
say "Installing #{tool}" if @verbose
@@ -319,7 +319,7 @@ By default, this RubyGems will install gem as:
end
def install_rdoc
- gem_doc_dir = File.join Gem.dir, 'doc'
+ gem_doc_dir = File.join Gem.dir, "doc"
rubygems_name = "rubygems-#{Gem::VERSION}"
rubygems_doc_dir = File.join gem_doc_dir, rubygems_name
@@ -333,19 +333,19 @@ By default, this RubyGems will install gem as:
(not File.exist? rubygems_doc_dir or
File.writable? rubygems_doc_dir)
say "Removing old RubyGems RDoc and ri" if @verbose
- Dir[File.join(Gem.dir, 'doc', 'rubygems-[0-9]*')].each do |dir|
+ Dir[File.join(Gem.dir, "doc", "rubygems-[0-9]*")].each do |dir|
rm_rf dir
end
- require_relative '../rdoc'
+ require_relative "../rdoc"
- fake_spec = Gem::Specification.new 'rubygems', Gem::VERSION
+ fake_spec = Gem::Specification.new "rubygems", Gem::VERSION
def fake_spec.full_gem_path
- File.expand_path '../../..', __dir__
+ File.expand_path "../../..", __dir__
end
- generate_ri = options[:document].include? 'ri'
- generate_rdoc = options[:document].include? 'rdoc'
+ generate_ri = options[:document].include? "ri"
+ generate_rdoc = options[:document].include? "rdoc"
rdoc = Gem::RDoc.new fake_spec, generate_rdoc, generate_ri
rdoc.generate
@@ -360,34 +360,24 @@ By default, this RubyGems will install gem as:
end
def install_default_bundler_gem(bin_dir)
- specs_dir = File.join(default_dir, "specifications", "default")
- mkdir_p specs_dir, :mode => 0755
-
- bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
-
current_default_spec = Gem::Specification.default_stubs.find {|s| s.name == "bundler" }
- if current_default_spec
- File.delete(current_default_spec.loaded_from)
+ specs_dir = if current_default_spec && default_dir == Gem.default_dir
Gem::Specification.remove_spec current_default_spec
+ loaded_from = current_default_spec.loaded_from
+ File.delete(loaded_from)
+ File.dirname(loaded_from)
+ else
+ target_specs_dir = File.join(default_dir, "specifications", "default")
+ mkdir_p target_specs_dir, :mode => 0755
+ target_specs_dir
end
+ bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
default_spec_path = File.join(specs_dir, "#{bundler_spec.full_name}.gemspec")
Gem.write_binary(default_spec_path, bundler_spec.to_ruby)
bundler_spec = Gem::Specification.load(default_spec_path)
- # The base_dir value for a specification is inferred by walking up from the
- # folder where the spec was `loaded_from`. In the case of default gems, we
- # walk up two levels, because they live at `specifications/default/`, whereas
- # in the case of regular gems we walk up just one level because they live at
- # `specifications/`. However, in this case, the gem we are installing is
- # misdetected as a regular gem, when it's a default gem in reality. This is
- # because when there's a `:destdir`, the `loaded_from` path has changed and
- # doesn't match `Gem.default_specifications_dir` which is the criteria to
- # tag a gem as a default gem. So, in that case, write the correct
- # `@base_dir` directly.
- bundler_spec.instance_variable_set(:@base_dir, File.dirname(File.dirname(specs_dir)))
-
# Remove gemspec that was same version of vendored bundler.
normal_gemspec = File.join(default_dir, "specifications", "bundler-#{bundler_spec.version}.gemspec")
if File.file? normal_gemspec
@@ -407,7 +397,7 @@ By default, this RubyGems will install gem as:
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
end
- require_relative '../installer'
+ require_relative "../installer"
Dir.chdir("bundler") do
built_gem = Gem::Package.build(bundler_spec)
@@ -449,10 +439,10 @@ By default, this RubyGems will install gem as:
prefix = options[:prefix]
if prefix.empty?
- man_dir = RbConfig::CONFIG['mandir']
+ man_dir = RbConfig::CONFIG["mandir"]
return unless man_dir
else
- man_dir = File.join prefix, 'man'
+ man_dir = File.join prefix, "man"
end
prepend_destdir_if_present(man_dir)
@@ -464,10 +454,10 @@ By default, this RubyGems will install gem as:
if prefix.empty?
lib_dir = RbConfig::CONFIG[site_or_vendor]
- bin_dir = RbConfig::CONFIG['bindir']
+ bin_dir = RbConfig::CONFIG["bindir"]
else
- lib_dir = File.join prefix, 'lib'
- bin_dir = File.join prefix, 'bin'
+ lib_dir = File.join prefix, "lib"
+ bin_dir = File.join prefix, "bin"
end
[prepend_destdir_if_present(lib_dir), prepend_destdir_if_present(bin_dir)]
@@ -475,19 +465,19 @@ By default, this RubyGems will install gem as:
def files_in(dir)
Dir.chdir dir do
- Dir.glob(File.join('**', '*'), File::FNM_DOTMATCH).
+ Dir.glob(File.join("**", "*"), File::FNM_DOTMATCH).
select {|f| !File.directory?(f) }
end
end
def remove_old_bin_files(bin_dir)
old_bin_files = {
- 'gem_mirror' => 'gem mirror',
- 'gem_server' => 'gem server',
- 'gemlock' => 'gem lock',
- 'gemri' => 'ri',
- 'gemwhich' => 'gem which',
- 'index_gem_repository.rb' => 'gem generate_index',
+ "gem_mirror" => "gem mirror",
+ "gem_server" => "gem server",
+ "gemlock" => "gem lock",
+ "gemri" => "ri",
+ "gemwhich" => "gem which",
+ "index_gem_repository.rb" => "gem generate_index",
}
old_bin_files.each do |old_bin_file, new_name|
@@ -496,7 +486,7 @@ By default, this RubyGems will install gem as:
deprecation_message = "`#{old_bin_file}` has been deprecated. Use `#{new_name}` instead."
- File.open old_bin_path, 'w' do |fp|
+ File.open old_bin_path, "w" do |fp|
fp.write <<-EOF
#!#{Gem.ruby}
@@ -506,15 +496,15 @@ abort "#{deprecation_message}"
next unless Gem.win_platform?
- File.open "#{old_bin_path}.bat", 'w' do |fp|
+ File.open "#{old_bin_path}.bat", "w" do |fp|
fp.puts %(@ECHO.#{deprecation_message})
end
end
end
def remove_old_lib_files(lib_dir)
- lib_dirs = { File.join(lib_dir, 'rubygems') => 'lib/rubygems' }
- lib_dirs[File.join(lib_dir, 'bundler')] = 'bundler/lib/bundler'
+ lib_dirs = { File.join(lib_dir, "rubygems") => "lib/rubygems" }
+ lib_dirs[File.join(lib_dir, "bundler")] = "bundler/lib/bundler"
lib_dirs.each do |old_lib_dir, new_lib_dir|
lib_files = files_in(new_lib_dir)
@@ -522,11 +512,11 @@ abort "#{deprecation_message}"
to_remove = old_lib_files - lib_files
- gauntlet_rubygems = File.join(lib_dir, 'gauntlet_rubygems.rb')
+ gauntlet_rubygems = File.join(lib_dir, "gauntlet_rubygems.rb")
to_remove << gauntlet_rubygems if File.exist? gauntlet_rubygems
to_remove.delete_if do |file|
- file.start_with? 'defaults'
+ file.start_with? "defaults"
end
remove_file_list(to_remove, old_lib_dir)
@@ -552,7 +542,7 @@ abort "#{deprecation_message}"
end
def show_release_notes
- release_notes = File.join Dir.pwd, 'CHANGELOG.md'
+ release_notes = File.join Dir.pwd, "CHANGELOG.md"
release_notes =
if File.exist? release_notes
@@ -583,10 +573,10 @@ abort "#{deprecation_message}"
end
def uninstall_old_gemcutter
- require_relative '../uninstaller'
+ require_relative "../uninstaller"
- ui = Gem::Uninstaller.new('gemcutter', :all => true, :ignore => true,
- :version => '< 0.4')
+ ui = Gem::Uninstaller.new("gemcutter", :all => true, :ignore => true,
+ :version => "< 0.4")
ui.uninstall
rescue Gem::InstallError
end
@@ -635,7 +625,7 @@ abort "#{deprecation_message}"
destdir = options[:destdir]
return path if destdir.empty?
- File.join(options[:destdir], path.gsub(/^[a-zA-Z]:/, ''))
+ File.join(options[:destdir], path.gsub(/^[a-zA-Z]:/, ""))
end
def install_file_list(files, dest_dir)
diff --git a/lib/rubygems/commands/signin_command.rb b/lib/rubygems/commands/signin_command.rb
index 23bb2f937f..2660eee4f3 100644
--- a/lib/rubygems/commands/signin_command.rb
+++ b/lib/rubygems/commands/signin_command.rb
@@ -1,15 +1,15 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../gemcutter_utilities'
+require_relative "../command"
+require_relative "../gemcutter_utilities"
class Gem::Commands::SigninCommand < Gem::Command
include Gem::GemcutterUtilities
def initialize
- super 'signin', 'Sign in to any gemcutter-compatible host. '\
- 'It defaults to https://rubygems.org'
+ super "signin", "Sign in to any gemcutter-compatible host. "\
+ "It defaults to https://rubygems.org"
- add_option('--host HOST', 'Push to another gemcutter-compatible host') do |value, options|
+ add_option("--host HOST", "Push to another gemcutter-compatible host") do |value, options|
options[:host] = value
end
@@ -17,10 +17,10 @@ class Gem::Commands::SigninCommand < Gem::Command
end
def description # :nodoc:
- 'The signin command executes host sign in for a push server (the default is'\
- ' https://rubygems.org). The host can be provided with the host flag or can'\
- ' be inferred from the provided gem. Host resolution matches the resolution'\
- ' strategy for the push command.'
+ "The signin command executes host sign in for a push server (the default is"\
+ " https://rubygems.org). The host can be provided with the host flag or can"\
+ " be inferred from the provided gem. Host resolution matches the resolution"\
+ " strategy for the push command."
end
def usage # :nodoc:
diff --git a/lib/rubygems/commands/signout_command.rb b/lib/rubygems/commands/signout_command.rb
index c9485e0c1b..fa688ea3f8 100644
--- a/lib/rubygems/commands/signout_command.rb
+++ b/lib/rubygems/commands/signout_command.rb
@@ -1,14 +1,14 @@
# frozen_string_literal: true
-require_relative '../command'
+require_relative "../command"
class Gem::Commands::SignoutCommand < Gem::Command
def initialize
- super 'signout', 'Sign out from all the current sessions.'
+ super "signout", "Sign out from all the current sessions."
end
def description # :nodoc:
- 'The `signout` command is used to sign out from all current sessions,'\
- ' allowing you to sign in using a different set of credentials.'
+ "The `signout` command is used to sign out from all current sessions,"\
+ " allowing you to sign in using a different set of credentials."
end
def usage # :nodoc:
@@ -19,13 +19,13 @@ class Gem::Commands::SignoutCommand < Gem::Command
credentials_path = Gem.configuration.credentials_path
if !File.exist?(credentials_path)
- alert_error 'You are not currently signed in.'
+ alert_error "You are not currently signed in."
elsif !File.writable?(credentials_path)
alert_error "File '#{Gem.configuration.credentials_path}' is read-only."\
- ' Please make sure it is writable.'
+ " Please make sure it is writable."
else
Gem.configuration.unset_api_key!
- say 'You have successfully signed out from all sessions.'
+ say "You have successfully signed out from all sessions."
end
end
end
diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb
index 35fba1bd04..a5f2d022c6 100644
--- a/lib/rubygems/commands/sources_command.rb
+++ b/lib/rubygems/commands/sources_command.rb
@@ -1,40 +1,40 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../remote_fetcher'
-require_relative '../spec_fetcher'
-require_relative '../local_remote_options'
+require_relative "../command"
+require_relative "../remote_fetcher"
+require_relative "../spec_fetcher"
+require_relative "../local_remote_options"
class Gem::Commands::SourcesCommand < Gem::Command
include Gem::LocalRemoteOptions
def initialize
- require 'fileutils'
+ require "fileutils"
- super 'sources',
- 'Manage the sources and cache file RubyGems uses to search for gems'
+ super "sources",
+ "Manage the sources and cache file RubyGems uses to search for gems"
- add_option '-a', '--add SOURCE_URI', 'Add source' do |value, options|
+ add_option "-a", "--add SOURCE_URI", "Add source" do |value, options|
options[:add] = value
end
- add_option '-l', '--list', 'List sources' do |value, options|
+ add_option "-l", "--list", "List sources" do |value, options|
options[:list] = value
end
- add_option '-r', '--remove SOURCE_URI', 'Remove source' do |value, options|
+ add_option "-r", "--remove SOURCE_URI", "Remove source" do |value, options|
options[:remove] = value
end
- add_option '-c', '--clear-all',
- 'Remove all sources (clear the cache)' do |value, options|
+ add_option "-c", "--clear-all",
+ "Remove all sources (clear the cache)" do |value, options|
options[:clear_all] = value
end
- add_option '-u', '--update', 'Update source cache' do |value, options|
+ add_option "-u", "--update", "Update source cache" do |value, options|
options[:update] = value
end
- add_option '-f', '--[no-]force', "Do not show any confirmation prompts and behave as if 'yes' was always answered" do |value, options|
+ add_option "-f", "--[no-]force", "Do not show any confirmation prompts and behave as if 'yes' was always answered" do |value, options|
options[:force] = value
end
@@ -82,8 +82,8 @@ Do you want to add this source?
def check_rubygems_https(source_uri) # :nodoc:
uri = URI source_uri
- if uri.scheme and uri.scheme.downcase == 'http' and
- uri.host.downcase == 'rubygems.org'
+ if uri.scheme and uri.scheme.downcase == "http" and
+ uri.host.downcase == "rubygems.org"
question = <<-QUESTION.chomp
https://rubygems.org is recommended for security over #{uri}
@@ -112,7 +112,7 @@ Do you want to add this insecure source?
end
def defaults_str # :nodoc:
- '--list'
+ "--list"
end
def description # :nodoc:
@@ -138,8 +138,8 @@ do not recognize you should remove them.
RubyGems has been configured to serve gems via the following URLs through
its history:
-* http://gems.rubyforge.org (RubyGems 1.3.6 and earlier)
-* https://rubygems.org/ (RubyGems 1.3.7 through 1.8.25)
+* http://gems.rubyforge.org (RubyGems 1.3.5 and earlier)
+* http://rubygems.org (RubyGems 1.3.6 through 1.8.30, and 2.0.0)
* https://rubygems.org (RubyGems 2.0.1 and newer)
Since all of these sources point to the same set of gems you only need one
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index 6fba3a36ec..6457a755ae 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../local_remote_options'
-require_relative '../version_option'
-require_relative '../package'
+require_relative "../command"
+require_relative "../local_remote_options"
+require_relative "../version_option"
+require_relative "../package"
class Gem::Commands::SpecificationCommand < Gem::Command
include Gem::LocalRemoteOptions
@@ -11,28 +11,28 @@ class Gem::Commands::SpecificationCommand < Gem::Command
def initialize
Gem.load_yaml
- super 'specification', 'Display gem specification (in yaml)',
+ super "specification", "Display gem specification (in yaml)",
:domain => :local, :version => Gem::Requirement.default,
:format => :yaml
- add_version_option('examine')
+ add_version_option("examine")
add_platform_option
add_prerelease_option
- add_option('--all', 'Output specifications for all versions of',
- 'the gem') do |value, options|
+ add_option("--all", "Output specifications for all versions of",
+ "the gem") do |value, options|
options[:all] = true
end
- add_option('--ruby', 'Output ruby format') do |value, options|
+ add_option("--ruby", "Output ruby format") do |value, options|
options[:format] = :ruby
end
- add_option('--yaml', 'Output YAML format') do |value, options|
+ add_option("--yaml", "Output YAML format") do |value, options|
options[:format] = :yaml
end
- add_option('--marshal', 'Output Marshal format') do |value, options|
+ add_option("--marshal", "Output Marshal format") do |value, options|
options[:format] = :marshal
end
diff --git a/lib/rubygems/commands/stale_command.rb b/lib/rubygems/commands/stale_command.rb
index 62a97966f1..0246f42e3e 100644
--- a/lib/rubygems/commands/stale_command.rb
+++ b/lib/rubygems/commands/stale_command.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require_relative '../command'
+require_relative "../command"
class Gem::Commands::StaleCommand < Gem::Command
def initialize
- super('stale', 'List gems along with access times')
+ super("stale", "List gems along with access times")
end
def description # :nodoc:
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index 467c8bf7ed..d03a96bf87 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../version_option'
-require_relative '../uninstaller'
-require 'fileutils'
+require_relative "../command"
+require_relative "../version_option"
+require_relative "../uninstaller"
+require "fileutils"
##
# Gem uninstaller command line tool
@@ -13,78 +13,78 @@ class Gem::Commands::UninstallCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'uninstall', 'Uninstall gems from the local repository',
+ super "uninstall", "Uninstall gems from the local repository",
:version => Gem::Requirement.default, :user_install => true,
:check_dev => false, :vendor => false
- add_option('-a', '--[no-]all',
- 'Uninstall all matching versions'
+ add_option("-a", "--[no-]all",
+ "Uninstall all matching versions"
) do |value, options|
options[:all] = value
end
- add_option('-I', '--[no-]ignore-dependencies',
- 'Ignore dependency requirements while',
- 'uninstalling') do |value, options|
+ add_option("-I", "--[no-]ignore-dependencies",
+ "Ignore dependency requirements while",
+ "uninstalling") do |value, options|
options[:ignore] = value
end
- add_option('-D', '--[no-]check-development',
- 'Check development dependencies while uninstalling',
- '(default: false)') do |value, options|
+ add_option("-D", "--[no-]check-development",
+ "Check development dependencies while uninstalling",
+ "(default: false)") do |value, options|
options[:check_dev] = value
end
- add_option('-x', '--[no-]executables',
- 'Uninstall applicable executables without',
- 'confirmation') do |value, options|
+ add_option("-x", "--[no-]executables",
+ "Uninstall applicable executables without",
+ "confirmation") do |value, options|
options[:executables] = value
end
- add_option('-i', '--install-dir DIR',
- 'Directory to uninstall gem from') do |value, options|
+ add_option("-i", "--install-dir DIR",
+ "Directory to uninstall gem from") do |value, options|
options[:install_dir] = File.expand_path(value)
end
- add_option('-n', '--bindir DIR',
- 'Directory to remove executables from') do |value, options|
+ add_option("-n", "--bindir DIR",
+ "Directory to remove executables from") do |value, options|
options[:bin_dir] = File.expand_path(value)
end
- add_option('--[no-]user-install',
- 'Uninstall from user\'s home directory',
- 'in addition to GEM_HOME.') do |value, options|
+ add_option("--[no-]user-install",
+ "Uninstall from user's home directory",
+ "in addition to GEM_HOME.") do |value, options|
options[:user_install] = value
end
- add_option('--[no-]format-executable',
- 'Assume executable names match Ruby\'s prefix and suffix.') do |value, options|
+ add_option("--[no-]format-executable",
+ "Assume executable names match Ruby's prefix and suffix.") do |value, options|
options[:format_executable] = value
end
- add_option('--[no-]force',
- 'Uninstall all versions of the named gems',
- 'ignoring dependencies') do |value, options|
+ add_option("--[no-]force",
+ "Uninstall all versions of the named gems",
+ "ignoring dependencies") do |value, options|
options[:force] = value
end
- add_option('--[no-]abort-on-dependent',
- 'Prevent uninstalling gems that are',
- 'depended on by other gems.') do |value, options|
+ add_option("--[no-]abort-on-dependent",
+ "Prevent uninstalling gems that are",
+ "depended on by other gems.") do |value, options|
options[:abort_on_dependent] = value
end
add_version_option
add_platform_option
- add_option('--vendor',
- 'Uninstall gem from the vendor directory.',
- 'Only for use by gem repackagers.') do |value, options|
+ add_option("--vendor",
+ "Uninstall gem from the vendor directory.",
+ "Only for use by gem repackagers.") do |value, options|
unless Gem.vendor_dir
- raise Gem::OptionParser::InvalidOption.new 'your platform is not supported'
+ raise Gem::OptionParser::InvalidOption.new "your platform is not supported"
end
- alert_warning 'Use your OS package manager to uninstall vendor gems'
+ alert_warning "Use your OS package manager to uninstall vendor gems"
options[:vendor] = true
options[:install_dir] = Gem.vendor_dir
end
diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb
index 3f1708375f..a365e85416 100644
--- a/lib/rubygems/commands/unpack_command.rb
+++ b/lib/rubygems/commands/unpack_command.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../version_option'
-require_relative '../security_option'
-require_relative '../remote_fetcher'
-require_relative '../package'
+require_relative "../command"
+require_relative "../version_option"
+require_relative "../security_option"
+require_relative "../remote_fetcher"
+require_relative "../package"
# forward-declare
@@ -17,18 +17,18 @@ class Gem::Commands::UnpackCommand < Gem::Command
include Gem::SecurityOption
def initialize
- require 'fileutils'
+ require "fileutils"
- super 'unpack', 'Unpack an installed gem to the current directory',
+ super "unpack", "Unpack an installed gem to the current directory",
:version => Gem::Requirement.default,
:target => Dir.pwd
- add_option('--target=DIR',
- 'target directory for unpacking') do |value, options|
+ add_option("--target=DIR",
+ "target directory for unpacking") do |value, options|
options[:target] = value
end
- add_option('--spec', 'unpack the gem specification') do |value, options|
+ add_option("--spec", "unpack the gem specification") do |value, options|
options[:spec] = true
end
@@ -103,11 +103,11 @@ command help for an example.
end
end
- File.open destination, 'w' do |io|
+ File.open destination, "w" do |io|
io.write metadata
end
else
- basename = File.basename path, '.gem'
+ basename = File.basename path, ".gem"
target_dir = File.expand_path basename, options[:target]
package = Gem::Package.new path, security_policy
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index 4080bf5feb..a079642669 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../command_manager'
-require_relative '../dependency_installer'
-require_relative '../install_update_options'
-require_relative '../local_remote_options'
-require_relative '../spec_fetcher'
-require_relative '../version_option'
-require_relative '../install_message' # must come before rdoc for messaging
-require_relative '../rdoc'
+require_relative "../command"
+require_relative "../command_manager"
+require_relative "../dependency_installer"
+require_relative "../install_update_options"
+require_relative "../local_remote_options"
+require_relative "../spec_fetcher"
+require_relative "../version_option"
+require_relative "../install_message" # must come before rdoc for messaging
+require_relative "../rdoc"
class Gem::Commands::UpdateCommand < Gem::Command
include Gem::InstallUpdateOptions
@@ -25,7 +25,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
options.merge!(install_update_options)
- super 'update', 'Update installed gems to the latest version', options
+ super "update", "Update installed gems to the latest version", options
add_install_update_options
@@ -35,8 +35,8 @@ class Gem::Commands::UpdateCommand < Gem::Command
value
end
- add_option('--system [VERSION]', Gem::Version,
- 'Update the RubyGems system software') do |value, options|
+ add_option("--system [VERSION]", Gem::Version,
+ "Update the RubyGems system software") do |value, options|
value = true unless value
options[:system] = value
@@ -166,13 +166,8 @@ command to remove old versions.
def highest_remote_name_tuple(spec) # :nodoc:
spec_tuples = fetch_remote_gems spec
- matching_gems = spec_tuples.select do |g,_|
- g.name == spec.name and g.match_platform?
- end
-
- highest_remote_gem = matching_gems.max
-
- highest_remote_gem ||= [Gem::NameTuple.null]
+ highest_remote_gem = spec_tuples.max
+ return unless highest_remote_gem
highest_remote_gem.first
end
@@ -181,13 +176,13 @@ command to remove old versions.
args = update_rubygems_arguments
version = spec.version
- update_dir = File.join spec.base_dir, 'gems', "rubygems-update-#{version}"
+ update_dir = File.join spec.base_dir, "gems", "rubygems-update-#{version}"
Dir.chdir update_dir do
say "Installing RubyGems #{version}" unless options[:silent]
installed = preparing_gem_layout_for(version) do
- system Gem.ruby, '--disable-gems', 'setup.rb', *args
+ system Gem.ruby, "--disable-gems", "setup.rb", *args
end
say "RubyGems system software updated" if installed unless options[:silent]
@@ -218,30 +213,22 @@ command to remove old versions.
version = options[:system]
update_latest = version == true
- if update_latest
- version = Gem::Version.new Gem::VERSION
- requirement = Gem::Requirement.new ">= #{Gem::VERSION}"
- else
+ unless update_latest
version = Gem::Version.new version
requirement = Gem::Requirement.new version
+
+ return version, requirement
end
+ version = Gem::Version.new Gem::VERSION
+ requirement = Gem::Requirement.new ">= #{Gem::VERSION}"
+
rubygems_update = Gem::Specification.new
- rubygems_update.name = 'rubygems-update'
+ rubygems_update.name = "rubygems-update"
rubygems_update.version = version
- hig = {
- 'rubygems-update' => rubygems_update,
- }
-
- gems_to_update = which_to_update hig, options[:args], :system
- up_ver = gems_to_update.first.version
-
- target = if update_latest
- up_ver
- else
- version
- end
+ highest_remote_tup = highest_remote_name_tuple(rubygems_update)
+ target = highest_remote_tup ? highest_remote_tup.version : version
return target, requirement
end
@@ -291,8 +278,8 @@ command to remove old versions.
check_oldest_rubygems version
- installed_gems = Gem::Specification.find_all_by_name 'rubygems-update', requirement
- installed_gems = update_gem('rubygems-update', version) if installed_gems.empty? || installed_gems.first.version != version
+ installed_gems = Gem::Specification.find_all_by_name "rubygems-update", requirement
+ installed_gems = update_gem("rubygems-update", version) if installed_gems.empty? || installed_gems.first.version != version
return if installed_gems.empty?
install_rubygems installed_gems.first
@@ -300,17 +287,17 @@ command to remove old versions.
def update_rubygems_arguments # :nodoc:
args = []
- args << '--silent' if options[:silent]
- args << '--prefix' << Gem.prefix if Gem.prefix
- args << '--no-document' unless options[:document].include?('rdoc') || options[:document].include?('ri')
- args << '--no-format-executable' if options[:no_format_executable]
- args << '--previous-version' << Gem::VERSION if
+ args << "--silent" if options[:silent]
+ args << "--prefix" << Gem.prefix if Gem.prefix
+ args << "--no-document" unless options[:document].include?("rdoc") || options[:document].include?("ri")
+ args << "--no-format-executable" if options[:no_format_executable]
+ args << "--previous-version" << Gem::VERSION if
options[:system] == true or
Gem::Version.new(options[:system]) >= Gem::Version.new(2)
args
end
- def which_to_update(highest_installed_gems, gem_names, system = false)
+ def which_to_update(highest_installed_gems, gem_names)
result = []
highest_installed_gems.each do |l_name, l_spec|
@@ -318,12 +305,9 @@ command to remove old versions.
gem_names.none? {|name| name == l_spec.name }
highest_remote_tup = highest_remote_name_tuple l_spec
- highest_remote_ver = highest_remote_tup.version
- highest_installed_ver = l_spec.version
+ next unless highest_remote_tup
- if system or (highest_installed_ver < highest_remote_ver)
- result << Gem::NameTuple.new(l_spec.name, [highest_installed_ver, highest_remote_ver].max, highest_remote_tup.platform)
- end
+ result << highest_remote_tup
end
result
diff --git a/lib/rubygems/commands/which_command.rb b/lib/rubygems/commands/which_command.rb
index 44e87a2b98..78493e9380 100644
--- a/lib/rubygems/commands/which_command.rb
+++ b/lib/rubygems/commands/which_command.rb
@@ -1,17 +1,17 @@
# frozen_string_literal: true
-require_relative '../command'
+require_relative "../command"
class Gem::Commands::WhichCommand < Gem::Command
def initialize
- super 'which', 'Find the location of a library file you can require',
+ super "which", "Find the location of a library file you can require",
:search_gems_first => false, :show_all => false
- add_option '-a', '--[no-]all', 'show all matching files' do |show_all, options|
+ add_option "-a", "--[no-]all", "show all matching files" do |show_all, options|
options[:show_all] = show_all
end
- add_option '-g', '--[no-]gems-first',
- 'search gems before non-gems' do |gems_first, options|
+ add_option "-g", "--[no-]gems-first",
+ "search gems before non-gems" do |gems_first, options|
options[:search_gems_first] = gems_first
end
end
@@ -39,7 +39,7 @@ requiring to see why it does not behave as you expect.
found = true
options[:args].each do |arg|
- arg = arg.sub(/#{Regexp.union(*Gem.suffixes)}$/, '')
+ arg = arg.sub(/#{Regexp.union(*Gem.suffixes)}$/, "")
dirs = $LOAD_PATH
spec = Gem::Specification.find_by_path arg
diff --git a/lib/rubygems/commands/yank_command.rb b/lib/rubygems/commands/yank_command.rb
index cad78aec5f..1499f72f5d 100644
--- a/lib/rubygems/commands/yank_command.rb
+++ b/lib/rubygems/commands/yank_command.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative '../command'
-require_relative '../local_remote_options'
-require_relative '../version_option'
-require_relative '../gemcutter_utilities'
+require_relative "../command"
+require_relative "../local_remote_options"
+require_relative "../version_option"
+require_relative "../gemcutter_utilities"
class Gem::Commands::YankCommand < Gem::Command
include Gem::LocalRemoteOptions
@@ -28,15 +28,15 @@ data you will need to change them immediately and yank your gem.
end
def initialize
- super 'yank', 'Remove a pushed gem from the index'
+ super "yank", "Remove a pushed gem from the index"
add_version_option("remove")
add_platform_option("remove")
add_otp_option
- add_option('--host HOST',
- 'Yank from another gemcutter-compatible host',
- ' (e.g. https://rubygems.org)') do |value, options|
+ add_option("--host HOST",
+ "Yank from another gemcutter-compatible host",
+ " (e.g. https://rubygems.org)") do |value, options|
options[:host] = value
end
@@ -76,10 +76,10 @@ data you will need to change them immediately and yank your gem.
request.add_field("Authorization", api_key)
data = {
- 'gem_name' => name,
- 'version' => version,
+ "gem_name" => name,
+ "version" => version,
}
- data['platform'] = platform if platform
+ data["platform"] = platform if platform
request.set_form_data data
end
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index 5dd2bfe88d..d711a51bd0 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -5,8 +5,8 @@
# See LICENSE.txt for permissions.
#++
-require_relative 'user_interaction'
-require 'rbconfig'
+require_relative "user_interaction"
+require "rbconfig"
##
# Gem::ConfigFile RubyGems options and gem command options from gemrc.
@@ -71,7 +71,7 @@ class Gem::ConfigFile
# :startdoc:
- SYSTEM_WIDE_CONFIG_FILE = File.join SYSTEM_CONFIG_PATH, 'gemrc'
+ SYSTEM_WIDE_CONFIG_FILE = File.join SYSTEM_CONFIG_PATH, "gemrc"
##
# List of arguments supplied to the config file object.
@@ -182,20 +182,20 @@ class Gem::ConfigFile
@update_sources = DEFAULT_UPDATE_SOURCES
@concurrent_downloads = DEFAULT_CONCURRENT_DOWNLOADS
@cert_expiration_length_days = DEFAULT_CERT_EXPIRATION_LENGTH_DAYS
- @ipv4_fallback_enabled = ENV['IPV4_FALLBACK_ENABLED'] == 'true' || DEFAULT_IPV4_FALLBACK_ENABLED
+ @ipv4_fallback_enabled = ENV["IPV4_FALLBACK_ENABLED"] == "true" || DEFAULT_IPV4_FALLBACK_ENABLED
operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS)
platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
system_config = load_file SYSTEM_WIDE_CONFIG_FILE
user_config = load_file config_file_name.dup.tap(&Gem::UNTAINT)
- environment_config = (ENV['GEMRC'] || '')
+ environment_config = (ENV["GEMRC"] || "")
.split(File::PATH_SEPARATOR).inject({}) do |result, file|
result.merge load_file file
end
@hash = operating_system_config.merge platform_config
- unless args.index '--norc'
+ unless args.index "--norc"
@hash = @hash.merge system_config
@hash = @hash.merge user_config
@hash = @hash.merge environment_config
@@ -269,7 +269,7 @@ if you believe they were disclosed to a third party.
# Location of RubyGems.org credentials
def credentials_path
- credentials = File.join Gem.user_home, '.gem', 'credentials'
+ credentials = File.join Gem.user_home, ".gem", "credentials"
if File.exist? credentials
credentials
else
@@ -320,13 +320,13 @@ if you believe they were disclosed to a third party.
config = load_file(credentials_path).merge(host => api_key)
dirname = File.dirname credentials_path
- require 'fileutils'
+ require "fileutils"
FileUtils.mkdir_p(dirname)
Gem.load_yaml
permissions = 0600 & (~File.umask)
- File.open(credentials_path, 'w', permissions) do |f|
+ File.open(credentials_path, "w", permissions) do |f|
f.write config.to_yaml
end
@@ -389,7 +389,7 @@ if you believe they were disclosed to a third party.
yield :backtrace, @backtrace
yield :bulk_threshold, @bulk_threshold
- yield 'config_file_name', @config_file_name if @config_file_name
+ yield "config_file_name", @config_file_name if @config_file_name
hash.each(&block)
end
@@ -405,7 +405,7 @@ if you believe they were disclosed to a third party.
when /^--debug$/ then
$DEBUG = true
- warn 'NOTE: Debugging mode prints all exceptions even when rescued'
+ warn "NOTE: Debugging mode prints all exceptions even when rescued"
else
@args << arg
end
@@ -444,7 +444,7 @@ if you believe they were disclosed to a third party.
@hash[:ssl_client_cert] if @hash.key? :ssl_client_cert
keys = yaml_hash.keys.map {|key| key.to_s }
- keys << 'debug'
+ keys << "debug"
re = Regexp.union(*keys)
@hash.each do |key, value|
@@ -458,10 +458,10 @@ if you believe they were disclosed to a third party.
# Writes out this config file, replacing its source.
def write
- require 'fileutils'
+ require "fileutils"
FileUtils.mkdir_p File.dirname(config_file_name)
- File.open config_file_name, 'w' do |io|
+ File.open config_file_name, "w" do |io|
io.write to_yaml
end
end
diff --git a/lib/rubygems/core_ext/kernel_gem.rb b/lib/rubygems/core_ext/kernel_gem.rb
index e722225739..6f96cab84f 100644
--- a/lib/rubygems/core_ext/kernel_gem.rb
+++ b/lib/rubygems/core_ext/kernel_gem.rb
@@ -39,7 +39,7 @@ module Kernel
# GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb
def gem(gem_name, *requirements) # :doc:
- skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
+ skip_list = (ENV["GEM_SKIP"] || "").split(/:/)
raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
if gem_name.kind_of? Gem::Dependency
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index 23badd75d2..8064d813e1 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -5,7 +5,7 @@
# See LICENSE.txt for permissions.
#++
-require 'monitor'
+require "monitor"
module Kernel
diff --git a/lib/rubygems/core_ext/kernel_warn.rb b/lib/rubygems/core_ext/kernel_warn.rb
index 3373cfdd3b..7df6c48b8f 100644
--- a/lib/rubygems/core_ext/kernel_warn.rb
+++ b/lib/rubygems/core_ext/kernel_warn.rb
@@ -39,7 +39,7 @@ if RUBY_VERSION >= "2.5" && !Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES
start += 1
if path = loc.path
- unless path.start_with?(rubygems_path) or path.start_with?('<internal:')
+ unless path.start_with?(rubygems_path) or path.start_with?("<internal:")
# Non-rubygems frames
uplevel -= 1
end
diff --git a/lib/rubygems/core_ext/tcpsocket_init.rb b/lib/rubygems/core_ext/tcpsocket_init.rb
index 2a79b63bd6..c9e0a92953 100644
--- a/lib/rubygems/core_ext/tcpsocket_init.rb
+++ b/lib/rubygems/core_ext/tcpsocket_init.rb
@@ -1,4 +1,4 @@
-require 'socket'
+require "socket"
module CoreExtensions
module TCPSocketExt
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index 39b69ddb1c..d27f286265 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -20,10 +20,10 @@ module Gem
# specified in the environment
def self.default_spec_cache_dir
- default_spec_cache_dir = File.join Gem.user_home, '.gem', 'specs'
+ default_spec_cache_dir = File.join Gem.user_home, ".gem", "specs"
unless File.exist?(default_spec_cache_dir)
- default_spec_cache_dir = File.join Gem.data_home, 'gem', 'specs'
+ default_spec_cache_dir = File.join Gem.data_home, "gem", "specs"
end
default_spec_cache_dir
@@ -34,7 +34,7 @@ module Gem
# specified in the environment
def self.default_dir
- @default_dir ||= File.join(RbConfig::CONFIG['rubylibprefix'], 'gems', RbConfig::CONFIG['ruby_version'])
+ @default_dir ||= File.join(RbConfig::CONFIG["rubylibprefix"], "gems", RbConfig::CONFIG["ruby_version"])
end
##
@@ -81,7 +81,7 @@ module Gem
Dir.home.dup
rescue
if Gem.win_platform?
- File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/')
+ File.expand_path File.join(ENV["HOMEDRIVE"] || ENV["SystemDrive"], "/")
else
File.expand_path "/"
end
@@ -103,7 +103,7 @@ module Gem
gem_dir = File.join(Gem.user_home, ".gem")
gem_dir = File.join(Gem.data_home, "gem") unless File.exist?(gem_dir)
parts = [gem_dir, ruby_engine]
- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
+ parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty?
File.join parts
end
@@ -111,14 +111,14 @@ module Gem
# The path to standard location of the user's configuration directory.
def self.config_home
- @config_home ||= (ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, '.config'))
+ @config_home ||= (ENV["XDG_CONFIG_HOME"] || File.join(Gem.user_home, ".config"))
end
##
# Finds the user's config file
def self.find_config_file
- gemrc = File.join Gem.user_home, '.gemrc'
+ gemrc = File.join Gem.user_home, ".gemrc"
if File.exist? gemrc
gemrc
else
@@ -137,14 +137,14 @@ module Gem
# The path to standard location of the user's cache directory.
def self.cache_home
- @cache_home ||= (ENV["XDG_CACHE_HOME"] || File.join(Gem.user_home, '.cache'))
+ @cache_home ||= (ENV["XDG_CACHE_HOME"] || File.join(Gem.user_home, ".cache"))
end
##
# The path to standard location of the user's data directory.
def self.data_home
- @data_home ||= (ENV["XDG_DATA_HOME"] || File.join(Gem.user_home, '.local', 'share'))
+ @data_home ||= (ENV["XDG_DATA_HOME"] || File.join(Gem.user_home, ".local", "share"))
end
##
@@ -169,7 +169,7 @@ module Gem
# Deduce Ruby's --program-prefix and --program-suffix from its install name
def self.default_exec_format
- exec_format = RbConfig::CONFIG['ruby_install_name'].sub('ruby', '%s') rescue '%s'
+ exec_format = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "%s") rescue "%s"
unless exec_format =~ /%s/
raise Gem::Exception,
@@ -183,7 +183,7 @@ module Gem
# The default directory for binaries
def self.default_bindir
- RbConfig::CONFIG['bindir']
+ RbConfig::CONFIG["bindir"]
end
def self.ruby_engine
@@ -227,14 +227,14 @@ module Gem
# Directory where vendor gems are installed.
def self.vendor_dir # :nodoc:
- if vendor_dir = ENV['GEM_VENDOR']
+ if vendor_dir = ENV["GEM_VENDOR"]
return vendor_dir.dup
end
- return nil unless RbConfig::CONFIG.key? 'vendordir'
+ return nil unless RbConfig::CONFIG.key? "vendordir"
- File.join RbConfig::CONFIG['vendordir'], 'gems',
- RbConfig::CONFIG['ruby_version']
+ File.join RbConfig::CONFIG["vendordir"], "gems",
+ RbConfig::CONFIG["ruby_version"]
end
##
diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb
index 3640362364..c561db1af2 100644
--- a/lib/rubygems/dependency.rb
+++ b/lib/rubygems/dependency.rb
@@ -97,14 +97,14 @@ class Gem::Dependency
end
def pretty_print(q) # :nodoc:
- q.group 1, 'Gem::Dependency.new(', ')' do
+ q.group 1, "Gem::Dependency.new(", ")" do
q.pp name
- q.text ','
+ q.text ","
q.breakable
q.pp requirement
- q.text ','
+ q.text ","
q.breakable
q.pp type
@@ -197,7 +197,7 @@ class Gem::Dependency
reqs = other.requirement.requirements
return false unless reqs.length == 1
- return false unless reqs.first.first == '='
+ return false unless reqs.first.first == "="
version = reqs.first.last
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
index 913bba32eb..acdad6b98f 100644
--- a/lib/rubygems/dependency_installer.rb
+++ b/lib/rubygems/dependency_installer.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require_relative '../rubygems'
-require_relative 'dependency_list'
-require_relative 'package'
-require_relative 'installer'
-require_relative 'spec_fetcher'
-require_relative 'user_interaction'
-require_relative 'available_set'
-require_relative 'deprecate'
+require_relative "../rubygems"
+require_relative "dependency_list"
+require_relative "package"
+require_relative "installer"
+require_relative "spec_fetcher"
+require_relative "user_interaction"
+require_relative "available_set"
+require_relative "deprecate"
##
# Installs a gem along with all its dependencies from local and remote gems.
diff --git a/lib/rubygems/dependency_list.rb b/lib/rubygems/dependency_list.rb
index 10e08fc703..3cecb1e536 100644
--- a/lib/rubygems/dependency_list.rb
+++ b/lib/rubygems/dependency_list.rb
@@ -5,8 +5,8 @@
# See LICENSE.txt for permissions.
#++
-require_relative 'tsort'
-require_relative 'deprecate'
+require_relative "tsort"
+require_relative "deprecate"
##
# Gem::DependencyList is used for installing and uninstalling gems in the
diff --git a/lib/rubygems/doctor.rb b/lib/rubygems/doctor.rb
index d14c64a166..662eff9559 100644
--- a/lib/rubygems/doctor.rb
+++ b/lib/rubygems/doctor.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative '../rubygems'
-require_relative 'user_interaction'
+require_relative "../rubygems"
+require_relative "user_interaction"
##
# Cleans up after a partially-failed uninstall or for an invalid
@@ -19,13 +19,13 @@ class Gem::Doctor
# subdirectory.
REPOSITORY_EXTENSION_MAP = [ # :nodoc:
- ['specifications', '.gemspec'],
- ['build_info', '.info'],
- ['cache', '.gem'],
- ['doc', ''],
- ['extensions', ''],
- ['gems', ''],
- ['plugins', ''],
+ ["specifications", ".gemspec"],
+ ["build_info", ".info"],
+ ["cache", ".gem"],
+ ["doc", ""],
+ ["extensions", ""],
+ ["gems", ""],
+ ["plugins", ""],
].freeze
missing =
@@ -74,8 +74,8 @@ class Gem::Doctor
Gem.use_paths @gem_repository.to_s
unless gem_repository?
- say 'This directory does not appear to be a RubyGems repository, ' +
- 'skipping'
+ say "This directory does not appear to be a RubyGems repository, " +
+ "skipping"
say
return
end
@@ -111,16 +111,16 @@ class Gem::Doctor
basename = File.basename(child, extension)
next if installed_specs.include? basename
next if /^rubygems-\d/ =~ basename
- next if 'specifications' == sub_directory and 'default' == basename
- next if 'plugins' == sub_directory and Gem.plugin_suffix_regexp =~ basename
+ next if "specifications" == sub_directory and "default" == basename
+ next if "plugins" == sub_directory and Gem.plugin_suffix_regexp =~ basename
- type = File.directory?(child) ? 'directory' : 'file'
+ type = File.directory?(child) ? "directory" : "file"
action = if @dry_run
- 'Extra'
+ "Extra"
else
FileUtils.rm_r(child)
- 'Removed'
+ "Removed"
end
say "#{action} #{type} #{sub_directory}/#{File.basename(child)}"
diff --git a/lib/rubygems/errors.rb b/lib/rubygems/errors.rb
index e6e222033d..ac82a551a5 100644
--- a/lib/rubygems/errors.rb
+++ b/lib/rubygems/errors.rb
@@ -136,8 +136,8 @@ module Gem
"Found %s (%s), but was for platform%s %s" %
[@name,
@version,
- @platforms.size == 1 ? '' : 's',
- @platforms.join(' ,')]
+ @platforms.size == 1 ? "" : "s",
+ @platforms.join(" ,")]
end
end
diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb
index 1806869098..5fadbe9bca 100644
--- a/lib/rubygems/exceptions.rb
+++ b/lib/rubygems/exceptions.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'deprecate'
-require_relative 'unknown_command_spell_checker'
+require_relative "deprecate"
+require_relative "unknown_command_spell_checker"
##
# Base exception class for RubyGems. All exception raised by RubyGems are a
@@ -27,7 +27,7 @@ class Gem::UnknownCommandError < Gem::Exception
if DidYouMean.respond_to?(:correct_error)
DidYouMean.correct_error(Gem::UnknownCommandError, Gem::UnknownCommandSpellChecker)
else
- DidYouMean::SPELL_CHECKERS['Gem::UnknownCommandError'] =
+ DidYouMean::SPELL_CHECKERS["Gem::UnknownCommandError"] =
Gem::UnknownCommandSpellChecker
prepend DidYouMean::Correctable
@@ -154,7 +154,7 @@ class Gem::ImpossibleDependenciesError < Gem::Exception
def build_message # :nodoc:
requester = @request.requester
- requester = requester ? requester.spec.full_name : 'The user'
+ requester = requester ? requester.spec.full_name : "The user"
dependency = @request.dependency
message = "#{requester} requires #{dependency} but it conflicted:\n".dup
diff --git a/lib/rubygems/ext.rb b/lib/rubygems/ext.rb
index 59fd830437..d714985c21 100644
--- a/lib/rubygems/ext.rb
+++ b/lib/rubygems/ext.rb
@@ -10,10 +10,10 @@
module Gem::Ext; end
-require_relative 'ext/build_error'
-require_relative 'ext/builder'
-require_relative 'ext/configure_builder'
-require_relative 'ext/ext_conf_builder'
-require_relative 'ext/rake_builder'
-require_relative 'ext/cmake_builder'
-require_relative 'ext/cargo_builder'
+require_relative "ext/build_error"
+require_relative "ext/builder"
+require_relative "ext/configure_builder"
+require_relative "ext/ext_conf_builder"
+require_relative "ext/rake_builder"
+require_relative "ext/cmake_builder"
+require_relative "ext/cargo_builder"
diff --git a/lib/rubygems/ext/build_error.rb b/lib/rubygems/ext/build_error.rb
index 8ef57ed91a..727bc065c2 100644
--- a/lib/rubygems/ext/build_error.rb
+++ b/lib/rubygems/ext/build_error.rb
@@ -2,7 +2,7 @@
##
# Raised when there is an error while building extensions.
-require_relative '../exceptions'
+require_relative "../exceptions"
class Gem::Ext::BuildError < Gem::InstallError
end
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index 99dd2c162c..c5a03806b9 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -5,7 +5,7 @@
# See LICENSE.txt for permissions.
#++
-require_relative '../user_interaction'
+require_relative "../user_interaction"
class Gem::Ext::Builder
include Gem::UserInteraction
@@ -18,29 +18,29 @@ class Gem::Ext::Builder
end
def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil)
- unless File.exist? File.join(make_dir, 'Makefile')
- raise Gem::InstallError, 'Makefile not found'
+ unless File.exist? File.join(make_dir, "Makefile")
+ raise Gem::InstallError, "Makefile not found"
end
# try to find make program from Ruby configure arguments first
- RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
- make_program_name = ENV['MAKE'] || ENV['make'] || $1
+ RbConfig::CONFIG["configure_args"] =~ /with-make-prog\=(\w+)/
+ make_program_name = ENV["MAKE"] || ENV["make"] || $1
unless make_program_name
- make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
+ make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? "nmake" : "make"
end
make_program = Shellwords.split(make_program_name)
# The installation of the bundled gems is failed when DESTDIR is empty in mswin platform.
- destdir = (/\bnmake/i !~ make_program_name || ENV['DESTDIR'] && ENV['DESTDIR'] != "") ? 'DESTDIR=%s' % ENV['DESTDIR'] : ''
+ destdir = (/\bnmake/i !~ make_program_name || ENV["DESTDIR"] && ENV["DESTDIR"] != "") ? "DESTDIR=%s" % ENV["DESTDIR"] : ""
env = [destdir]
if sitedir
- env << 'sitearchdir=%s' % sitedir
- env << 'sitelibdir=%s' % sitedir
+ env << "sitearchdir=%s" % sitedir
+ env << "sitelibdir=%s" % sitedir
end
- ['clean', '', 'install'].each do |target|
+ ["clean", "", "install"].each do |target|
# Pass DESTDIR via command line to override what's in MAKEFLAGS
cmd = [
*make_program,
@@ -50,7 +50,7 @@ class Gem::Ext::Builder
begin
run(cmd, results, "make #{target}".rstrip, make_dir)
rescue Gem::InstallError
- raise unless target == 'clean' # ignore clean failure
+ raise unless target == "clean" # ignore clean failure
end
end
end
@@ -59,7 +59,7 @@ class Gem::Ext::Builder
verbose = Gem.configuration.really_verbose
begin
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], nil
+ rubygems_gemdeps, ENV["RUBYGEMS_GEMDEPS"] = ENV["RUBYGEMS_GEMDEPS"], nil
if verbose
puts("current directory: #{dir}")
p(command)
@@ -70,7 +70,7 @@ class Gem::Ext::Builder
require "open3"
# Set $SOURCE_DATE_EPOCH for the subprocess.
- build_env = { 'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string }.merge(env)
+ build_env = { "SOURCE_DATE_EPOCH" => Gem.source_date_epoch_string }.merge(env)
output, status = begin
Open3.capture2e(build_env, *command, :chdir => dir)
rescue => error
@@ -82,7 +82,7 @@ class Gem::Ext::Builder
results << output
end
ensure
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
+ ENV["RUBYGEMS_GEMDEPS"] = rubygems_gemdeps
end
unless status.success?
@@ -212,11 +212,11 @@ EOF
# Writes +output+ to gem_make.out in the extension install directory.
def write_gem_make_out(output) # :nodoc:
- destination = File.join @spec.extension_dir, 'gem_make.out'
+ destination = File.join @spec.extension_dir, "gem_make.out"
FileUtils.mkdir_p @spec.extension_dir
- File.open destination, 'wb' do |io|
+ File.open destination, "wb" do |io|
io.puts output
end
diff --git a/lib/rubygems/ext/cargo_builder.rb b/lib/rubygems/ext/cargo_builder.rb
index 232c0a313d..e33b07a8a2 100644
--- a/lib/rubygems/ext/cargo_builder.rb
+++ b/lib/rubygems/ext/cargo_builder.rb
@@ -29,14 +29,14 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
def build_crate(dest_path, results, args, cargo_dir)
env = build_env
cmd = cargo_command(cargo_dir, dest_path, args)
- runner.call cmd, results, 'cargo', cargo_dir, env
+ runner.call cmd, results, "cargo", cargo_dir, env
results
end
def build_env
build_env = rb_config_env
- build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?('RUBY_STATIC')
+ build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?("RUBY_STATIC")
build_env
end
@@ -46,7 +46,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
cmd = []
cmd += [cargo, "rustc"]
- cmd += ["--target", ENV['CARGO_BUILD_TARGET']] if ENV['CARGO_BUILD_TARGET']
+ cmd += ["--target", ENV["CARGO_BUILD_TARGET"]] if ENV["CARGO_BUILD_TARGET"]
cmd += ["--target-dir", dest_path]
cmd += ["--manifest-path", manifest]
cmd += ["--lib"]
@@ -144,13 +144,13 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
def cargo_dylib_path(dest_path)
prefix = so_ext == "dll" ? "" : "lib"
path_parts = [dest_path]
- path_parts << ENV['CARGO_BUILD_TARGET'] if ENV['CARGO_BUILD_TARGET']
+ path_parts << ENV["CARGO_BUILD_TARGET"] if ENV["CARGO_BUILD_TARGET"]
path_parts += [profile_target_directory, "#{prefix}#{cargo_crate_name}.#{so_ext}"]
File.join(*path_parts)
end
def cargo_crate_name
- spec.metadata.fetch('cargo_crate_name', spec.name).tr('-', '_')
+ spec.metadata.fetch("cargo_crate_name", spec.name).tr("-", "_")
end
def rustc_dynamic_linker_flags(dest_dir)
@@ -297,8 +297,8 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
def profile_target_directory
case profile
- when :release then 'release'
- when :dev then 'debug'
+ when :release then "release"
+ when :dev then "debug"
else raise "unknown target directory for profile: #{profile}"
end
end
diff --git a/lib/rubygems/ext/cmake_builder.rb b/lib/rubygems/ext/cmake_builder.rb
index e47cabef84..b162664784 100644
--- a/lib/rubygems/ext/cmake_builder.rb
+++ b/lib/rubygems/ext/cmake_builder.rb
@@ -2,8 +2,8 @@
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd)
- unless File.exist?(File.join(cmake_dir, 'Makefile'))
- require_relative '../command'
+ unless File.exist?(File.join(cmake_dir, "Makefile"))
+ require_relative "../command"
cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args]
run cmd, results, class_name, cmake_dir
diff --git a/lib/rubygems/ext/configure_builder.rb b/lib/rubygems/ext/configure_builder.rb
index eb2f9fce61..51106c6370 100644
--- a/lib/rubygems/ext/configure_builder.rb
+++ b/lib/rubygems/ext/configure_builder.rb
@@ -7,7 +7,7 @@
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd)
- unless File.exist?(File.join(configure_dir, 'Makefile'))
+ unless File.exist?(File.join(configure_dir, "Makefile"))
cmd = ["sh", "./configure", "--prefix=#{dest_path}", *args]
run cmd, results, class_name, configure_dir
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index 2f0183fe2f..f8920596d5 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -7,8 +7,8 @@
class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd)
- require 'fileutils'
- require 'tempfile'
+ require "fileutils"
+ require "tempfile"
tmp_dest = Dir.mktmpdir(".gem.", extension_dir)
@@ -22,16 +22,16 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
begin
require "shellwords"
- cmd = Gem.ruby.shellsplit << "-I" << File.expand_path('../..', __dir__) << File.basename(extension)
+ cmd = Gem.ruby.shellsplit << "-I" << File.expand_path("../..", __dir__) << File.basename(extension)
cmd.push(*args)
run(cmd, results, class_name, extension_dir) do |s, r|
- mkmf_log = File.join(extension_dir, 'mkmf.log')
+ mkmf_log = File.join(extension_dir, "mkmf.log")
if File.exist? mkmf_log
unless s.success?
r << "To see why this extension failed to compile, please check" \
" the mkmf.log which can be found here:\n"
- r << " " + File.join(dest_path, 'mkmf.log') + "\n"
+ r << " " + File.join(dest_path, "mkmf.log") + "\n"
end
FileUtils.mv mkmf_log, dest_path
end
@@ -67,7 +67,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
private
def self.get_relative_path(path, base)
- path[0..base.length - 1] = '.' if path.start_with?(base)
+ path[0..base.length - 1] = "." if path.start_with?(base)
path
end
end
diff --git a/lib/rubygems/ext/rake_builder.rb b/lib/rubygems/ext/rake_builder.rb
index fed98e741c..9f2e099d40 100644
--- a/lib/rubygems/ext/rake_builder.rb
+++ b/lib/rubygems/ext/rake_builder.rb
@@ -11,16 +11,16 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
run([Gem.ruby, File.basename(extension), *args], results, class_name, extension_dir)
end
- rake = ENV['rake']
+ rake = ENV["rake"]
if rake
require "shellwords"
rake = rake.shellsplit
else
begin
- rake = [Gem.ruby, "-I#{File.expand_path("../..", __dir__)}", "-rrubygems", Gem.bin_path('rake', 'rake')]
+ rake = [Gem.ruby, "-I#{File.expand_path("../..", __dir__)}", "-rrubygems", Gem.bin_path("rake", "rake")]
rescue Gem::Exception
- rake = [Gem.default_exec_format % 'rake']
+ rake = [Gem.default_exec_format % "rake"]
end
end
diff --git a/lib/rubygems/gem_runner.rb b/lib/rubygems/gem_runner.rb
index b3f925773b..31890a60d7 100644
--- a/lib/rubygems/gem_runner.rb
+++ b/lib/rubygems/gem_runner.rb
@@ -5,9 +5,9 @@
# See LICENSE.txt for permissions.
#++
-require_relative '../rubygems'
-require_relative 'command_manager'
-require_relative 'deprecate'
+require_relative "../rubygems"
+require_relative "command_manager"
+require_relative "deprecate"
##
# Run an instance of the gem program.
@@ -41,7 +41,7 @@ class Gem::GemRunner
config_args = Gem.configuration[command_name]
config_args = case config_args
when String
- config_args.split ' '
+ config_args.split " "
else
Array(config_args)
end
@@ -56,7 +56,7 @@ class Gem::GemRunner
# other arguments in the list.
def extract_build_args(args) # :nodoc:
- return [] unless offset = args.index('--')
+ return [] unless offset = args.index("--")
build_args = args.slice!(offset...args.length)
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb
index af0d957bc8..c46650afb1 100644
--- a/lib/rubygems/gemcutter_utilities.rb
+++ b/lib/rubygems/gemcutter_utilities.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'remote_fetcher'
-require_relative 'text'
+require_relative "remote_fetcher"
+require_relative "text"
##
# Utility methods for using the RubyGems API.
@@ -19,8 +19,8 @@ module Gem::GemcutterUtilities
# Add the --key option
def add_key_option
- add_option('-k', '--key KEYNAME', Symbol,
- 'Use the given API key',
+ add_option("-k", "--key KEYNAME", Symbol,
+ "Use the given API key",
"from #{Gem.configuration.credentials_path}") do |value,options|
options[:key] = value
end
@@ -30,9 +30,9 @@ module Gem::GemcutterUtilities
# Add the --otp option
def add_otp_option
- add_option('--otp CODE',
- 'Digit code for multifactor authentication',
- 'You can also use the environment variable GEM_HOST_OTP_CODE') do |value, options|
+ add_option("--otp CODE",
+ "Digit code for multifactor authentication",
+ "You can also use the environment variable GEM_HOST_OTP_CODE") do |value, options|
options[:otp] = value
end
end
@@ -69,7 +69,7 @@ module Gem::GemcutterUtilities
@host ||=
begin
- env_rubygems_host = ENV['RUBYGEMS_HOST']
+ env_rubygems_host = ENV["RUBYGEMS_HOST"]
env_rubygems_host = nil if
env_rubygems_host and env_rubygems_host.empty?
@@ -83,7 +83,7 @@ module Gem::GemcutterUtilities
# If +allowed_push_host+ metadata is present, then it will only allow that host.
def rubygems_api_request(method, path, host = nil, allowed_push_host = nil, scope: nil, &block)
- require 'net/http'
+ require "net/http"
self.host = host if host
unless self.host
@@ -118,7 +118,7 @@ module Gem::GemcutterUtilities
end
def mfa_unauthorized?(response)
- response.kind_of?(Net::HTTPUnauthorized) && response.body.start_with?('You have enabled multifactor authentication')
+ response.kind_of?(Net::HTTPUnauthorized) && response.body.start_with?("You have enabled multifactor authentication")
end
def update_scope(scope)
@@ -163,8 +163,12 @@ module Gem::GemcutterUtilities
key_name = get_key_name(scope)
scope_params = get_scope_params(scope)
- mfa_params = get_mfa_params(email, password)
+ profile = get_user_profile(email, password)
+ mfa_params = get_mfa_params(profile)
all_params = scope_params.merge(mfa_params)
+ warning = profile["warning"]
+
+ say "#{warning}\n" if warning
response = rubygems_api_request(:post, "api/v1/api_key",
sign_in_host, scope: scope) do |request|
@@ -240,13 +244,13 @@ module Gem::GemcutterUtilities
end
def ask_otp
- say 'You have enabled multi-factor authentication. Please enter OTP code.'
- options[:otp] = ask 'Code: '
+ say "You have enabled multi-factor authentication. Please enter OTP code."
+ options[:otp] = ask "Code: "
end
def pretty_host(host)
if default_host?
- 'RubyGems.org'
+ "RubyGems.org"
else
host
end
@@ -273,29 +277,28 @@ module Gem::GemcutterUtilities
self.host == Gem::DEFAULT_HOST
end
- def get_mfa_params(email, password)
+ def get_user_profile(email, password)
return {} unless default_host?
- mfa_level = get_user_mfa_level(email, password)
- params = {}
- if mfa_level == "ui_only" || mfa_level == "ui_and_gem_signin"
- selected = ask_yes_no("Would you like to enable MFA for this key? (strongly recommended)")
- params["mfa"] = true if selected
- end
- params
- end
-
- def get_user_mfa_level(email, password)
response = rubygems_api_request(:get, "api/v1/profile/me.yaml") do |request|
request.basic_auth email, password
end
with_response response do |resp|
- body = Gem::SafeYAML.load clean_text(resp.body)
- body["mfa"]
+ Gem::SafeYAML.load clean_text(resp.body)
end
end
+ def get_mfa_params(profile)
+ mfa_level = profile["mfa"]
+ params = {}
+ if mfa_level == "ui_only" || mfa_level == "ui_and_gem_signin"
+ selected = ask_yes_no("Would you like to enable MFA for this key? (strongly recommended)")
+ params["mfa"] = true if selected
+ end
+ params
+ end
+
def get_key_name(scope)
hostname = Socket.gethostname || "unknown-host"
user = ENV["USER"] || ENV["USERNAME"] || "unknown-user"
diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb
index a5a86f4111..2299932f45 100644
--- a/lib/rubygems/indexer.rb
+++ b/lib/rubygems/indexer.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative '../rubygems'
-require_relative 'package'
-require 'tmpdir'
+require_relative "../rubygems"
+require_relative "package"
+require "tmpdir"
##
# Top level class for building the gem repository index.
@@ -43,28 +43,28 @@ class Gem::Indexer
# Create an indexer that will index the gems in +directory+.
def initialize(directory, options = {})
- require 'fileutils'
- require 'tmpdir'
- require 'zlib'
+ require "fileutils"
+ require "tmpdir"
+ require "zlib"
options = { :build_modern => true }.merge options
@build_modern = options[:build_modern]
@dest_directory = directory
- @directory = Dir.mktmpdir 'gem_generate_index'
+ @directory = Dir.mktmpdir "gem_generate_index"
marshal_name = "Marshal.#{Gem.marshal_version}"
- @master_index = File.join @directory, 'yaml'
+ @master_index = File.join @directory, "yaml"
@marshal_index = File.join @directory, marshal_name
- @quick_dir = File.join @directory, 'quick'
+ @quick_dir = File.join @directory, "quick"
@quick_marshal_dir = File.join @quick_dir, marshal_name
@quick_marshal_dir_base = File.join "quick", marshal_name # FIX: UGH
- @quick_index = File.join @quick_dir, 'index'
- @latest_index = File.join @quick_dir, 'latest_index'
+ @quick_index = File.join @quick_dir, "index"
+ @latest_index = File.join @quick_dir, "latest_index"
@specs_index = File.join @directory, "specs.#{Gem.marshal_version}"
@latest_specs_index =
@@ -104,7 +104,7 @@ class Gem::Indexer
files = []
- Gem.time 'Generated Marshal quick index gemspecs' do
+ Gem.time "Generated Marshal quick index gemspecs" do
specs.each do |spec|
next if spec.default_gem?
spec_file_name = "#{spec.original_name}.gemspec.rz"
@@ -112,7 +112,7 @@ class Gem::Indexer
marshal_zipped = Gem.deflate Marshal.dump(spec)
- File.open marshal_name, 'wb' do |io|
+ File.open marshal_name, "wb" do |io|
io.write marshal_zipped
end
@@ -136,7 +136,7 @@ class Gem::Indexer
say "Generating #{name} index"
Gem.time "Generated #{name} index" do
- File.open(file, 'wb') do |io|
+ File.open(file, "wb") do |io|
specs = index.map do |*spec|
# We have to splat here because latest_specs is an array, while the
# others are hashes.
@@ -169,10 +169,10 @@ class Gem::Indexer
latest_specs =
Gem::Specification._latest_specs specs
- build_modern_index(released.sort, @specs_index, 'specs')
- build_modern_index(latest_specs.sort, @latest_specs_index, 'latest specs')
+ build_modern_index(released.sort, @specs_index, "specs")
+ build_modern_index(latest_specs.sort, @latest_specs_index, "latest specs")
build_modern_index(prerelease.sort, @prerelease_specs_index,
- 'prerelease specs')
+ "prerelease specs")
@files += [@specs_index,
"#{@specs_index}.gz",
@@ -217,7 +217,7 @@ class Gem::Indexer
def compress_indices
say "Compressing indices"
- Gem.time 'Compressed indices' do
+ Gem.time "Compressed indices" do
if @build_modern
gzip @specs_index
gzip @latest_specs_index
@@ -252,7 +252,7 @@ class Gem::Indexer
zipped = Gem.deflate data
- File.open "#{filename}.#{extension}", 'wb' do |io|
+ File.open "#{filename}.#{extension}", "wb" do |io|
io.write zipped
end
end
@@ -308,7 +308,7 @@ class Gem::Indexer
end
files = files.map do |path|
- path.sub(/^#{Regexp.escape @directory}\/?/, '') # HACK?
+ path.sub(/^#{Regexp.escape @directory}\/?/, "") # HACK?
end
files.each do |file|
@@ -358,7 +358,7 @@ class Gem::Indexer
end
if updated_gems.empty?
- say 'No new gems'
+ say "No new gems"
terminate_interaction 0
end
@@ -367,7 +367,7 @@ class Gem::Indexer
files = build_marshal_gemspecs specs
- Gem.time 'Updated indexes' do
+ Gem.time "Updated indexes" do
update_specs_index released, @dest_specs_index, @specs_index
update_specs_index released, @dest_latest_specs_index, @latest_specs_index
update_specs_index(prerelease,
@@ -389,7 +389,7 @@ class Gem::Indexer
files << "#{@prerelease_specs_index}.gz"
files = files.map do |path|
- path.sub(/^#{Regexp.escape @directory}\/?/, '') # HACK?
+ path.sub(/^#{Regexp.escape @directory}\/?/, "") # HACK?
end
files.each do |file|
@@ -420,7 +420,7 @@ class Gem::Indexer
specs_index = compact_specs specs_index.uniq.sort
- File.open dest, 'wb' do |io|
+ File.open dest, "wb" do |io|
Marshal.dump specs_index, io
end
end
diff --git a/lib/rubygems/install_default_message.rb b/lib/rubygems/install_default_message.rb
index 052ef528e1..0d112a15df 100644
--- a/lib/rubygems/install_default_message.rb
+++ b/lib/rubygems/install_default_message.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative '../rubygems'
-require_relative 'user_interaction'
+require_relative "../rubygems"
+require_relative "user_interaction"
##
# A post-install hook that displays "Successfully installed
diff --git a/lib/rubygems/install_message.rb b/lib/rubygems/install_message.rb
index 861ead3770..2565f36261 100644
--- a/lib/rubygems/install_message.rb
+++ b/lib/rubygems/install_message.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative '../rubygems'
-require_relative 'user_interaction'
+require_relative "../rubygems"
+require_relative "user_interaction"
##
# A default post-install hook that displays "Successfully installed
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index 454104435d..79effcf21f 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -5,8 +5,8 @@
# See LICENSE.txt for permissions.
#++
-require_relative '../rubygems'
-require_relative 'security_option'
+require_relative "../rubygems"
+require_relative "security_option"
##
# Mixin methods for install and update options for Gem::Commands
@@ -18,22 +18,22 @@ module Gem::InstallUpdateOptions
# Add the install/update options to the option parser.
def add_install_update_options
- add_option(:"Install/Update", '-i', '--install-dir DIR',
- 'Gem repository directory to get installed',
- 'gems') do |value, options|
+ add_option(:"Install/Update", "-i", "--install-dir DIR",
+ "Gem repository directory to get installed",
+ "gems") do |value, options|
options[:install_dir] = File.expand_path(value)
end
- add_option(:"Install/Update", '-n', '--bindir DIR',
- 'Directory where executables will be',
- 'placed when the gem is installed') do |value, options|
+ add_option(:"Install/Update", "-n", "--bindir DIR",
+ "Directory where executables will be",
+ "placed when the gem is installed") do |value, options|
options[:bin_dir] = File.expand_path(value)
end
- 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|
+ 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|
options[:document] = case value
when nil then %w[ri]
when false then []
@@ -41,63 +41,63 @@ module Gem::InstallUpdateOptions
end
end
- add_option(:"Install/Update", '--build-root DIR',
- 'Temporary installation root. Useful for building',
- 'packages. Do not use this when installing remote gems.') do |value, options|
+ add_option(:"Install/Update", "--build-root DIR",
+ "Temporary installation root. Useful for building",
+ "packages. Do not use this when installing remote gems.") do |value, options|
options[:build_root] = File.expand_path(value)
end
- add_option(:"Install/Update", '--vendor',
- 'Install gem into the vendor directory.',
- 'Only for use by gem repackagers.') do |value, options|
+ add_option(:"Install/Update", "--vendor",
+ "Install gem into the vendor directory.",
+ "Only for use by gem repackagers.") do |value, options|
unless Gem.vendor_dir
- raise Gem::OptionParser::InvalidOption.new 'your platform is not supported'
+ raise Gem::OptionParser::InvalidOption.new "your platform is not supported"
end
options[:vendor] = true
options[:install_dir] = Gem.vendor_dir
end
- add_option(:"Install/Update", '-N', '--no-document',
- 'Disable documentation generation') do |value, options|
+ add_option(:"Install/Update", "-N", "--no-document",
+ "Disable documentation generation") do |value, options|
options[:document] = []
end
- add_option(:"Install/Update", '-E', '--[no-]env-shebang',
+ add_option(:"Install/Update", "-E", "--[no-]env-shebang",
"Rewrite the shebang line on installed",
"scripts to use /usr/bin/env") do |value, options|
options[:env_shebang] = value
end
- add_option(:"Install/Update", '-f', '--[no-]force',
- 'Force gem to install, bypassing dependency',
- 'checks') do |value, options|
+ add_option(:"Install/Update", "-f", "--[no-]force",
+ "Force gem to install, bypassing dependency",
+ "checks") do |value, options|
options[:force] = value
end
- add_option(:"Install/Update", '-w', '--[no-]wrappers',
- 'Use bin wrappers for executables',
- 'Not available on dosish platforms') do |value, options|
+ add_option(:"Install/Update", "-w", "--[no-]wrappers",
+ "Use bin wrappers for executables",
+ "Not available on dosish platforms") do |value, options|
options[:wrappers] = value
end
add_security_option
- add_option(:"Install/Update", '--ignore-dependencies',
- 'Do not install any required dependent gems') do |value, options|
+ add_option(:"Install/Update", "--ignore-dependencies",
+ "Do not install any required dependent gems") do |value, options|
options[:ignore_dependencies] = value
end
- 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|
+ 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|
options[:format_executable] = value
end
- add_option(:"Install/Update", '--[no-]user-install',
- 'Install in user\'s home directory instead',
- 'of GEM_HOME.') do |value, options|
+ add_option(:"Install/Update", "--[no-]user-install",
+ "Install in user's home directory instead",
+ "of GEM_HOME.") do |value, options|
options[:user_install] = value
end
@@ -133,9 +133,9 @@ module Gem::InstallUpdateOptions
options[:post_install_message] = value
end
- add_option(:"Install/Update", '-g', '--file [FILE]',
- 'Read from a gem dependencies API file and',
- 'install the listed gems') do |v,o|
+ add_option(:"Install/Update", "-g", "--file [FILE]",
+ "Read from a gem dependencies API file and",
+ "install the listed gems") do |v,o|
v = Gem::GEM_DEP_FILES.find do |file|
File.exist? file
end unless v
@@ -150,32 +150,32 @@ module Gem::InstallUpdateOptions
options[:gemdeps] = v
end
- add_option(:"Install/Update", '--without GROUPS', Array,
- 'Omit the named groups (comma separated)',
- 'when installing from a gem dependencies',
- 'file') do |v,o|
+ add_option(:"Install/Update", "--without GROUPS", Array,
+ "Omit the named groups (comma separated)",
+ "when installing from a gem dependencies",
+ "file") do |v,o|
options[:without_groups].concat v.map {|without| without.intern }
end
- add_option(:"Install/Update", '--default',
- 'Add the gem\'s full specification to',
- 'specifications/default and extract only its bin') do |v,o|
+ add_option(:"Install/Update", "--default",
+ "Add the gem's full specification to",
+ "specifications/default and extract only its bin") do |v,o|
options[:install_as_default] = v
end
- add_option(:"Install/Update", '--explain',
- 'Rather than install the gems, indicate which would',
- 'be installed') do |v,o|
+ add_option(:"Install/Update", "--explain",
+ "Rather than install the gems, indicate which would",
+ "be installed") do |v,o|
options[:explain] = v
end
- add_option(:"Install/Update", '--[no-]lock',
- 'Create a lock file (when used with -g/--file)') do |v,o|
+ add_option(:"Install/Update", "--[no-]lock",
+ "Create a lock file (when used with -g/--file)") do |v,o|
options[:lock] = v
end
- add_option(:"Install/Update", '--[no-]suggestions',
- 'Suggest alternates when gems are not found') do |v,o|
+ add_option(:"Install/Update", "--[no-]suggestions",
+ "Suggest alternates when gems are not found") do |v,o|
options[:suggest_alternate] = v
end
end
@@ -193,7 +193,7 @@ module Gem::InstallUpdateOptions
# Default description for the gem install and update commands.
def install_update_defaults_str
- '--document=ri'
+ "--document=ri"
end
end
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 7484145467..52307f6d93 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -5,12 +5,12 @@
# See LICENSE.txt for permissions.
#++
-require_relative 'installer_uninstaller_utils'
-require_relative 'exceptions'
-require_relative 'deprecate'
-require_relative 'package'
-require_relative 'ext'
-require_relative 'user_interaction'
+require_relative "installer_uninstaller_utils"
+require_relative "exceptions"
+require_relative "deprecate"
+require_relative "package"
+require_relative "ext"
+require_relative "user_interaction"
##
# The installer installs the files contained in the .gem into the Gem.home.
@@ -125,14 +125,14 @@ class Gem::Installer
@spec = spec
end
- def extract_files(destination_dir, pattern = '*')
+ def extract_files(destination_dir, pattern = "*")
FileUtils.mkdir_p destination_dir
spec.files.each do |file|
file = File.join destination_dir, file
next if File.exist? file
FileUtils.mkdir_p File.dirname(file)
- File.open file, 'w' do |fp|
+ File.open file, "w" do |fp|
fp.puts "# #{file}"
end
end
@@ -177,7 +177,7 @@ class Gem::Installer
# :post_install_message:: Print gem post install message if true
def initialize(package, options={})
- require 'fileutils'
+ require "fileutils"
@options = options
@package = package
@@ -219,7 +219,7 @@ class Gem::Installer
ruby_executable = false
existing = nil
- File.open generated_bin, 'rb' do |io|
+ File.open generated_bin, "rb" do |io|
line = io.gets
shebang = /^#!.*ruby/
@@ -256,7 +256,7 @@ class Gem::Installer
question = "#{spec.name}'s executable \"#{filename}\" conflicts with ".dup
if ruby_executable
- question << (existing || 'an unknown executable')
+ question << (existing || "an unknown executable")
return if ask_yes_no "#{question}\nOverwrite the executable?", false
@@ -474,7 +474,7 @@ class Gem::Installer
if Gem.win_platform?
script_name = formatted_program_filename(filename) + ".bat"
script_path = File.join bindir, File.basename(script_name)
- File.open script_path, 'w' do |file|
+ File.open script_path, "w" do |file|
file.puts windows_stub_script(bindir, filename)
end
@@ -504,7 +504,7 @@ class Gem::Installer
dir_mode = options[:prog_mode] || (mode | 0111)
unless dir_mode == mode
- require 'fileutils'
+ require "fileutils"
FileUtils.chmod dir_mode, bin_path
end
@@ -541,10 +541,10 @@ class Gem::Installer
def generate_bin_script(filename, bindir)
bin_script_path = File.join bindir, formatted_program_filename(filename)
- require 'fileutils'
+ require "fileutils"
FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
- File.open bin_script_path, 'wb', 0755 do |file|
+ File.open bin_script_path, "wb", 0755 do |file|
file.print app_script_text(filename)
file.chmod(options[:prog_mode] || 0755)
end
@@ -565,7 +565,7 @@ class Gem::Installer
if File.exist? dst
if File.symlink? dst
link = File.readlink(dst).split File::SEPARATOR
- cur_version = Gem::Version.create(link[-3].sub(/^.*-/, ''))
+ cur_version = Gem::Version.create(link[-3].sub(/^.*-/, ""))
return if spec.version < cur_version
end
File.unlink dst
@@ -684,9 +684,9 @@ class Gem::Installer
@build_args = options[:build_args]
unless @build_root.nil?
- @bin_dir = File.join(@build_root, @bin_dir.gsub(/^[a-zA-Z]:/, ''))
- @gem_home = File.join(@build_root, @gem_home.gsub(/^[a-zA-Z]:/, ''))
- @plugins_dir = File.join(@build_root, @plugins_dir.gsub(/^[a-zA-Z]:/, ''))
+ @bin_dir = File.join(@build_root, @bin_dir.gsub(/^[a-zA-Z]:/, ""))
+ @gem_home = File.join(@build_root, @gem_home.gsub(/^[a-zA-Z]:/, ""))
+ @plugins_dir = File.join(@build_root, @plugins_dir.gsub(/^[a-zA-Z]:/, ""))
alert_warning "You build with buildroot.\n Build root: #{@build_root}\n Bin dir: #{@bin_dir}\n Gem home: #{@gem_home}\n Plugins dir: #{@plugins_dir}"
end
end
@@ -697,7 +697,7 @@ class Gem::Installer
user_bin_dir = @bin_dir || Gem.bindir(gem_home)
user_bin_dir = user_bin_dir.tr(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
- path = ENV['PATH']
+ path = ENV["PATH"]
path = path.tr(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
if Gem.win_platform?
@@ -708,7 +708,7 @@ class Gem::Installer
path = path.split(File::PATH_SEPARATOR)
unless path.include? user_bin_dir
- unless !Gem.win_platform? && (path.include? user_bin_dir.sub(ENV['HOME'], '~'))
+ unless !Gem.win_platform? && (path.include? user_bin_dir.sub(ENV["HOME"], "~"))
alert_warning "You don't have #{user_bin_dir} in your PATH,\n\t gem executables will not run."
self.class.path_warning = true
end
@@ -788,7 +788,7 @@ TEXT
end
def gemdeps_load(name)
- return '' if name == "bundler"
+ return "" if name == "bundler"
<<-TEXT
@@ -824,7 +824,7 @@ TEXT
TEXT
elsif bindir.downcase.start_with? rb_topdir.downcase
# stub within ruby folder, but not standard bin. Portable
- require 'pathname'
+ require "pathname"
from = Pathname.new bindir
to = Pathname.new "#{rb_topdir}/bin"
rel = to.relative_path_from from
@@ -935,14 +935,14 @@ TEXT
def write_build_info_file
return if build_args.empty?
- build_info_dir = File.join gem_home, 'build_info'
+ build_info_dir = File.join gem_home, "build_info"
dir_mode = options[:dir_mode]
FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0755
build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
- File.open build_info_file, 'w' do |io|
+ File.open build_info_file, "w" do |io|
build_args.each do |arg|
io.puts arg
end
@@ -955,7 +955,7 @@ TEXT
# Writes the .gem file to the cache directory
def write_cache_file
- cache_file = File.join gem_home, 'cache', spec.file_name
+ cache_file = File.join gem_home, "cache", spec.file_name
@package.copy_to cache_file
end
@@ -987,7 +987,7 @@ TEXT
end
def load_relative_enabled?
- rb_config["LIBRUBY_RELATIVE"] == 'yes'
+ rb_config["LIBRUBY_RELATIVE"] == "yes"
end
def bash_prolog_script
diff --git a/lib/rubygems/installer_uninstaller_utils.rb b/lib/rubygems/installer_uninstaller_utils.rb
index 2c8b7c635e..d97b4e29b1 100644
--- a/lib/rubygems/installer_uninstaller_utils.rb
+++ b/lib/rubygems/installer_uninstaller_utils.rb
@@ -9,12 +9,12 @@ module Gem::InstallerUninstallerUtils
plugins = spec.plugins
return if plugins.empty?
- require 'pathname'
+ require "pathname"
spec.plugins.each do |plugin|
plugin_script_path = File.join plugins_dir, "#{spec.name}_plugin#{File.extname(plugin)}"
- File.open plugin_script_path, 'wb' do |file|
+ File.open plugin_script_path, "wb" do |file|
file.puts "require_relative '#{Pathname.new(plugin).relative_path_from(Pathname.new(plugins_dir))}'"
end
diff --git a/lib/rubygems/local_remote_options.rb b/lib/rubygems/local_remote_options.rb
index 9811c8f948..b2c2dea905 100644
--- a/lib/rubygems/local_remote_options.rb
+++ b/lib/rubygems/local_remote_options.rb
@@ -5,8 +5,8 @@
# See LICENSE.txt for permissions.
#++
-require 'uri'
-require_relative '../rubygems'
+require "uri"
+require_relative "../rubygems"
##
# Mixin methods for local and remote Gem::Command options.
@@ -38,18 +38,18 @@ module Gem::LocalRemoteOptions
# Add local/remote options to the command line parser.
def add_local_remote_options
- add_option(:"Local/Remote", '-l', '--local',
- 'Restrict operations to the LOCAL domain') do |value, options|
+ add_option(:"Local/Remote", "-l", "--local",
+ "Restrict operations to the LOCAL domain") do |value, options|
options[:domain] = :local
end
- add_option(:"Local/Remote", '-r', '--remote',
- 'Restrict operations to the REMOTE domain') do |value, options|
+ add_option(:"Local/Remote", "-r", "--remote",
+ "Restrict operations to the REMOTE domain") do |value, options|
options[:domain] = :remote
end
- add_option(:"Local/Remote", '-b', '--both',
- 'Allow LOCAL and REMOTE operations') do |value, options|
+ add_option(:"Local/Remote", "-b", "--both",
+ "Allow LOCAL and REMOTE operations") do |value, options|
options[:domain] = :both
end
@@ -64,7 +64,7 @@ module Gem::LocalRemoteOptions
# Add the --bulk-threshold option
def add_bulk_threshold_option
- add_option(:"Local/Remote", '-B', '--bulk-threshold COUNT',
+ add_option(:"Local/Remote", "-B", "--bulk-threshold COUNT",
"Threshold for switching to bulk",
"synchronization (default #{Gem.configuration.bulk_threshold})") do
|value, options|
@@ -76,9 +76,8 @@ module Gem::LocalRemoteOptions
# Add the --clear-sources option
def add_clear_sources_option
- add_option(:"Local/Remote", '--clear-sources',
- 'Clear the gem sources') do |value, options|
-
+ add_option(:"Local/Remote", "--clear-sources",
+ "Clear the gem sources") do |value, options|
Gem.sources = nil
options[:sources_cleared] = true
end
@@ -90,8 +89,8 @@ module Gem::LocalRemoteOptions
def add_proxy_option
accept_uri_http
- add_option(:"Local/Remote", '-p', '--[no-]http-proxy [URL]', URI::HTTP,
- 'Use HTTP proxy for remote operations') do |value, options|
+ add_option(:"Local/Remote", "-p", "--[no-]http-proxy [URL]", URI::HTTP,
+ "Use HTTP proxy for remote operations") do |value, options|
options[:http_proxy] = (value == false) ? :no_proxy : value
Gem.configuration[:http_proxy] = options[:http_proxy]
end
@@ -103,10 +102,9 @@ module Gem::LocalRemoteOptions
def add_source_option
accept_uri_http
- add_option(:"Local/Remote", '-s', '--source URL', URI::HTTP,
- 'Append URL to list of remote gem sources') do |source, options|
-
- source << '/' if source !~ /\/\z/
+ add_option(:"Local/Remote", "-s", "--source URL", URI::HTTP,
+ "Append URL to list of remote gem sources") do |source, options|
+ source << "/" if source !~ /\/\z/
if options.delete :sources_cleared
Gem.sources = [source]
@@ -120,8 +118,8 @@ module Gem::LocalRemoteOptions
# Add the --update-sources option
def add_update_sources_option
- add_option(:Deprecated, '-u', '--[no-]update-sources',
- 'Update local source cache') do |value, options|
+ add_option(:Deprecated, "-u", "--[no-]update-sources",
+ "Update local source cache") do |value, options|
Gem.configuration.update_sources = value
end
end
diff --git a/lib/rubygems/mock_gem_ui.rb b/lib/rubygems/mock_gem_ui.rb
index 914ecb9a71..5cc67ad099 100644
--- a/lib/rubygems/mock_gem_ui.rb
+++ b/lib/rubygems/mock_gem_ui.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'user_interaction'
+require_relative "user_interaction"
##
# This Gem::StreamUI subclass records input and output to StringIO for
@@ -40,7 +40,7 @@ class Gem::MockGemUi < Gem::StreamUI
end
def initialize(input = "")
- require 'stringio'
+ require "stringio"
ins = StringIO.new input
outs = StringIO.new
errs = StringIO.new
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb
index c732d7f968..b9f330ee4d 100644
--- a/lib/rubygems/name_tuple.rb
+++ b/lib/rubygems/name_tuple.rb
@@ -48,7 +48,7 @@ class Gem::NameTuple
def full_name
case @platform
- when nil, 'ruby', ''
+ when nil, "ruby", ""
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{@platform}"
diff --git a/lib/rubygems/optparse.rb b/lib/rubygems/optparse.rb
index 65be9f6b74..6ed718423c 100644
--- a/lib/rubygems/optparse.rb
+++ b/lib/rubygems/optparse.rb
@@ -1,3 +1,3 @@
# frozen_string_literal: true
-require_relative 'optparse/lib/optparse'
+require_relative "optparse/lib/optparse"
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 2dd8e8c28e..1e87837b0e 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -5,8 +5,8 @@
#++
require_relative "../rubygems"
-require_relative 'security'
-require_relative 'user_interaction'
+require_relative "security"
+require_relative "user_interaction"
##
# Example using a Gem::Package
@@ -158,7 +158,7 @@ class Gem::Package
return super unless gem.present?
return super unless gem.start
- return super unless gem.start.include? 'MD5SUM ='
+ return super unless gem.start.include? "MD5SUM ="
Gem::Package::Old.new gem
end
@@ -178,9 +178,9 @@ class Gem::Package
tar = Gem::Package::TarReader.new io
tar.each_entry do |entry|
case entry.full_name
- when 'metadata' then
+ when "metadata" then
metadata = entry.read
- when 'metadata.gz' then
+ when "metadata.gz" then
metadata = Gem::Util.gunzip entry.read
end
end
@@ -193,7 +193,7 @@ class Gem::Package
# Creates a new package that will read or write to the file +gem+.
def initialize(gem, security_policy) # :notnew:
- require 'zlib'
+ require "zlib"
@gem = gem
@@ -229,7 +229,7 @@ class Gem::Package
end
end
- tar.add_file_signed 'checksums.yaml.gz', 0444, @signer do |io|
+ tar.add_file_signed "checksums.yaml.gz", 0444, @signer do |io|
gzip_to io do |gz_io|
Psych.dump checksums_by_algorithm, gz_io
end
@@ -241,7 +241,7 @@ class Gem::Package
# and adds this file to the +tar+.
def add_contents(tar) # :nodoc:
- digests = tar.add_file_signed 'data.tar.gz', 0444, @signer do |io|
+ digests = tar.add_file_signed "data.tar.gz", 0444, @signer do |io|
gzip_to io do |gz_io|
Gem::Package::TarWriter.new gz_io do |data_tar|
add_files data_tar
@@ -249,7 +249,7 @@ class Gem::Package
end
end
- @checksums['data.tar.gz'] = digests
+ @checksums["data.tar.gz"] = digests
end
##
@@ -266,7 +266,7 @@ class Gem::Package
next unless stat.file?
tar.add_file_simple file, stat.mode, stat.size do |dst_io|
- File.open file, 'rb' do |src_io|
+ File.open file, "rb" do |src_io|
dst_io.write src_io.read 16384 until src_io.eof?
end
end
@@ -277,13 +277,13 @@ class Gem::Package
# Adds the package's Gem::Specification to the +tar+ file
def add_metadata(tar) # :nodoc:
- digests = tar.add_file_signed 'metadata.gz', 0444, @signer do |io|
+ digests = tar.add_file_signed "metadata.gz", 0444, @signer do |io|
gzip_to io do |gz_io|
gz_io.write @spec.to_yaml
end
end
- @checksums['metadata.gz'] = digests
+ @checksums["metadata.gz"] = digests
end
##
@@ -335,7 +335,7 @@ EOM
gem_tar = Gem::Package::TarReader.new io
gem_tar.each do |entry|
- next unless entry.full_name == 'data.tar.gz'
+ next unless entry.full_name == "data.tar.gz"
open_tar_gz entry do |pkg_tar|
pkg_tar.each do |contents_entry|
@@ -387,7 +387,7 @@ EOM
reader = Gem::Package::TarReader.new io
reader.each do |entry|
- next unless entry.full_name == 'data.tar.gz'
+ next unless entry.full_name == "data.tar.gz"
extract_tar_gz entry, destination_dir, pattern
@@ -420,7 +420,7 @@ EOM
real_destination = link_target.start_with?("/") ? link_target : File.expand_path(link_target, File.dirname(destination))
raise Gem::Package::SymlinkError.new(entry.full_name, real_destination, destination_dir) unless
- normalize_path(real_destination).start_with? normalize_path(destination_dir + '/')
+ normalize_path(real_destination).start_with? normalize_path(destination_dir + "/")
end
FileUtils.rm_rf destination
@@ -439,7 +439,7 @@ EOM
directories << mkdir
end
- File.open destination, 'wb' do |out|
+ File.open destination, "wb" do |out|
out.write entry.read
FileUtils.chmod file_mode(entry.header.mode), destination
end if entry.file?
@@ -481,13 +481,13 @@ EOM
def install_location(filename, destination_dir) # :nodoc:
raise Gem::Package::PathError.new(filename, destination_dir) if
- filename.start_with? '/'
+ filename.start_with? "/"
destination_dir = File.realpath(destination_dir)
destination = File.expand_path(filename, destination_dir)
raise Gem::Package::PathError.new(destination, destination_dir) unless
- normalize_path(destination).start_with? normalize_path(destination_dir + '/')
+ normalize_path(destination).start_with? normalize_path(destination_dir + "/")
destination.tap(&Gem::UNTAINT)
destination
@@ -506,9 +506,9 @@ EOM
def load_spec(entry) # :nodoc:
case entry.full_name
- when 'metadata' then
+ when "metadata" then
@spec = Gem::Specification.from_yaml entry.read
- when 'metadata.gz' then
+ when "metadata.gz" then
Zlib::GzipReader.wrap(entry, external_encoding: Encoding::UTF_8) do |gzio|
@spec = Gem::Specification.from_yaml gzio.read
end
@@ -532,7 +532,7 @@ EOM
def read_checksums(gem)
Gem.load_yaml
- @checksums = gem.seek 'checksums.yaml.gz' do |entry|
+ @checksums = gem.seek "checksums.yaml.gz" do |entry|
Zlib::GzipReader.wrap entry do |gz_io|
Gem::SafeYAML.safe_load gz_io.read
end
@@ -544,7 +544,7 @@ EOM
# certificate and key are not present only checksum generation is set up.
def setup_signer(signer_options: {})
- passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
+ passphrase = ENV["GEM_PRIVATE_KEY_PASSPHRASE"]
if @spec.signing_key
@signer =
Gem::Security::Signer.new(
@@ -651,7 +651,7 @@ EOM
case file_name
when "metadata", "metadata.gz" then
load_spec entry
- when 'data.tar.gz' then
+ when "data.tar.gz" then
verify_gz entry
end
rescue
@@ -668,12 +668,12 @@ EOM
end
unless @spec
- raise Gem::Package::FormatError.new 'package metadata is missing', @gem
+ raise Gem::Package::FormatError.new "package metadata is missing", @gem
end
- unless @files.include? 'data.tar.gz'
+ unless @files.include? "data.tar.gz"
raise Gem::Package::FormatError.new \
- 'package content (data.tar.gz) is missing', @gem
+ "package content (data.tar.gz) is missing", @gem
end
if duplicates = @files.group_by {|f| f }.select {|k,v| v.size > 1 }.map(&:first) and duplicates.any?
@@ -693,12 +693,12 @@ EOM
end
end
-require_relative 'package/digest_io'
-require_relative 'package/source'
-require_relative 'package/file_source'
-require_relative 'package/io_source'
-require_relative 'package/old'
-require_relative 'package/tar_header'
-require_relative 'package/tar_reader'
-require_relative 'package/tar_reader/entry'
-require_relative 'package/tar_writer'
+require_relative "package/digest_io"
+require_relative "package/source"
+require_relative "package/file_source"
+require_relative "package/io_source"
+require_relative "package/old"
+require_relative "package/tar_header"
+require_relative "package/tar_reader"
+require_relative "package/tar_reader/entry"
+require_relative "package/tar_writer"
diff --git a/lib/rubygems/package/file_source.rb b/lib/rubygems/package/file_source.rb
index 114a950c77..14c7a9f6d2 100644
--- a/lib/rubygems/package/file_source.rb
+++ b/lib/rubygems/package/file_source.rb
@@ -22,10 +22,10 @@ class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all
end
def with_write_io(&block)
- File.open path, 'wb', &block
+ File.open path, "wb", &block
end
def with_read_io(&block)
- File.open path, 'rb', &block
+ File.open path, "rb", &block
end
end
diff --git a/lib/rubygems/package/old.rb b/lib/rubygems/package/old.rb
index 301d403411..09a02d3ecd 100644
--- a/lib/rubygems/package/old.rb
+++ b/lib/rubygems/package/old.rb
@@ -19,8 +19,8 @@ class Gem::Package::Old < Gem::Package
# cannot be written.
def initialize(gem, security_policy)
- require 'fileutils'
- require 'zlib'
+ require "fileutils"
+ require "zlib"
Gem.load_yaml
@contents = nil
@@ -41,7 +41,7 @@ class Gem::Package::Old < Gem::Package
read_until_dashes io # spec
header = file_list io
- @contents = header.map {|file| file['path'] }
+ @contents = header.map {|file| file["path"] }
end
end
@@ -59,7 +59,7 @@ class Gem::Package::Old < Gem::Package
raise Gem::Exception, errstr unless header
header.each do |entry|
- full_name = entry['path']
+ full_name = entry["path"]
destination = install_location full_name, destination_dir
@@ -73,13 +73,13 @@ class Gem::Package::Old < Gem::Package
file_data = Zlib::Inflate.inflate file_data
raise Gem::Package::FormatError, "#{full_name} in #{@gem} is corrupt" if
- file_data.length != entry['size'].to_i
+ file_data.length != entry["size"].to_i
FileUtils.rm_rf destination
FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0755
- File.open destination, 'wb', file_mode(entry['mode']) do |out|
+ File.open destination, "wb", file_mode(entry["mode"]) do |out|
out.write file_data
end
@@ -119,7 +119,7 @@ class Gem::Package::Old < Gem::Package
loop do
line = io.gets
- return if line.chomp == '__END__'
+ return if line.chomp == "__END__"
break unless line
end
@@ -160,7 +160,7 @@ class Gem::Package::Old < Gem::Package
return true unless @security_policy
raise Gem::Security::Exception,
- 'old format gems do not contain signatures and cannot be verified' if
+ "old format gems do not contain signatures and cannot be verified" if
@security_policy.verify_data
true
diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb
index ce9b49e3eb..fb70765dde 100644
--- a/lib/rubygems/package/tar_header.rb
+++ b/lib/rubygems/package/tar_header.rb
@@ -53,42 +53,42 @@ class Gem::Package::TarHeader
##
# Pack format for a tar header
- PACK_FORMAT = 'a100' + # name
- 'a8' + # mode
- 'a8' + # uid
- 'a8' + # gid
- 'a12' + # size
- 'a12' + # mtime
- 'a7a' + # chksum
- 'a' + # typeflag
- 'a100' + # linkname
- 'a6' + # magic
- 'a2' + # version
- 'a32' + # uname
- 'a32' + # gname
- 'a8' + # devmajor
- 'a8' + # devminor
- 'a155' # prefix
+ PACK_FORMAT = "a100" + # name
+ "a8" + # mode
+ "a8" + # uid
+ "a8" + # gid
+ "a12" + # size
+ "a12" + # mtime
+ "a7a" + # chksum
+ "a" + # typeflag
+ "a100" + # linkname
+ "a6" + # magic
+ "a2" + # version
+ "a32" + # uname
+ "a32" + # gname
+ "a8" + # devmajor
+ "a8" + # devminor
+ "a155" # prefix
##
# Unpack format for a tar header
- UNPACK_FORMAT = 'A100' + # name
- 'A8' + # mode
- 'A8' + # uid
- 'A8' + # gid
- 'A12' + # size
- 'A12' + # mtime
- 'A8' + # checksum
- 'A' + # typeflag
- 'A100' + # linkname
- 'A6' + # magic
- 'A2' + # version
- 'A32' + # uname
- 'A32' + # gname
- 'A8' + # devmajor
- 'A8' + # devminor
- 'A155' # prefix
+ UNPACK_FORMAT = "A100" + # name
+ "A8" + # mode
+ "A8" + # uid
+ "A8" + # gid
+ "A12" + # size
+ "A12" + # mtime
+ "A8" + # checksum
+ "A" + # typeflag
+ "A100" + # linkname
+ "A6" + # magic
+ "A2" + # version
+ "A32" + # uname
+ "A32" + # gname
+ "A8" + # devmajor
+ "A8" + # devminor
+ "A155" # prefix
attr_reader(*FIELDS)
@@ -134,7 +134,7 @@ class Gem::Package::TarHeader
# \ff flags a negative 256-based number
# In case we have a match, parse it as a signed binary value
# in big-endian order, except that the high-order bit is ignored.
- return str.unpack('N2').last if str =~ /\A[\x80\xff]/n
+ return str.unpack("N2").last if str =~ /\A[\x80\xff]/n
strict_oct(str)
end
diff --git a/lib/rubygems/package/tar_reader.rb b/lib/rubygems/package/tar_reader.rb
index 41121f3bfb..cdc3fdc015 100644
--- a/lib/rubygems/package/tar_reader.rb
+++ b/lib/rubygems/package/tar_reader.rb
@@ -121,4 +121,4 @@ class Gem::Package::TarReader
end
end
-require_relative 'tar_reader/entry'
+require_relative "tar_reader/entry"
diff --git a/lib/rubygems/package/tar_reader/entry.rb b/lib/rubygems/package/tar_reader/entry.rb
index 5865599d3a..8634381c18 100644
--- a/lib/rubygems/package/tar_reader/entry.rb
+++ b/lib/rubygems/package/tar_reader/entry.rb
@@ -68,9 +68,9 @@ class Gem::Package::TarReader::Entry
@header.name
end
rescue ArgumentError => e
- raise unless e.message == 'string contains null byte'
+ raise unless e.message == "string contains null byte"
raise Gem::Package::TarInvalidError,
- 'tar is corrupt, name contains null byte'
+ "tar is corrupt, name contains null byte"
end
##
diff --git a/lib/rubygems/package/tar_writer.rb b/lib/rubygems/package/tar_writer.rb
index 877cc167c9..6f068f50c2 100644
--- a/lib/rubygems/package/tar_writer.rb
+++ b/lib/rubygems/package/tar_writer.rb
@@ -166,7 +166,7 @@ class Gem::Package::TarWriter
def add_file_signed(name, mode, signer)
digest_algorithms = [
signer.digest_algorithm,
- Gem::Security.create_digest('SHA512'),
+ Gem::Security.create_digest("SHA512"),
].compact.uniq
digests = add_file_digest name, mode, digest_algorithms do |io|
@@ -304,14 +304,14 @@ class Gem::Package::TarWriter
raise Gem::Package::TooLongFileName.new("File \"#{name}\" has a too long path (should be 256 or less)")
end
- prefix = ''
+ prefix = ""
if name.bytesize > 100
- parts = name.split('/', -1) # parts are never empty here
+ parts = name.split("/", -1) # parts are never empty here
name = parts.pop # initially empty for names with a trailing slash ("foo/.../bar/")
- prefix = parts.join('/') # if empty, then it's impossible to split (parts is empty too)
+ prefix = parts.join("/") # if empty, then it's impossible to split (parts is empty too)
while !parts.empty? && (prefix.bytesize > 155 || name.empty?)
- name = parts.pop + '/' + name
- prefix = parts.join('/')
+ name = parts.pop + "/" + name
+ prefix = parts.join("/")
end
if name.bytesize > 100 or prefix.empty?
diff --git a/lib/rubygems/package_task.rb b/lib/rubygems/package_task.rb
index bb48616b0e..8432bc5806 100644
--- a/lib/rubygems/package_task.rb
+++ b/lib/rubygems/package_task.rb
@@ -20,9 +20,9 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-require_relative '../rubygems'
-require_relative 'package'
-require 'rake/packagetask'
+require_relative "../rubygems"
+require_relative "package"
+require "rake/packagetask"
##
# Create a package based upon a Gem::Specification. Gem packages, as well as
@@ -113,7 +113,7 @@ class Gem::PackageTask < Rake::PackageTask
Gem::Package.build gem_spec
verbose trace do
- mv gem_file, '..'
+ mv gem_file, ".."
end
end
end
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 8fcabf164d..607e3906d6 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -12,7 +12,7 @@ class Gem::Platform
attr_accessor :cpu, :os, :version
def self.local
- arch = RbConfig::CONFIG['arch']
+ arch = RbConfig::CONFIG["arch"]
arch = "#{arch}_60" if arch =~ /mswin(?:32|64)$/
@local ||= new(arch)
end
@@ -56,7 +56,7 @@ class Gem::Platform
case arch
when Gem::Platform::CURRENT then
Gem::Platform.local
- when Gem::Platform::RUBY, nil, '' then
+ when Gem::Platform::RUBY, nil, "" then
Gem::Platform::RUBY
else
super
@@ -68,7 +68,7 @@ class Gem::Platform
when Array then
@cpu, @os, @version = arch
when String then
- arch = arch.split '-'
+ arch = arch.split "-"
if arch.length > 2 and arch.last !~ /\d/ # reassemble x86-linux-gnu
extra = arch.pop
@@ -78,7 +78,7 @@ class Gem::Platform
cpu = arch.shift
@cpu = case cpu
- when /i\d86/ then 'x86'
+ when /i\d86/ then "x86"
else cpu
end
@@ -91,31 +91,31 @@ 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 /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$/
+ @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 ]
+ 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 ]
+ else [ "unknown", nil ]
end
when Gem::Platform then
@cpu = arch.cpu
@@ -131,7 +131,7 @@ class Gem::Platform
end
def to_s
- to_a.compact.join '-'
+ to_a.compact.join "-"
end
##
@@ -160,12 +160,12 @@ class Gem::Platform
return nil unless Gem::Platform === other
# universal-mingw32 matches x64-mingw-ucrt
- return true if (@cpu == 'universal' or other.cpu == 'universal') and
- @os.start_with?('mingw') and other.os.start_with?('mingw')
+ return true if (@cpu == "universal" or other.cpu == "universal") and
+ @os.start_with?("mingw") and other.os.start_with?("mingw")
# cpu
- ([nil,'universal'].include?(@cpu) or [nil, 'universal'].include?(other.cpu) or @cpu == other.cpu or
- (@cpu == 'arm' and other.cpu.start_with?("arm"))) and
+ ([nil,"universal"].include?(@cpu) or [nil, "universal"].include?(other.cpu) or @cpu == other.cpu or
+ (@cpu == "arm" and other.cpu.start_with?("arm"))) and
# os
@os == other.os and
@@ -184,17 +184,17 @@ 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 ]
+ 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
@@ -210,11 +210,11 @@ class Gem::Platform
# A pure-Ruby gem that may use Gem::Specification#extensions to build
# binary files.
- RUBY = 'ruby'.freeze
+ RUBY = "ruby".freeze
##
# A platform-specific gem that is built for the packaging Ruby's platform.
# This will be replaced with Gem::Platform::local.
- CURRENT = 'current'.freeze
+ CURRENT = "current".freeze
end
diff --git a/lib/rubygems/psych_tree.rb b/lib/rubygems/psych_tree.rb
index 6f399a289e..b90f9f7d1d 100644
--- a/lib/rubygems/psych_tree.rb
+++ b/lib/rubygems/psych_tree.rb
@@ -7,7 +7,7 @@ module Gem
end unless respond_to? :create
def visit_String(str)
- return super unless str == '=' # or whatever you want
+ return super unless str == "=" # or whatever you want
quote = Psych::Nodes::Scalar::SINGLE_QUOTED
@emitter.scalar str, nil, nil, false, true, quote
diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb
index e0c71c43cb..4601d9374c 100644
--- a/lib/rubygems/query_utils.rb
+++ b/lib/rubygems/query_utils.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require_relative 'local_remote_options'
-require_relative 'spec_fetcher'
-require_relative 'version_option'
-require_relative 'text'
+require_relative "local_remote_options"
+require_relative "spec_fetcher"
+require_relative "version_option"
+require_relative "text"
module Gem::QueryUtils
@@ -12,41 +12,41 @@ module Gem::QueryUtils
include Gem::VersionOption
def add_query_options
- add_option('-i', '--[no-]installed',
- 'Check for installed gem') do |value, options|
+ add_option("-i", "--[no-]installed",
+ "Check for installed gem") do |value, options|
options[:installed] = value
end
- add_option('-I', 'Equivalent to --no-installed') do |value, options|
+ add_option("-I", "Equivalent to --no-installed") do |value, options|
options[:installed] = false
end
add_version_option command, "for use with --installed"
- add_option('-d', '--[no-]details',
- 'Display detailed information of gem(s)') do |value, options|
+ add_option("-d", "--[no-]details",
+ "Display detailed information of gem(s)") do |value, options|
options[:details] = value
end
- add_option('--[no-]versions',
- 'Display only gem names') do |value, options|
+ add_option("--[no-]versions",
+ "Display only gem names") do |value, options|
options[:versions] = value
options[:details] = false unless value
end
- add_option('-a', '--all',
- 'Display all gem versions') do |value, options|
+ add_option("-a", "--all",
+ "Display all gem versions") do |value, options|
options[:all] = value
end
- add_option('-e', '--exact',
- 'Name of gem(s) to query on matches the',
- 'provided STRING') do |value, options|
+ add_option("-e", "--exact",
+ "Name of gem(s) to query on matches the",
+ "provided STRING") do |value, options|
options[:exact] = value
end
- add_option('--[no-]prerelease',
- 'Display prerelease versions') do |value, options|
+ add_option("--[no-]prerelease",
+ "Display prerelease versions") do |value, options|
options[:prerelease] = value
end
@@ -257,7 +257,7 @@ module Gem::QueryUtils
if pls != [Gem::Platform::RUBY]
platform_list = [pls.delete(Gem::Platform::RUBY), *pls.sort].compact
- out = platform_list.unshift(out).join(' ')
+ out = platform_list.unshift(out).join(" ")
end
out
@@ -284,7 +284,7 @@ module Gem::QueryUtils
def spec_authors(entry, spec)
authors = "Author#{spec.authors.length > 1 ? 's' : ''}: ".dup
- authors << spec.authors.join(', ')
+ authors << spec.authors.join(", ")
entry << format_text(authors, 68, 4)
end
@@ -298,7 +298,7 @@ module Gem::QueryUtils
return if spec.license.nil? or spec.license.empty?
licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup
- licenses << spec.licenses.join(', ')
+ licenses << spec.licenses.join(", ")
entry << "\n" << format_text(licenses, 68, 4)
end
@@ -306,15 +306,15 @@ module Gem::QueryUtils
return unless spec.loaded_from
if specs.length == 1
- default = spec.default_gem? ? ' (default)' : nil
+ default = spec.default_gem? ? " (default)" : nil
entry << "\n" << " Installed at#{default}: #{spec.base_dir}"
else
- label = 'Installed at'
+ label = "Installed at"
specs.each do |s|
version = s.version.to_s
- version << ', default' if s.default_gem?
+ version << ", default" if s.default_gem?
entry << "\n" << " #{label} (#{version}): #{s.base_dir}"
- label = ' ' * label.length
+ label = " " * label.length
end
end
end
@@ -327,7 +327,7 @@ module Gem::QueryUtils
return unless non_ruby
if platforms.length == 1
- title = platforms.values.length == 1 ? 'Platform' : 'Platforms'
+ title = platforms.values.length == 1 ? "Platform" : "Platforms"
entry << " #{title}: #{platforms.values.sort.join(', ')}\n"
else
entry << " Platforms:\n"
@@ -336,7 +336,7 @@ module Gem::QueryUtils
sorted_platforms.each do |version, pls|
label = " #{version}: "
- data = format_text pls.sort.join(', '), 68, label.length
+ data = format_text pls.sort.join(", "), 68, label.length
data[0, label.length] = label
entry << data << "\n"
end
diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
index ac5e8f0822..769ec61d1e 100644
--- a/lib/rubygems/rdoc.rb
+++ b/lib/rubygems/rdoc.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative '../rubygems'
+require_relative "../rubygems"
begin
- require 'rdoc/rubygems_hook'
+ require "rdoc/rubygems_hook"
module Gem
RDoc = ::RDoc::RubygemsHook
end
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index b8f9f90cee..d028739861 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -1,11 +1,11 @@
# frozen_string_literal: true
-require_relative '../rubygems'
-require_relative 'request'
-require_relative 'request/connection_pools'
-require_relative 's3_uri_signer'
-require_relative 'uri_formatter'
-require_relative 'uri'
-require_relative 'user_interaction'
+require_relative "../rubygems"
+require_relative "request"
+require_relative "request/connection_pools"
+require_relative "s3_uri_signer"
+require_relative "uri_formatter"
+require_relative "uri"
+require_relative "user_interaction"
##
# RemoteFetcher handles the details of fetching gems and gem information from
@@ -72,10 +72,10 @@ class Gem::RemoteFetcher
# fetching the gem.
def initialize(proxy=nil, dns=nil, headers={})
- require_relative 'core_ext/tcpsocket_init' if Gem.configuration.ipv4_fallback_enabled
- require 'net/http'
- require 'stringio'
- require 'uri'
+ require_relative "core_ext/tcpsocket_init" if Gem.configuration.ipv4_fallback_enabled
+ require "net/http"
+ require "stringio"
+ require "uri"
Socket.do_not_reverse_lookup = true
@@ -136,7 +136,7 @@ class Gem::RemoteFetcher
# REFACTOR: split this up and dispatch on scheme (eg download_http)
# REFACTOR: be sure to clean up fake fetcher when you do this... cleaner
case scheme
- when 'http', 'https', 's3' then
+ when "http", "https", "s3" then
unless File.exist? local_gem_path
begin
verbose "Downloading gem #{gem_file_name}"
@@ -156,12 +156,12 @@ class Gem::RemoteFetcher
self.cache_update_path remote_gem_path, local_gem_path
end
end
- when 'file' then
+ when "file" then
begin
path = source_uri.path
- path = File.dirname(path) if File.extname(path) == '.gem'
+ path = File.dirname(path) if File.extname(path) == ".gem"
- remote_gem_path = Gem::Util.correct_for_windows_path(File.join(path, 'gems', gem_file_name))
+ remote_gem_path = Gem::Util.correct_for_windows_path(File.join(path, "gems", gem_file_name))
FileUtils.cp(remote_gem_path, local_gem_path)
rescue Errno::EACCES
@@ -171,7 +171,7 @@ class Gem::RemoteFetcher
verbose "Using local gem #{local_gem_path}"
when nil then # TODO test for local overriding cache
source_path = if Gem.win_platform? && source_uri.scheme &&
- !source_uri.path.include?(':')
+ !source_uri.path.include?(":")
"#{source_uri.scheme}:#{source_uri.path}"
else
source_uri.path
@@ -216,9 +216,9 @@ class Gem::RemoteFetcher
head ? response : response.body
when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,
Net::HTTPTemporaryRedirect then
- raise FetchError.new('too many redirects', uri) if depth > 10
+ raise FetchError.new("too many redirects", uri) if depth > 10
- unless location = response['Location']
+ unless location = response["Location"]
raise FetchError.new("redirecting but no redirect location was given", uri)
end
location = Gem::Uri.new location
@@ -312,7 +312,7 @@ class Gem::RemoteFetcher
end
def https?(uri)
- uri.scheme.downcase == 'https'
+ uri.scheme.downcase == "https"
end
def close_all
diff --git a/lib/rubygems/request.rb b/lib/rubygems/request.rb
index 6d6c2d8de8..d15ba91209 100644
--- a/lib/rubygems/request.rb
+++ b/lib/rubygems/request.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'net/http'
-require_relative 'user_interaction'
+require "net/http"
+require_relative "user_interaction"
class Gem::Request
extend Gem::UserInteraction
@@ -44,7 +44,7 @@ class Gem::Request
end
def self.configure_connection_for_https(connection, cert_files)
- raise Gem::Exception.new('OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources') unless Gem::HAVE_OPENSSL
+ raise Gem::Exception.new("OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources") unless Gem::HAVE_OPENSSL
connection.use_ssl = true
connection.verify_mode =
@@ -96,10 +96,10 @@ class Gem::Request
return unless cert
case error_number
when OpenSSL::X509::V_ERR_CERT_HAS_EXPIRED then
- require 'time'
+ require "time"
"Certificate #{cert.subject} expired at #{cert.not_after.iso8601}"
when OpenSSL::X509::V_ERR_CERT_NOT_YET_VALID then
- require 'time'
+ require "time"
"Certificate #{cert.subject} not valid until #{cert.not_before.iso8601}"
when OpenSSL::X509::V_ERR_CERT_REJECTED then
"Certificate #{cert.subject} is rejected"
@@ -140,13 +140,13 @@ class Gem::Request
Gem::UriFormatter.new(@uri.password).unescape
end
- request.add_field 'User-Agent', @user_agent
- request.add_field 'Connection', 'keep-alive'
- request.add_field 'Keep-Alive', '30'
+ request.add_field "User-Agent", @user_agent
+ request.add_field "Connection", "keep-alive"
+ request.add_field "Keep-Alive", "30"
if @last_modified
- require 'time'
- request.add_field 'If-Modified-Since', @last_modified.httpdate
+ require "time"
+ request.add_field "If-Modified-Since", @last_modified.httpdate
end
yield request if block_given?
@@ -158,7 +158,7 @@ class Gem::Request
# Returns a proxy URI for the given +scheme+ if one is set in the
# environment variables.
- def self.get_proxy_from_env(scheme = 'http')
+ def self.get_proxy_from_env(scheme = "http")
_scheme = scheme.downcase
_SCHEME = scheme.upcase
env_proxy = ENV["#{_scheme}_proxy"] || ENV["#{_SCHEME}_PROXY"]
@@ -166,8 +166,8 @@ class Gem::Request
no_env_proxy = env_proxy.nil? || env_proxy.empty?
if no_env_proxy
- return (_scheme == 'https' || _scheme == 'http') ?
- :no_proxy : get_proxy_from_env('http')
+ return (_scheme == "https" || _scheme == "http") ?
+ :no_proxy : get_proxy_from_env("http")
end
require "uri"
@@ -229,14 +229,14 @@ class Gem::Request
reset connection
- raise Gem::RemoteFetcher::FetchError.new('too many bad responses', @uri) if bad_response
+ raise Gem::RemoteFetcher::FetchError.new("too many bad responses", @uri) if bad_response
bad_response = true
retry
rescue Net::HTTPFatalError
verbose "fatal error"
- raise Gem::RemoteFetcher::FetchError.new('fatal error', @uri)
+ raise Gem::RemoteFetcher::FetchError.new("fatal error", @uri)
# HACK work around EOFError bug in Net::HTTP
# NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible
# to install gems.
@@ -246,7 +246,7 @@ class Gem::Request
requests = @requests[connection.object_id]
verbose "connection reset after #{requests} requests, retrying"
- raise Gem::RemoteFetcher::FetchError.new('too many connection resets', @uri) if retried
+ raise Gem::RemoteFetcher::FetchError.new("too many connection resets", @uri) if retried
reset connection
@@ -273,7 +273,7 @@ class Gem::Request
ua = "RubyGems/#{Gem::VERSION} #{Gem::Platform.local}".dup
ruby_version = RUBY_VERSION
- ruby_version += 'dev' if RUBY_PATCHLEVEL == -1
+ ruby_version += "dev" if RUBY_PATCHLEVEL == -1
ua << " Ruby/#{ruby_version} (#{RUBY_RELEASE_DATE}"
if RUBY_PATCHLEVEL >= 0
@@ -283,12 +283,12 @@ class Gem::Request
end
ua << ")"
- ua << " #{RUBY_ENGINE}" if RUBY_ENGINE != 'ruby'
+ ua << " #{RUBY_ENGINE}" if RUBY_ENGINE != "ruby"
ua
end
end
-require_relative 'request/http_pool'
-require_relative 'request/https_pool'
-require_relative 'request/connection_pools'
+require_relative "request/http_pool"
+require_relative "request/https_pool"
+require_relative "request/connection_pools"
diff --git a/lib/rubygems/request/connection_pools.rb b/lib/rubygems/request/connection_pools.rb
index a4c2929b38..a283267674 100644
--- a/lib/rubygems/request/connection_pools.rb
+++ b/lib/rubygems/request/connection_pools.rb
@@ -37,7 +37,7 @@ class Gem::Request::ConnectionPools # :nodoc:
# Returns list of no_proxy entries (if any) from the environment
def get_no_proxy_from_env
- env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
+ env_no_proxy = ENV["no_proxy"] || ENV["NO_PROXY"]
return [] if env_no_proxy.nil? or env_no_proxy.empty?
@@ -45,7 +45,7 @@ class Gem::Request::ConnectionPools # :nodoc:
end
def https?(uri)
- uri.scheme.downcase == 'https'
+ uri.scheme.downcase == "https"
end
def no_proxy?(host, env_no_proxy)
diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
index 01b01599a8..df215e4af3 100644
--- a/lib/rubygems/request_set.rb
+++ b/lib/rubygems/request_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'tsort'
+require_relative "tsort"
##
# A RequestSet groups a request to activate a set of dependencies.
@@ -254,7 +254,7 @@ class Gem::RequestSet
end
def install_into(dir, force = true, options = {})
- gem_home, ENV['GEM_HOME'] = ENV['GEM_HOME'], dir
+ gem_home, ENV["GEM_HOME"] = ENV["GEM_HOME"], dir
existing = force ? [] : specs_in(dir)
existing.delete_if {|s| @always_install.include? s }
@@ -287,7 +287,7 @@ class Gem::RequestSet
installed
ensure
- ENV['GEM_HOME'] = gem_home
+ ENV["GEM_HOME"] = gem_home
end
##
@@ -337,32 +337,32 @@ class Gem::RequestSet
end
def pretty_print(q) # :nodoc:
- q.group 2, '[RequestSet:', ']' do
+ q.group 2, "[RequestSet:", "]" do
q.breakable
if @remote
- q.text 'remote'
+ q.text "remote"
q.breakable
end
if @prerelease
- q.text 'prerelease'
+ q.text "prerelease"
q.breakable
end
if @development_shallow
- q.text 'shallow development'
+ q.text "shallow development"
q.breakable
elsif @development
- q.text 'development'
+ q.text "development"
q.breakable
end
if @soft_missing
- q.text 'soft missing'
+ q.text "soft missing"
end
- q.group 2, '[dependencies:', ']' do
+ q.group 2, "[dependencies:", "]" do
q.breakable
@dependencies.map do |dep|
q.text dep.to_s
@@ -371,7 +371,7 @@ class Gem::RequestSet
end
q.breakable
- q.text 'sets:'
+ q.text "sets:"
q.breakable
q.pp @sets.map {|set| set.class }
@@ -461,6 +461,6 @@ class Gem::RequestSet
end
end
-require_relative 'request_set/gem_dependency_api'
-require_relative 'request_set/lockfile'
-require_relative 'request_set/lockfile/tokenizer'
+require_relative "request_set/gem_dependency_api"
+require_relative "request_set/lockfile"
+require_relative "request_set/lockfile/tokenizer"
diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb
index 7188b07346..568d9f952f 100644
--- a/lib/rubygems/request_set/gem_dependency_api.rb
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -50,10 +50,10 @@ class Gem::RequestSet::GemDependencyAPI
:ruby_21 => %w[ruby rbx maglev truffleruby],
}.freeze
- mswin = Gem::Platform.new 'x86-mswin32'
- mswin64 = Gem::Platform.new 'x64-mswin64'
- x86_mingw = Gem::Platform.new 'x86-mingw32'
- x64_mingw = Gem::Platform.new 'x64-mingw32'
+ mswin = Gem::Platform.new "x86-mswin32"
+ mswin64 = Gem::Platform.new "x64-mswin64"
+ x86_mingw = Gem::Platform.new "x86-mingw32"
+ x64_mingw = Gem::Platform.new "x64-mingw32"
PLATFORM_MAP = { # :nodoc:
:jruby => Gem::Platform::RUBY,
@@ -91,11 +91,11 @@ class Gem::RequestSet::GemDependencyAPI
:x64_mingw_21 => x64_mingw,
}.freeze
- gt_eq_0 = Gem::Requirement.new '>= 0'
- tilde_gt_1_8_0 = Gem::Requirement.new '~> 1.8.0'
- tilde_gt_1_9_0 = Gem::Requirement.new '~> 1.9.0'
- tilde_gt_2_0_0 = Gem::Requirement.new '~> 2.0.0'
- tilde_gt_2_1_0 = Gem::Requirement.new '~> 2.1.0'
+ gt_eq_0 = Gem::Requirement.new ">= 0"
+ tilde_gt_1_8_0 = Gem::Requirement.new "~> 1.8.0"
+ tilde_gt_1_9_0 = Gem::Requirement.new "~> 1.9.0"
+ tilde_gt_2_0_0 = Gem::Requirement.new "~> 2.0.0"
+ tilde_gt_2_1_0 = Gem::Requirement.new "~> 2.1.0"
VERSION_MAP = { # :nodoc:
:jruby => gt_eq_0,
@@ -435,7 +435,7 @@ Gem dependencies file #{@path} requires #{name} more than once.
reference ||= ref
reference ||= branch
reference ||= tag
- reference ||= 'master'
+ reference ||= "master"
if ref && branch
warn <<-WARNING
@@ -637,8 +637,8 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
# :development. Only one group may be specified.
def gemspec(options = {})
- name = options.delete(:name) || '{,*}'
- path = options.delete(:path) || '.'
+ name = options.delete(:name) || "{,*}"
+ path = options.delete(:path) || "."
development_group = options.delete(:development_group) || :development
spec = find_gemspec name, path
@@ -697,11 +697,11 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
def pin_gem_source(name, type = :default, source = nil)
source_description =
case type
- when :default then '(default)'
+ when :default then "(default)"
when :path then "path: #{source}"
when :git then "git: #{source}"
when :source then "source: #{source}"
- else '(unknown)'
+ else "(unknown)"
end
raise ArgumentError,
@@ -788,7 +788,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
engine_version = options[:engine_version]
raise ArgumentError,
- 'You must specify engine_version along with the Ruby engine' if
+ "You must specify engine_version along with the Ruby engine" if
engine and not engine_version
return true if @installing
diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb
index 684d3fc7fe..3ba202f661 100644
--- a/lib/rubygems/request_set/lockfile.rb
+++ b/lib/rubygems/request_set/lockfile.rb
@@ -76,7 +76,7 @@ class Gem::RequestSet::Lockfile
@gem_deps_file = File.expand_path(gem_deps_file)
@gem_deps_dir = File.dirname(@gem_deps_file)
- if RUBY_VERSION < '2.7'
+ if RUBY_VERSION < "2.7"
@gem_deps_file.untaint unless gem_deps_file.tainted?
end
@@ -106,7 +106,7 @@ class Gem::RequestSet::Lockfile
out << " specs:"
requests.sort_by {|request| request.name }.each do |request|
- next if request.spec.name == 'bundler'
+ next if request.spec.name == "bundler"
platform = "-#{request.spec.platform}" unless
Gem::Platform::RUBY == request.spec.platform
@@ -156,7 +156,7 @@ class Gem::RequestSet::Lockfile
if dest.index(base) == 0
offset = dest[base.size + 1..-1]
- return '.' unless offset
+ return "." unless offset
offset
else
@@ -224,7 +224,7 @@ class Gem::RequestSet::Lockfile
def write
content = to_s
- File.open "#{@gem_deps_file}.lock", 'w' do |io|
+ File.open "#{@gem_deps_file}.lock", "w" do |io|
io.write content
end
end
@@ -236,4 +236,4 @@ class Gem::RequestSet::Lockfile
end
end
-require_relative 'lockfile/tokenizer'
+require_relative "lockfile/tokenizer"
diff --git a/lib/rubygems/request_set/lockfile/parser.rb b/lib/rubygems/request_set/lockfile/parser.rb
index 8c12b435af..376d37f9e2 100644
--- a/lib/rubygems/request_set/lockfile/parser.rb
+++ b/lib/rubygems/request_set/lockfile/parser.rb
@@ -19,15 +19,15 @@ class Gem::RequestSet::Lockfile::Parser
@tokens.skip :newline
case token.value
- when 'DEPENDENCIES' then
+ when "DEPENDENCIES" then
parse_DEPENDENCIES
- when 'GIT' then
+ when "GIT" then
parse_GIT
- when 'GEM' then
+ when "GEM" then
parse_GEM
- when 'PATH' then
+ when "PATH" then
parse_PATH
- when 'PLATFORMS' then
+ when "PLATFORMS" then
parse_PLATFORMS
else
token = get until @tokens.empty? or peek.first == :section
@@ -110,8 +110,8 @@ class Gem::RequestSet::Lockfile::Parser
def parse_GEM # :nodoc:
sources = []
- while [:entry, 'remote'] == peek.first(2) do
- get :entry, 'remote'
+ while [:entry, "remote"] == peek.first(2) do
+ get :entry, "remote"
data = get(:text).value
skip :newline
@@ -120,7 +120,7 @@ class Gem::RequestSet::Lockfile::Parser
sources << Gem::Source.new(Gem::DEFAULT_HOST) if sources.empty?
- get :entry, 'specs'
+ get :entry, "specs"
skip :newline
@@ -145,7 +145,7 @@ class Gem::RequestSet::Lockfile::Parser
data = token.value
if type == :text and column == 4
- version, platform = data.split '-', 2
+ version, platform = data.split "-", 2
platform =
platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
@@ -171,12 +171,12 @@ class Gem::RequestSet::Lockfile::Parser
end
def parse_GIT # :nodoc:
- get :entry, 'remote'
+ get :entry, "remote"
repository = get(:text).value
skip :newline
- get :entry, 'revision'
+ get :entry, "revision"
revision = get(:text).value
skip :newline
@@ -190,7 +190,7 @@ class Gem::RequestSet::Lockfile::Parser
skip :newline
end
- get :entry, 'specs'
+ get :entry, "specs"
skip :newline
@@ -234,12 +234,12 @@ class Gem::RequestSet::Lockfile::Parser
end
def parse_PATH # :nodoc:
- get :entry, 'remote'
+ get :entry, "remote"
directory = get(:text).value
skip :newline
- get :entry, 'specs'
+ get :entry, "specs"
skip :newline
diff --git a/lib/rubygems/request_set/lockfile/tokenizer.rb b/lib/rubygems/request_set/lockfile/tokenizer.rb
index cb8030c143..79c573a02d 100644
--- a/lib/rubygems/request_set/lockfile/tokenizer.rb
+++ b/lib/rubygems/request_set/lockfile/tokenizer.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'parser'
+require_relative "parser"
class Gem::RequestSet::Lockfile::Tokenizer
Token = Struct.new :type, :value, :column, :line
@@ -57,7 +57,7 @@ class Gem::RequestSet::Lockfile::Tokenizer
private
def tokenize(input)
- require 'strscan'
+ require "strscan"
s = StringScanner.new input
until s.eos? do
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index 9edd6aa7d3..12bf371f4e 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -61,7 +61,7 @@ class Gem::Requirement
input
when Gem::Version, Array then
new input
- when '!' then
+ when "!" then
source_set
else
if input.respond_to? :to_str
@@ -73,11 +73,11 @@ class Gem::Requirement
end
def self.default
- new '>= 0'
+ new ">= 0"
end
def self.default_prerelease
- new '>= 0.a'
+ new ">= 0.a"
end
###
@@ -218,7 +218,7 @@ class Gem::Requirement
end
def encode_with(coder) # :nodoc:
- coder.add 'requirements', @requirements
+ coder.add "requirements", @requirements
end
##
@@ -230,7 +230,7 @@ class Gem::Requirement
end
def pretty_print(q) # :nodoc:
- q.group 1, 'Gem::Requirement.new(', ')' do
+ q.group 1, "Gem::Requirement.new(", ")" do
q.pp as_list
end
end
diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb
index 51a11fed47..097e8243ee 100644
--- a/lib/rubygems/resolver.rb
+++ b/lib/rubygems/resolver.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'dependency'
-require_relative 'exceptions'
-require_relative 'util/list'
+require_relative "dependency"
+require_relative "exceptions"
+require_relative "util/list"
##
# Given a set of Gem::Dependency objects as +needed+ and a way to query the
@@ -10,14 +10,14 @@ require_relative 'util/list'
# all the requirements.
class Gem::Resolver
- require_relative 'resolver/molinillo'
+ require_relative "resolver/molinillo"
##
# If the DEBUG_RESOLVER environment variable is set then debugging mode is
# enabled for the resolver. This will display information about the state
# of the resolver while a set of dependencies is being resolved.
- DEBUG_RESOLVER = !ENV['DEBUG_RESOLVER'].nil?
+ DEBUG_RESOLVER = !ENV["DEBUG_RESOLVER"].nil?
##
# Set to true if all development dependencies should be considered.
@@ -74,7 +74,7 @@ class Gem::Resolver
case sets.length
when 0 then
- raise ArgumentError, 'one set in the composition must be non-nil'
+ raise ArgumentError, "one set in the composition must be non-nil"
when 1 then
sets.first
else
@@ -124,7 +124,7 @@ class Gem::Resolver
data = yield
$stderr.printf "%10s (%d entries)\n", stage.to_s.upcase, data.size
unless data.empty?
- require 'pp'
+ require "pp"
PP.pp data, $stderr
end
end
@@ -173,7 +173,7 @@ class Gem::Resolver
include Molinillo::UI
def output
- @output ||= debug? ? $stdout : File.open(IO::NULL, 'w')
+ @output ||= debug? ? $stdout : File.open(IO::NULL, "w")
end
def debug?
@@ -318,30 +318,30 @@ class Gem::Resolver
private :amount_constrained
end
-require_relative 'resolver/activation_request'
-require_relative 'resolver/conflict'
-require_relative 'resolver/dependency_request'
-require_relative 'resolver/requirement_list'
-require_relative 'resolver/stats'
-
-require_relative 'resolver/set'
-require_relative 'resolver/api_set'
-require_relative 'resolver/composed_set'
-require_relative 'resolver/best_set'
-require_relative 'resolver/current_set'
-require_relative 'resolver/git_set'
-require_relative 'resolver/index_set'
-require_relative 'resolver/installer_set'
-require_relative 'resolver/lock_set'
-require_relative 'resolver/vendor_set'
-require_relative 'resolver/source_set'
-
-require_relative 'resolver/specification'
-require_relative 'resolver/spec_specification'
-require_relative 'resolver/api_specification'
-require_relative 'resolver/git_specification'
-require_relative 'resolver/index_specification'
-require_relative 'resolver/installed_specification'
-require_relative 'resolver/local_specification'
-require_relative 'resolver/lock_specification'
-require_relative 'resolver/vendor_specification'
+require_relative "resolver/activation_request"
+require_relative "resolver/conflict"
+require_relative "resolver/dependency_request"
+require_relative "resolver/requirement_list"
+require_relative "resolver/stats"
+
+require_relative "resolver/set"
+require_relative "resolver/api_set"
+require_relative "resolver/composed_set"
+require_relative "resolver/best_set"
+require_relative "resolver/current_set"
+require_relative "resolver/git_set"
+require_relative "resolver/index_set"
+require_relative "resolver/installer_set"
+require_relative "resolver/lock_set"
+require_relative "resolver/vendor_set"
+require_relative "resolver/source_set"
+
+require_relative "resolver/specification"
+require_relative "resolver/spec_specification"
+require_relative "resolver/api_specification"
+require_relative "resolver/git_specification"
+require_relative "resolver/index_specification"
+require_relative "resolver/installed_specification"
+require_relative "resolver/local_specification"
+require_relative "resolver/lock_specification"
+require_relative "resolver/vendor_specification"
diff --git a/lib/rubygems/resolver/activation_request.rb b/lib/rubygems/resolver/activation_request.rb
index ae35681db9..27877e0f4b 100644
--- a/lib/rubygems/resolver/activation_request.rb
+++ b/lib/rubygems/resolver/activation_request.rb
@@ -93,7 +93,7 @@ class Gem::Resolver::ActivationRequest
end
def inspect # :nodoc:
- '#<%s for %p from %s>' % [
+ "#<%s for %p from %s>" % [
self.class, @spec, @request
]
end
@@ -130,12 +130,12 @@ class Gem::Resolver::ActivationRequest
end
def pretty_print(q) # :nodoc:
- q.group 2, '[Activation request', ']' do
+ q.group 2, "[Activation request", "]" do
q.breakable
q.pp @spec
q.breakable
- q.text ' for '
+ q.text " for "
q.pp @request
end
end
diff --git a/lib/rubygems/resolver/api_set.rb b/lib/rubygems/resolver/api_set.rb
index 21c9b8920c..f2bef54a9c 100644
--- a/lib/rubygems/resolver/api_set.rb
+++ b/lib/rubygems/resolver/api_set.rb
@@ -26,13 +26,13 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
# API URL +dep_uri+ which is described at
# https://guides.rubygems.org/rubygems-org-api
- def initialize(dep_uri = 'https://index.rubygems.org/info/')
+ def initialize(dep_uri = "https://index.rubygems.org/info/")
super()
dep_uri = URI dep_uri unless URI === dep_uri
@dep_uri = dep_uri
- @uri = dep_uri + '..'
+ @uri = dep_uri + ".."
@data = Hash.new {|h,k| h[k] = [] }
@source = Gem::Source.new @uri
@@ -83,12 +83,12 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
end
def pretty_print(q) # :nodoc:
- q.group 2, '[APISet', ']' do
+ q.group 2, "[APISet", "]" do
q.breakable
q.text "URI: #{@dep_uri}"
q.breakable
- q.text 'gem names:'
+ q.text "gem names:"
q.pp @data.keys
end
end
diff --git a/lib/rubygems/resolver/api_specification.rb b/lib/rubygems/resolver/api_specification.rb
index b5aa0b71d4..7af4d9cff3 100644
--- a/lib/rubygems/resolver/api_specification.rb
+++ b/lib/rubygems/resolver/api_specification.rb
@@ -62,7 +62,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
end
def pretty_print(q) # :nodoc:
- q.group 2, '[APISpecification', ']' do
+ q.group 2, "[APISpecification", "]" do
q.breakable
q.text "name: #{name}"
@@ -73,7 +73,7 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification
q.text "platform: #{platform}"
q.breakable
- q.text 'dependencies:'
+ q.text "dependencies:"
q.breakable
q.pp @dependencies
diff --git a/lib/rubygems/resolver/best_set.rb b/lib/rubygems/resolver/best_set.rb
index 300ea8015c..ab91ebca08 100644
--- a/lib/rubygems/resolver/best_set.rb
+++ b/lib/rubygems/resolver/best_set.rb
@@ -41,9 +41,9 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
end
def pretty_print(q) # :nodoc:
- q.group 2, '[BestSet', ']' do
+ q.group 2, "[BestSet", "]" do
q.breakable
- q.text 'sets:'
+ q.text "sets:"
q.breakable
q.pp @sets
diff --git a/lib/rubygems/resolver/conflict.rb b/lib/rubygems/resolver/conflict.rb
index 4c4588d7e8..54a7ca4641 100644
--- a/lib/rubygems/resolver/conflict.rb
+++ b/lib/rubygems/resolver/conflict.rb
@@ -65,7 +65,7 @@ class Gem::Resolver::Conflict
matching = matching % [
dependency,
- alternates.join(', '),
+ alternates.join(", "),
]
end
@@ -97,21 +97,21 @@ class Gem::Resolver::Conflict
end
def pretty_print(q) # :nodoc:
- q.group 2, '[Dependency conflict: ', ']' do
+ q.group 2, "[Dependency conflict: ", "]" do
q.breakable
- q.text 'activated '
+ q.text "activated "
q.pp @activated
q.breakable
- q.text ' dependency '
+ q.text " dependency "
q.pp @dependency
q.breakable
if @dependency == @failed_dep
- q.text ' failed'
+ q.text " failed"
else
- q.text ' failed dependency '
+ q.text " failed dependency "
q.pp @failed_dep
end
end
@@ -139,7 +139,7 @@ class Gem::Resolver::Conflict
end
end
- path = ['user request (gem command or Gemfile)'] if path.empty?
+ path = ["user request (gem command or Gemfile)"] if path.empty?
path
end
diff --git a/lib/rubygems/resolver/dependency_request.rb b/lib/rubygems/resolver/dependency_request.rb
index 356aadb3b2..70a61cbc25 100644
--- a/lib/rubygems/resolver/dependency_request.rb
+++ b/lib/rubygems/resolver/dependency_request.rb
@@ -95,12 +95,12 @@ class Gem::Resolver::DependencyRequest
end
def pretty_print(q) # :nodoc:
- q.group 2, '[Dependency request ', ']' do
+ q.group 2, "[Dependency request ", "]" do
q.breakable
q.text @dependency.to_s
q.breakable
- q.text ' requested by '
+ q.text " requested by "
q.pp @requester
end
end
diff --git a/lib/rubygems/resolver/git_set.rb b/lib/rubygems/resolver/git_set.rb
index eac51f15ad..f010273a8f 100644
--- a/lib/rubygems/resolver/git_set.rb
+++ b/lib/rubygems/resolver/git_set.rb
@@ -35,7 +35,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
def initialize # :nodoc:
super()
- @git = ENV['git'] || 'git'
+ @git = ENV["git"] || "git"
@need_submodules = {}
@repositories = {}
@root_dir = Gem.dir
@@ -104,7 +104,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
end
def pretty_print(q) # :nodoc:
- q.group 2, '[GitSet', ']' do
+ q.group 2, "[GitSet", "]" do
next if @repositories.empty?
q.breakable
diff --git a/lib/rubygems/resolver/git_specification.rb b/lib/rubygems/resolver/git_specification.rb
index ee47080ab4..d1e04737da 100644
--- a/lib/rubygems/resolver/git_specification.rb
+++ b/lib/rubygems/resolver/git_specification.rb
@@ -21,7 +21,7 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
# the executables.
def install(options = {})
- require_relative '../installer'
+ require_relative "../installer"
installer = Gem::Installer.for_spec spec, options
@@ -35,7 +35,7 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
end
def pretty_print(q) # :nodoc:
- q.group 2, '[GitSpecification', ']' do
+ q.group 2, "[GitSpecification", "]" do
q.breakable
q.text "name: #{name}"
@@ -43,7 +43,7 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
q.text "version: #{version}"
q.breakable
- q.text 'dependencies:'
+ q.text "dependencies:"
q.breakable
q.pp dependencies
diff --git a/lib/rubygems/resolver/index_set.rb b/lib/rubygems/resolver/index_set.rb
index 9390e34255..2344178314 100644
--- a/lib/rubygems/resolver/index_set.rb
+++ b/lib/rubygems/resolver/index_set.rb
@@ -53,14 +53,14 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
end
def pretty_print(q) # :nodoc:
- q.group 2, '[IndexSet', ']' do
+ q.group 2, "[IndexSet", "]" do
q.breakable
- q.text 'sources:'
+ q.text "sources:"
q.breakable
q.pp @f.sources
q.breakable
- q.text 'specs:'
+ q.text "specs:"
q.breakable
diff --git a/lib/rubygems/resolver/index_specification.rb b/lib/rubygems/resolver/index_specification.rb
index 9ea76f40ba..e8c3b35f7e 100644
--- a/lib/rubygems/resolver/index_specification.rb
+++ b/lib/rubygems/resolver/index_specification.rb
@@ -66,11 +66,11 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
end
def inspect # :nodoc:
- '#<%s %s source %s>' % [self.class, full_name, @source]
+ "#<%s %s source %s>" % [self.class, full_name, @source]
end
def pretty_print(q) # :nodoc:
- q.group 2, '[Index specification', ']' do
+ q.group 2, "[Index specification", "]" do
q.breakable
q.text full_name
@@ -80,7 +80,7 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
end
q.breakable
- q.text 'source '
+ q.text "source "
q.pp @source
end
end
diff --git a/lib/rubygems/resolver/installed_specification.rb b/lib/rubygems/resolver/installed_specification.rb
index 167ba1439e..7c7ad8d85b 100644
--- a/lib/rubygems/resolver/installed_specification.rb
+++ b/lib/rubygems/resolver/installed_specification.rb
@@ -30,7 +30,7 @@ class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
end
def pretty_print(q) # :nodoc:
- q.group 2, '[InstalledSpecification', ']' do
+ q.group 2, "[InstalledSpecification", "]" do
q.breakable
q.text "name: #{name}"
@@ -41,7 +41,7 @@ class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
q.text "platform: #{platform}"
q.breakable
- q.text 'dependencies:'
+ q.text "dependencies:"
q.breakable
q.pp spec.dependencies
end
diff --git a/lib/rubygems/resolver/installer_set.rb b/lib/rubygems/resolver/installer_set.rb
index 45252ed241..15580d7095 100644
--- a/lib/rubygems/resolver/installer_set.rb
+++ b/lib/rubygems/resolver/installer_set.rb
@@ -190,7 +190,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
def inspect # :nodoc:
always_install = @always_install.map {|s| s.full_name }
- '#<%s domain: %s specs: %p always install: %p>' % [
+ "#<%s domain: %s specs: %p always install: %p>" % [
self.class, @domain, @specs.keys, always_install
]
end
@@ -219,16 +219,16 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
def pretty_print(q) # :nodoc:
- q.group 2, '[InstallerSet', ']' do
+ q.group 2, "[InstallerSet", "]" do
q.breakable
q.text "domain: #{@domain}"
q.breakable
- q.text 'specs: '
+ q.text "specs: "
q.pp @specs.keys
q.breakable
- q.text 'always install: '
+ q.text "always install: "
q.pp @always_install
end
end
diff --git a/lib/rubygems/resolver/local_specification.rb b/lib/rubygems/resolver/local_specification.rb
index 9c69c4ab74..c27bab0f5a 100644
--- a/lib/rubygems/resolver/local_specification.rb
+++ b/lib/rubygems/resolver/local_specification.rb
@@ -17,7 +17,7 @@ class Gem::Resolver::LocalSpecification < Gem::Resolver::SpecSpecification
end
def pretty_print(q) # :nodoc:
- q.group 2, '[LocalSpecification', ']' do
+ q.group 2, "[LocalSpecification", "]" do
q.breakable
q.text "name: #{name}"
@@ -28,7 +28,7 @@ class Gem::Resolver::LocalSpecification < Gem::Resolver::SpecSpecification
q.text "platform: #{platform}"
q.breakable
- q.text 'dependencies:'
+ q.text "dependencies:"
q.breakable
q.pp dependencies
diff --git a/lib/rubygems/resolver/lock_set.rb b/lib/rubygems/resolver/lock_set.rb
index eabf217aba..ff6c6c912f 100644
--- a/lib/rubygems/resolver/lock_set.rb
+++ b/lib/rubygems/resolver/lock_set.rb
@@ -63,15 +63,15 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
end
def pretty_print(q) # :nodoc:
- q.group 2, '[LockSet', ']' do
+ q.group 2, "[LockSet", "]" do
q.breakable
- q.text 'source:'
+ q.text "source:"
q.breakable
q.pp @source
q.breakable
- q.text 'specs:'
+ q.text "specs:"
q.breakable
q.pp @specs.map {|spec| spec.full_name }
diff --git a/lib/rubygems/resolver/lock_specification.rb b/lib/rubygems/resolver/lock_specification.rb
index cdb8e4e425..4a30dcf849 100644
--- a/lib/rubygems/resolver/lock_specification.rb
+++ b/lib/rubygems/resolver/lock_specification.rb
@@ -29,7 +29,7 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
def install(options = {})
destination = options[:install_dir] || Gem.dir
- if File.exist? File.join(destination, 'specifications', spec.spec_name)
+ if File.exist? File.join(destination, "specifications", spec.spec_name)
yield nil
return
end
@@ -45,7 +45,7 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
end
def pretty_print(q) # :nodoc:
- q.group 2, '[LockSpecification', ']' do
+ q.group 2, "[LockSpecification", "]" do
q.breakable
q.text "name: #{@name}"
@@ -59,7 +59,7 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
unless @dependencies.empty?
q.breakable
- q.text 'dependencies:'
+ q.text "dependencies:"
q.breakable
q.pp @dependencies
end
diff --git a/lib/rubygems/resolver/molinillo.rb b/lib/rubygems/resolver/molinillo.rb
index 12ca740e5a..e154342571 100644
--- a/lib/rubygems/resolver/molinillo.rb
+++ b/lib/rubygems/resolver/molinillo.rb
@@ -1,2 +1,2 @@
# frozen_string_literal: true
-require_relative 'molinillo/lib/molinillo'
+require_relative "molinillo/lib/molinillo"
diff --git a/lib/rubygems/resolver/specification.rb b/lib/rubygems/resolver/specification.rb
index dfcb7eb057..3da803cab5 100644
--- a/lib/rubygems/resolver/specification.rb
+++ b/lib/rubygems/resolver/specification.rb
@@ -93,7 +93,7 @@ class Gem::Resolver::Specification
# specification.
def install(options = {})
- require_relative '../installer'
+ require_relative "../installer"
gem = download options
diff --git a/lib/rubygems/resolver/vendor_set.rb b/lib/rubygems/resolver/vendor_set.rb
index 48c640d8c9..6c0ef2a1a1 100644
--- a/lib/rubygems/resolver/vendor_set.rb
+++ b/lib/rubygems/resolver/vendor_set.rb
@@ -69,7 +69,7 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set
end
def pretty_print(q) # :nodoc:
- q.group 2, '[VendorSet', ']' do
+ q.group 2, "[VendorSet", "]" do
next if @directories.empty?
q.breakable
diff --git a/lib/rubygems/s3_uri_signer.rb b/lib/rubygems/s3_uri_signer.rb
index 4d1deee997..5522753af5 100644
--- a/lib/rubygems/s3_uri_signer.rb
+++ b/lib/rubygems/s3_uri_signer.rb
@@ -1,4 +1,4 @@
-require_relative 'openssl'
+require_relative "openssl"
##
# S3URISigner implements AWS SigV4 for S3 Source to avoid a dependency on the aws-sdk-* gems
@@ -138,14 +138,14 @@ class Gem::S3URISigner
end
def ec2_metadata_credentials_json
- require 'net/http'
- require_relative 'request'
- require_relative 'request/connection_pools'
- require 'json'
+ require "net/http"
+ require_relative "request"
+ require_relative "request/connection_pools"
+ require "json"
iam_info = ec2_metadata_request(EC2_IAM_INFO)
# Expected format: arn:aws:iam::<id>:instance-profile/<role_name>
- role_name = iam_info['InstanceProfileArn'].split('/').last
+ role_name = iam_info["InstanceProfileArn"].split("/").last
ec2_metadata_request(EC2_IAM_SECURITY_CREDENTIALS + role_name)
end
diff --git a/lib/rubygems/safe_yaml.rb b/lib/rubygems/safe_yaml.rb
index 81f99ee26e..5a98505598 100644
--- a/lib/rubygems/safe_yaml.rb
+++ b/lib/rubygems/safe_yaml.rb
@@ -26,7 +26,7 @@ module Gem
if ::Psych.respond_to? :safe_load
def self.safe_load(input)
- if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
+ if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0.pre1")
::Psych.safe_load(input, permitted_classes: PERMITTED_CLASSES, permitted_symbols: PERMITTED_SYMBOLS, aliases: true)
else
::Psych.safe_load(input, PERMITTED_CLASSES, PERMITTED_SYMBOLS, true)
@@ -34,7 +34,7 @@ module Gem
end
def self.load(input)
- if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
+ if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0.pre1")
::Psych.safe_load(input, permitted_classes: [::Symbol])
else
::Psych.safe_load(input, [::Symbol])
diff --git a/lib/rubygems/security.rb b/lib/rubygems/security.rb
index fc23c1c481..4eb4023055 100644
--- a/lib/rubygems/security.rb
+++ b/lib/rubygems/security.rb
@@ -5,8 +5,8 @@
# See LICENSE.txt for permissions.
#++
-require_relative 'exceptions'
-require_relative 'openssl'
+require_relative "exceptions"
+require_relative "openssl"
##
# = Signing gems
@@ -334,7 +334,7 @@ module Gem::Security
##
# Used internally to select the signing digest from all computed digests
- DIGEST_NAME = 'SHA256' # :nodoc:
+ DIGEST_NAME = "SHA256" # :nodoc:
##
# Length of keys created by RSA and DSA keys
@@ -344,18 +344,18 @@ module Gem::Security
##
# Default algorithm to use when building a key pair
- DEFAULT_KEY_ALGORITHM = 'RSA'
+ DEFAULT_KEY_ALGORITHM = "RSA"
##
# Named curve used for Elliptic Curve
- EC_NAME = 'secp384r1'
+ EC_NAME = "secp384r1"
##
# Cipher used to encrypt the key pair used to sign gems.
# Must be in the list returned by OpenSSL::Cipher.ciphers
- KEY_CIPHER = OpenSSL::Cipher.new('AES-256-CBC') if defined?(OpenSSL::Cipher)
+ KEY_CIPHER = OpenSSL::Cipher.new("AES-256-CBC") if defined?(OpenSSL::Cipher)
##
# One day in seconds
@@ -376,10 +376,10 @@ module Gem::Security
# * The certificate contains a subject key identifier
EXTENSIONS = {
- 'basicConstraints' => 'CA:FALSE',
- 'keyUsage' =>
- 'keyEncipherment,dataEncipherment,digitalSignature',
- 'subjectKeyIdentifier' => 'hash',
+ "basicConstraints" => "CA:FALSE",
+ "keyUsage" =>
+ "keyEncipherment,dataEncipherment,digitalSignature",
+ "subjectKeyIdentifier" => "hash",
}.freeze
def self.alt_name_or_x509_entry(certificate, x509_entry)
@@ -473,7 +473,7 @@ module Gem::Security
OpenSSL::Digest.new(algorithm)
end
else
- require 'digest'
+ require "digest"
def self.create_digest(algorithm = DIGEST_NAME)
Digest.const_get(algorithm).new
@@ -487,11 +487,11 @@ module Gem::Security
def self.create_key(algorithm)
if defined?(OpenSSL::PKey)
case algorithm.downcase
- when 'dsa'
+ when "dsa"
OpenSSL::PKey::DSA.new(RSA_DSA_KEY_LENGTH)
- when 'rsa'
+ when "rsa"
OpenSSL::PKey::RSA.new(RSA_DSA_KEY_LENGTH)
- when 'ec'
+ when "ec"
if RUBY_VERSION >= "2.4.0"
OpenSSL::PKey::EC.generate(EC_NAME)
else
@@ -510,11 +510,11 @@ module Gem::Security
# Turns +email_address+ into an OpenSSL::X509::Name
def self.email_to_name(email_address)
- email_address = email_address.gsub(/[^\w@.-]+/i, '_')
+ email_address = email_address.gsub(/[^\w@.-]+/i, "_")
- cn, dcs = email_address.split '@'
+ cn, dcs = email_address.split "@"
- dcs = dcs.split '.'
+ dcs = dcs.split "."
OpenSSL::X509::Name.new([
["CN", cn],
@@ -571,17 +571,17 @@ module Gem::Security
signee_key = certificate.public_key
alt_name = certificate.extensions.find do |extension|
- extension.oid == 'subjectAltName'
+ extension.oid == "subjectAltName"
end
- extensions = extensions.merge 'subjectAltName' => alt_name.value if
+ extensions = extensions.merge "subjectAltName" => alt_name.value if
alt_name
issuer_alt_name = signing_cert.extensions.find do |extension|
- extension.oid == 'subjectAltName'
+ extension.oid == "subjectAltName"
end
- extensions = extensions.merge 'issuerAltName' => issuer_alt_name.value if
+ extensions = extensions.merge "issuerAltName" => issuer_alt_name.value if
issuer_alt_name
signed = create_cert signee_subject, signee_key, age, extensions, serial
@@ -597,7 +597,7 @@ module Gem::Security
def self.trust_dir
return @trust_dir if @trust_dir
- dir = File.join Gem.user_home, '.gem', 'trust'
+ dir = File.join Gem.user_home, ".gem", "trust"
@trust_dir ||= Gem::Security::TrustDir.new dir
end
@@ -617,7 +617,7 @@ module Gem::Security
def self.write(pemmable, path, permissions = 0600, passphrase = nil, cipher = KEY_CIPHER)
path = File.expand_path path
- File.open path, 'wb', permissions do |io|
+ File.open path, "wb", permissions do |io|
if passphrase and cipher
io.write pemmable.to_pem cipher, passphrase
else
@@ -633,9 +633,9 @@ module Gem::Security
end
if Gem::HAVE_OPENSSL
- require_relative 'security/policy'
- require_relative 'security/policies'
- require_relative 'security/trust_dir'
+ require_relative "security/policy"
+ require_relative "security/policies"
+ require_relative "security/trust_dir"
end
-require_relative 'security/signer'
+require_relative "security/signer"
diff --git a/lib/rubygems/security/policies.rb b/lib/rubygems/security/policies.rb
index 8f6ad99316..b3f9070394 100644
--- a/lib/rubygems/security/policies.rb
+++ b/lib/rubygems/security/policies.rb
@@ -5,7 +5,7 @@ module Gem::Security
# No security policy: all package signature checks are disabled.
NoSecurity = Policy.new(
- 'No Security',
+ "No Security",
:verify_data => false,
:verify_signer => false,
:verify_chain => false,
@@ -23,7 +23,7 @@ module Gem::Security
# easily spoofed, and is not recommended.
AlmostNoSecurity = Policy.new(
- 'Almost No Security',
+ "Almost No Security",
:verify_data => true,
:verify_signer => false,
:verify_chain => false,
@@ -40,7 +40,7 @@ module Gem::Security
# is not recommended.
LowSecurity = Policy.new(
- 'Low Security',
+ "Low Security",
:verify_data => true,
:verify_signer => true,
:verify_chain => false,
@@ -59,7 +59,7 @@ module Gem::Security
# gem off as unsigned.
MediumSecurity = Policy.new(
- 'Medium Security',
+ "Medium Security",
:verify_data => true,
:verify_signer => true,
:verify_chain => true,
@@ -78,7 +78,7 @@ module Gem::Security
# a reasonable guarantee that the contents of the gem have not been altered.
HighSecurity = Policy.new(
- 'High Security',
+ "High Security",
:verify_data => true,
:verify_signer => true,
:verify_chain => true,
@@ -91,7 +91,7 @@ module Gem::Security
# Policy used to verify a certificate and key when signing a gem
SigningPolicy = Policy.new(
- 'Signing Policy',
+ "Signing Policy",
:verify_data => false,
:verify_signer => true,
:verify_chain => true,
@@ -104,11 +104,11 @@ module Gem::Security
# Hash of configured security policies
Policies = {
- 'NoSecurity' => NoSecurity,
- 'AlmostNoSecurity' => AlmostNoSecurity,
- 'LowSecurity' => LowSecurity,
- 'MediumSecurity' => MediumSecurity,
- 'HighSecurity' => HighSecurity,
+ "NoSecurity" => NoSecurity,
+ "AlmostNoSecurity" => AlmostNoSecurity,
+ "LowSecurity" => LowSecurity,
+ "MediumSecurity" => MediumSecurity,
+ "HighSecurity" => HighSecurity,
# SigningPolicy is not intended for use by `gem -P` so do not list it
}.freeze
diff --git a/lib/rubygems/security/policy.rb b/lib/rubygems/security/policy.rb
index 06eae073f4..43588fd7f1 100644
--- a/lib/rubygems/security/policy.rb
+++ b/lib/rubygems/security/policy.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative '../user_interaction'
+require_relative "../user_interaction"
##
# A Gem::Security::Policy object encapsulates the settings for verifying
@@ -53,8 +53,8 @@ class Gem::Security::Policy
# and is valid for the given +time+.
def check_chain(chain, time)
- raise Gem::Security::Exception, 'missing signing chain' unless chain
- raise Gem::Security::Exception, 'empty signing chain' if chain.empty?
+ raise Gem::Security::Exception, "missing signing chain" unless chain
+ raise Gem::Security::Exception, "empty signing chain" if chain.empty?
begin
chain.each_cons 2 do |issuer, cert|
@@ -83,7 +83,7 @@ class Gem::Security::Policy
# If the +issuer+ is +nil+ no verification is performed.
def check_cert(signer, issuer, time)
- raise Gem::Security::Exception, 'missing signing certificate' unless
+ raise Gem::Security::Exception, "missing signing certificate" unless
signer
message = "certificate #{signer.subject}"
@@ -112,7 +112,7 @@ class Gem::Security::Policy
unless signer and key
return true unless @only_signed
- raise Gem::Security::Exception, 'missing key or signature'
+ raise Gem::Security::Exception, "missing key or signature"
end
raise Gem::Security::Exception,
@@ -127,11 +127,11 @@ class Gem::Security::Policy
# +time+.
def check_root(chain, time)
- raise Gem::Security::Exception, 'missing signing chain' unless chain
+ raise Gem::Security::Exception, "missing signing chain" unless chain
root = chain.first
- raise Gem::Security::Exception, 'missing root certificate' unless root
+ raise Gem::Security::Exception, "missing root certificate" unless root
raise Gem::Security::Exception,
"root certificate #{root.subject} is not self-signed " +
@@ -146,11 +146,11 @@ class Gem::Security::Policy
# the digests of the two certificates match according to +digester+
def check_trust(chain, digester, trust_dir)
- raise Gem::Security::Exception, 'missing signing chain' unless chain
+ raise Gem::Security::Exception, "missing signing chain" unless chain
root = chain.first
- raise Gem::Security::Exception, 'missing root certificate' unless root
+ raise Gem::Security::Exception, "missing root certificate" unless root
path = Gem::Security.trust_dir.cert_path root
@@ -182,7 +182,7 @@ class Gem::Security::Policy
def subject(certificate) # :nodoc:
certificate.extensions.each do |extension|
- next unless extension.oid == 'subjectAltName'
+ next unless extension.oid == "subjectAltName"
return extension.value
end
@@ -206,7 +206,7 @@ class Gem::Security::Policy
# If +key+ is given it is used to validate the signing certificate.
def verify(chain, key = nil, digests = {}, signatures = {},
- full_name = '(unknown)')
+ full_name = "(unknown)")
if signatures.empty?
if @only_signed
raise Gem::Security::Exception,
@@ -230,7 +230,7 @@ class Gem::Security::Policy
end
if @verify_data
- raise Gem::Security::Exception, 'no digests provided (probable bug)' if
+ raise Gem::Security::Exception, "no digests provided (probable bug)" if
signer_digests.nil? or signer_digests.empty?
else
signer_digests = {}
diff --git a/lib/rubygems/security/signer.rb b/lib/rubygems/security/signer.rb
index 968cf88973..b1308c4e42 100644
--- a/lib/rubygems/security/signer.rb
+++ b/lib/rubygems/security/signer.rb
@@ -42,7 +42,7 @@ class Gem::Security::Signer
def self.re_sign_cert(expired_cert, expired_cert_path, private_key)
return unless expired_cert.not_after < Time.now
- expiry = expired_cert.not_after.strftime('%Y%m%d%H%M%S')
+ expiry = expired_cert.not_after.strftime("%Y%m%d%H%M%S")
expired_cert_file = "#{File.basename(expired_cert_path)}.expired.#{expiry}"
new_expired_cert_path = File.join(Gem.user_home, ".gem", expired_cert_file)
@@ -105,7 +105,7 @@ class Gem::Security::Signer
# this value is preferred, otherwise the subject is used.
def extract_name(cert) # :nodoc:
- subject_alt_name = cert.extensions.find {|e| 'subjectAltName' == e.oid }
+ subject_alt_name = cert.extensions.find {|e| "subjectAltName" == e.oid }
if subject_alt_name
/\Aemail:/ =~ subject_alt_name.value # rubocop:disable Performance/StartWith
@@ -139,7 +139,7 @@ class Gem::Security::Signer
def sign(data)
return unless @key
- raise Gem::Security::Exception, 'no certs provided' if @cert_chain.empty?
+ raise Gem::Security::Exception, "no certs provided" if @cert_chain.empty?
if @cert_chain.length == 1 and @cert_chain.last.not_after < Time.now
alert("Your certificate has expired, trying to re-sign it...")
@@ -182,7 +182,7 @@ class Gem::Security::Signer
return unless disk_key
if disk_key.to_pem == @key.to_pem && disk_cert == old_cert.to_pem
- expiry = old_cert.not_after.strftime('%Y%m%d%H%M%S')
+ expiry = old_cert.not_after.strftime("%Y%m%d%H%M%S")
old_cert_file = "gem-public_cert.pem.expired.#{expiry}"
old_cert_path = File.join(Gem.user_home, ".gem", old_cert_file)
diff --git a/lib/rubygems/security/trust_dir.rb b/lib/rubygems/security/trust_dir.rb
index 456947274c..a6882c66e7 100644
--- a/lib/rubygems/security/trust_dir.rb
+++ b/lib/rubygems/security/trust_dir.rb
@@ -41,7 +41,7 @@ class Gem::Security::TrustDir
def each_certificate
return enum_for __method__ unless block_given?
- glob = File.join @dir, '*.pem'
+ glob = File.join @dir, "*.pem"
Dir[glob].each do |certificate_file|
begin
@@ -92,7 +92,7 @@ class Gem::Security::TrustDir
destination = cert_path certificate
- File.open destination, 'wb', 0600 do |io|
+ File.open destination, "wb", 0600 do |io|
io.write certificate.to_pem
io.chmod(@permissions[:trusted_cert])
end
@@ -104,7 +104,7 @@ class Gem::Security::TrustDir
# permissions.
def verify
- require 'fileutils'
+ require "fileutils"
if File.exist? @dir
raise Gem::Security::Exception,
"trust directory #{@dir} is not a directory" unless
diff --git a/lib/rubygems/security_option.rb b/lib/rubygems/security_option.rb
index a4c570ded5..ab3898bf11 100644
--- a/lib/rubygems/security_option.rb
+++ b/lib/rubygems/security_option.rb
@@ -5,7 +5,7 @@
# See LICENSE.txt for permissions.
#++
-require_relative '../rubygems'
+require_relative "../rubygems"
# forward-declare
@@ -20,9 +20,9 @@ end
module Gem::SecurityOption
def add_security_option
Gem::OptionParser.accept Gem::Security::Policy do |value|
- require_relative 'security'
+ require_relative "security"
- raise Gem::OptionParser::InvalidArgument, 'OpenSSL not installed' unless
+ raise Gem::OptionParser::InvalidArgument, "OpenSSL not installed" unless
defined?(Gem::Security::HighSecurity)
policy = Gem::Security::Policies[value]
@@ -33,9 +33,9 @@ module Gem::SecurityOption
policy
end
- add_option(:"Install/Update", '-P', '--trust-policy POLICY',
+ add_option(:"Install/Update", "-P", "--trust-policy POLICY",
Gem::Security::Policy,
- 'Specify gem trust policy') do |value, options|
+ "Specify gem trust policy") do |value, options|
options[:security_policy] = value
end
end
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index 5f49a0d216..7c3b678645 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -12,9 +12,9 @@ class Gem::Source
include Gem::Text
FILES = { # :nodoc:
- :released => 'specs',
- :latest => 'latest_specs',
- :prerelease => 'prerelease_specs',
+ :released => "specs",
+ :latest => "latest_specs",
+ :prerelease => "prerelease_specs",
}.freeze
##
@@ -71,7 +71,7 @@ class Gem::Source
# Returns a Set that can fetch specifications from this source.
def dependency_resolver_set # :nodoc:
- return Gem::Resolver::IndexSet.new self if 'file' == uri.scheme
+ return Gem::Resolver::IndexSet.new self if "file" == uri.scheme
fetch_uri = if uri.host == "rubygems.org"
index_uri = uri.dup
@@ -141,7 +141,7 @@ class Gem::Source
return spec if spec
end
- source_uri.path << '.rz'
+ source_uri.path << ".rz"
spec = fetcher.fetch_path source_uri
spec = Gem::Util.inflate spec
@@ -150,7 +150,7 @@ class Gem::Source
require "fileutils"
FileUtils.mkdir_p cache_dir
- File.open local_spec, 'wb' do |io|
+ File.open local_spec, "wb" do |io|
io.write spec
end
end
@@ -209,13 +209,13 @@ class Gem::Source
end
def pretty_print(q) # :nodoc:
- q.group 2, '[Remote:', ']' do
+ q.group 2, "[Remote:", "]" do
q.breakable
q.text @uri.to_s
if api = uri
q.breakable
- q.text 'API URI: '
+ q.text "API URI: "
q.text api.to_s
end
end
@@ -229,13 +229,13 @@ class Gem::Source
private
def enforce_trailing_slash(uri)
- uri.merge(uri.path.gsub(/\/+$/, '') + '/')
+ uri.merge(uri.path.gsub(/\/+$/, "") + "/")
end
end
-require_relative 'source/git'
-require_relative 'source/installed'
-require_relative 'source/specific_file'
-require_relative 'source/local'
-require_relative 'source/lock'
-require_relative 'source/vendor'
+require_relative "source/git"
+require_relative "source/installed"
+require_relative "source/specific_file"
+require_relative "source/local"
+require_relative "source/lock"
+require_relative "source/vendor"
diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb
index 1d964eb59a..22355adcfa 100644
--- a/lib/rubygems/source/git.rb
+++ b/lib/rubygems/source/git.rb
@@ -58,7 +58,7 @@ class Gem::Source::Git < Gem::Source
@remote = true
@root_dir = Gem.dir
- @git = ENV['git'] || 'git'
+ @git = ENV["git"] || "git"
end
def <=>(other)
@@ -92,18 +92,18 @@ class Gem::Source::Git < Gem::Source
return false unless File.exist? repo_cache_dir
unless File.exist? install_dir
- system @git, 'clone', '--quiet', '--no-checkout',
+ system @git, "clone", "--quiet", "--no-checkout",
repo_cache_dir, install_dir
end
Dir.chdir install_dir do
- system @git, 'fetch', '--quiet', '--force', '--tags', install_dir
+ system @git, "fetch", "--quiet", "--force", "--tags", install_dir
- success = system @git, 'reset', '--quiet', '--hard', rev_parse
+ success = system @git, "reset", "--quiet", "--hard", rev_parse
if @need_submodules
require "open3"
- _, status = Open3.capture2e(@git, 'submodule', 'update', '--quiet', '--init', '--recursive')
+ _, status = Open3.capture2e(@git, "submodule", "update", "--quiet", "--init", "--recursive")
success &&= status.success?
end
@@ -120,11 +120,11 @@ class Gem::Source::Git < Gem::Source
if File.exist? repo_cache_dir
Dir.chdir repo_cache_dir do
- system @git, 'fetch', '--quiet', '--force', '--tags',
- @repository, 'refs/heads/*:refs/heads/*'
+ system @git, "fetch", "--quiet", "--force", "--tags",
+ @repository, "refs/heads/*:refs/heads/*"
end
else
- system @git, 'clone', '--quiet', '--bare', '--no-hardlinks',
+ system @git, "clone", "--quiet", "--bare", "--no-hardlinks",
@repository, repo_cache_dir
end
end
@@ -133,7 +133,7 @@ class Gem::Source::Git < Gem::Source
# Directory where git gems get unpacked and so-forth.
def base_dir # :nodoc:
- File.join @root_dir, 'bundler'
+ File.join @root_dir, "bundler"
end
##
@@ -155,11 +155,11 @@ class Gem::Source::Git < Gem::Source
def install_dir # :nodoc:
return unless File.exist? repo_cache_dir
- File.join base_dir, 'gems', "#{@name}-#{dir_shortref}"
+ File.join base_dir, "gems", "#{@name}-#{dir_shortref}"
end
def pretty_print(q) # :nodoc:
- q.group 2, '[Git: ', ']' do
+ q.group 2, "[Git: ", "]" do
q.breakable
q.text @repository
@@ -172,7 +172,7 @@ class Gem::Source::Git < Gem::Source
# The directory where the git gem's repository will be cached.
def repo_cache_dir # :nodoc:
- File.join @root_dir, 'cache', 'bundler', 'git', "#{@name}-#{uri_hash}"
+ File.join @root_dir, "cache", "bundler", "git", "#{@name}-#{uri_hash}"
end
##
@@ -182,7 +182,7 @@ class Gem::Source::Git < Gem::Source
hash = nil
Dir.chdir repo_cache_dir do
- hash = Gem::Util.popen(@git, 'rev-parse', @reference).strip
+ hash = Gem::Util.popen(@git, "rev-parse", @reference).strip
end
raise Gem::Exception,
@@ -201,7 +201,7 @@ class Gem::Source::Git < Gem::Source
return [] unless install_dir
Dir.chdir install_dir do
- Dir['{,*,*/*}.gemspec'].map do |spec_file|
+ Dir["{,*,*/*}.gemspec"].map do |spec_file|
directory = File.dirname spec_file
file = File.basename spec_file
@@ -211,7 +211,7 @@ class Gem::Source::Git < Gem::Source
spec.base_dir = base_dir
spec.extension_dir =
- File.join base_dir, 'extensions', Gem::Platform.local.to_s,
+ File.join base_dir, "extensions", Gem::Platform.local.to_s,
Gem.extension_api_version, "#{name}-#{dir_shortref}"
spec.full_gem_path = File.dirname spec.loaded_from if spec
@@ -226,11 +226,11 @@ class Gem::Source::Git < Gem::Source
# A hash for the git gem based on the git repository URI.
def uri_hash # :nodoc:
- require_relative '../openssl'
+ require_relative "../openssl"
normalized =
if @repository =~ %r{^\w+://(\w+@)?}
- uri = URI(@repository).normalize.to_s.sub %r{/$},''
+ uri = URI(@repository).normalize.to_s.sub %r{/$},""
uri.sub(/\A(\w+)/) { $1.downcase }
else
@repository
diff --git a/lib/rubygems/source/installed.rb b/lib/rubygems/source/installed.rb
index 7e1dd7af5a..786faab3e3 100644
--- a/lib/rubygems/source/installed.rb
+++ b/lib/rubygems/source/installed.rb
@@ -33,6 +33,6 @@ class Gem::Source::Installed < Gem::Source
end
def pretty_print(q) # :nodoc:
- q.text '[Installed]'
+ q.text "[Installed]"
end
end
diff --git a/lib/rubygems/source/local.rb b/lib/rubygems/source/local.rb
index 078b06203f..ec1a594238 100644
--- a/lib/rubygems/source/local.rb
+++ b/lib/rubygems/source/local.rb
@@ -29,7 +29,7 @@ class Gem::Source::Local < Gem::Source
end
def inspect # :nodoc:
- keys = @specs ? @specs.keys.sort : 'NOT LOADED'
+ keys = @specs ? @specs.keys.sort : "NOT LOADED"
"#<%s specs: %p>" % [self.class, keys]
end
@@ -121,7 +121,7 @@ class Gem::Source::Local < Gem::Source
end
def pretty_print(q) # :nodoc:
- q.group 2, '[Local gems:', ']' do
+ q.group 2, "[Local gems:", "]" do
q.breakable
q.seplist @specs.keys do |v|
q.text v.full_name
diff --git a/lib/rubygems/source/specific_file.rb b/lib/rubygems/source/specific_file.rb
index 24db1440dd..552aeba50f 100644
--- a/lib/rubygems/source/specific_file.rb
+++ b/lib/rubygems/source/specific_file.rb
@@ -42,7 +42,7 @@ class Gem::Source::SpecificFile < Gem::Source
end
def pretty_print(q) # :nodoc:
- q.group 2, '[SpecificFile:', ']' do
+ q.group 2, "[SpecificFile:", "]" do
q.breakable
q.text @path
end
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index 4033e2efa3..43e7e05b63 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require_relative 'remote_fetcher'
-require_relative 'user_interaction'
-require_relative 'errors'
-require_relative 'text'
-require_relative 'name_tuple'
+require_relative "remote_fetcher"
+require_relative "user_interaction"
+require_relative "errors"
+require_relative "text"
+require_relative "name_tuple"
##
# SpecFetcher handles metadata updates from remote gem repositories.
@@ -171,19 +171,19 @@ class Gem::SpecFetcher
# alternative gem names.
def suggest_gems_from_name(gem_name, type = :latest, num_results = 5)
- gem_name = gem_name.downcase.tr('_-', '')
+ gem_name = gem_name.downcase.tr("_-", "")
max = gem_name.size / 2
names = available_specs(type).first.values.flatten(1)
matches = names.map do |n|
next unless n.match_platform?
- [n.name, 0] if n.name.downcase.tr('_-', '').include?(gem_name)
+ [n.name, 0] if n.name.downcase.tr("_-", "").include?(gem_name)
end.compact
if matches.length < num_results
matches += names.map do |n|
next unless n.match_platform?
- distance = levenshtein_distance gem_name, n.name.downcase.tr('_-', '')
+ distance = levenshtein_distance gem_name, n.name.downcase.tr("_-", "")
next if distance >= max
return [n.name] if distance == 0
[n.name, distance]
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 0ced1d9020..00d139d854 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -6,12 +6,11 @@
# See LICENSE.txt for permissions.
#++
-require_relative 'deprecate'
-require_relative 'basic_specification'
-require_relative 'stub_specification'
-require_relative 'platform'
-require_relative 'requirement'
-require_relative 'util/list'
+require_relative "deprecate"
+require_relative "basic_specification"
+require_relative "stub_specification"
+require_relative "platform"
+require_relative "util/list"
##
# The Specification class contains the information for a gem. Typically
@@ -75,20 +74,20 @@ class Gem::Specification < Gem::BasicSpecification
# key should be equal to the CURRENT_SPECIFICATION_VERSION.
SPECIFICATION_VERSION_HISTORY = { # :nodoc:
- -1 => ['(RubyGems versions up to and including 0.7 did not have versioned specifications)'],
+ -1 => ["(RubyGems versions up to and including 0.7 did not have versioned specifications)"],
1 => [
'Deprecated "test_suite_file" in favor of the new, but equivalent, "test_files"',
'"test_file=x" is a shortcut for "test_files=[x]"',
],
2 => [
'Added "required_rubygems_version"',
- 'Now forward-compatible with future versions',
+ "Now forward-compatible with future versions",
],
3 => [
- 'Added Fixnum validation to the specification_version',
+ "Added Fixnum validation to the specification_version",
],
4 => [
- 'Added sandboxed freeform metadata to the specification version.',
+ "Added sandboxed freeform metadata to the specification version.",
],
}.freeze
@@ -127,7 +126,7 @@ class Gem::Specification < Gem::BasicSpecification
@@default_value = {
:authors => [],
:autorequire => nil,
- :bindir => 'bin',
+ :bindir => "bin",
:cert_chain => [],
:date => nil,
:dependencies => [],
@@ -144,7 +143,7 @@ class Gem::Specification < Gem::BasicSpecification
:platform => Gem::Platform::RUBY,
:post_install_message => nil,
:rdoc_options => [],
- :require_paths => ['lib'],
+ :require_paths => ["lib"],
:required_ruby_version => Gem::Requirement.default,
:required_rubygems_version => Gem::Requirement.default,
:requirements => [],
@@ -490,12 +489,12 @@ class Gem::Specification < Gem::BasicSpecification
# legacy constants
when nil, Gem::Platform::RUBY then
@new_platform = Gem::Platform::RUBY
- when 'mswin32' then # was Gem::Platform::WIN32
- @new_platform = Gem::Platform.new 'x86-mswin32'
- when 'i586-linux' then # was Gem::Platform::LINUX_586
- @new_platform = Gem::Platform.new 'x86-linux'
- when 'powerpc-darwin' then # was Gem::Platform::DARWIN
- @new_platform = Gem::Platform.new 'ppc-darwin'
+ when "mswin32" then # was Gem::Platform::WIN32
+ @new_platform = Gem::Platform.new "x86-mswin32"
+ when "i586-linux" then # was Gem::Platform::LINUX_586
+ @new_platform = Gem::Platform.new "x86-linux"
+ when "powerpc-darwin" then # was Gem::Platform::DARWIN
+ @new_platform = Gem::Platform.new "ppc-darwin"
else
@new_platform = Gem::Platform.new platform
end
@@ -1150,7 +1149,7 @@ class Gem::Specification < Gem::BasicSpecification
file = file.dup.tap(&Gem::UNTAINT)
return unless File.file?(file)
- code = Gem.open_file(file, 'r:UTF-8:-', &:read)
+ code = Gem.open_file(file, "r:UTF-8:-", &:read)
code.tap(&Gem::UNTAINT)
@@ -1392,7 +1391,7 @@ class Gem::Specification < Gem::BasicSpecification
@required_rubygems_version,
@original_platform,
@dependencies,
- '', # rubyforge_project
+ "", # rubyforge_project
@email,
@authors,
@description,
@@ -1610,7 +1609,7 @@ class Gem::Specification < Gem::BasicSpecification
return if default_gem?
return if File.exist? gem_build_complete_path
return if !File.writable?(base_dir)
- return if !File.exist?(File.join(base_dir, 'extensions'))
+ return if !File.exist?(File.join(base_dir, "extensions"))
begin
# We need to require things in $LOAD_PATH without looking for the
@@ -1618,9 +1617,9 @@ class Gem::Specification < Gem::BasicSpecification
unresolved_deps = Gem::Specification.unresolved_deps.dup
Gem::Specification.unresolved_deps.clear
- require_relative 'config_file'
- require_relative 'ext'
- require_relative 'user_interaction'
+ require_relative "config_file"
+ require_relative "ext"
+ require_relative "user_interaction"
ui = Gem::SilentUI.new
Gem::DefaultUserInteraction.use_ui ui do
@@ -1839,7 +1838,7 @@ class Gem::Specification < Gem::BasicSpecification
# spec.doc_dir 'ri' # => "/path/to/gem_repo/doc/a-1/ri"
def doc_dir(type = nil)
- @doc_dir ||= File.join base_dir, 'doc', full_name
+ @doc_dir ||= File.join base_dir, "doc", full_name
if type
File.join @doc_dir, type
@@ -1851,17 +1850,17 @@ class Gem::Specification < Gem::BasicSpecification
def encode_with(coder) # :nodoc:
mark_version
- coder.add 'name', @name
- coder.add 'version', @version
+ coder.add "name", @name
+ coder.add "version", @version
platform = case @original_platform
- when nil, '' then
- 'ruby'
+ when nil, "" then
+ "ruby"
when String then
@original_platform
else
@original_platform.to_s
end
- coder.add 'platform', platform
+ coder.add "platform", platform
attributes = @@attributes.map(&:to_s) - %w[name version platform]
attributes.each do |name|
@@ -2231,7 +2230,7 @@ class Gem::Specification < Gem::BasicSpecification
end
def pretty_print(q) # :nodoc:
- q.group 2, 'Gem::Specification.new do |s|', 'end' do
+ q.group 2, "Gem::Specification.new do |s|", "end" do
q.breakable
attributes = @@attributes - [:name, :version]
@@ -2326,7 +2325,7 @@ class Gem::Specification < Gem::BasicSpecification
# Returns the full path to this spec's ri directory.
def ri_dir
- @ri_dir ||= File.join base_dir, 'ri', full_name
+ @ri_dir ||= File.join base_dir, "ri", full_name
end
##
@@ -2336,13 +2335,13 @@ class Gem::Specification < Gem::BasicSpecification
def ruby_code(obj)
case obj
when String then obj.dump + ".freeze"
- when Array then '[' + obj.map {|x| ruby_code x }.join(", ") + ']'
+ when Array then "[" + obj.map {|x| ruby_code x }.join(", ") + "]"
when Hash then
seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
"{ #{seg.join(', ')} }"
when Gem::Version then obj.to_s.dump
- when DateLike then obj.strftime('%Y-%m-%d').dump
- when Time then obj.strftime('%Y-%m-%d').dump
+ when DateLike then obj.strftime("%Y-%m-%d").dump
+ when Time then obj.strftime("%Y-%m-%d").dump
when Numeric then obj.inspect
when true, false, nil then obj.inspect
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
@@ -2575,14 +2574,14 @@ class Gem::Specification < Gem::BasicSpecification
# back, we have to check again here to make sure that our
# psych code was properly loaded, and load it if not.
unless Gem.const_defined?(:NoAliasYAMLTree)
- require_relative 'psych_tree'
+ require_relative "psych_tree"
end
builder = Gem::NoAliasYAMLTree.create
builder << self
ast = builder.tree
- require 'stringio'
+ require "stringio"
io = StringIO.new
io.set_encoding Encoding::UTF_8
@@ -2669,7 +2668,7 @@ class Gem::Specification < Gem::BasicSpecification
# skip to set required_ruby_version when pre-released rubygems.
# It caused to raise CircularDependencyError
if @version.prerelease? && (@name.nil? || @name.strip != "rubygems")
- self.required_rubygems_version = '> 1.3.1'
+ self.required_rubygems_version = "> 1.3.1"
end
invalidate_memoized_attributes
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index 8b5d01dda2..332189ae9f 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -1,4 +1,4 @@
-require_relative 'user_interaction'
+require_relative "user_interaction"
class Gem::SpecificationPolicy
include Gem::UserInteraction
@@ -120,7 +120,7 @@ class Gem::SpecificationPolicy
metadata = @specification.metadata
unless Hash === metadata
- error 'metadata must be a hash'
+ error "metadata must be a hash"
end
metadata.each do |key, value|
@@ -188,7 +188,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
prerelease_dep && !@specification.version.prerelease?
open_ended = dep.requirement.requirements.all? do |op, version|
- not version.prerelease? and (op == '>' or op == '>=')
+ not version.prerelease? and (op == ">" or op == ">=")
end
if open_ended
@@ -198,12 +198,12 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
base = segments.first 2
- recommendation = if (op == '>' || op == '>=') && segments == [0]
+ recommendation = if (op == ">" || op == ">=") && segments == [0]
" use a bounded requirement, such as '~> x.y'"
else
- bugfix = if op == '>'
+ bugfix = if op == ">"
", '> #{dep_version}'"
- elsif op == '>=' and base != segments
+ elsif op == ">=" and base != segments
", '>= #{dep_version}'"
end
@@ -286,7 +286,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
def validate_require_paths
return unless @specification.raw_require_paths.empty?
- error 'specification must have at least one require_path'
+ error "specification must have at least one require_path"
end
def validate_non_files
@@ -310,7 +310,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
def validate_specification_version
return if @specification.specification_version.is_a?(Integer)
- error 'specification_version must be an Integer (did you mean version?)'
+ error "specification_version must be an Integer (did you mean version?)"
end
def validate_platform
@@ -380,7 +380,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
WARNING
end
- LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '')
+ LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, "")
LAZY_PATTERN = /\AFI XME|\ATO DO/x.freeze
HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i.freeze
@@ -405,7 +405,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
# Make sure a homepage is valid HTTP/HTTPS URI
if homepage and not homepage.empty?
- require 'uri'
+ require "uri"
begin
homepage_uri = URI.parse(homepage)
unless [URI::HTTP, URI::HTTPS].member? homepage_uri.class
@@ -445,7 +445,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
def validate_shebang_line_in(executable)
executable_path = File.join(@specification.bindir, executable)
- return if File.read(executable_path, 2) == '#!'
+ return if File.read(executable_path, 2) == "#!"
warning "#{executable_path} is missing #! line"
end
@@ -457,11 +457,11 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
end
def validate_extensions # :nodoc:
- require_relative 'ext'
+ require_relative "ext"
builder = Gem::Ext::Builder.new(@specification)
rake_extension = @specification.extensions.any? {|s| builder.builder_for(s) == Gem::Ext::RakeBuilder }
- rake_dependency = @specification.dependencies.any? {|d| d.name == 'rake' }
+ rake_dependency = @specification.dependencies.any? {|d| d.name == "rake" }
warning <<-WARNING if rake_extension && !rake_dependency
You have specified rake based extension, but rake is not added as dependency. It is recommended to add rake as a dependency in gemspec since there's no guarantee rake will be already installed.
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb
index b1dd7397ae..33b4f45b0a 100644
--- a/lib/rubygems/stub_specification.rb
+++ b/lib/rubygems/stub_specification.rb
@@ -9,7 +9,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
PREFIX = "# stub: ".freeze
# :nodoc:
- OPEN_MODE = 'r:UTF-8:-'.freeze
+ OPEN_MODE = "r:UTF-8:-".freeze
class StubLine # :nodoc: all
attr_reader :name, :version, :platform, :require_paths, :extensions,
@@ -19,9 +19,9 @@ class Gem::StubSpecification < Gem::BasicSpecification
# These are common require paths.
REQUIRE_PATHS = { # :nodoc:
- 'lib' => 'lib'.freeze,
- 'test' => 'test'.freeze,
- 'ext' => 'ext'.freeze,
+ "lib" => "lib".freeze,
+ "test" => "test".freeze,
+ "ext" => "ext".freeze,
}.freeze
# These are common require path lists. This hash is used to optimize
@@ -29,7 +29,7 @@ class Gem::StubSpecification < Gem::BasicSpecification
# in their require paths, so lets take advantage of that by pre-allocating
# a require path list for that case.
REQUIRE_PATH_LIST = { # :nodoc:
- 'lib' => ['lib'].freeze,
+ "lib" => ["lib"].freeze,
}.freeze
def initialize(data, extensions)
diff --git a/lib/rubygems/tsort.rb b/lib/rubygems/tsort.rb
index ebe7c3364b..60ebe22e81 100644
--- a/lib/rubygems/tsort.rb
+++ b/lib/rubygems/tsort.rb
@@ -1,3 +1,3 @@
# frozen_string_literal: true
-require_relative 'tsort/lib/tsort'
+require_relative "tsort/lib/tsort"
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index a36c5cbe2b..1ae301a44d 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -5,12 +5,12 @@
# See LICENSE.txt for permissions.
#++
-require 'fileutils'
-require_relative '../rubygems'
-require_relative 'installer_uninstaller_utils'
-require_relative 'dependency_list'
-require_relative 'rdoc'
-require_relative 'user_interaction'
+require "fileutils"
+require_relative "../rubygems"
+require_relative "installer_uninstaller_utils"
+require_relative "dependency_list"
+require_relative "rdoc"
+require_relative "user_interaction"
##
# An Uninstaller.
@@ -302,8 +302,8 @@ class Gem::Uninstaller
# Is +spec+ in +gem_dir+?
def path_ok?(gem_dir, spec)
- full_path = File.join gem_dir, 'gems', spec.full_name
- original_path = File.join gem_dir, 'gems', spec.original_name
+ full_path = File.join gem_dir, "gems", spec.full_name
+ original_path = File.join gem_dir, "gems", spec.original_name
full_path == spec.full_gem_path || original_path == spec.full_gem_path
end
@@ -332,10 +332,10 @@ class Gem::Uninstaller
# Asks if it is OK to remove +spec+. Returns true if it is OK.
def ask_if_ok(spec) # :nodoc:
- msg = ['']
- msg << 'You have requested to uninstall the gem:'
+ msg = [""]
+ msg << "You have requested to uninstall the gem:"
msg << "\t#{spec.full_name}"
- msg << ''
+ msg << ""
siblings = Gem::Specification.select do |s|
s.name == spec.name && s.full_name != spec.full_name
@@ -347,8 +347,8 @@ class Gem::Uninstaller
end
end
- msg << 'If you remove this gem, these dependencies will not be met.'
- msg << 'Continue with Uninstall?'
+ msg << "If you remove this gem, these dependencies will not be met."
+ msg << "Continue with Uninstall?"
return ask_yes_no(msg.join("\n"), false)
end
@@ -360,7 +360,7 @@ class Gem::Uninstaller
# of what it did for us to find rather than trying to recreate
# it again.
if @format_executable
- require_relative 'installer'
+ require_relative "installer"
Gem::Installer.exec_format % File.basename(filename)
else
filename
diff --git a/lib/rubygems/uri.rb b/lib/rubygems/uri.rb
index 6acb9041f9..4b5d035aa0 100644
--- a/lib/rubygems/uri.rb
+++ b/lib/rubygems/uri.rb
@@ -66,7 +66,7 @@ class Gem::Uri
def redact_credentials_from(text)
return text unless valid_uri? && password? && text.include?(to_s)
- text.sub(password, 'REDACTED')
+ text.sub(password, "REDACTED")
end
def method_missing(method_name, *args, &blk)
@@ -97,11 +97,11 @@ class Gem::Uri
end
def with_redacted_user
- clone.tap {|uri| uri.user = 'REDACTED' }
+ clone.tap {|uri| uri.user = "REDACTED" }
end
def with_redacted_password
- clone.tap {|uri| uri.password = 'REDACTED' }
+ clone.tap {|uri| uri.password = "REDACTED" }
end
def valid_uri?
@@ -113,7 +113,7 @@ class Gem::Uri
end
def oauth_basic?
- password == 'x-oauth-basic'
+ password == "x-oauth-basic"
end
def token?
diff --git a/lib/rubygems/uri_formatter.rb b/lib/rubygems/uri_formatter.rb
index 3bda896875..3f1d02d774 100644
--- a/lib/rubygems/uri_formatter.rb
+++ b/lib/rubygems/uri_formatter.rb
@@ -17,7 +17,7 @@ class Gem::UriFormatter
# Creates a new URI formatter for +uri+.
def initialize(uri)
- require 'cgi'
+ require "cgi"
@uri = uri
end
diff --git a/lib/rubygems/user_interaction.rb b/lib/rubygems/user_interaction.rb
index e632f418a9..4b0a7c60bb 100644
--- a/lib/rubygems/user_interaction.rb
+++ b/lib/rubygems/user_interaction.rb
@@ -5,8 +5,8 @@
# See LICENSE.txt for permissions.
#++
-require_relative 'deprecate'
-require_relative 'text'
+require_relative "deprecate"
+require_relative "text"
##
# Module that defines the default UserInteraction. Any class including this
@@ -148,7 +148,7 @@ module Gem::UserInteraction
##
# Displays the given +statement+ on the standard output (or equivalent).
- def say(statement = '')
+ def say(statement = "")
ui.say statement
end
@@ -259,11 +259,11 @@ class Gem::StreamUI
default_answer = case default
when nil
- 'yn'
+ "yn"
when true
- 'Yn'
+ "Yn"
else
- 'yN'
+ "yN"
end
result = nil
@@ -312,7 +312,7 @@ class Gem::StreamUI
def require_io_console
@require_io_console ||= begin
begin
- require 'io/console'
+ require "io/console"
rescue LoadError
end
true
@@ -472,7 +472,7 @@ class Gem::StreamUI
# and the +terminal_message+ when it is complete.
def initialize(out_stream, size, initial_message,
- terminal_message = 'complete')
+ terminal_message = "complete")
@out = out_stream
@total = size
@count = 0
@@ -616,18 +616,11 @@ class Gem::SilentUI < Gem::StreamUI
# The SilentUI has no arguments as it does not use any stream.
def initialize
- reader, writer = nil, nil
-
- reader = File.open(IO::NULL, 'r')
- writer = File.open(IO::NULL, 'w')
-
- super reader, writer, writer, false
+ io = NullIO.new
+ super io, io, io, false
end
def close
- super
- @ins.close
- @outs.close
end
def download_reporter(*args) # :nodoc:
@@ -637,4 +630,25 @@ class Gem::SilentUI < Gem::StreamUI
def progress_reporter(*args) # :nodoc:
SilentProgressReporter.new(@outs, *args)
end
+
+ ##
+ # An absolutely silent IO.
+
+ class NullIO
+ def puts(*args)
+ end
+
+ def print(*args)
+ end
+
+ def flush
+ end
+
+ def gets(*args)
+ end
+
+ def tty?
+ false
+ end
+ end
end
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb
index 9fd78ab2bc..356c46a5a1 100644
--- a/lib/rubygems/util.rb
+++ b/lib/rubygems/util.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'deprecate'
+require_relative "deprecate"
##
# This module contains various utility methods as module methods.
@@ -10,9 +10,9 @@ module Gem::Util
# Zlib::GzipReader wrapper that unzips +data+.
def self.gunzip(data)
- require 'zlib'
- require 'stringio'
- data = StringIO.new(data, 'r')
+ require "zlib"
+ require "stringio"
+ data = StringIO.new(data, "r")
gzip_reader = begin
Zlib::GzipReader.new(data)
@@ -29,9 +29,9 @@ module Gem::Util
# Zlib::GzipWriter wrapper that zips +data+.
def self.gzip(data)
- require 'zlib'
- require 'stringio'
- zipped = StringIO.new(String.new, 'w')
+ require "zlib"
+ require "stringio"
+ zipped = StringIO.new(String.new, "w")
zipped.set_encoding Encoding::BINARY
Zlib::GzipWriter.wrap zipped do |io|
@@ -45,7 +45,7 @@ module Gem::Util
# A Zlib::Inflate#inflate wrapper
def self.inflate(data)
- require 'zlib'
+ require "zlib"
Zlib::Inflate.inflate data
end
@@ -86,7 +86,7 @@ module Gem::Util
loop do
Dir.chdir here, &block rescue Errno::EACCES
- new_here = File.expand_path('..', here)
+ new_here = File.expand_path("..", here)
return if new_here == here # toplevel
here = new_here
end
@@ -109,7 +109,7 @@ module Gem::Util
# comes with a leading slash.
def self.correct_for_windows_path(path)
- if path[0].chr == '/' && path[1].chr =~ /[a-z]/i && path[2].chr == ':'
+ if path[0].chr == "/" && path[1].chr =~ /[a-z]/i && path[2].chr == ":"
path[1..-1]
else
path
diff --git a/lib/rubygems/util/licenses.rb b/lib/rubygems/util/licenses.rb
index 3f4178c6e0..96f47781c0 100644
--- a/lib/rubygems/util/licenses.rb
+++ b/lib/rubygems/util/licenses.rb
@@ -1,11 +1,11 @@
# frozen_string_literal: true
-require_relative '../text'
+require_relative "../text"
class Gem::Licenses
extend Gem::Text
- NONSTANDARD = 'Nonstandard'.freeze
- LICENSE_REF = 'LicenseRef-.+'.freeze
+ NONSTANDARD = "Nonstandard".freeze
+ LICENSE_REF = "LicenseRef-.+".freeze
# Software Package Data Exchange (SPDX) standard open-source software
# license identifiers
diff --git a/lib/rubygems/validator.rb b/lib/rubygems/validator.rb
index 728595e778..60104a34d5 100644
--- a/lib/rubygems/validator.rb
+++ b/lib/rubygems/validator.rb
@@ -5,8 +5,8 @@
# See LICENSE.txt for permissions.
#++
-require_relative 'package'
-require_relative 'installer'
+require_relative "package"
+require_relative "installer"
##
# Validator performs various gem file and gem database validation
@@ -15,7 +15,7 @@ class Gem::Validator
include Gem::UserInteraction
def initialize # :nodoc:
- require 'find'
+ require "find"
end
private
@@ -110,11 +110,11 @@ class Gem::Validator
begin
next unless data # HACK `gem check -a mkrf`
- source = File.join gem_directory, entry['path']
+ source = File.join gem_directory, entry["path"]
File.open source, Gem.binary_mode do |f|
unless f.read == data
- errors[gem_name][entry['path']] = "Modified from original"
+ errors[gem_name][entry["path"]] = "Modified from original"
end
end
end
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
index c59501ad5d..03ae5ca17e 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -153,8 +153,6 @@ require_relative "deprecate"
# a zero to give a sensible result.
class Gem::Version
- autoload :Requirement, File.expand_path('requirement', __dir__)
-
include Comparable
VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?'.freeze # :nodoc:
@@ -278,7 +276,7 @@ class Gem::Version
end
def yaml_initialize(tag, map) # :nodoc:
- @version = map['version']
+ @version = map["version"]
@segments = nil
@hash = nil
end
@@ -288,7 +286,7 @@ class Gem::Version
end
def encode_with(coder) # :nodoc:
- coder.add 'version', @version
+ coder.add "version", @version
end
##
@@ -313,7 +311,7 @@ class Gem::Version
@@release[self] ||= if prerelease?
segments = self.segments
segments.pop while segments.any? {|s| String === s }
- self.class.new segments.join('.')
+ self.class.new segments.join(".")
else
self
end
diff --git a/lib/rubygems/version_option.rb b/lib/rubygems/version_option.rb
index 1db382fa7f..a487a0bc24 100644
--- a/lib/rubygems/version_option.rb
+++ b/lib/rubygems/version_option.rb
@@ -5,7 +5,7 @@
# See LICENSE.txt for permissions.
#++
-require_relative '../rubygems'
+require_relative "../rubygems"
##
# Mixin methods for --version and --platform Gem::Command options.
@@ -24,7 +24,7 @@ module Gem::VersionOption
end
end
- add_option('--platform PLATFORM', Gem::Platform,
+ add_option("--platform PLATFORM", Gem::Platform,
"Specify the platform of gem to #{task}", *wrap) do
|value, options|
unless options[:added_platform]
@@ -55,7 +55,7 @@ module Gem::VersionOption
Gem::Requirement.new(*value.split(/\s*,\s*/))
end
- add_option('-v', '--version VERSION', Gem::Requirement,
+ add_option("-v", "--version VERSION", Gem::Requirement,
"Specify version of gem to #{task}", *wrap) do
|value, options|
# Allow handling for multiple --version operators
diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb
index 5cd79de620..7d955007ab 100644
--- a/spec/bundler/bundler/gem_helper_spec.rb
+++ b/spec/bundler/bundler/gem_helper_spec.rb
@@ -11,6 +11,7 @@ RSpec.describe Bundler::GemHelper do
before(:each) do
global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false", "BUNDLE_GEM__LINTER" => "false",
"BUNDLE_GEM__CI" => "false", "BUNDLE_GEM__CHANGELOG" => "false"
+ sys_exec("git config --global init.defaultBranch main")
bundle "gem #{app_name}"
prepare_gemspec(app_gemspec_path)
end
@@ -295,7 +296,7 @@ RSpec.describe Bundler::GemHelper do
mock_confirm_message "Tagged v#{app_version}."
mock_confirm_message "Pushed git commits and release tag."
- sys_exec("git push -u origin master", :dir => app_path)
+ sys_exec("git push -u origin main", :dir => app_path)
end
it "calls rubygem_push with proper arguments" do
@@ -336,7 +337,7 @@ RSpec.describe Bundler::GemHelper do
mock_build_message app_name, app_version
mock_confirm_message "Pushed git commits and release tag."
- sys_exec("git push -u origin master", :dir => app_path)
+ sys_exec("git push -u origin main", :dir => app_path)
expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s)
end
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index b88993e9b1..7ea23cd312 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/spec/bundler/cache/git_spec.rb
@@ -15,7 +15,7 @@ end
RSpec.describe "bundle cache with git" do
it "copies repository to vendor cache and uses it" do
git = build_git "foo"
- ref = git.ref_for("master", 11)
+ ref = git.ref_for("main", 11)
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -34,7 +34,7 @@ RSpec.describe "bundle cache with git" do
it "copies repository to vendor cache and uses it even when configured with `path`" do
git = build_git "foo"
- ref = git.ref_for("master", 11)
+ ref = git.ref_for("main", 11)
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -72,7 +72,7 @@ RSpec.describe "bundle cache with git" do
it "tracks updates" do
git = build_git "foo"
- old_ref = git.ref_for("master", 11)
+ old_ref = git.ref_for("main", 11)
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -86,7 +86,7 @@ RSpec.describe "bundle cache with git" do
s.write "lib/foo.rb", "puts :CACHE"
end
- ref = git.ref_for("master", 11)
+ ref = git.ref_for("main", 11)
expect(ref).not_to eq(old_ref)
bundle "update", :all => true
@@ -103,7 +103,7 @@ RSpec.describe "bundle cache with git" do
it "tracks updates when specifying the gem" do
git = build_git "foo"
- old_ref = git.ref_for("master", 11)
+ old_ref = git.ref_for("main", 11)
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -117,7 +117,7 @@ RSpec.describe "bundle cache with git" do
s.write "lib/foo.rb", "puts :CACHE"
end
- ref = git.ref_for("master", 11)
+ ref = git.ref_for("main", 11)
expect(ref).not_to eq(old_ref)
bundle "update foo"
@@ -132,11 +132,11 @@ RSpec.describe "bundle cache with git" do
it "uses the local repository to generate the cache" do
git = build_git "foo"
- ref = git.ref_for("master", 11)
+ ref = git.ref_for("main", 11)
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :master
+ gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :main
G
bundle %(config set local.foo #{lib_path("foo-1.0")})
@@ -172,7 +172,7 @@ RSpec.describe "bundle cache with git" do
end
G
- ref = git.ref_for("master", 11)
+ ref = git.ref_for("main", 11)
bundle "config set cache_all true"
bundle :cache
@@ -196,7 +196,7 @@ RSpec.describe "bundle cache with git" do
bundle "config set cache_all true"
bundle :cache
- ref = git.ref_for("master", 11)
+ ref = git.ref_for("main", 11)
gemspec = bundled_app("vendor/cache/foo-1.0-#{ref}/foo.gemspec").read
expect(gemspec).to_not match("`echo bob`")
end
diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb
index 74943703a2..e4b970eb34 100644
--- a/spec/bundler/commands/info_spec.rb
+++ b/spec/bundler/commands/info_spec.rb
@@ -163,10 +163,10 @@ RSpec.describe "bundle info" do
expect(the_bundle).to include_gems "foo 1.0"
bundle "info foo"
- expect(out).to include("foo (1.0 #{@git.ref_for("master", 6)}")
+ expect(out).to include("foo (1.0 #{@git.ref_for("main", 6)}")
end
- it "prints out branch names other than master" do
+ it "prints out branch names other than main" do
update_git "foo", :branch => "omg" do |s|
s.write "lib/foo.rb", "FOO = '1.0.omg'"
end
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 4a48187db0..49bd560703 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -723,6 +723,36 @@ RSpec.describe "bundle install with gem sources" do
end
end
+ describe "when bundle extensions path does not have write access", :permissions do
+ let(:extensions_path) { bundled_app("vendor/#{Bundler.ruby_scope}/extensions/#{Gem::Platform.local}/#{Gem.extension_api_version}") }
+
+ before do
+ FileUtils.mkdir_p(extensions_path)
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem 'simple_binary'
+ G
+ end
+
+ it "should display a proper message to explain the problem" do
+ FileUtils.chmod("-x", extensions_path)
+ bundle "config set --local path vendor"
+
+ begin
+ bundle :install, :raise_on_error => false
+ ensure
+ FileUtils.chmod("+x", extensions_path)
+ end
+
+ expect(err).not_to include("ERROR REPORT TEMPLATE")
+
+ expect(err).to include(
+ "There was an error while trying to create `#{extensions_path.join("simple_binary-1.0")}`. " \
+ "It is likely that you need to grant executable permissions for all parent directories and write permissions for `#{extensions_path}`."
+ )
+ end
+ end
+
describe "when the path of a specific gem is not writable", :permissions do
let(:gems_path) { bundled_app("vendor/#{Bundler.ruby_scope}/gems") }
let(:foo_path) { gems_path.join("foo-1.0.0") }
@@ -970,6 +1000,26 @@ RSpec.describe "bundle install with gem sources" do
end
end
+ context "with only option" do
+ before do
+ bundle "config set only a:b"
+ end
+
+ it "installs only gems of the specified groups" do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rails"
+ gem "rack", group: :a
+ gem "rake", group: :b
+ gem "yard", group: :c
+ G
+
+ expect(out).to include("Installing rack")
+ expect(out).to include("Installing rake")
+ expect(out).not_to include("Installing yard")
+ end
+ end
+
context "with a symlinked configured as bundle path and a gem with symlinks" do
before do
symlinked_bundled_app = tmp("bundled_app-symlink")
diff --git a/spec/bundler/commands/open_spec.rb b/spec/bundler/commands/open_spec.rb
index 53dc35c2c7..85f15176b4 100644
--- a/spec/bundler/commands/open_spec.rb
+++ b/spec/bundler/commands/open_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe "bundle open" do
it "does not blow up if the gem to open does not have a Gemfile" do
git = build_git "foo"
- ref = git.ref_for("master", 11)
+ ref = git.ref_for("main", 11)
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
diff --git a/spec/bundler/commands/pristine_spec.rb b/spec/bundler/commands/pristine_spec.rb
index fe85e1ecd1..9e496dc91a 100644
--- a/spec/bundler/commands/pristine_spec.rb
+++ b/spec/bundler/commands/pristine_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "bundle pristine" do
source "#{file_uri_for(gem_repo2)}"
gem "weakling"
gem "very_simple_binary"
- gem "foo", :git => "#{lib_path("foo")}", :branch => "master"
+ gem "foo", :git => "#{lib_path("foo")}", :branch => "main"
gem "git_with_ext", :git => "#{lib_path("git_with_ext")}"
gem "bar", :path => "#{lib_path("bar")}"
diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb
index ceba6c5ede..093130f7d5 100644
--- a/spec/bundler/commands/remove_spec.rb
+++ b/spec/bundler/commands/remove_spec.rb
@@ -86,7 +86,7 @@ RSpec.describe "bundle remove" do
gem 'git'
gem 'rack',
git: "#{lib_path("rack-1.0")}",
- branch: 'master'
+ branch: 'main'
gem 'nokogiri'
G
diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb
index 2adb121616..925e40b71b 100644
--- a/spec/bundler/commands/show_spec.rb
+++ b/spec/bundler/commands/show_spec.rb
@@ -100,10 +100,10 @@ RSpec.describe "bundle show", :bundler => "< 3" do
expect(the_bundle).to include_gems "foo 1.0"
bundle :show
- expect(out).to include("foo (1.0 #{@git.ref_for("master", 6)}")
+ expect(out).to include("foo (1.0 #{@git.ref_for("main", 6)}")
end
- it "prints out branch names other than master" do
+ it "prints out branch names other than main" do
update_git "foo", :branch => "omg" do |s|
s.write "lib/foo.rb", "FOO = '1.0.omg'"
end
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index 3f8a5afc40..2058674105 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe "bundle install with git sources" do
- describe "when floating on master" do
+ describe "when floating on main" do
before :each do
build_git "foo" do |s|
s.executables = "foobar"
@@ -51,7 +51,7 @@ RSpec.describe "bundle install with git sources" do
bundle "update foo"
- sha = git.ref_for("master", 11)
+ sha = git.ref_for("main", 11)
spec_file = default_bundle_path.join("bundler/gems/foo-1.0-#{sha}/foo.gemspec").to_s
ruby_code = Gem::Specification.load(spec_file).to_ruby
file_code = File.read(spec_file)
@@ -219,12 +219,12 @@ RSpec.describe "bundle install with git sources" do
end
it "works when the revision is a non-head ref" do
- # want to ensure we don't fallback to master
+ # want to ensure we don't fallback to main
update_git "foo", :path => lib_path("foo-1.0") do |s|
s.write("lib/foo.rb", "raise 'FAIL'")
end
- sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 master~1", :dir => lib_path("foo-1.0"))
+ sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 main~1", :dir => lib_path("foo-1.0"))
# want to ensure we don't fallback to HEAD
update_git "foo", :path => lib_path("foo-1.0"), :branch => "rando" do |s|
@@ -255,12 +255,12 @@ RSpec.describe "bundle install with git sources" do
end
G
- # want to ensure we don't fallback to master
+ # want to ensure we don't fallback to main
update_git "foo", :path => lib_path("foo-1.0") do |s|
s.write("lib/foo.rb", "raise 'FAIL'")
end
- sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 master~1", :dir => lib_path("foo-1.0"))
+ sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 main~1", :dir => lib_path("foo-1.0"))
# want to ensure we don't fallback to HEAD
update_git "foo", :path => lib_path("foo-1.0"), :branch => "rando" do |s|
@@ -284,7 +284,7 @@ RSpec.describe "bundle install with git sources" do
end
it "does not download random non-head refs" do
- sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 master~1", :dir => lib_path("foo-1.0"))
+ sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 main~1", :dir => lib_path("foo-1.0"))
bundle "config set global_gem_cache true"
@@ -420,7 +420,7 @@ RSpec.describe "bundle install with git sources" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -441,7 +441,7 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -461,7 +461,7 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -477,7 +477,7 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
lockfile0 = File.read(bundled_app_lock)
@@ -499,7 +499,7 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
lockfile0 = File.read(bundled_app_lock)
@@ -519,7 +519,7 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -583,12 +583,12 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install, :raise_on_error => false
- expect(err).to match(/is using branch another but Gemfile specifies master/)
+ expect(err).to match(/is using branch another but Gemfile specifies main/)
end
it "explodes on invalid revision on install" do
@@ -600,7 +600,7 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -617,7 +617,7 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -1519,7 +1519,7 @@ In Gemfile:
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "foo", :git => "#{lib_path("foo")}", :branch => "master"
+ gem "foo", :git => "#{lib_path("foo")}", :branch => "main"
G
bundle :install
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index 89c812e5d5..ee0aa2a347 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -1563,4 +1563,43 @@ RSpec.describe "bundle install with gems on multiple sources" do
L
end
end
+
+ context "when mistakenly adding a top level gem already depended on and cached under the wrong source" do
+ before do
+ build_repo4 do
+ build_gem "some_private_gem", "0.1.0" do |s|
+ s.add_dependency "example", "~> 1.0"
+ end
+ end
+
+ build_repo2 do
+ build_gem "example", "1.0.0"
+ end
+
+ install_gemfile <<~G, :artifice => "compact_index"
+ source "https://gem.repo2"
+
+ source "https://gem.repo4" do
+ gem "some_private_gem"
+ end
+ G
+
+ gemfile <<~G
+ source "https://gem.repo2"
+
+ source "https://gem.repo4" do
+ gem "some_private_gem"
+ gem "example" # MISTAKE, example is not available at gem.repo4
+ end
+ G
+ end
+
+ it "shows a proper error message and does not generate a corrupted lockfile" do
+ expect do
+ bundle :install, :artifice => "compact_index", :raise_on_error => false, :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
+ end.not_to change { lockfile }
+
+ expect(err).to include("Could not find gem 'example' in rubygems repository https://gem.repo4/")
+ end
+ end
end
diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb
index 276a84f2a6..6994cb2af1 100644
--- a/spec/bundler/install/gemfile/specific_platform_spec.rb
+++ b/spec/bundler/install/gemfile/specific_platform_spec.rb
@@ -180,7 +180,7 @@ RSpec.describe "bundle install with specific platforms" do
lockfile <<-L
GIT
remote: #{lib_path("pg_array_parser-1.0")}
- revision: #{git.ref_for("master")}
+ revision: #{git.ref_for("main")}
specs:
pg_array_parser (1.0-java)
pg_array_parser (1.0)
diff --git a/spec/bundler/install/gems/fund_spec.rb b/spec/bundler/install/gems/fund_spec.rb
index f521b0296f..436454c1f4 100644
--- a/spec/bundler/install/gems/fund_spec.rb
+++ b/spec/bundler/install/gems/fund_spec.rb
@@ -52,6 +52,33 @@ RSpec.describe "bundle install" do
end
end
+ context "when gems include a fund URI but `ignore_funding_requests` is configured" do
+ before do
+ bundle "config set ignore_funding_requests true"
+ end
+
+ it "does not display the plural fund message after installing" do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem 'has_funding_and_other_metadata'
+ gem 'has_funding'
+ gem 'rack-obama'
+ G
+
+ expect(out).not_to include("2 installed gems you directly depend on are looking for funding.")
+ end
+
+ it "does not display the singular fund message after installing" do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem 'has_funding'
+ gem 'rack-obama'
+ G
+
+ expect(out).not_to include("1 installed gem you directly depend on is looking for funding.")
+ end
+ end
+
context "when gems do not include fund messages" do
it "does not display any fund messages" do
install_gemfile <<-G
diff --git a/spec/bundler/install/git_spec.rb b/spec/bundler/install/git_spec.rb
index d43aacee7e..0fa7ed8531 100644
--- a/spec/bundler/install/git_spec.rb
+++ b/spec/bundler/install/git_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe "bundle install" do
gem "foo", :git => "#{file_uri_for(lib_path("foo"))}"
G
- expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at master@#{revision_for(lib_path("foo"))[0..6]})")
+ expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main@#{revision_for(lib_path("foo"))[0..6]})")
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
end
@@ -37,16 +37,16 @@ RSpec.describe "bundle install" do
install_gemfile <<-G, :verbose => true
source "#{file_uri_for(gem_repo1)}"
- gem "foo", :git => "#{file_uri_for(lib_path("foo"))}", :ref => "master~2"
+ gem "foo", :git => "#{file_uri_for(lib_path("foo"))}", :ref => "main~2"
G
- expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at master~2@#{rev})")
+ expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main~2@#{rev})")
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
update_git "foo", "4.0", :path => lib_path("foo"), :gemspec => true
bundle :update, :all => true, :verbose => true
- expect(out).to include("Using foo 2.0 (was 1.0) from #{file_uri_for(lib_path("foo"))} (at master~2@#{rev2})")
+ expect(out).to include("Using foo 2.0 (was 1.0) from #{file_uri_for(lib_path("foo"))} (at main~2@#{rev2})")
expect(the_bundle).to include_gems "foo 2.0", :source => "git@#{lib_path("foo")}"
end
diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb
index b53c15be69..44fbb0bda3 100644
--- a/spec/bundler/install/yanked_spec.rb
+++ b/spec/bundler/install/yanked_spec.rb
@@ -15,7 +15,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do
foo (10.0.0)
PLATFORMS
- ruby
+ #{lockfile_platforms}
DEPENDENCIES
foo (= 10.0.0)
@@ -57,7 +57,7 @@ RSpec.context "when using gem before installing" do
rack (0.9.1)
PLATFORMS
- ruby
+ #{lockfile_platforms}
DEPENDENCIES
rack (= 0.9.1)
@@ -65,7 +65,7 @@ RSpec.context "when using gem before installing" do
bundle :list, :raise_on_error => false
- expect(err).to include("Could not find rack-0.9.1 in any of the sources")
+ expect(err).to include("Could not find rack-0.9.1 in locally installed gems")
expect(err).to_not include("Your bundle is locked to rack (0.9.1) from")
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
@@ -86,7 +86,7 @@ RSpec.context "when using gem before installing" do
rack_middleware (1.0)
PLATFORMS
- ruby
+ #{lockfile_platforms}
DEPENDENCIES
rack (= 0.9.1)
@@ -95,7 +95,7 @@ RSpec.context "when using gem before installing" do
bundle :list, :raise_on_error => false
- expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in any of the sources")
+ expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in locally installed gems")
expect(err).to include("Install missing gems with `bundle install`.")
expect(err).to_not include("Your bundle is locked to rack (0.9.1) from")
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index ea9893fb0e..b21765ec4d 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -386,7 +386,7 @@ RSpec.describe "the lockfile format" do
expect(lockfile).to eq <<~G
GIT
remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("master")}
+ revision: #{git.ref_for("main")}
specs:
foo (1.0)
@@ -457,7 +457,7 @@ RSpec.describe "the lockfile format" do
expect(lockfile).to eq <<~G
GIT
remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("master")}
+ revision: #{git.ref_for("main")}
specs:
foo (1.0)
@@ -617,7 +617,7 @@ RSpec.describe "the lockfile format" do
expect(lockfile).to eq <<~G
GIT
remote: #{lib_path("bar-1.0")}
- revision: #{bar.ref_for("master")}
+ revision: #{bar.ref_for("main")}
specs:
bar (1.0)
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index af6bbbce48..e14b5ff003 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -414,7 +414,7 @@ RSpec.describe "major deprecations" do
it "shows a deprecation", :bundler => "< 3" do
expect(deprecations).to include(
- "Your Gemfile contains multiple primary sources. " \
+ "Your Gemfile contains multiple global sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source."
@@ -425,7 +425,7 @@ RSpec.describe "major deprecations" do
bundle "install"
expect(deprecations).to include(
- "Your Gemfile contains multiple primary sources. " \
+ "Your Gemfile contains multiple global sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source."
@@ -438,7 +438,7 @@ RSpec.describe "major deprecations" do
bundle "install"
expect(deprecations).to include(
- "Your Gemfile contains multiple primary sources. " \
+ "Your Gemfile contains multiple global sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source."
diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb
index 7d098997ec..412de04d44 100644
--- a/spec/bundler/plugins/source/example_spec.rb
+++ b/spec/bundler/plugins/source/example_spec.rb
@@ -203,7 +203,7 @@ RSpec.describe "real source plugins" do
def initialize(opts)
super
- @ref = options["ref"] || options["branch"] || options["tag"] || "master"
+ @ref = options["ref"] || options["branch"] || options["tag"] || "main"
@unlocked = false
end
@@ -247,7 +247,7 @@ RSpec.describe "real source plugins" do
def options_to_lock
opts = {"revision" => revision}
- opts["ref"] = ref if ref != "master"
+ opts["ref"] = ref if ref != "main"
opts
end
@@ -435,7 +435,7 @@ RSpec.describe "real source plugins" do
describe "bundle cache with gitp" do
it "copies repository to vendor cache and uses it" do
git = build_git "foo"
- ref = git.ref_for("master", 11)
+ ref = git.ref_for("main", 11)
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}" # plugin source
diff --git a/spec/bundler/resolver/basic_spec.rb b/spec/bundler/resolver/basic_spec.rb
index ee62dc3577..7182d1e29c 100644
--- a/spec/bundler/resolver/basic_spec.rb
+++ b/spec/bundler/resolver/basic_spec.rb
@@ -233,7 +233,7 @@ Bundler could not find compatible versions for gem "a":
it "resolves foo only to latest patch - changing dependency declared case" do
# bar is locked AND a declared dependency in the Gemfile, so it will not move, and therefore
# foo can only move up to 1.4.4.
- @base << build_spec("bar", "2.0.3").first
+ @base << Bundler::LazySpecification.new("bar", "2.0.3", nil)
should_conservative_resolve_and_include :patch, ["foo"], %w[foo-1.4.4 bar-2.0.3]
end
diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb
index a8aaa2b607..a7161c9cfe 100644
--- a/spec/bundler/runtime/platform_spec.rb
+++ b/spec/bundler/runtime/platform_spec.rb
@@ -408,6 +408,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
gem "requires_platform_specific"
G
+ expect(out).to include("lockfile does not have all gems needed for the current platform")
expect(the_bundle).to include_gem "platform_specific 1.0 x64-mingw32"
end
end
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index cadbf44109..083bb730bf 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -515,7 +515,7 @@ RSpec.describe "Bundler.setup" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -533,7 +533,7 @@ RSpec.describe "Bundler.setup" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -555,7 +555,7 @@ RSpec.describe "Bundler.setup" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -567,7 +567,7 @@ RSpec.describe "Bundler.setup" do
G
run "require 'rack'", :raise_on_error => false
- expect(err).to match(/is using branch master but Gemfile specifies changed/)
+ expect(err).to match(/is using branch main but Gemfile specifies changed/)
end
it "explodes on refs with different branches on runtime" do
@@ -577,17 +577,17 @@ RSpec.describe "Bundler.setup" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :ref => "master", :branch => "master"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :ref => "main", :branch => "main"
G
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{lib_path("rack-0.8")}", :ref => "master", :branch => "nonexistant"
+ gem "rack", :git => "#{lib_path("rack-0.8")}", :ref => "main", :branch => "nonexistant"
G
bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'", :raise_on_error => false
- expect(err).to match(/is using branch master but Gemfile specifies nonexistant/)
+ expect(err).to match(/is using branch main but Gemfile specifies nonexistant/)
end
end
@@ -660,6 +660,7 @@ RSpec.describe "Bundler.setup" do
ruby "require '#{system_gem_path("gems/bundler-9.99.9.beta1/lib/bundler.rb")}'; Bundler.setup", :env => { "DEBUG" => "1" }
expect(out).to include("Found no changes, using resolution from the lockfile")
+ expect(out).not_to include("lockfile does not have all gems needed for the current platform")
expect(err).to be_empty
end
diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb
index 285b68c047..a4d4c9f085 100644
--- a/spec/bundler/support/builders.rb
+++ b/spec/bundler/support/builders.rb
@@ -94,8 +94,8 @@ module Spec
end
build_gem "platform_specific" do |s|
- s.platform = Bundler.local_platform
- s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 #{Bundler.local_platform}'"
+ s.platform = Gem::Platform.local
+ s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 #{Gem::Platform.local}'"
end
build_gem "platform_specific" do |s|
@@ -528,7 +528,7 @@ module Spec
class GitBuilder < LibBuilder
def _build(options)
- default_branch = options[:default_branch] || "master"
+ default_branch = options[:default_branch] || "main"
path = options[:path] || _default_path
source = options[:source] || "git@#{path}"
super(options.merge(:path => path, :source => source))
diff --git a/spec/bundler/support/hax.rb b/spec/bundler/support/hax.rb
index ff45bacaed..da67e8c5d1 100644
--- a/spec/bundler/support/hax.rb
+++ b/spec/bundler/support/hax.rb
@@ -15,7 +15,7 @@ module Gem
end
if ENV["BUNDLER_SPEC_WINDOWS"]
- @@win_platform = true # rubocop:disable Sryle/ClassVars
+ @@win_platform = true # rubocop:disable Style/ClassVars
end
if ENV["BUNDLER_SPEC_PLATFORM"]
diff --git a/spec/bundler/support/indexes.rb b/spec/bundler/support/indexes.rb
index 638f394e76..55d798a90a 100644
--- a/spec/bundler/support/indexes.rb
+++ b/spec/bundler/support/indexes.rb
@@ -26,6 +26,7 @@ module Spec
end
end
args[0] ||= [] # base
+ args[0].each {|ls| ls.source = default_source }
args[1] ||= Bundler::GemVersionPromoter.new # gem_version_promoter
args[2] ||= [] # additional_base_requirements
args[3] ||= @platforms # platforms
diff --git a/spec/bundler/update/git_spec.rb b/spec/bundler/update/git_spec.rb
index 0787ee41a7..da92cab1cc 100644
--- a/spec/bundler/update/git_spec.rb
+++ b/spec/bundler/update/git_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe "bundle update" do
expect(the_bundle).to include_gems "foo 1.1"
end
- it "floats on master when updating all gems that are pinned to the source even if you have child dependencies" do
+ it "floats on main when updating all gems that are pinned to the source even if you have child dependencies" do
build_git "foo", :path => lib_path("foo")
build_gem "bar", :to_bundle => true do |s|
s.add_dependency "foo"
@@ -103,7 +103,7 @@ RSpec.describe "bundle update" do
build_git "foo"
@remote = build_git("bar", :bare => true)
update_git "foo", :remote => file_uri_for(@remote.path)
- update_git "foo", :push => "master"
+ update_git "foo", :push => "main"
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -211,7 +211,7 @@ RSpec.describe "bundle update" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem "rack", :git => "#{file_uri_for(lib_path("rack-0.8"))}", :branch => "master"
+ gem "rack", :git => "#{file_uri_for(lib_path("rack-0.8"))}", :branch => "main"
G
bundle %(config set local.rack #{lib_path("local-rack")})
@@ -230,7 +230,7 @@ RSpec.describe "bundle update" do
update_git "rails", "3.0", :path => lib_path("rails"), :gemspec => true
bundle "update", :all => true
- expect(out).to include("Using rails 3.0 (was 2.3.2) from #{file_uri_for(lib_path("rails"))} (at master@#{revision_for(lib_path("rails"))[0..6]})")
+ expect(out).to include("Using rails 3.0 (was 2.3.2) from #{file_uri_for(lib_path("rails"))} (at main@#{revision_for(lib_path("rails"))[0..6]})")
end
end
@@ -301,7 +301,7 @@ RSpec.describe "bundle update" do
s.write "foo.gemspec", spec_lines.join("\n")
end
- ref = @git.ref_for "master"
+ ref = @git.ref_for "main"
bundle "update --source bar"
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index 7bd7dd0c3b..dab3cd4d4c 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require 'rubygems'
+require "rubygems"
# If bundler gemspec exists, add to stubs
-bundler_gemspec = File.expand_path('../../bundler/bundler.gemspec', __dir__)
+bundler_gemspec = File.expand_path("../../bundler/bundler.gemspec", __dir__)
if File.exist?(bundler_gemspec)
Gem::Specification.dirs.unshift File.dirname(bundler_gemspec)
Gem::Specification.class_variable_set :@@stubs, nil
@@ -12,32 +12,32 @@ if File.exist?(bundler_gemspec)
end
begin
- gem 'test-unit', '~> 3.0'
+ gem "test-unit", "~> 3.0"
rescue Gem::LoadError
end
if File.exist?(bundler_gemspec)
- require_relative '../../bundler/lib/bundler'
+ require_relative "../../bundler/lib/bundler"
else
- require 'bundler'
+ require "bundler"
end
-require 'test/unit'
+require "test/unit"
ENV["JARS_SKIP"] = "true" if Gem.java_platform? # avoid unnecessary and noisy `jar-dependencies` post install hook
-require 'rubygems/deprecate'
+require "rubygems/deprecate"
-require 'fileutils'
-require 'pathname'
-require 'pp'
-require 'rubygems/package'
-require 'shellwords'
-require 'tmpdir'
-require 'uri'
-require 'zlib'
-require 'benchmark' # stdlib
-require 'rubygems/mock_gem_ui'
+require "fileutils"
+require "pathname"
+require "pp"
+require "rubygems/package"
+require "shellwords"
+require "tmpdir"
+require "uri"
+require "zlib"
+require "benchmark" # stdlib
+require "rubygems/mock_gem_ui"
module Gem
@@ -165,15 +165,15 @@ class Gem::TestCase < Test::Unit::TestCase
# the original value when the block ends
def enable_shared(value)
- enable_shared = RbConfig::CONFIG['ENABLE_SHARED']
- RbConfig::CONFIG['ENABLE_SHARED'] = value
+ enable_shared = RbConfig::CONFIG["ENABLE_SHARED"]
+ RbConfig::CONFIG["ENABLE_SHARED"] = value
yield
ensure
if enable_shared
- RbConfig::CONFIG['enable_shared'] = enable_shared
+ RbConfig::CONFIG["ENABLE_SHARED"] = enable_shared
else
- RbConfig::CONFIG.delete 'enable_shared'
+ RbConfig::CONFIG.delete "ENABLE_SHARED"
end
end
@@ -182,20 +182,20 @@ class Gem::TestCase < Test::Unit::TestCase
# original value when the block ends
#
def vendordir(value)
- vendordir = RbConfig::CONFIG['vendordir']
+ vendordir = RbConfig::CONFIG["vendordir"]
if value
- RbConfig::CONFIG['vendordir'] = value
+ RbConfig::CONFIG["vendordir"] = value
else
- RbConfig::CONFIG.delete 'vendordir'
+ RbConfig::CONFIG.delete "vendordir"
end
yield
ensure
if vendordir
- RbConfig::CONFIG['vendordir'] = vendordir
+ RbConfig::CONFIG["vendordir"] = vendordir
else
- RbConfig::CONFIG.delete 'vendordir'
+ RbConfig::CONFIG.delete "vendordir"
end
end
@@ -205,21 +205,21 @@ class Gem::TestCase < Test::Unit::TestCase
#
def bindir(value)
with_clean_path_to_ruby do
- bindir = RbConfig::CONFIG['bindir']
+ bindir = RbConfig::CONFIG["bindir"]
if value
- RbConfig::CONFIG['bindir'] = value
+ RbConfig::CONFIG["bindir"] = value
else
- RbConfig::CONFIG.delete 'bindir'
+ RbConfig::CONFIG.delete "bindir"
end
begin
yield
ensure
if bindir
- RbConfig::CONFIG['bindir'] = bindir
+ RbConfig::CONFIG["bindir"] = bindir
else
- RbConfig::CONFIG.delete 'bindir'
+ RbConfig::CONFIG.delete "bindir"
end
end
end
@@ -230,20 +230,20 @@ class Gem::TestCase < Test::Unit::TestCase
# original value when the block ends
#
def exeext(value)
- exeext = RbConfig::CONFIG['EXEEXT']
+ exeext = RbConfig::CONFIG["EXEEXT"]
if value
- RbConfig::CONFIG['EXEEXT'] = value
+ RbConfig::CONFIG["EXEEXT"] = value
else
- RbConfig::CONFIG.delete 'EXEEXT'
+ RbConfig::CONFIG.delete "EXEEXT"
end
yield
ensure
if exeext
- RbConfig::CONFIG['EXEEXT'] = exeext
+ RbConfig::CONFIG["EXEEXT"] = exeext
else
- RbConfig::CONFIG.delete 'EXEEXT'
+ RbConfig::CONFIG.delete "EXEEXT"
end
end
@@ -264,7 +264,7 @@ class Gem::TestCase < Test::Unit::TestCase
end
end
- targets << '' if targets.empty?
+ targets << "" if targets.empty?
targets
end
@@ -273,14 +273,14 @@ class Gem::TestCase < Test::Unit::TestCase
if output.match(/\n/)
msg = build_message(msg,
"Expected output containing make command \"%s\", but was \n\nBEGIN_OF_OUTPUT\n%sEND_OF_OUTPUT" % [
- ('%s %s' % [make_command, target]).rstrip,
+ ("%s %s" % [make_command, target]).rstrip,
output,
]
)
else
msg = build_message(msg,
'Expected make command "%s", but was "%s"' % [
- ('%s %s' % [make_command, target]).rstrip,
+ ("%s %s" % [make_command, target]).rstrip,
output,
]
)
@@ -317,13 +317,13 @@ class Gem::TestCase < Test::Unit::TestCase
@tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
@tempdir.tap(&Gem::UNTAINT)
- ENV['GEM_VENDOR'] = nil
- ENV['GEMRC'] = nil
- ENV['XDG_CACHE_HOME'] = nil
- ENV['XDG_CONFIG_HOME'] = nil
- ENV['XDG_DATA_HOME'] = nil
- ENV['SOURCE_DATE_EPOCH'] = nil
- ENV['BUNDLER_VERSION'] = nil
+ ENV["GEM_VENDOR"] = nil
+ ENV["GEMRC"] = nil
+ ENV["XDG_CACHE_HOME"] = nil
+ ENV["XDG_CONFIG_HOME"] = nil
+ ENV["XDG_DATA_HOME"] = nil
+ ENV["SOURCE_DATE_EPOCH"] = nil
+ ENV["BUNDLER_VERSION"] = nil
@current_dir = Dir.pwd
@fetcher = nil
@@ -339,19 +339,19 @@ class Gem::TestCase < Test::Unit::TestCase
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
- File.join(@tempdir, 'system-gemrc')
+ File.join(@tempdir, "system-gemrc")
- @gemhome = File.join @tempdir, 'gemhome'
- @userhome = File.join @tempdir, 'userhome'
- ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
+ @gemhome = File.join @tempdir, "gemhome"
+ @userhome = File.join @tempdir, "userhome"
+ ENV["GEM_SPEC_CACHE"] = File.join @tempdir, "spec_cache"
- @orig_ruby = if ENV['RUBY']
+ @orig_ruby = if ENV["RUBY"]
ruby = Gem.ruby
- Gem.ruby = ENV['RUBY']
+ Gem.ruby = ENV["RUBY"]
ruby
end
- @git = ENV['GIT'] || (win_platform? ? 'git.exe' : 'git')
+ @git = ENV["GIT"] || (win_platform? ? "git.exe" : "git")
Gem.ensure_gem_subdirectories @gemhome
Gem.ensure_default_gem_subdirectories @gemhome
@@ -372,7 +372,7 @@ class Gem::TestCase < Test::Unit::TestCase
Dir.chdir @tempdir
- ENV['HOME'] = @userhome
+ ENV["HOME"] = @userhome
Gem.instance_variable_set :@config_file, nil
Gem.instance_variable_set :@user_home, nil
Gem.instance_variable_set :@config_home, nil
@@ -384,12 +384,12 @@ class Gem::TestCase < Test::Unit::TestCase
FileUtils.mkdir_p @userhome
- ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = PRIVATE_KEY_PASSPHRASE
+ ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = PRIVATE_KEY_PASSPHRASE
Gem.instance_variable_set(:@default_specifications_dir, nil)
if Gem.java_platform?
- @orig_default_gem_home = RbConfig::CONFIG['default_gem_home']
- RbConfig::CONFIG['default_gem_home'] = @gemhome
+ @orig_default_gem_home = RbConfig::CONFIG["default_gem_home"]
+ RbConfig::CONFIG["default_gem_home"] = @gemhome
else
Gem.instance_variable_set(:@default_dir, @gemhome)
end
@@ -425,12 +425,12 @@ class Gem::TestCase < Test::Unit::TestCase
Gem.searcher = nil
Gem::SpecFetcher.fetcher = nil
- @orig_arch = RbConfig::CONFIG['arch']
+ @orig_arch = RbConfig::CONFIG["arch"]
if win_platform?
- util_set_arch 'i386-mswin32'
+ util_set_arch "i386-mswin32"
else
- util_set_arch 'i686-darwin8.10.1'
+ util_set_arch "i686-darwin8.10.1"
end
%w[post_install_hooks done_installing_hooks post_uninstall_hooks pre_uninstall_hooks pre_install_hooks pre_reset_hooks post_reset_hooks post_build_hooks].each do |name|
@@ -457,7 +457,7 @@ class Gem::TestCase < Test::Unit::TestCase
end
end
- RbConfig::CONFIG['arch'] = @orig_arch
+ RbConfig::CONFIG["arch"] = @orig_arch
if defined? Gem::RemoteFetcher
Gem::RemoteFetcher.fetcher = nil
@@ -475,13 +475,13 @@ class Gem::TestCase < Test::Unit::TestCase
Gem.ruby = @orig_ruby if @orig_ruby
- RbConfig::CONFIG['mandir'] = @orig_mandir
- RbConfig::CONFIG['sitelibdir'] = @orig_sitelibdir
- RbConfig::CONFIG['bindir'] = @orig_bindir
+ RbConfig::CONFIG["mandir"] = @orig_mandir
+ RbConfig::CONFIG["sitelibdir"] = @orig_sitelibdir
+ RbConfig::CONFIG["bindir"] = @orig_bindir
Gem.instance_variable_set :@default_specifications_dir, nil
if Gem.java_platform?
- RbConfig::CONFIG['default_gem_home'] = @orig_default_gem_home
+ RbConfig::CONFIG["default_gem_home"] = @orig_default_gem_home
else
Gem.instance_variable_set :@default_dir, nil
end
@@ -497,9 +497,9 @@ class Gem::TestCase < Test::Unit::TestCase
end
def credential_setup
- @temp_cred = File.join(@userhome, '.gem', 'credentials')
+ @temp_cred = File.join(@userhome, ".gem", "credentials")
FileUtils.mkdir_p File.dirname(@temp_cred)
- File.write @temp_cred, ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97'
+ File.write @temp_cred, ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
File.chmod 0600, @temp_cred
end
@@ -554,10 +554,10 @@ class Gem::TestCase < Test::Unit::TestCase
#
# Yields the +specification+ to the block, if given
- def git_gem(name = 'a', version = 1)
+ def git_gem(name = "a", version = 1)
have_git?
- directory = File.join 'git', name
+ directory = File.join "git", name
directory = File.expand_path directory
git_spec = Gem::Specification.new name, version do |specification|
@@ -568,22 +568,22 @@ class Gem::TestCase < Test::Unit::TestCase
gemspec = "#{name}.gemspec"
- File.open File.join(directory, gemspec), 'w' do |io|
+ File.open File.join(directory, gemspec), "w" do |io|
io.write git_spec.to_ruby
end
head = nil
Dir.chdir directory do
- unless File.exist? '.git'
- system @git, 'init', '--quiet'
- system @git, 'config', 'user.name', 'RubyGems Tests'
- system @git, 'config', 'user.email', 'rubygems@example'
+ unless File.exist? ".git"
+ system @git, "init", "--quiet"
+ system @git, "config", "user.name", "RubyGems Tests"
+ system @git, "config", "user.email", "rubygems@example"
end
- system @git, 'add', gemspec
- system @git, 'commit', '-a', '-m', 'a non-empty commit message', '--quiet'
- head = Gem::Util.popen(@git, 'rev-parse', 'master').strip
+ system @git, "add", gemspec
+ system @git, "commit", "-a", "-m", "a non-empty commit message", "--quiet"
+ head = Gem::Util.popen(@git, "rev-parse", "master").strip
end
return name, git_spec.version, directory, head
@@ -595,13 +595,13 @@ class Gem::TestCase < Test::Unit::TestCase
def have_git?
return if in_path? @git
- pend 'cannot find git executable, use GIT environment variable to set'
+ pend "cannot find git executable, use GIT environment variable to set"
end
def in_path?(executable) # :nodoc:
return true if %r{\A([A-Z]:|/)} =~ executable and File.exist? executable
- ENV['PATH'].split(File::PATH_SEPARATOR).any? do |directory|
+ ENV["PATH"].split(File::PATH_SEPARATOR).any? do |directory|
File.exist? File.join directory, executable
end
end
@@ -610,7 +610,7 @@ class Gem::TestCase < Test::Unit::TestCase
# Builds and installs the Gem::Specification +spec+
def install_gem(spec, options = {})
- require 'rubygems/installer'
+ require "rubygems/installer"
gem = spec.cache_file
@@ -637,7 +637,7 @@ class Gem::TestCase < Test::Unit::TestCase
##
# Uninstalls the Gem::Specification +spec+
def uninstall_gem(spec)
- require 'rubygems/uninstaller'
+ require "rubygems/uninstaller"
Class.new(Gem::Uninstaller) do
def ask_if_ok(spec)
@@ -660,7 +660,7 @@ class Gem::TestCase < Test::Unit::TestCase
# Reads a Marshal file at +path+
def read_cache(path)
- File.open path.dup.tap(&Gem::UNTAINT), 'rb' do |io|
+ File.open path.dup.tap(&Gem::UNTAINT), "rb" do |io|
Marshal.load io.read
end
end
@@ -680,7 +680,7 @@ class Gem::TestCase < Test::Unit::TestCase
dir = File.dirname path
FileUtils.mkdir_p dir unless File.directory? dir
- File.open path, 'wb' do |io|
+ File.open path, "wb" do |io|
yield io if block_given?
end
@@ -723,16 +723,16 @@ class Gem::TestCase < Test::Unit::TestCase
#
# Use this with #write_file to build an installed gem.
- def quick_gem(name, version='2')
- require 'rubygems/specification'
+ def quick_gem(name, version="2")
+ require "rubygems/specification"
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = name
s.version = version
- s.author = 'A User'
- s.email = 'example@example.com'
- s.homepage = 'http://example.com'
+ s.author = "A User"
+ s.email = "example@example.com"
+ s.homepage = "http://example.com"
s.summary = "this is a summary"
s.description = "This is a test description"
@@ -763,7 +763,7 @@ class Gem::TestCase < Test::Unit::TestCase
next if File.exist? file
FileUtils.mkdir_p File.dirname(file)
- File.open file, 'w' do |fp|
+ File.open file, "w" do |fp|
fp.puts "# #{file}"
end
end
@@ -855,9 +855,9 @@ class Gem::TestCase < Test::Unit::TestCase
s.platform = Gem::Platform::RUBY
s.name = name
s.version = version
- s.author = 'A User'
- s.email = 'example@example.com'
- s.homepage = 'http://example.com'
+ s.author = "A User"
+ s.email = "example@example.com"
+ s.homepage = "http://example.com"
s.summary = "this is a summary"
s.description = "This is a test description"
@@ -868,7 +868,7 @@ class Gem::TestCase < Test::Unit::TestCase
if deps
deps.keys.each do |n|
- spec.add_dependency n, (deps[n] || '>= 0')
+ spec.add_dependency n, (deps[n] || ">= 0")
end
end
@@ -895,7 +895,7 @@ class Gem::TestCase < Test::Unit::TestCase
if deps
block = proc do |s|
deps.keys.each do |n|
- s.add_dependency n, (deps[n] || '>= 0')
+ s.add_dependency n, (deps[n] || ">= 0")
end
end
end
@@ -904,7 +904,7 @@ class Gem::TestCase < Test::Unit::TestCase
util_build_gem spec
- cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
+ cache_file = File.join @tempdir, "gems", "#{spec.original_name}.gem"
FileUtils.mkdir_p File.dirname cache_file
FileUtils.mv spec.cache_file, cache_file
FileUtils.rm spec.spec_file
@@ -946,11 +946,11 @@ class Gem::TestCase < Test::Unit::TestCase
# TODO: nuke this and fix tests. this should speed up a lot
def util_make_gems(prerelease = false)
- @a1 = quick_gem 'a', '1' do |s|
+ @a1 = quick_gem "a", "1" do |s|
s.files = %w[lib/code.rb]
s.require_paths = %w[lib]
s.date = Gem::Specification::TODAY - 86400
- s.homepage = 'http://a.example.com'
+ s.homepage = "http://a.example.com"
s.email = %w[example@example.com example2@example.com]
s.authors = %w[Example Example2]
s.description = <<-DESC
@@ -967,27 +967,27 @@ Also, a list:
s.require_paths = %w[lib]
end
- @a2 = quick_gem('a', '2', &init)
- @a3a = quick_gem('a', '3.a', &init)
- @a_evil9 = quick_gem('a_evil', '9', &init)
- @b2 = quick_gem('b', '2', &init)
- @c1_2 = quick_gem('c', '1.2', &init)
- @x = quick_gem('x', '1', &init)
- @dep_x = quick_gem('dep_x', '1') do |s|
+ @a2 = quick_gem("a", "2", &init)
+ @a3a = quick_gem("a", "3.a", &init)
+ @a_evil9 = quick_gem("a_evil", "9", &init)
+ @b2 = quick_gem("b", "2", &init)
+ @c1_2 = quick_gem("c", "1.2", &init)
+ @x = quick_gem("x", "1", &init)
+ @dep_x = quick_gem("dep_x", "1") do |s|
s.files = %w[lib/code.rb]
s.require_paths = %w[lib]
- s.add_dependency 'x', '>= 1'
+ s.add_dependency "x", ">= 1"
end
- @pl1 = quick_gem 'pl', '1' do |s| # l for legacy
+ @pl1 = quick_gem "pl", "1" do |s| # l for legacy
s.files = %w[lib/code.rb]
s.require_paths = %w[lib]
- s.platform = Gem::Platform.new 'i386-linux'
- s.instance_variable_set :@original_platform, 'i386-linux'
+ s.platform = Gem::Platform.new "i386-linux"
+ s.instance_variable_set :@original_platform, "i386-linux"
end
if prerelease
- @a2_pre = quick_gem('a', '2.a', &init)
+ @a2_pre = quick_gem("a", "2.a", &init)
write_file File.join(*%W[gems #{@a2_pre.original_name} lib code.rb])
util_build_gem @a2_pre
end
@@ -1013,7 +1013,7 @@ Also, a list:
# Set the platform to +arch+
def util_set_arch(arch)
- RbConfig::CONFIG['arch'] = arch
+ RbConfig::CONFIG["arch"] = arch
platform = Gem::Platform.new arch
Gem.instance_variable_set :@platforms, nil
@@ -1182,7 +1182,7 @@ Also, a list:
# Borland) versus Cygwin, Mingw, etc.
def self.vc_windows?
- RUBY_PLATFORM.match('mswin')
+ RUBY_PLATFORM.match("mswin")
end
##
@@ -1190,7 +1190,7 @@ Also, a list:
# Borland) versus Cygwin, Mingw, etc.
def vc_windows?
- RUBY_PLATFORM.match('mswin')
+ RUBY_PLATFORM.match("mswin")
end
##
@@ -1207,7 +1207,7 @@ Also, a list:
# other platforms, including Cygwin, it will return 'make'.
def self.make_command
- ENV["make"] || ENV["MAKE"] || (vc_windows? ? 'nmake' : 'make')
+ ENV["make"] || ENV["MAKE"] || (vc_windows? ? "nmake" : "make")
end
##
@@ -1216,14 +1216,14 @@ Also, a list:
# other platforms, including Cygwin, it will return 'make'.
def make_command
- ENV["make"] || ENV["MAKE"] || (vc_windows? ? 'nmake' : 'make')
+ ENV["make"] || ENV["MAKE"] || (vc_windows? ? "nmake" : "make")
end
##
# Returns whether or not the nmake command could be found.
def nmake_found?
- system('nmake /? 1>NUL 2>&1')
+ system("nmake /? 1>NUL 2>&1")
end
# In case we're building docs in a background process, this method waits for
@@ -1431,8 +1431,8 @@ Also, a list:
#
# Yields the +specification+ to the block, if given
- def vendor_gem(name = 'a', version = 1)
- directory = File.join 'vendor', name
+ def vendor_gem(name = "a", version = 1)
+ directory = File.join "vendor", name
FileUtils.mkdir_p directory
@@ -1445,12 +1445,12 @@ Also, a list:
#
# Yields the +specification+ to the block, if given
- def save_gemspec(name = 'a', version = 1, directory = '.')
+ def save_gemspec(name = "a", version = 1, directory = ".")
vendor_spec = Gem::Specification.new name, version do |specification|
yield specification if block_given?
end
- File.open File.join(directory, "#{name}.gemspec"), 'w' do |io|
+ File.open File.join(directory, "#{name}.gemspec"), "w" do |io|
io.write vendor_spec.to_ruby
end
@@ -1564,20 +1564,20 @@ Also, a list:
# :stopdoc:
# only available in RubyGems tests
- PRIVATE_KEY_PASSPHRASE = 'Foo bar'.freeze
+ PRIVATE_KEY_PASSPHRASE = "Foo bar".freeze
begin
- PRIVATE_KEY = load_key 'private'
- PRIVATE_KEY_PATH = key_path 'private'
+ PRIVATE_KEY = load_key "private"
+ PRIVATE_KEY_PATH = key_path "private"
# ENCRYPTED_PRIVATE_KEY is PRIVATE_KEY encrypted with PRIVATE_KEY_PASSPHRASE
- ENCRYPTED_PRIVATE_KEY = load_key 'encrypted_private', PRIVATE_KEY_PASSPHRASE
- ENCRYPTED_PRIVATE_KEY_PATH = key_path 'encrypted_private'
+ ENCRYPTED_PRIVATE_KEY = load_key "encrypted_private", PRIVATE_KEY_PASSPHRASE
+ ENCRYPTED_PRIVATE_KEY_PATH = key_path "encrypted_private"
PUBLIC_KEY = PRIVATE_KEY.public_key
- PUBLIC_CERT = load_cert 'public'
- PUBLIC_CERT_PATH = cert_path 'public'
+ PUBLIC_CERT = load_cert "public"
+ PUBLIC_CERT_PATH = cert_path "public"
rescue Errno::ENOENT
PRIVATE_KEY = nil
PUBLIC_KEY = nil
@@ -1619,4 +1619,4 @@ class Object
end unless method_defined?(:stub) # lib/resolv/test_dns.rb also has the same method definition
end
-require_relative 'utilities'
+require_relative "utilities"
diff --git a/test/rubygems/installer_test_case.rb b/test/rubygems/installer_test_case.rb
index 824ac53a82..6211cfff16 100644
--- a/test/rubygems/installer_test_case.rb
+++ b/test/rubygems/installer_test_case.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/installer'
+require_relative "helper"
+require "rubygems/installer"
class Gem::Installer
##
@@ -133,7 +133,7 @@ class Gem::InstallerTestCase < Gem::TestCase
# And returns it
def setup_base_spec
- quick_gem 'a' do |spec|
+ quick_gem "a" do |spec|
util_make_exec spec
end
end
@@ -154,7 +154,7 @@ class Gem::InstallerTestCase < Gem::TestCase
# And returns a Gem::Installer for the @user_spec that installs into Gem.user_dir
def setup_base_user_installer
- @user_spec = quick_gem 'b' do |spec|
+ @user_spec = quick_gem "b" do |spec|
util_make_exec spec
end
@@ -183,23 +183,23 @@ class Gem::InstallerTestCase < Gem::TestCase
# ext/a/mkrf_conf.rb
def util_setup_gem(ui = @ui, force = true)
- @spec.files << File.join('lib', 'code.rb')
- @spec.extensions << File.join('ext', 'a', 'mkrf_conf.rb')
+ @spec.files << File.join("lib", "code.rb")
+ @spec.extensions << File.join("ext", "a", "mkrf_conf.rb")
Dir.chdir @tempdir do
- FileUtils.mkdir_p 'bin'
- FileUtils.mkdir_p 'lib'
- FileUtils.mkdir_p File.join('ext', 'a')
+ FileUtils.mkdir_p "bin"
+ FileUtils.mkdir_p "lib"
+ FileUtils.mkdir_p File.join("ext", "a")
- File.open File.join('bin', 'executable'), 'w' do |f|
+ File.open File.join("bin", "executable"), "w" do |f|
f.puts "raise 'ran executable'"
end
- File.open File.join('lib', 'code.rb'), 'w' do |f|
- f.puts '1'
+ File.open File.join("lib", "code.rb"), "w" do |f|
+ f.puts "1"
end
- File.open File.join('ext', 'a', 'mkrf_conf.rb'), 'w' do |f|
+ File.open File.join("ext", "a", "mkrf_conf.rb"), "w" do |f|
f << <<-EOF
File.open 'Rakefile', 'w' do |rf| rf.puts "task :default" end
EOF
diff --git a/test/rubygems/package/tar_test_case.rb b/test/rubygems/package/tar_test_case.rb
index 4517f40730..6cee7f86dc 100644
--- a/test/rubygems/package/tar_test_case.rb
+++ b/test/rubygems/package/tar_test_case.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative '../helper'
-require 'rubygems/package'
+require_relative "../helper"
+require "rubygems/package"
##
# A test case for Gem::Package::Tar* classes
diff --git a/test/rubygems/plugin/exception/rubygems_plugin.rb b/test/rubygems/plugin/exception/rubygems_plugin.rb
index 9a6f557b5c..f54e689d87 100644
--- a/test/rubygems/plugin/exception/rubygems_plugin.rb
+++ b/test/rubygems/plugin/exception/rubygems_plugin.rb
@@ -1,3 +1,3 @@
# frozen_string_literal: true
TestGem::TEST_PLUGIN_EXCEPTION = :loaded
-raise Exception.new('boom')
+raise Exception.new("boom")
diff --git a/test/rubygems/plugin/standarderror/rubygems_plugin.rb b/test/rubygems/plugin/standarderror/rubygems_plugin.rb
index 94cf4e8a52..0fcca28728 100644
--- a/test/rubygems/plugin/standarderror/rubygems_plugin.rb
+++ b/test/rubygems/plugin/standarderror/rubygems_plugin.rb
@@ -1,3 +1,3 @@
# frozen_string_literal: true
TestGem::TEST_PLUGIN_STANDARDERROR = :loaded
-raise StandardError.new('boom')
+raise StandardError.new("boom")
diff --git a/test/rubygems/rubygems_plugin.rb b/test/rubygems/rubygems_plugin.rb
index 2dc7836904..b538487bbf 100644
--- a/test/rubygems/rubygems_plugin.rb
+++ b/test/rubygems/rubygems_plugin.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/command_manager'
+require "rubygems/command_manager"
##
# This is an example of exactly what NOT to do.
@@ -12,7 +12,7 @@ end
class Gem::Commands::InterruptCommand < Gem::Command
def initialize
- super('interrupt', 'Raises an Interrupt Exception', {})
+ super("interrupt", "Raises an Interrupt Exception", {})
end
def execute
diff --git a/test/rubygems/specifications/rubyforge-0.0.1.gemspec b/test/rubygems/specifications/rubyforge-0.0.1.gemspec
index c760a42073..e8d5030326 100644
--- a/test/rubygems/specifications/rubyforge-0.0.1.gemspec
+++ b/test/rubygems/specifications/rubyforge-0.0.1.gemspec
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.summary = "A very bar gem"
s.authors = ["unknown"]
- s.license = 'MIT'
- s.homepage = 'http://example.com'
- s.files = ['README.md']
- s.rubyforge_project = 'abc'
+ s.license = "MIT"
+ s.homepage = "http://example.com"
+ s.files = ["README.md"]
+ s.rubyforge_project = "abc"
end
diff --git a/test/rubygems/test_bundled_ca.rb b/test/rubygems/test_bundled_ca.rb
index fff5904aba..b061666c76 100644
--- a/test/rubygems/test_bundled_ca.rb
+++ b/test/rubygems/test_bundled_ca.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'net/http'
-require 'rubygems/openssl'
+require_relative "helper"
+require "net/http"
+require "rubygems/openssl"
unless Gem::HAVE_OPENSSL
- warn 'Skipping bundled certificates tests. openssl not found.'
+ warn "Skipping bundled certificates tests. openssl not found."
end
-require 'rubygems/request'
+require "rubygems/request"
# = Testing Bundled CA
#
@@ -31,7 +31,7 @@ class TestBundledCA < Gem::TestCase
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
http.cert_store = bundled_certificate_store
- http.get('/')
+ http.get("/")
rescue Errno::ENOENT, Errno::ETIMEDOUT, SocketError
pend "#{host} seems offline, I can't tell whether ssl would work."
rescue OpenSSL::SSL::SSLError => e
@@ -43,18 +43,18 @@ class TestBundledCA < Gem::TestCase
end
def test_accessing_rubygems
- assert_https('rubygems.org')
+ assert_https("rubygems.org")
end
def test_accessing_www_rubygems
- assert_https('www.rubygems.org')
+ assert_https("www.rubygems.org")
end
def test_accessing_staging
- assert_https('staging.rubygems.org')
+ assert_https("staging.rubygems.org")
end
def test_accessing_new_index
- assert_https('index.rubygems.org')
+ assert_https("index.rubygems.org")
end
end if Gem::HAVE_OPENSSL
diff --git a/test/rubygems/test_config.rb b/test/rubygems/test_config.rb
index fff539c816..d9e0f4dd9d 100644
--- a/test/rubygems/test_config.rb
+++ b/test/rubygems/test_config.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems'
-require 'shellwords'
+require_relative "helper"
+require "rubygems"
+require "shellwords"
class TestConfig < Gem::TestCase
def test_datadir
diff --git a/test/rubygems/test_deprecate.rb b/test/rubygems/test_deprecate.rb
index a619eccb37..dfcf8dea11 100644
--- a/test/rubygems/test_deprecate.rb
+++ b/test/rubygems/test_deprecate.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/deprecate'
+require_relative "helper"
+require "rubygems/deprecate"
class TestDeprecate < Gem::TestCase
def setup
@@ -123,7 +123,7 @@ class TestDeprecate < Gem::TestCase
end
def test_rubygems_deprecate_command
- require 'rubygems/command'
+ require "rubygems/command"
foo_command = Class.new(Gem::Command) do
extend Gem::Deprecate
diff --git a/test/rubygems/test_exit.rb b/test/rubygems/test_exit.rb
index 9557fe5d06..3986daa992 100644
--- a/test/rubygems/test_exit.rb
+++ b/test/rubygems/test_exit.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems'
+require_relative "helper"
+require "rubygems"
class TestExit < Gem::TestCase
def test_exit
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 4d9644d5c9..bbb3e6dd0a 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1,16 +1,16 @@
# coding: US-ASCII
-require_relative 'helper'
-require 'rubygems'
-require 'rubygems/command'
-require 'rubygems/installer'
-require 'pathname'
-require 'tmpdir'
-require 'rbconfig'
+require_relative "helper"
+require "rubygems"
+require "rubygems/command"
+require "rubygems/installer"
+require "pathname"
+require "tmpdir"
+require "rbconfig"
class TestGem < Gem::TestCase
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
- PROJECT_DIR = File.expand_path('../..', __dir__).tap(&Gem::UNTAINT)
+ PROJECT_DIR = File.expand_path("../..", __dir__).tap(&Gem::UNTAINT)
def setup
super
@@ -89,32 +89,32 @@ class TestGem < Gem::TestCase
def test_self_install
spec_fetcher do |f|
- f.gem 'a', 1
- f.spec 'a', 2
+ f.gem "a", 1
+ f.spec "a", 2
end
gemhome2 = "#{@gemhome}2"
- installed = Gem.install 'a', '= 1', :install_dir => gemhome2
+ installed = Gem.install "a", "= 1", :install_dir => gemhome2
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
- assert_path_exist File.join(gemhome2, 'gems', 'a-1')
+ assert_path_exist File.join(gemhome2, "gems", "a-1")
end
def test_self_install_in_rescue
spec_fetcher do |f|
- f.gem 'a', 1
- f.spec 'a', 2
+ f.gem "a", 1
+ f.spec "a", 2
end
gemhome2 = "#{@gemhome}2"
installed =
begin
- raise 'Error'
+ raise "Error"
rescue StandardError
- Gem.install 'a', '= 1', :install_dir => gemhome2
+ Gem.install "a", "= 1", :install_dir => gemhome2
end
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
end
@@ -143,7 +143,7 @@ class TestGem < Gem::TestCase
def test_self_install_permissions_with_format_executable_and_non_standard_ruby_install_name
Gem::Installer.exec_format = nil
- ruby_install_name 'ruby27' do
+ ruby_install_name "ruby27" do
assert_self_install_permissions(format_executable: true)
end
ensure
@@ -160,35 +160,35 @@ class TestGem < Gem::TestCase
:format_executable => format_executable,
}
Dir.chdir @tempdir do
- Dir.mkdir 'bin'
- Dir.mkdir 'data'
+ Dir.mkdir "bin"
+ Dir.mkdir "data"
- File.write 'bin/foo', "#!/usr/bin/env ruby\n"
- File.chmod 0755, 'bin/foo'
+ File.write "bin/foo", "#!/usr/bin/env ruby\n"
+ File.chmod 0755, "bin/foo"
- File.write 'data/foo.txt', "blah\n"
+ File.write "data/foo.txt", "blah\n"
spec_fetcher do |f|
- f.gem 'foo', 1 do |s|
- s.executables = ['foo']
+ f.gem "foo", 1 do |s|
+ s.executables = ["foo"]
s.files = %w[bin/foo data/foo.txt]
end
end
- Gem.install 'foo', Gem::Requirement.default, options
+ Gem.install "foo", Gem::Requirement.default, options
end
prog_mode = (options[:prog_mode] & mask).to_s(8)
dir_mode = (options[:dir_mode] & mask).to_s(8)
data_mode = (options[:data_mode] & mask).to_s(8)
- prog_name = 'foo'
- prog_name = RbConfig::CONFIG['ruby_install_name'].sub('ruby', 'foo') if options[:format_executable]
+ prog_name = "foo"
+ prog_name = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "foo") if options[:format_executable]
expected = {
"bin/#{prog_name}" => prog_mode,
- 'gems/foo-1' => dir_mode,
- 'gems/foo-1/bin' => dir_mode,
- 'gems/foo-1/data' => dir_mode,
- 'gems/foo-1/bin/foo' => prog_mode,
- 'gems/foo-1/data/foo.txt' => data_mode,
+ "gems/foo-1" => dir_mode,
+ "gems/foo-1/bin" => dir_mode,
+ "gems/foo-1/data" => dir_mode,
+ "gems/foo-1/bin/foo" => prog_mode,
+ "gems/foo-1/data/foo.txt" => data_mode,
}
# add Windows script
expected["bin/#{prog_name}.bat"] = mask.to_s(8) if win_platform?
@@ -200,7 +200,7 @@ class TestGem < Gem::TestCase
end
assert_equal(expected, result)
ensure
- File.chmod(0755, *Dir.glob(@gemhome + '/gems/**/').map {|path| path.tap(&Gem::UNTAINT) })
+ File.chmod(0755, *Dir.glob(@gemhome + "/gems/**/").map {|path| path.tap(&Gem::UNTAINT) })
end
def test_require_missing
@@ -222,57 +222,57 @@ class TestGem < Gem::TestCase
end
def test_self_bin_path_active
- a1 = util_spec 'a', '1' do |s|
- s.executables = ['exec']
+ a1 = util_spec "a", "1" do |s|
+ s.executables = ["exec"]
end
- util_spec 'a', '2' do |s|
- s.executables = ['exec']
+ util_spec "a", "2" do |s|
+ s.executables = ["exec"]
end
a1.activate
- assert_match 'a-1/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
+ assert_match "a-1/bin/exec", Gem.bin_path("a", "exec", ">= 0")
end
def test_self_bin_path_picking_newest
- a1 = util_spec 'a', '1' do |s|
- s.executables = ['exec']
+ a1 = util_spec "a", "1" do |s|
+ s.executables = ["exec"]
end
- a2 = util_spec 'a', '2' do |s|
- s.executables = ['exec']
+ a2 = util_spec "a", "2" do |s|
+ s.executables = ["exec"]
end
install_specs a1, a2
- assert_match 'a-2/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
+ assert_match "a-2/bin/exec", Gem.bin_path("a", "exec", ">= 0")
end
def test_self_activate_bin_path_no_exec_name
e = assert_raise ArgumentError do
- Gem.activate_bin_path 'a'
+ Gem.activate_bin_path "a"
end
- assert_equal 'you must supply exec_name', e.message
+ assert_equal "you must supply exec_name", e.message
end
def test_activate_bin_path_resolves_eagerly
- a1 = util_spec 'a', '1' do |s|
- s.executables = ['exec']
- s.add_dependency 'b'
+ a1 = util_spec "a", "1" do |s|
+ s.executables = ["exec"]
+ s.add_dependency "b"
end
- b1 = util_spec 'b', '1' do |s|
- s.add_dependency 'c', '2'
+ b1 = util_spec "b", "1" do |s|
+ s.add_dependency "c", "2"
end
- b2 = util_spec 'b', '2' do |s|
- s.add_dependency 'c', '1'
+ b2 = util_spec "b", "2" do |s|
+ s.add_dependency "c", "1"
end
- c1 = util_spec 'c', '1'
- c2 = util_spec 'c', '2'
+ c1 = util_spec "c", "1"
+ c2 = util_spec "c", "2"
install_specs c1, c2, b1, b2, a1
@@ -280,27 +280,27 @@ class TestGem < Gem::TestCase
# If we didn't eagerly resolve, this would activate c-2 and then the
# finish_resolve would cause a conflict
- gem 'c'
+ gem "c"
Gem.finish_resolve
assert_equal %w[a-1 b-2 c-1], loaded_spec_names
end
def test_activate_bin_path_does_not_error_if_a_gem_thats_not_finally_activated_has_orphaned_dependencies
- a1 = util_spec 'a', '1' do |s|
- s.executables = ['exec']
- s.add_dependency 'b'
+ a1 = util_spec "a", "1" do |s|
+ s.executables = ["exec"]
+ s.add_dependency "b"
end
- b1 = util_spec 'b', '1' do |s|
- s.add_dependency 'c', '1'
+ b1 = util_spec "b", "1" do |s|
+ s.add_dependency "c", "1"
end
- b2 = util_spec 'b', '2' do |s|
- s.add_dependency 'c', '2'
+ b2 = util_spec "b", "2" do |s|
+ s.add_dependency "c", "2"
end
- c2 = util_spec 'c', '2'
+ c2 = util_spec "c", "2"
install_specs c2, b1, b2, a1
@@ -312,20 +312,20 @@ class TestGem < Gem::TestCase
end
def test_activate_bin_path_raises_a_meaningful_error_if_a_gem_thats_finally_activated_has_orphaned_dependencies
- a1 = util_spec 'a', '1' do |s|
- s.executables = ['exec']
- s.add_dependency 'b'
+ a1 = util_spec "a", "1" do |s|
+ s.executables = ["exec"]
+ s.add_dependency "b"
end
- b1 = util_spec 'b', '1' do |s|
- s.add_dependency 'c', '1'
+ b1 = util_spec "b", "1" do |s|
+ s.add_dependency "c", "1"
end
- b2 = util_spec 'b', '2' do |s|
- s.add_dependency 'c', '2'
+ b2 = util_spec "b", "2" do |s|
+ s.add_dependency "c", "2"
end
- c1 = util_spec 'c', '1'
+ c1 = util_spec "c", "1"
install_specs c1, b1, b2, a1
@@ -339,8 +339,8 @@ class TestGem < Gem::TestCase
end
def test_activate_bin_path_in_debug_mode
- a1 = util_spec 'a', '1' do |s|
- s.executables = ['exec']
+ a1 = util_spec "a", "1" do |s|
+ s.executables = ["exec"]
end
install_specs a1
@@ -355,12 +355,12 @@ class TestGem < Gem::TestCase
end
def test_activate_bin_path_selects_exact_bundler_version_if_present
- bundler_latest = util_spec 'bundler', '2.0.1' do |s|
- s.executables = ['bundle']
+ bundler_latest = util_spec "bundler", "2.0.1" do |s|
+ s.executables = ["bundle"]
end
- bundler_previous = util_spec 'bundler', '2.0.0' do |s|
- s.executables = ['bundle']
+ bundler_previous = util_spec "bundler", "2.0.0" do |s|
+ s.executables = ["bundle"]
end
install_specs bundler_latest, bundler_previous
@@ -389,12 +389,12 @@ class TestGem < Gem::TestCase
end
def test_activate_bin_path_respects_underscore_selection_if_given
- bundler_latest = util_spec 'bundler', '2.0.1' do |s|
- s.executables = ['bundle']
+ bundler_latest = util_spec "bundler", "2.0.1" do |s|
+ s.executables = ["bundle"]
end
- bundler_previous = util_spec 'bundler', '1.17.3' do |s|
- s.executables = ['bundle']
+ bundler_previous = util_spec "bundler", "1.17.3" do |s|
+ s.executables = ["bundle"]
end
install_specs bundler_latest, bundler_previous
@@ -450,57 +450,57 @@ class TestGem < Gem::TestCase
def test_self_bin_path_no_exec_name
e = assert_raise ArgumentError do
- Gem.bin_path 'a'
+ Gem.bin_path "a"
end
- assert_equal 'you must supply exec_name', e.message
+ assert_equal "you must supply exec_name", e.message
end
def test_self_bin_path_bin_name
install_specs util_exec_gem
- assert_equal @abin_path, Gem.bin_path('a', 'abin')
+ assert_equal @abin_path, Gem.bin_path("a", "abin")
end
def test_self_bin_path_bin_name_version
install_specs util_exec_gem
- assert_equal @abin_path, Gem.bin_path('a', 'abin', '4')
+ assert_equal @abin_path, Gem.bin_path("a", "abin", "4")
end
def test_self_bin_path_nonexistent_binfile
- util_spec 'a', '2' do |s|
- s.executables = ['exec']
+ util_spec "a", "2" do |s|
+ s.executables = ["exec"]
end
assert_raise(Gem::GemNotFoundException) do
- Gem.bin_path('a', 'other', '2')
+ Gem.bin_path("a", "other", "2")
end
end
def test_self_bin_path_no_bin_file
- util_spec 'a', '1'
+ util_spec "a", "1"
assert_raise(ArgumentError) do
- Gem.bin_path('a', nil, '1')
+ Gem.bin_path("a", nil, "1")
end
end
def test_self_bin_path_not_found
assert_raise(Gem::GemNotFoundException) do
- Gem.bin_path('non-existent', 'blah')
+ Gem.bin_path("non-existent", "blah")
end
end
def test_self_bin_path_bin_file_gone_in_latest
install_specs util_exec_gem
- spec = util_spec 'a', '10' do |s|
+ spec = util_spec "a", "10" do |s|
s.executables = []
end
install_specs spec
- assert_equal @abin_path, Gem.bin_path('a', 'abin')
+ assert_equal @abin_path, Gem.bin_path("a", "abin")
end
def test_self_bindir
- assert_equal File.join(@gemhome, 'bin'), Gem.bindir
- assert_equal File.join(@gemhome, 'bin'), Gem.bindir(Gem.dir)
- assert_equal File.join(@gemhome, 'bin'), Gem.bindir(Pathname.new(Gem.dir))
+ assert_equal File.join(@gemhome, "bin"), Gem.bindir
+ assert_equal File.join(@gemhome, "bin"), Gem.bindir(Gem.dir)
+ assert_equal File.join(@gemhome, "bin"), Gem.bindir(Pathname.new(Gem.dir))
end
def test_self_bindir_default_dir
@@ -529,21 +529,21 @@ class TestGem < Gem::TestCase
foo = nil
Dir.chdir @tempdir do
- FileUtils.mkdir_p 'data'
- File.open File.join('data', 'foo.txt'), 'w' do |fp|
- fp.puts 'blah'
+ FileUtils.mkdir_p "data"
+ File.open File.join("data", "foo.txt"), "w" do |fp|
+ fp.puts "blah"
end
- foo = util_spec 'foo' do |s|
+ foo = util_spec "foo" do |s|
s.files = %w[data/foo.txt]
end
install_gem foo
end
- gem 'foo'
+ gem "foo"
- expected = File.join @gemhome, 'gems', foo.full_name, 'data', 'foo'
+ expected = File.join @gemhome, "gems", foo.full_name, "data", "foo"
assert_equal expected, Gem::Specification.find_by_name("foo").datadir
end
@@ -555,25 +555,25 @@ class TestGem < Gem::TestCase
end
def test_self_default_exec_format
- ruby_install_name 'ruby' do
- assert_equal '%s', Gem.default_exec_format
+ ruby_install_name "ruby" do
+ assert_equal "%s", Gem.default_exec_format
end
end
def test_self_default_exec_format_18
- ruby_install_name 'ruby18' do
- assert_equal '%s18', Gem.default_exec_format
+ ruby_install_name "ruby18" do
+ assert_equal "%s18", Gem.default_exec_format
end
end
def test_self_default_exec_format_jruby
- ruby_install_name 'jruby' do
- assert_equal 'j%s', Gem.default_exec_format
+ ruby_install_name "jruby" do
+ assert_equal "j%s", Gem.default_exec_format
end
end
def test_default_path
- vendordir(File.join(@tempdir, 'vendor')) do
+ vendordir(File.join(@tempdir, "vendor")) do
FileUtils.rm_rf Gem.user_home
expected = [Gem.default_dir]
@@ -593,7 +593,7 @@ class TestGem < Gem::TestCase
end
def test_default_path_user_home
- vendordir(File.join(@tempdir, 'vendor')) do
+ vendordir(File.join(@tempdir, "vendor")) do
expected = [Gem.user_dir, Gem.default_dir]
assert_equal expected, Gem.default_path
@@ -601,7 +601,7 @@ class TestGem < Gem::TestCase
end
def test_default_path_vendor_dir
- vendordir(File.join(@tempdir, 'vendor')) do
+ vendordir(File.join(@tempdir, "vendor")) do
FileUtils.mkdir_p Gem.vendor_dir
FileUtils.rm_rf Gem.user_home
@@ -617,14 +617,14 @@ class TestGem < Gem::TestCase
end
def test_self_use_gemdeps
- with_rubygems_gemdeps('-') do
- FileUtils.mkdir_p 'detect/a/b'
- FileUtils.mkdir_p 'detect/a/Isolate'
+ with_rubygems_gemdeps("-") do
+ FileUtils.mkdir_p "detect/a/b"
+ FileUtils.mkdir_p "detect/a/Isolate"
- FileUtils.touch 'detect/Isolate'
+ FileUtils.touch "detect/Isolate"
begin
- Dir.chdir 'detect/a/b'
+ Dir.chdir "detect/a/b"
Gem.use_gemdeps
@@ -645,12 +645,12 @@ class TestGem < Gem::TestCase
Gem.ensure_gem_subdirectories @gemhome
- assert_path_exist File.join @gemhome, 'build_info'
- assert_path_exist File.join @gemhome, 'cache'
- assert_path_exist File.join @gemhome, 'doc'
- assert_path_exist File.join @gemhome, 'extensions'
- assert_path_exist File.join @gemhome, 'gems'
- assert_path_exist File.join @gemhome, 'specifications'
+ assert_path_exist File.join @gemhome, "build_info"
+ assert_path_exist File.join @gemhome, "cache"
+ assert_path_exist File.join @gemhome, "doc"
+ assert_path_exist File.join @gemhome, "extensions"
+ assert_path_exist File.join @gemhome, "gems"
+ assert_path_exist File.join @gemhome, "specifications"
end
def test_self_ensure_gem_directories_permissions
@@ -680,9 +680,9 @@ class TestGem < Gem::TestCase
end unless win_platform?
def test_self_ensure_gem_directories_missing_parents
- gemdir = File.join @tempdir, 'a/b/c/gemdir'
- FileUtils.rm_rf File.join(@tempdir, 'a') rescue nil
- refute File.exist?(File.join(@tempdir, 'a')),
+ gemdir = File.join @tempdir, "a/b/c/gemdir"
+ FileUtils.rm_rf File.join(@tempdir, "a") rescue nil
+ refute File.exist?(File.join(@tempdir, "a")),
"manually remove #{File.join @tempdir, 'a'}, tests are broken"
Gem.use_paths gemdir
@@ -725,19 +725,19 @@ class TestGem < Gem::TestCase
end
def test_self_ensure_gem_directories_non_existent_paths
- Gem.ensure_gem_subdirectories '/proc/0123456789/bogus' # should not raise
- Gem.ensure_gem_subdirectories 'classpath:/bogus/x' # JRuby embed scenario
+ Gem.ensure_gem_subdirectories "/proc/0123456789/bogus" # should not raise
+ Gem.ensure_gem_subdirectories "classpath:/bogus/x" # JRuby embed scenario
end
end
def test_self_extension_dir_shared
- enable_shared 'yes' do
+ enable_shared "yes" do
assert_equal Gem.ruby_api_version, Gem.extension_api_version
end
end
def test_self_extension_dir_static
- enable_shared 'no' do
+ enable_shared "no" do
assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
end
end
@@ -746,14 +746,14 @@ class TestGem < Gem::TestCase
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
$LOAD_PATH.unshift cwd
- discover_path = File.join 'lib', 'sff', 'discover.rb'
+ discover_path = File.join "lib", "sff", "discover.rb"
foo1, foo2 = %w[1 2].map do |version|
- spec = quick_gem 'sff', version do |s|
+ spec = quick_gem "sff", version do |s|
s.files << discover_path
end
- write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
+ write_file(File.join "gems", spec.full_name, discover_path) do |fp|
fp.puts "# #{spec.full_name}"
end
@@ -763,13 +763,13 @@ class TestGem < Gem::TestCase
Gem.refresh
expected = [
- File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
+ File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
File.join(foo2.full_gem_path, discover_path),
File.join(foo1.full_gem_path, discover_path),
]
- assert_equal expected, Gem.find_files('sff/discover')
- assert_equal expected, Gem.find_files('sff/**.rb'), '[ruby-core:31730]'
+ assert_equal expected, Gem.find_files("sff/discover")
+ assert_equal expected, Gem.find_files("sff/**.rb"), "[ruby-core:31730]"
ensure
assert_equal cwd, $LOAD_PATH.shift
end
@@ -778,14 +778,14 @@ class TestGem < Gem::TestCase
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
actual_load_path = $LOAD_PATH.unshift(cwd).dup
- discover_path = File.join 'lib', 'sff', 'discover.rb'
+ discover_path = File.join "lib", "sff", "discover.rb"
foo1, _ = %w[1 2].map do |version|
- spec = quick_gem 'sff', version do |s|
+ spec = quick_gem "sff", version do |s|
s.files << discover_path
end
- write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
+ write_file(File.join "gems", spec.full_name, discover_path) do |fp|
fp.puts "# #{spec.full_name}"
end
@@ -793,19 +793,19 @@ class TestGem < Gem::TestCase
end
Gem.refresh
- write_file(File.join Dir.pwd, 'Gemfile') do |fp|
+ write_file(File.join Dir.pwd, "Gemfile") do |fp|
fp.puts "source 'https://rubygems.org'"
fp.puts "gem '#{foo1.name}', '#{foo1.version}'"
end
- Gem.use_gemdeps(File.join Dir.pwd, 'Gemfile')
+ Gem.use_gemdeps(File.join Dir.pwd, "Gemfile")
expected = [
- File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
+ File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
File.join(foo1.full_gem_path, discover_path),
].sort
- assert_equal expected, Gem.find_files('sff/discover').sort
- assert_equal expected, Gem.find_files('sff/**.rb').sort, '[ruby-core:31730]'
+ assert_equal expected, Gem.find_files("sff/discover").sort
+ assert_equal expected, Gem.find_files("sff/**.rb").sort, "[ruby-core:31730]"
ensure
assert_equal cwd, actual_load_path.shift unless Gem.java_platform?
end
@@ -814,14 +814,14 @@ class TestGem < Gem::TestCase
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
$LOAD_PATH.unshift cwd
- discover_path = File.join 'lib', 'sff', 'discover.rb'
+ discover_path = File.join "lib", "sff", "discover.rb"
_, foo2 = %w[1 2].map do |version|
- spec = quick_gem 'sff', version do |s|
+ spec = quick_gem "sff", version do |s|
s.files << discover_path
end
- write_file(File.join 'gems', spec.full_name, discover_path) do |fp|
+ write_file(File.join "gems", spec.full_name, discover_path) do |fp|
fp.puts "# #{spec.full_name}"
end
@@ -831,30 +831,30 @@ class TestGem < Gem::TestCase
Gem.refresh
expected = [
- File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
+ File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
File.join(foo2.full_gem_path, discover_path),
]
- assert_equal expected, Gem.find_latest_files('sff/discover')
- assert_equal expected, Gem.find_latest_files('sff/**.rb'), '[ruby-core:31730]'
+ assert_equal expected, Gem.find_latest_files("sff/discover")
+ assert_equal expected, Gem.find_latest_files("sff/**.rb"), "[ruby-core:31730]"
ensure
assert_equal cwd, $LOAD_PATH.shift
end
def test_self_latest_spec_for
gems = spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '3.a'
- fetcher.spec 'a', 2
+ fetcher.spec "a", 1
+ fetcher.spec "a", "3.a"
+ fetcher.spec "a", 2
end
- spec = Gem.latest_spec_for 'a'
+ spec = Gem.latest_spec_for "a"
- assert_equal gems['a-2'], spec
+ assert_equal gems["a-2"], spec
end
def test_self_latest_spec_for_multiple_sources
- uri = 'https://example.sample.com/'
+ uri = "https://example.sample.com/"
source = Gem::Source.new(uri)
source_list = Gem::SourceList.new
source_list << Gem::Source.new(@uri)
@@ -862,44 +862,44 @@ class TestGem < Gem::TestCase
Gem.sources.replace source_list
spec_fetcher(uri) do |fetcher|
- fetcher.spec 'a', 1.1
+ fetcher.spec "a", 1.1
end
gems = spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '3.a'
- fetcher.spec 'a', 2
+ fetcher.spec "a", 1
+ fetcher.spec "a", "3.a"
+ fetcher.spec "a", 2
end
- spec = Gem.latest_spec_for 'a'
- assert_equal gems['a-2'], spec
+ spec = Gem.latest_spec_for "a"
+ assert_equal gems["a-2"], spec
end
def test_self_latest_rubygems_version
spec_fetcher do |fetcher|
- fetcher.spec 'rubygems-update', '1.8.23'
- fetcher.spec 'rubygems-update', '1.8.24'
- fetcher.spec 'rubygems-update', '2.0.0.preview3'
+ fetcher.spec "rubygems-update", "1.8.23"
+ fetcher.spec "rubygems-update", "1.8.24"
+ fetcher.spec "rubygems-update", "2.0.0.preview3"
end
version = Gem.latest_rubygems_version
- assert_equal Gem::Version.new('1.8.24'), version
+ assert_equal Gem::Version.new("1.8.24"), version
end
def test_self_latest_version_for
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'a', '3.a'
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "a", "3.a"
end
- version = Gem.latest_version_for 'a'
+ version = Gem.latest_version_for "a"
assert_equal Gem::Version.new(2), version
end
def test_self_latest_version_for_multiple_sources
- uri = 'https://example.sample.com/'
+ uri = "https://example.sample.com/"
source = Gem::Source.new(uri)
source_list = Gem::SourceList.new
source_list << Gem::Source.new(@uri)
@@ -907,27 +907,27 @@ class TestGem < Gem::TestCase
Gem.sources.replace source_list
spec_fetcher(uri) do |fetcher|
- fetcher.spec 'a', 1.1
+ fetcher.spec "a", 1.1
end
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'a', '3.a'
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "a", "3.a"
end
- version = Gem.latest_version_for 'a'
+ version = Gem.latest_version_for "a"
assert_equal Gem::Version.new(2), version
end
def test_self_loaded_specs
- foo = util_spec 'foo'
+ foo = util_spec "foo"
install_gem foo
foo.activate
- assert_equal true, Gem.loaded_specs.keys.include?('foo')
+ assert_equal true, Gem.loaded_specs.keys.include?("foo")
end
def test_self_path
@@ -947,7 +947,7 @@ class TestGem < Gem::TestCase
path_count = Gem.path.size
Gem.clear_paths
- ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR)
+ ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
assert_equal @additional, Gem.path[0,2]
@@ -959,10 +959,10 @@ class TestGem < Gem::TestCase
def test_self_path_duplicate
Gem.clear_paths
util_ensure_gem_dirs
- dirs = @additional + [@gemhome] + [File.join(@tempdir, 'a')]
+ dirs = @additional + [@gemhome] + [File.join(@tempdir, "a")]
- ENV['GEM_HOME'] = @gemhome
- ENV['GEM_PATH'] = dirs.join File::PATH_SEPARATOR
+ ENV["GEM_HOME"] = @gemhome
+ ENV["GEM_PATH"] = dirs.join File::PATH_SEPARATOR
assert_equal @gemhome, Gem.dir
@@ -974,8 +974,8 @@ class TestGem < Gem::TestCase
Gem.clear_paths
util_ensure_gem_dirs
- ENV['GEM_HOME'] = @gemhome
- ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR)
+ ENV["GEM_HOME"] = @gemhome
+ ENV["GEM_PATH"] = @additional.join(File::PATH_SEPARATOR)
assert_equal @gemhome, Gem.dir
@@ -992,38 +992,38 @@ class TestGem < Gem::TestCase
end
def test_self_prefix_libdir
- orig_libdir = RbConfig::CONFIG['libdir']
- RbConfig::CONFIG['libdir'] = PROJECT_DIR
+ orig_libdir = RbConfig::CONFIG["libdir"]
+ RbConfig::CONFIG["libdir"] = PROJECT_DIR
assert_nil Gem.prefix
ensure
- RbConfig::CONFIG['libdir'] = orig_libdir
+ RbConfig::CONFIG["libdir"] = orig_libdir
end
def test_self_prefix_sitelibdir
- orig_sitelibdir = RbConfig::CONFIG['sitelibdir']
- RbConfig::CONFIG['sitelibdir'] = PROJECT_DIR
+ orig_sitelibdir = RbConfig::CONFIG["sitelibdir"]
+ RbConfig::CONFIG["sitelibdir"] = PROJECT_DIR
assert_nil Gem.prefix
ensure
- RbConfig::CONFIG['sitelibdir'] = orig_sitelibdir
+ RbConfig::CONFIG["sitelibdir"] = orig_sitelibdir
end
def test_self_read_binary
- File.open 'test', 'w' do |io|
+ File.open "test", "w" do |io|
io.write "\xCF\x80"
end
- assert_equal ["\xCF", "\x80"], Gem.read_binary('test').chars.to_a
+ assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
- pend 'chmod not supported' if Gem.win_platform?
+ pend "chmod not supported" if Gem.win_platform?
begin
- File.chmod 0444, 'test'
+ File.chmod 0444, "test"
- assert_equal ["\xCF", "\x80"], Gem.read_binary('test').chars.to_a
+ assert_equal ["\xCF", "\x80"], Gem.read_binary("test").chars.to_a
ensure
- File.chmod 0644, 'test'
+ File.chmod 0644, "test"
end
end
@@ -1084,72 +1084,72 @@ class TestGem < Gem::TestCase
end
def test_self_ruby_api_version
- orig_ruby_version, RbConfig::CONFIG['ruby_version'] = RbConfig::CONFIG['ruby_version'], '1.2.3'
+ orig_ruby_version, RbConfig::CONFIG["ruby_version"] = RbConfig::CONFIG["ruby_version"], "1.2.3"
Gem.instance_variable_set :@ruby_api_version, nil
- assert_equal '1.2.3', Gem.ruby_api_version
+ assert_equal "1.2.3", Gem.ruby_api_version
ensure
Gem.instance_variable_set :@ruby_api_version, nil
- RbConfig::CONFIG['ruby_version'] = orig_ruby_version
+ RbConfig::CONFIG["ruby_version"] = orig_ruby_version
end
def test_self_env_requirement
- ENV["GEM_REQUIREMENT_FOO"] = '>= 1.2.3'
- ENV["GEM_REQUIREMENT_BAR"] = '1.2.3'
- ENV["GEM_REQUIREMENT_BAZ"] = 'abcd'
+ ENV["GEM_REQUIREMENT_FOO"] = ">= 1.2.3"
+ ENV["GEM_REQUIREMENT_BAR"] = "1.2.3"
+ ENV["GEM_REQUIREMENT_BAZ"] = "abcd"
- assert_equal Gem::Requirement.create('>= 1.2.3'), Gem.env_requirement('foo')
- assert_equal Gem::Requirement.create('1.2.3'), Gem.env_requirement('bAr')
- assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement('baz') }
- assert_equal Gem::Requirement.default, Gem.env_requirement('qux')
+ assert_equal Gem::Requirement.create(">= 1.2.3"), Gem.env_requirement("foo")
+ assert_equal Gem::Requirement.create("1.2.3"), Gem.env_requirement("bAr")
+ assert_raise(Gem::Requirement::BadRequirementError) { Gem.env_requirement("baz") }
+ assert_equal Gem::Requirement.default, Gem.env_requirement("qux")
end
def test_self_ruby_version_with_non_mri_implementations
- util_set_RUBY_VERSION '2.5.0', 0, 60928, 'jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]'
+ util_set_RUBY_VERSION "2.5.0", 0, 60928, "jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]"
- assert_equal Gem::Version.new('2.5.0'), Gem.ruby_version
+ assert_equal Gem::Version.new("2.5.0"), Gem.ruby_version
ensure
util_restore_RUBY_VERSION
end
def test_self_ruby_version_with_svn_prerelease
- util_set_RUBY_VERSION '2.6.0', -1, 63539, 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
+ util_set_RUBY_VERSION "2.6.0", -1, 63539, "ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]"
- assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
+ assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
ensure
util_restore_RUBY_VERSION
end
def test_self_ruby_version_with_git_prerelease
- util_set_RUBY_VERSION '2.7.0', -1, 'b563439274a402e33541f5695b1bfd4ac1085638', 'ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]'
+ util_set_RUBY_VERSION "2.7.0", -1, "b563439274a402e33541f5695b1bfd4ac1085638", "ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]"
- assert_equal Gem::Version.new('2.7.0.preview3'), Gem.ruby_version
+ assert_equal Gem::Version.new("2.7.0.preview3"), Gem.ruby_version
ensure
util_restore_RUBY_VERSION
end
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
- util_set_RUBY_VERSION '2.6.0', -1, 63539, 'weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]', 'weirdjruby', '9.2.0.0'
+ util_set_RUBY_VERSION "2.6.0", -1, 63539, "weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]", "weirdjruby", "9.2.0.0"
- assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
+ assert_equal Gem::Version.new("2.6.0.preview2"), Gem.ruby_version
ensure
util_restore_RUBY_VERSION
end
def test_self_ruby_version_with_svn_trunk
- util_set_RUBY_VERSION '1.9.2', -1, 23493, 'ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]'
+ util_set_RUBY_VERSION "1.9.2", -1, 23493, "ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]"
- assert_equal Gem::Version.new('1.9.2.dev'), Gem.ruby_version
+ assert_equal Gem::Version.new("1.9.2.dev"), Gem.ruby_version
ensure
util_restore_RUBY_VERSION
end
def test_self_ruby_version_with_git_master
- util_set_RUBY_VERSION '2.7.0', -1, '5de284ec78220e75643f89b454ce999da0c1c195', 'ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]'
+ util_set_RUBY_VERSION "2.7.0", -1, "5de284ec78220e75643f89b454ce999da0c1c195", "ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]"
- assert_equal Gem::Version.new('2.7.0.dev'), Gem.ruby_version
+ assert_equal Gem::Version.new("2.7.0.dev"), Gem.ruby_version
ensure
util_restore_RUBY_VERSION
end
@@ -1159,7 +1159,7 @@ class TestGem < Gem::TestCase
end
def test_self_paths_eq
- other = File.join @tempdir, 'other'
+ other = File.join @tempdir, "other"
path = [@userhome, other].join File::PATH_SEPARATOR
#
@@ -1172,12 +1172,12 @@ class TestGem < Gem::TestCase
end
def test_self_paths_eq_nonexistent_home
- ENV['GEM_HOME'] = @gemhome
+ ENV["GEM_HOME"] = @gemhome
Gem.clear_paths
- other = File.join @tempdir, 'other'
+ other = File.join @tempdir, "other"
- ENV['HOME'] = other
+ ENV["HOME"] = other
Gem.paths = { "GEM_PATH" => other }
@@ -1256,43 +1256,43 @@ class TestGem < Gem::TestCase
end
def test_try_activate_returns_true_for_activated_specs
- b = util_spec 'b', '1.0' do |spec|
- spec.files << 'lib/b.rb'
+ b = util_spec "b", "1.0" do |spec|
+ spec.files << "lib/b.rb"
end
install_specs b
- assert Gem.try_activate('b'), 'try_activate should return true'
- assert Gem.try_activate('b'), 'try_activate should still return true'
+ assert Gem.try_activate("b"), "try_activate should return true"
+ assert Gem.try_activate("b"), "try_activate should still return true"
end
def test_spec_order_is_consistent
- b1 = util_spec 'b', '1.0'
- b2 = util_spec 'b', '2.0'
- b3 = util_spec 'b', '3.0'
+ b1 = util_spec "b", "1.0"
+ b2 = util_spec "b", "2.0"
+ b3 = util_spec "b", "3.0"
install_specs b1, b2, b3
- specs1 = Gem::Specification.stubs.find_all {|s| s.name == 'b' }
+ specs1 = Gem::Specification.stubs.find_all {|s| s.name == "b" }
Gem::Specification.reset
- specs2 = Gem::Specification.stubs_for('b')
+ specs2 = Gem::Specification.stubs_for("b")
assert_equal specs1.map(&:version), specs2.map(&:version)
end
def test_self_try_activate_missing_dep
- b = util_spec 'b', '1.0'
- a = util_spec 'a', '1.0', 'b' => '>= 1.0'
+ b = util_spec "b", "1.0"
+ a = util_spec "a", "1.0", "b" => ">= 1.0"
install_specs b, a
uninstall_gem b
- a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
+ a_file = File.join a.gem_dir, "lib", "a_file.rb"
write_file a_file do |io|
- io.puts '# a_file.rb'
+ io.puts "# a_file.rb"
end
e = assert_raise Gem::MissingSpecError do
- Gem.try_activate 'a_file'
+ Gem.try_activate "a_file"
end
assert_match %r{Could not find 'b' }, e.message
@@ -1300,30 +1300,30 @@ class TestGem < Gem::TestCase
end
def test_self_try_activate_missing_prerelease
- b = util_spec 'b', '1.0rc1'
- a = util_spec 'a', '1.0rc1', 'b' => '1.0rc1'
+ b = util_spec "b", "1.0rc1"
+ a = util_spec "a", "1.0rc1", "b" => "1.0rc1"
install_specs b, a
uninstall_gem b
- a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
+ a_file = File.join a.gem_dir, "lib", "a_file.rb"
write_file a_file do |io|
- io.puts '# a_file.rb'
+ io.puts "# a_file.rb"
end
e = assert_raise Gem::MissingSpecError do
- Gem.try_activate 'a_file'
+ Gem.try_activate "a_file"
end
assert_match %r{Could not find 'b' \(= 1.0rc1\)}, e.message
end
def test_self_try_activate_missing_extensions
- spec = util_spec 'ext', '1' do |s|
+ spec = util_spec "ext", "1" do |s|
s.extensions = %w[ext/extconf.rb]
s.mark_version
- s.installed_by_version = v('2.2')
+ s.installed_by_version = v("2.2")
end
# write the spec without install to simulate a failed install
@@ -1332,7 +1332,7 @@ class TestGem < Gem::TestCase
end
_, err = capture_output do
- refute Gem.try_activate 'nonexistent'
+ refute Gem.try_activate "nonexistent"
end
unless Gem.java_platform?
@@ -1344,43 +1344,43 @@ class TestGem < Gem::TestCase
end
def test_self_use_paths_with_nils
- orig_home = ENV.delete 'GEM_HOME'
- orig_path = ENV.delete 'GEM_PATH'
+ orig_home = ENV.delete "GEM_HOME"
+ orig_path = ENV.delete "GEM_PATH"
Gem.use_paths nil, nil
assert_equal Gem.default_dir, Gem.paths.home
path = (Gem.default_path + [Gem.paths.home]).uniq
assert_equal path, Gem.paths.path
ensure
- ENV['GEM_HOME'] = orig_home
- ENV['GEM_PATH'] = orig_path
+ ENV["GEM_HOME"] = orig_home
+ ENV["GEM_PATH"] = orig_path
end
def test_setting_paths_does_not_warn_about_unknown_keys
stdout, stderr = capture_output do
- Gem.paths = { 'foo' => [],
- 'bar' => Object.new,
- 'GEM_HOME' => Gem.paths.home,
- 'GEM_PATH' => 'foo' }
+ Gem.paths = { "foo" => [],
+ "bar" => Object.new,
+ "GEM_HOME" => Gem.paths.home,
+ "GEM_PATH" => "foo" }
end
- assert_equal ['foo', Gem.paths.home], Gem.paths.path
- assert_equal '', stderr
- assert_equal '', stdout
+ assert_equal ["foo", Gem.paths.home], Gem.paths.path
+ assert_equal "", stderr
+ assert_equal "", stdout
end
def test_setting_paths_does_not_mutate_parameter_object
- Gem.paths = { 'GEM_HOME' => Gem.paths.home,
- 'GEM_PATH' => 'foo' }.freeze
- assert_equal ['foo', Gem.paths.home], Gem.paths.path
+ Gem.paths = { "GEM_HOME" => Gem.paths.home,
+ "GEM_PATH" => "foo" }.freeze
+ assert_equal ["foo", Gem.paths.home], Gem.paths.path
end
def test_deprecated_paths=
stdout, stderr = capture_output do
- Gem.paths = { 'GEM_HOME' => Gem.paths.home,
- 'GEM_PATH' => [Gem.paths.home, 'foo'] }
+ Gem.paths = { "GEM_HOME" => Gem.paths.home,
+ "GEM_PATH" => [Gem.paths.home, "foo"] }
end
- assert_equal [Gem.paths.home, 'foo'], Gem.paths.path
+ assert_equal [Gem.paths.home, "foo"], Gem.paths.path
assert_match(/Array values in the parameter to `Gem.paths=` are deprecated.\nPlease use a String or nil/m, stderr)
- assert_equal '', stdout
+ assert_equal "", stdout
end
def test_self_use_paths
@@ -1393,8 +1393,8 @@ class TestGem < Gem::TestCase
end
def test_self_user_dir
- parts = [@userhome, '.gem', Gem.ruby_engine]
- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
+ parts = [@userhome, ".gem", Gem.ruby_engine]
+ parts << RbConfig::CONFIG["ruby_version"] unless RbConfig::CONFIG["ruby_version"].empty?
FileUtils.mkdir_p File.join(parts)
@@ -1402,10 +1402,10 @@ class TestGem < Gem::TestCase
end
def test_self_user_home
- if ENV['HOME']
- assert_equal ENV['HOME'], Gem.user_home
+ if ENV["HOME"]
+ assert_equal ENV["HOME"], Gem.user_home
else
- assert true, 'count this test'
+ assert true, "count this test"
end
end
@@ -1430,7 +1430,7 @@ class TestGem < Gem::TestCase
a = util_spec "a", "1"
b = util_spec "b", "1", "c" => nil
c = util_spec "c", "2"
- d = util_spec "d", "1", { 'e' => '= 1' }, "lib/d#{$$}.rb"
+ d = util_spec "d", "1", { "e" => "= 1" }, "lib/d#{$$}.rb"
e = util_spec "e", "1"
install_specs a, c, b, e, d
@@ -1451,35 +1451,35 @@ class TestGem < Gem::TestCase
output = Gem::Util.gunzip input
- assert_equal 'hello', output
+ assert_equal "hello", output
assert_equal Encoding::BINARY, output.encoding
end
def test_self_gzip
- input = 'hello'
+ input = "hello"
output = Gem::Util.gzip input
zipped = StringIO.new output
- assert_equal 'hello', Zlib::GzipReader.new(zipped).read
+ assert_equal "hello", Zlib::GzipReader.new(zipped).read
assert_equal Encoding::BINARY, output.encoding
end
def test_self_vendor_dir
- vendordir(File.join(@tempdir, 'vendor')) do
+ vendordir(File.join(@tempdir, "vendor")) do
expected =
- File.join RbConfig::CONFIG['vendordir'], 'gems',
- RbConfig::CONFIG['ruby_version']
+ File.join RbConfig::CONFIG["vendordir"], "gems",
+ RbConfig::CONFIG["ruby_version"]
assert_equal expected, Gem.vendor_dir
end
end
def test_self_vendor_dir_ENV_GEM_VENDOR
- ENV['GEM_VENDOR'] = File.join @tempdir, 'vendor', 'gems'
+ ENV["GEM_VENDOR"] = File.join @tempdir, "vendor", "gems"
- assert_equal ENV['GEM_VENDOR'], Gem.vendor_dir
+ assert_equal ENV["GEM_VENDOR"], Gem.vendor_dir
refute Gem.vendor_dir.frozen?
end
@@ -1493,18 +1493,18 @@ class TestGem < Gem::TestCase
plugin_path = File.join "lib", "rubygems_plugin.rb"
Dir.chdir @tempdir do
- FileUtils.mkdir_p 'lib'
+ FileUtils.mkdir_p "lib"
File.open plugin_path, "w" do |fp|
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
end
- foo1 = util_spec 'foo', '1' do |s|
+ foo1 = util_spec "foo", "1" do |s|
s.files << plugin_path
end
install_gem foo1
- foo2 = util_spec 'foo', '2' do |s|
+ foo2 = util_spec "foo", "2" do |s|
s.files << plugin_path
end
@@ -1513,7 +1513,7 @@ class TestGem < Gem::TestCase
Gem::Specification.reset
- gem 'foo'
+ gem "foo"
Gem.load_plugins
@@ -1524,12 +1524,12 @@ class TestGem < Gem::TestCase
plugin_path = File.join "lib", "rubygems_plugin.rb"
Dir.chdir @tempdir do
- FileUtils.mkdir_p 'lib'
+ FileUtils.mkdir_p "lib"
File.open plugin_path, "w" do |fp|
fp.puts "class TestGem; PLUGINS_LOADED << 'plugin'; end"
end
- foo = util_spec 'foo', '1' do |s|
+ foo = util_spec "foo", "1" do |s|
s.files << plugin_path
end
@@ -1538,7 +1538,7 @@ class TestGem < Gem::TestCase
Gem.paths = { "GEM_PATH" => [Gem.dir, Gem.user_dir].join(File::PATH_SEPARATOR) }
- gem 'foo'
+ gem "foo"
Gem.load_plugins
@@ -1546,30 +1546,30 @@ class TestGem < Gem::TestCase
end
def test_load_env_plugins
- with_plugin('load') { Gem.load_env_plugins }
+ with_plugin("load") { Gem.load_env_plugins }
assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil
util_remove_interrupt_command
# Should attempt to cause a StandardError
- with_plugin('standarderror') { Gem.load_env_plugins }
+ with_plugin("standarderror") { Gem.load_env_plugins }
assert_equal :loaded, TEST_PLUGIN_STANDARDERROR rescue nil
util_remove_interrupt_command
# Should attempt to cause an Exception
- with_plugin('exception') { Gem.load_env_plugins }
+ with_plugin("exception") { Gem.load_env_plugins }
assert_equal :loaded, TEST_PLUGIN_EXCEPTION rescue nil
end
def test_gem_path_ordering
refute_equal Gem.dir, Gem.user_dir
- write_file File.join(@tempdir, 'lib', "g.rb") {|fp| fp.puts "" }
- write_file File.join(@tempdir, 'lib', 'm.rb') {|fp| fp.puts "" }
+ write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
+ write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
- g = util_spec 'g', '1', nil, "lib/g.rb"
- m = util_spec 'm', '1', nil, "lib/m.rb"
+ g = util_spec "g", "1", nil, "lib/g.rb"
+ m = util_spec "m", "1", nil, "lib/m.rb"
install_gem g, :install_dir => Gem.dir
m0 = install_gem m, :install_dir => Gem.dir
@@ -1588,15 +1588,15 @@ class TestGem < Gem::TestCase
Gem::Specification.reset
Gem.searcher = nil
- assert_equal Gem::Dependency.new('m','1').to_specs,
- Gem::Dependency.new('m','1').to_specs.sort
+ assert_equal Gem::Dependency.new("m","1").to_specs,
+ Gem::Dependency.new("m","1").to_specs.sort
assert_equal \
[expected.gem_dir],
- Gem::Dependency.new('m','1').to_specs.map(&:gem_dir).sort,
+ Gem::Dependency.new("m","1").to_specs.map(&:gem_dir).sort,
"Wrong specs for #{_name}"
- spec = Gem::Dependency.new('m','1').to_spec
+ spec = Gem::Dependency.new("m","1").to_spec
assert_equal \
File.join(_paths.first, "gems", "m-1"),
@@ -1606,7 +1606,7 @@ class TestGem < Gem::TestCase
gem "m"
- spec = Gem::Dependency.new('m','1').to_spec
+ spec = Gem::Dependency.new("m","1").to_spec
assert spec.activated?, "dependency not activated for #{_name}"
assert_equal \
@@ -1621,11 +1621,11 @@ class TestGem < Gem::TestCase
end
def test_gem_path_ordering_short
- write_file File.join(@tempdir, 'lib', "g.rb") {|fp| fp.puts "" }
- write_file File.join(@tempdir, 'lib', 'm.rb') {|fp| fp.puts "" }
+ write_file File.join(@tempdir, "lib", "g.rb") {|fp| fp.puts "" }
+ write_file File.join(@tempdir, "lib", "m.rb") {|fp| fp.puts "" }
- g = util_spec 'g', '1', nil, "lib/g.rb"
- m = util_spec 'm', '1', nil, "lib/m.rb"
+ g = util_spec "g", "1", nil, "lib/g.rb"
+ m = util_spec "m", "1", nil, "lib/m.rb"
install_gem g, :install_dir => Gem.dir
install_gem m, :install_dir => Gem.dir
@@ -1635,7 +1635,7 @@ class TestGem < Gem::TestCase
assert_equal \
File.join(Gem.dir, "gems", "m-1"),
- Gem::Dependency.new('m','1').to_spec.gem_dir,
+ Gem::Dependency.new("m","1").to_spec.gem_dir,
"Wrong spec selected"
end
@@ -1702,7 +1702,7 @@ class TestGem < Gem::TestCase
s.bindir = "exe"
end
- write_file File.join(@tempdir, 'exe', 'foo') do |fp|
+ write_file File.join(@tempdir, "exe", "foo") do |fp|
fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
end
@@ -1716,7 +1716,7 @@ class TestGem < Gem::TestCase
install_gem b, :install_dir => path
install_gem c, :install_dir => path
- ENV['GEM_PATH'] = path
+ ENV["GEM_PATH"] = path
with_rubygems_gemdeps("-") do
new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
@@ -1751,7 +1751,7 @@ class TestGem < Gem::TestCase
s.bindir = "exe"
end
- write_file File.join(@tempdir, 'exe', 'foo') do |fp|
+ write_file File.join(@tempdir, "exe", "foo") do |fp|
fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
end
@@ -1765,7 +1765,7 @@ class TestGem < Gem::TestCase
install_gem b, :install_dir => path
install_gem c, :install_dir => path
- ENV['GEM_PATH'] = path
+ ENV["GEM_PATH"] = path
with_rubygems_gemdeps("-") do
Dir.mkdir "sub1"
@@ -1837,14 +1837,14 @@ class TestGem < Gem::TestCase
end
def test_use_gemdeps
- gem_deps_file = 'gem.deps.rb'.tap(&Gem::UNTAINT)
- spec = util_spec 'a', 1
+ gem_deps_file = "gem.deps.rb".tap(&Gem::UNTAINT)
+ spec = util_spec "a", 1
install_specs spec
spec = Gem::Specification.find {|s| s == spec }
refute spec.activated?
- File.open gem_deps_file, 'w' do |io|
+ File.open gem_deps_file, "w" do |io|
io.write 'gem "a"'
end
@@ -1858,11 +1858,11 @@ class TestGem < Gem::TestCase
def test_use_gemdeps_ENV
with_rubygems_gemdeps(nil) do
- spec = util_spec 'a', 1
+ spec = util_spec "a", 1
refute spec.activated?
- File.open 'gem.deps.rb', 'w' do |io|
+ File.open "gem.deps.rb", "w" do |io|
io.write 'gem "a"'
end
@@ -1874,33 +1874,33 @@ class TestGem < Gem::TestCase
def test_use_gemdeps_argument_missing
e = assert_raise ArgumentError do
- Gem.use_gemdeps 'gem.deps.rb'
+ Gem.use_gemdeps "gem.deps.rb"
end
- assert_equal 'Unable to find gem dependencies file at gem.deps.rb',
+ assert_equal "Unable to find gem dependencies file at gem.deps.rb",
e.message
end
def test_use_gemdeps_argument_missing_match_ENV
- with_rubygems_gemdeps('gem.deps.rb') do
+ with_rubygems_gemdeps("gem.deps.rb") do
e = assert_raise ArgumentError do
- Gem.use_gemdeps 'gem.deps.rb'
+ Gem.use_gemdeps "gem.deps.rb"
end
- assert_equal 'Unable to find gem dependencies file at gem.deps.rb',
+ assert_equal "Unable to find gem dependencies file at gem.deps.rb",
e.message
end
end
def test_use_gemdeps_automatic
- with_rubygems_gemdeps('-') do
- spec = util_spec 'a', 1
+ with_rubygems_gemdeps("-") do
+ spec = util_spec "a", 1
install_specs spec
spec = Gem::Specification.find {|s| s == spec }
refute spec.activated?
- File.open 'Gemfile', 'w' do |io|
+ File.open "Gemfile", "w" do |io|
io.write 'gem "a"'
end
@@ -1911,7 +1911,7 @@ class TestGem < Gem::TestCase
end
def test_use_gemdeps_automatic_missing
- with_rubygems_gemdeps('-') do
+ with_rubygems_gemdeps("-") do
Gem.use_gemdeps
assert true # count
@@ -1919,12 +1919,12 @@ class TestGem < Gem::TestCase
end
def test_use_gemdeps_disabled
- with_rubygems_gemdeps('') do
- spec = util_spec 'a', 1
+ with_rubygems_gemdeps("") do
+ spec = util_spec "a", 1
refute spec.activated?
- File.open 'gem.deps.rb', 'w' do |io|
+ File.open "gem.deps.rb", "w" do |io|
io.write 'gem "a"'
end
@@ -1935,8 +1935,8 @@ class TestGem < Gem::TestCase
end
def test_use_gemdeps_missing_gem
- with_rubygems_gemdeps('x') do
- File.open 'x', 'w' do |io|
+ with_rubygems_gemdeps("x") do
+ File.open "x", "w" do |io|
io.write 'gem "a"'
end
@@ -1957,14 +1957,14 @@ You may need to `bundle install` to install missing gems
end
def test_use_gemdeps_specific
- with_rubygems_gemdeps('x') do
- spec = util_spec 'a', 1
+ with_rubygems_gemdeps("x") do
+ spec = util_spec "a", 1
install_specs spec
spec = Gem::Specification.find {|s| s == spec }
refute spec.activated?
- File.open 'x', 'w' do |io|
+ File.open "x", "w" do |io|
io.write 'gem "a"'
end
@@ -1991,8 +1991,8 @@ You may need to `bundle install` to install missing gems
# Ensure that `Gem.source_date_epoch` is consistent even if
# $SOURCE_DATE_EPOCH has not been set.
def test_default_source_date_epoch_doesnt_change
- old_epoch = ENV['SOURCE_DATE_EPOCH']
- ENV['SOURCE_DATE_EPOCH'] = nil
+ old_epoch = ENV["SOURCE_DATE_EPOCH"]
+ ENV["SOURCE_DATE_EPOCH"] = nil
# Unfortunately, there is no real way to test this aside from waiting
# enough for `Time.now.to_i` to change -- which is a whole second.
@@ -2003,23 +2003,23 @@ You may need to `bundle install` to install missing gems
b = Gem.source_date_epoch
assert_equal a, b
ensure
- ENV['SOURCE_DATE_EPOCH'] = old_epoch
+ ENV["SOURCE_DATE_EPOCH"] = old_epoch
end
private
def ruby_install_name(name)
with_clean_path_to_ruby do
- orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
- RbConfig::CONFIG['ruby_install_name'] = name
+ orig_RUBY_INSTALL_NAME = RbConfig::CONFIG["ruby_install_name"]
+ RbConfig::CONFIG["ruby_install_name"] = name
begin
yield
ensure
if orig_RUBY_INSTALL_NAME
- RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
+ RbConfig::CONFIG["ruby_install_name"] = orig_RUBY_INSTALL_NAME
else
- RbConfig::CONFIG.delete 'ruby_install_name'
+ RbConfig::CONFIG.delete "ruby_install_name"
end
end
end
@@ -2074,12 +2074,12 @@ You may need to `bundle install` to install missing gems
end
def util_exec_gem
- spec, _ = util_spec 'a', '4' do |s|
- s.executables = ['exec', 'abin']
+ spec, _ = util_spec "a", "4" do |s|
+ s.executables = ["exec", "abin"]
end
- @exec_path = File.join spec.full_gem_path, spec.bindir, 'exec'
- @abin_path = File.join spec.full_gem_path, spec.bindir, 'abin'
+ @exec_path = File.join spec.full_gem_path, spec.bindir, "exec"
+ @abin_path = File.join spec.full_gem_path, spec.bindir, "abin"
spec
end
@@ -2093,20 +2093,20 @@ You may need to `bundle install` to install missing gems
end
def with_path_and_rubyopt(path_value, rubyopt_value)
- path, ENV['PATH'] = ENV['PATH'], path_value
- rubyopt, ENV['RUBYOPT'] = ENV['RUBYOPT'], rubyopt_value
+ path, ENV["PATH"] = ENV["PATH"], path_value
+ rubyopt, ENV["RUBYOPT"] = ENV["RUBYOPT"], rubyopt_value
yield
ensure
- ENV['PATH'] = path
- ENV['RUBYOPT'] = rubyopt
+ ENV["PATH"] = path
+ ENV["RUBYOPT"] = rubyopt
end
def with_rubygems_gemdeps(value)
- rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], value
+ rubygems_gemdeps, ENV["RUBYGEMS_GEMDEPS"] = ENV["RUBYGEMS_GEMDEPS"], value
yield
ensure
- ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
+ ENV["RUBYGEMS_GEMDEPS"] = rubygems_gemdeps
end
end
diff --git a/test/rubygems/test_gem_available_set.rb b/test/rubygems/test_gem_available_set.rb
index c4164d77f2..576f3f4221 100644
--- a/test/rubygems/test_gem_available_set.rb
+++ b/test/rubygems/test_gem_available_set.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/available_set'
-require 'rubygems/security'
+require_relative "helper"
+require "rubygems/available_set"
+require "rubygems/security"
class TestGemAvailableSet < Gem::TestCase
def setup
@@ -11,7 +11,7 @@ class TestGemAvailableSet < Gem::TestCase
end
def test_add_and_empty
- a1, _ = util_gem 'a', '1'
+ a1, _ = util_gem "a", "1"
set = Gem::AvailableSet.new
assert set.empty?
@@ -24,8 +24,8 @@ class TestGemAvailableSet < Gem::TestCase
end
def test_find_all
- a1, a1_gem = util_gem 'a', 1
- a1a, a1a_gem = util_gem 'a', '1.a'
+ a1, a1_gem = util_gem "a", 1
+ a1a, a1a_gem = util_gem "a", "1.a"
a1_source = Gem::Source::SpecificFile.new a1_gem
a1a_source = Gem::Source::SpecificFile.new a1a_gem
@@ -34,26 +34,26 @@ class TestGemAvailableSet < Gem::TestCase
set.add a1, a1_source
set.add a1a, a1a_source
- dep = Gem::Resolver::DependencyRequest.new dep('a'), nil
+ dep = Gem::Resolver::DependencyRequest.new dep("a"), nil
assert_equal %w[a-1], set.find_all(dep).map {|spec| spec.full_name }
- dep = Gem::Resolver::DependencyRequest.new dep('a', '>= 0.a'), nil
+ dep = Gem::Resolver::DependencyRequest.new dep("a", ">= 0.a"), nil
assert_equal %w[a-1 a-1.a],
set.find_all(dep).map {|spec| spec.full_name }.sort
end
def test_match_platform
- a1, _ = util_gem 'a', '1' do |g|
+ a1, _ = util_gem "a", "1" do |g|
g.platform = "something-weird-yep"
end
- a1c, _ = util_gem 'a', '2' do |g|
+ a1c, _ = util_gem "a", "2" do |g|
g.platform = Gem::Platform.local
end
- a2, _ = util_gem 'a', '2'
+ a2, _ = util_gem "a", "2"
set = Gem::AvailableSet.new
set.add a1, @source
@@ -66,8 +66,8 @@ class TestGemAvailableSet < Gem::TestCase
end
def test_best
- a1, _ = util_gem 'a', '1'
- a2, _ = util_gem 'a', '2'
+ a1, _ = util_gem "a", "1"
+ a2, _ = util_gem "a", "2"
set = Gem::AvailableSet.new
set.add a1, @source
@@ -79,7 +79,7 @@ class TestGemAvailableSet < Gem::TestCase
end
def test_remove_installed_bang
- a1, _ = util_spec 'a', '1'
+ a1, _ = util_spec "a", "1"
install_specs a1
a1.activate
@@ -95,8 +95,8 @@ class TestGemAvailableSet < Gem::TestCase
end
def test_sorted_normal_versions
- a1, _ = util_gem 'a', '1'
- a2, _ = util_gem 'a', '2'
+ a1, _ = util_gem "a", "1"
+ a2, _ = util_gem "a", "2"
set = Gem::AvailableSet.new
set.add a1, @source
@@ -109,11 +109,11 @@ class TestGemAvailableSet < Gem::TestCase
end
def test_sorted_respect_pre
- a1a, _ = util_gem 'a', '1.a'
- a1, _ = util_gem 'a', '1'
- a2a, _ = util_gem 'a', '2.a'
- a2, _ = util_gem 'a', '2'
- a3a, _ = util_gem 'a', '3.a'
+ a1a, _ = util_gem "a", "1.a"
+ a1, _ = util_gem "a", "1"
+ a2a, _ = util_gem "a", "2.a"
+ a2, _ = util_gem "a", "2"
+ a3a, _ = util_gem "a", "3.a"
set = Gem::AvailableSet.new
set.add a1, @source
diff --git a/test/rubygems/test_gem_bundler_version_finder.rb b/test/rubygems/test_gem_bundler_version_finder.rb
index 7494a94d6e..0e21e460f6 100644
--- a/test/rubygems/test_gem_bundler_version_finder.rb
+++ b/test/rubygems/test_gem_bundler_version_finder.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemBundlerVersionFinder < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb
index 65b9b040b7..99fa89364d 100644
--- a/test/rubygems/test_gem_command.rb
+++ b/test/rubygems/test_gem_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/command'
+require_relative "helper"
+require "rubygems/command"
class Gem::Command
public :parser
@@ -15,13 +15,13 @@ class TestGemCommand < Gem::TestCase
@common_options = Gem::Command.common_options.dup
Gem::Command.common_options.clear
Gem::Command.common_options << [
- ['-x', '--exe', 'Execute'], lambda do |*a|
+ ["-x", "--exe", "Execute"], lambda do |*a|
@xopt = true
end
]
- @cmd_name = 'doit'
- @cmd = Gem::Command.new @cmd_name, 'summary'
+ @cmd_name = "doit"
+ @cmd = Gem::Command.new @cmd_name, "summary"
end
def teardown
@@ -31,7 +31,7 @@ class TestGemCommand < Gem::TestCase
def test_self_add_specific_extra_args
added_args = %w[--all]
- @cmd.add_option('--all') {|v,o| }
+ @cmd.add_option("--all") {|v,o| }
Gem::Command.add_specific_extra_args @cmd_name, added_args
@@ -86,7 +86,7 @@ class TestGemCommand < Gem::TestCase
end
def test_defaults
- @cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
+ @cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |value, options|
options[:help] = value
end
@@ -119,7 +119,7 @@ class TestGemCommand < Gem::TestCase
@cmd.when_invoked { true }
ex = assert_raise Gem::OptionParser::InvalidOption do
- @cmd.invoke('-zzz')
+ @cmd.invoke("-zzz")
end
assert_match(/invalid option:/, ex.message)
@@ -151,12 +151,12 @@ class TestGemCommand < Gem::TestCase
done = false
use_ui @ui do
- @cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
+ @cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |value, options|
options[:help] = true
done = true
end
- @cmd.invoke('--help')
+ @cmd.invoke("--help")
assert done
end
@@ -174,7 +174,7 @@ class TestGemCommand < Gem::TestCase
end
def test_invoke_with_options
- @cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
+ @cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |value, options|
options[:help] = true
end
@@ -183,7 +183,7 @@ class TestGemCommand < Gem::TestCase
end
use_ui @ui do
- @cmd.invoke '-h'
+ @cmd.invoke "-h"
end
assert_match %r{Usage: gem doit}, @ui.output
@@ -191,40 +191,40 @@ class TestGemCommand < Gem::TestCase
def test_add_option
assert_nothing_raised RuntimeError do
- @cmd.add_option('--force', 'skip validation of the spec') {|v,o| }
+ @cmd.add_option("--force", "skip validation of the spec") {|v,o| }
end
end
def test_add_option_with_empty
assert_raise RuntimeError, "Do not pass an empty string in opts" do
- @cmd.add_option('', 'skip validation of the spec') {|v,o| }
+ @cmd.add_option("", "skip validation of the spec") {|v,o| }
end
end
def test_option_recognition
- @cmd.add_option('-h', '--help [COMMAND]', 'Get help on COMMAND') do |value, options|
+ @cmd.add_option("-h", "--help [COMMAND]", "Get help on COMMAND") do |value, options|
options[:help] = true
end
- @cmd.add_option('-f', '--file FILE', 'File option') do |value, options|
+ @cmd.add_option("-f", "--file FILE", "File option") do |value, options|
options[:help] = true
end
- @cmd.add_option('--silent', 'Silence RubyGems output') do |value, options|
+ @cmd.add_option("--silent", "Silence RubyGems output") do |value, options|
options[:silent] = true
end
- assert @cmd.handles?(['-x'])
- assert @cmd.handles?(['-h'])
- assert @cmd.handles?(['-h', 'command'])
- assert @cmd.handles?(['--help', 'command'])
- assert @cmd.handles?(['-f', 'filename'])
- assert @cmd.handles?(['--file=filename'])
- assert @cmd.handles?(['--silent'])
- refute @cmd.handles?(['-z'])
- refute @cmd.handles?(['-f'])
- refute @cmd.handles?(['--toothpaste'])
-
- args = ['-h', 'command']
+ assert @cmd.handles?(["-x"])
+ assert @cmd.handles?(["-h"])
+ assert @cmd.handles?(["-h", "command"])
+ assert @cmd.handles?(["--help", "command"])
+ assert @cmd.handles?(["-f", "filename"])
+ assert @cmd.handles?(["--file=filename"])
+ assert @cmd.handles?(["--silent"])
+ refute @cmd.handles?(["-z"])
+ refute @cmd.handles?(["-f"])
+ refute @cmd.handles?(["--toothpaste"])
+
+ args = ["-h", "command"]
@cmd.handles?(args)
- assert_equal ['-h', 'command'], args
+ assert_equal ["-h", "command"], args
end
def test_deprecate_option
@@ -234,13 +234,13 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg
testCommand = Class.new(Gem::Command) do
def initialize
- super('test', 'Gem::Command instance for testing')
+ super("test", "Gem::Command instance for testing")
- add_option('-t', '--test', 'Test command') do |value, options|
+ add_option("-t", "--test", "Test command") do |value, options|
options[:test] = true
end
- deprecate_option('--test', version: '3.1')
+ deprecate_option("--test", version: "3.1")
end
def execute
@@ -263,13 +263,13 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur
testCommand = Class.new(Gem::Command) do
def initialize
- super('test', 'Gem::Command instance for testing')
+ super("test", "Gem::Command instance for testing")
- add_option('-t', '--test', 'Test command') do |value, options|
+ add_option("-t", "--test", "Test command") do |value, options|
options[:test] = true
end
- deprecate_option('--test')
+ deprecate_option("--test")
end
def execute
@@ -292,13 +292,13 @@ WARNING: The \"--test\" option has been deprecated and will be removed in Rubyg
testCommand = Class.new(Gem::Command) do
def initialize
- super('test', 'Gem::Command instance for testing')
+ super("test", "Gem::Command instance for testing")
- add_option('-t', '--test', 'Test command') do |value, options|
+ add_option("-t", "--test", "Test command") do |value, options|
options[:test] = true
end
- deprecate_option('--test', version: '3.1', extra_msg: 'Whether you set `--test` mode or not, this dummy app always runs in test mode.')
+ deprecate_option("--test", version: "3.1", extra_msg: "Whether you set `--test` mode or not, this dummy app always runs in test mode.")
end
def execute
@@ -321,13 +321,13 @@ WARNING: The \"--test\" option has been deprecated and will be removed in futur
testCommand = Class.new(Gem::Command) do
def initialize
- super('test', 'Gem::Command instance for testing')
+ super("test", "Gem::Command instance for testing")
- add_option('-t', '--test', 'Test command') do |value, options|
+ add_option("-t", "--test", "Test command") do |value, options|
options[:test] = true
end
- deprecate_option('--test', extra_msg: 'Whether you set `--test` mode or not, this dummy app always runs in test mode.')
+ deprecate_option("--test", extra_msg: "Whether you set `--test` mode or not, this dummy app always runs in test mode.")
end
def execute
@@ -364,11 +364,11 @@ ERROR: Could not find a valid gem 'nonexistent_with_hint' (>= 0) in any reposit
def test_show_lookup_failure_suggestions_none
spec_fetcher do |fetcher|
- fetcher.spec 'correct', 2
+ fetcher.spec "correct", 2
end
use_ui @ui do
- @cmd.show_lookup_failure 'other', Gem::Requirement.default, [], :remote
+ @cmd.show_lookup_failure "other", Gem::Requirement.default, [], :remote
end
expected = <<-EXPECTED
diff --git a/test/rubygems/test_gem_command_manager.rb b/test/rubygems/test_gem_command_manager.rb
index 00197d10f7..b8f35192ae 100644
--- a/test/rubygems/test_gem_command_manager.rb
+++ b/test/rubygems/test_gem_command_manager.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/command_manager'
+require_relative "helper"
+require "rubygems/command_manager"
class TestGemCommandManager < Gem::TestCase
- PROJECT_DIR = File.expand_path('../..', __dir__).tap(&Gem::UNTAINT)
+ PROJECT_DIR = File.expand_path("../..", __dir__).tap(&Gem::UNTAINT)
def setup
super
@@ -12,38 +12,38 @@ class TestGemCommandManager < Gem::TestCase
end
def test_find_command
- command = @command_manager.find_command 'install'
+ command = @command_manager.find_command "install"
assert_kind_of Gem::Commands::InstallCommand, command
- command = @command_manager.find_command 'ins'
+ command = @command_manager.find_command "ins"
assert_kind_of Gem::Commands::InstallCommand, command
end
def test_find_command_ambiguous
e = assert_raise Gem::CommandLineError do
- @command_manager.find_command 'u'
+ @command_manager.find_command "u"
end
- assert_equal 'Ambiguous command u matches [uninstall, unpack, update]',
+ assert_equal "Ambiguous command u matches [uninstall, unpack, update]",
e.message
end
def test_find_alias_command
- command = @command_manager.find_command 'i'
+ command = @command_manager.find_command "i"
assert_kind_of Gem::Commands::InstallCommand, command
end
def test_find_login_alias_command
- command = @command_manager.find_command 'login'
+ command = @command_manager.find_command "login"
assert_kind_of Gem::Commands::SigninCommand, command
end
def test_find_logout_alias_comamnd
- command = @command_manager.find_command 'logout'
+ command = @command_manager.find_command "logout"
assert_kind_of Gem::Commands::SignoutCommand, command
end
@@ -54,7 +54,7 @@ class TestGemCommandManager < Gem::TestCase
@command_manager.register_command :ins
- command = @command_manager.find_command 'ins'
+ command = @command_manager.find_command "ins"
assert_kind_of ins_command, command
ensure
@@ -63,18 +63,18 @@ class TestGemCommandManager < Gem::TestCase
def test_find_command_unknown
e = assert_raise Gem::UnknownCommandError do
- @command_manager.find_command 'xyz'
+ @command_manager.find_command "xyz"
end
- assert_equal 'Unknown command xyz', e.message
+ assert_equal "Unknown command xyz", e.message
end
def test_find_command_unknown_suggestions
e = assert_raise Gem::UnknownCommandError do
- @command_manager.find_command 'pish'
+ @command_manager.find_command "pish"
end
- message = 'Unknown command pish'.dup
+ message = "Unknown command pish".dup
if RUBY_VERSION >= "2.4" && defined?(DidYouMean::SPELL_CHECKERS) && defined?(DidYouMean::Correctable)
message << "\nDid you mean? \"push\""
@@ -100,7 +100,7 @@ class TestGemCommandManager < Gem::TestCase
assert_raise Gem::MockGemUi::TermError do
@command_manager.run %w[interrupt]
end
- assert_equal '', ui.output
+ assert_equal "", ui.output
assert_equal "ERROR: Interrupted\n", ui.error
end
ensure
@@ -117,7 +117,7 @@ class TestGemCommandManager < Gem::TestCase
assert_raise Gem::MockGemUi::TermError do
@command_manager.run %w[crash]
end
- assert_equal '', ui.output
+ assert_equal "", ui.output
err = ui.error.split("\n").first
assert_equal "ERROR: Loading command: crash (RuntimeError)", err
end
@@ -141,7 +141,7 @@ class TestGemCommandManager < Gem::TestCase
#capture all install options
use_ui @ui do
check_options = nil
- @command_manager['install'].when_invoked do |options|
+ @command_manager["install"].when_invoked do |options|
check_options = options
true
end
@@ -166,7 +166,7 @@ class TestGemCommandManager < Gem::TestCase
assert_equal true, check_options[:force]
assert_equal :local, check_options[:domain]
assert_equal false, check_options[:wrappers]
- assert_equal Gem::Requirement.new('3.0'), check_options[:version]
+ assert_equal Gem::Requirement.new("3.0"), check_options[:version]
assert_equal Dir.pwd, check_options[:install_dir]
assert_equal Dir.pwd, check_options[:bin_dir]
@@ -191,7 +191,7 @@ class TestGemCommandManager < Gem::TestCase
def test_process_args_uninstall
#capture all uninstall options
check_options = nil
- @command_manager['uninstall'].when_invoked do |options|
+ @command_manager["uninstall"].when_invoked do |options|
check_options = options
true
end
@@ -204,14 +204,14 @@ class TestGemCommandManager < Gem::TestCase
check_options = nil
@command_manager.process_args %w[uninstall foobar --version 3.0]
assert_equal "foobar", check_options[:args].first
- assert_equal Gem::Requirement.new('3.0'), check_options[:version]
+ assert_equal Gem::Requirement.new("3.0"), check_options[:version]
end
# HACK move to check command test
def test_process_args_check
#capture all check options
check_options = nil
- @command_manager['check'].when_invoked do |options|
+ @command_manager["check"].when_invoked do |options|
check_options = options
true
end
@@ -230,7 +230,7 @@ class TestGemCommandManager < Gem::TestCase
def test_process_args_build
#capture all build options
check_options = nil
- @command_manager['build'].when_invoked do |options|
+ @command_manager["build"].when_invoked do |options|
check_options = options
true
end
@@ -242,14 +242,14 @@ class TestGemCommandManager < Gem::TestCase
#check settings
check_options = nil
@command_manager.process_args %w[build foobar.rb]
- assert_equal 'foobar.rb', check_options[:args].first
+ assert_equal "foobar.rb", check_options[:args].first
end
# HACK move to query command test
def test_process_args_query
#capture all query options
check_options = nil
- @command_manager['query'].when_invoked do |options|
+ @command_manager["query"].when_invoked do |options|
check_options = options
true
end
@@ -290,25 +290,25 @@ class TestGemCommandManager < Gem::TestCase
def test_process_args_update
#capture all update options
check_options = nil
- @command_manager['update'].when_invoked do |options|
+ @command_manager["update"].when_invoked do |options|
check_options = options
true
end
#check defaults
@command_manager.process_args %w[update]
- assert_includes check_options[:document], 'ri'
+ assert_includes check_options[:document], "ri"
#check settings
check_options = nil
@command_manager.process_args %w[update --force --document=ri --install-dir .]
- assert_includes check_options[:document], 'ri'
+ assert_includes check_options[:document], "ri"
assert_equal true, check_options[:force]
assert_equal Dir.pwd, check_options[:install_dir]
end
def test_deprecated_command
- require 'rubygems/command'
+ require "rubygems/command"
foo_command = Class.new(Gem::Command) do
extend Gem::Deprecate
diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb
index 1304beb580..1edb30f221 100644
--- a/test/rubygems/test_gem_commands_build_command.rb
+++ b/test/rubygems/test_gem_commands_build_command.rb
@@ -1,32 +1,32 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/build_command'
-require 'rubygems/package'
+require_relative "helper"
+require "rubygems/commands/build_command"
+require "rubygems/package"
class TestGemCommandsBuildCommand < Gem::TestCase
- CERT_FILE = cert_path 'public3072'
- SIGNING_KEY = key_path 'private3072'
+ CERT_FILE = cert_path "public3072"
+ SIGNING_KEY = key_path "private3072"
- EXPIRED_CERT_FILE = cert_path 'expired'
- PRIVATE_KEY_FILE = key_path 'private'
+ EXPIRED_CERT_FILE = cert_path "expired"
+ PRIVATE_KEY_FILE = key_path "private"
def setup
super
- readme_file = File.join(@tempdir, 'README.md')
+ readme_file = File.join(@tempdir, "README.md")
begin
umask_orig = File.umask(2)
- File.open readme_file, 'w' do |f|
- f.write 'My awesome gem'
+ File.open readme_file, "w" do |f|
+ f.write "My awesome gem"
end
ensure
File.umask(umask_orig)
end
- @gem = util_spec 'some_gem' do |s|
- s.license = 'AGPL-3.0'
- s.files = ['README.md']
+ @gem = util_spec "some_gem" do |s|
+ s.license = "AGPL-3.0"
+ s.files = ["README.md"]
end
@cmd = Gem::Commands::BuildCommand.new
@@ -44,7 +44,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
def test_options_filename
gemspec_file = File.join(@tempdir, @gem.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -79,7 +79,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
def test_execute
gemspec_file = File.join(@tempdir, @gem.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -91,7 +91,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
def test_execute_platform
gemspec_file = File.join(@tempdir, @gem.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -110,15 +110,15 @@ class TestGemCommandsBuildCommand < Gem::TestCase
def test_execute_bad_name
[".", "-", "_"].each do |special_char|
- gem = util_spec 'some_gem_with_bad_name' do |s|
+ gem = util_spec "some_gem_with_bad_name" do |s|
s.name = "#{special_char}bad_gem_name"
- s.license = 'AGPL-3.0'
- s.files = ['README.md']
+ s.license = "AGPL-3.0"
+ s.files = ["README.md"]
end
gemspec_file = File.join(@tempdir, gem.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write gem.to_ruby
end
@@ -137,7 +137,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
def test_execute_strict_without_warnings
gemspec_file = File.join(@tempdir, @gem.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -165,13 +165,13 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
def test_execute_strict_with_warnings
- bad_gem = util_spec 'some_bad_gem' do |s|
- s.files = ['README.md']
+ bad_gem = util_spec "some_bad_gem" do |s|
+ s.files = ["README.md"]
end
gemspec_file = File.join(@tempdir, bad_gem.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write bad_gem.to_ruby
end
@@ -201,7 +201,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
gemspec_file = File.join(@tempdir, @gem.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby.sub(/11-08/, "11-8")
end
@@ -218,7 +218,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
assert_equal "", out
assert_match(/invalid date format in specification/, err)
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
assert_equal "ERROR: Error loading gemspec. Aborting.\n", @ui.error
end
@@ -230,22 +230,22 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
end
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
assert_equal "ERROR: Couldn't find a gemspec file matching 'some_gem' in #{@tempdir}\n", @ui.error
end
def test_execute_outside_dir
- gemspec_dir = File.join @tempdir, 'build_command_gem'
+ gemspec_dir = File.join @tempdir, "build_command_gem"
gemspec_file = File.join gemspec_dir, @gem.spec_name
- readme_file = File.join gemspec_dir, 'README.md'
+ readme_file = File.join gemspec_dir, "README.md"
FileUtils.mkdir_p gemspec_dir
- File.open readme_file, 'w' do |f|
+ File.open readme_file, "w" do |f|
f.write "My awesome gem"
end
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -273,17 +273,17 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
def test_execute_outside_dir_with_glob_argument
- gemspec_dir = File.join @tempdir, 'build_command_gem'
+ gemspec_dir = File.join @tempdir, "build_command_gem"
gemspec_file = File.join gemspec_dir, @gem.spec_name
- readme_file = File.join gemspec_dir, 'README.md'
+ readme_file = File.join gemspec_dir, "README.md"
FileUtils.mkdir_p gemspec_dir
- File.open readme_file, 'w' do |f|
+ File.open readme_file, "w" do |f|
f.write "My awesome gem"
end
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -311,17 +311,17 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
def test_execute_outside_dir_no_gemspec_present
- gemspec_dir = File.join @tempdir, 'build_command_gem'
+ gemspec_dir = File.join @tempdir, "build_command_gem"
gemspec_file = File.join @tempdir, @gem.spec_name
- readme_file = File.join gemspec_dir, 'README.md'
+ readme_file = File.join gemspec_dir, "README.md"
FileUtils.mkdir_p gemspec_dir
- File.open readme_file, 'w' do |f|
+ File.open readme_file, "w" do |f|
f.write "My awesome gem"
end
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -342,14 +342,14 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
def test_execute_outside_dir_without_gem_name
- gemspec_dir = File.join(@tempdir, 'build_command_gem')
+ gemspec_dir = File.join(@tempdir, "build_command_gem")
gemspec_file = File.join(gemspec_dir, @gem.spec_name)
- readme_file = File.join gemspec_dir, 'README.md'
+ readme_file = File.join gemspec_dir, "README.md"
FileUtils.mkdir_p(gemspec_dir)
- File.open readme_file, 'w' do |f|
+ File.open readme_file, "w" do |f|
f.write "My awesome gem"
end
@@ -383,20 +383,20 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
def test_execute_outside_dir_with_external_gemspec
- gemspec_dir = File.join @tempdir, 'gemspec_dir'
+ gemspec_dir = File.join @tempdir, "gemspec_dir"
gemspec_file = File.join gemspec_dir, @gem.spec_name
- gemcode_dir = File.join @tempdir, 'build_command_gem'
- readme_file = File.join gemcode_dir, 'README.md'
+ gemcode_dir = File.join @tempdir, "build_command_gem"
+ readme_file = File.join gemcode_dir, "README.md"
FileUtils.mkdir_p gemspec_dir
FileUtils.mkdir_p gemcode_dir
- File.open readme_file, 'w' do |f|
+ File.open readme_file, "w" do |f|
f.write "My awesome gem in nested directory"
end
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -424,20 +424,20 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
def test_execute_outside_dir_with_external_relative_gemspec
- gemspec_dir = File.join @tempdir, 'gemspec_dir'
+ gemspec_dir = File.join @tempdir, "gemspec_dir"
gemspec_file = File.join gemspec_dir, @gem.spec_name
- gemcode_dir = File.join @tempdir, 'build_command_gem'
- readme_file = File.join gemcode_dir, 'README.md'
+ gemcode_dir = File.join @tempdir, "build_command_gem"
+ readme_file = File.join gemcode_dir, "README.md"
FileUtils.mkdir_p gemspec_dir
FileUtils.mkdir_p gemcode_dir
- File.open readme_file, 'w' do |f|
+ File.open readme_file, "w" do |f|
f.write "My awesome gem in nested directory"
end
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -467,7 +467,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
def test_can_find_gemspecs_without_dot_gemspec
gemspec_file = File.join(@tempdir, @gem.name)
- File.open gemspec_file + ".gemspec", 'w' do |gs|
+ File.open gemspec_file + ".gemspec", "w" do |gs|
gs.write @gem.to_ruby
end
@@ -571,7 +571,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
@gem.send :remove_instance_variable, :@rubygems_version
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write @gem.to_ruby
end
@@ -582,18 +582,18 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
def test_build_signed_gem
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL && !java_platform?
trust_dir = Gem::Security.trust_dir
- spec = util_spec 'some_gem' do |s|
+ spec = util_spec "some_gem" do |s|
s.signing_key = SIGNING_KEY
s.cert_chain = [CERT_FILE]
end
gemspec_file = File.join(@tempdir, spec.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write spec.to_ruby
end
@@ -609,7 +609,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
def test_build_signed_gem_with_cert_expiration_length_days
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL && !java_platform?
gem_path = File.join Gem.user_home, ".gem"
Dir.mkdir gem_path
@@ -622,14 +622,14 @@ class TestGemCommandsBuildCommand < Gem::TestCase
tmp_private_key_file = File.join gem_path, "gem-private_key.pem"
File.write(tmp_private_key_file, File.read(PRIVATE_KEY_FILE))
- spec = util_spec 'some_gem' do |s|
+ spec = util_spec "some_gem" do |s|
s.signing_key = tmp_private_key_file
s.cert_chain = [tmp_expired_cert_file]
end
gemspec_file = File.join(@tempdir, spec.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write spec.to_ruby
end
@@ -653,7 +653,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
end
def test_build_auto_resign_cert
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL && !java_platform?
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL && !java_platform?
gem_path = File.join Gem.user_home, ".gem"
Dir.mkdir gem_path
@@ -666,14 +666,14 @@ class TestGemCommandsBuildCommand < Gem::TestCase
tmp_private_key_file = File.join gem_path, "gem-private_key.pem"
File.write(tmp_private_key_file, File.read(PRIVATE_KEY_FILE))
- spec = util_spec 'some_gem' do |s|
+ spec = util_spec "some_gem" do |s|
s.signing_key = tmp_private_key_file
s.cert_chain = [tmp_expired_cert_file]
end
gemspec_file = File.join(@tempdir, spec.spec_name)
- File.open gemspec_file, 'w' do |gs|
+ File.open gemspec_file, "w" do |gs|
gs.write spec.to_ruby
end
diff --git a/test/rubygems/test_gem_commands_cert_command.rb b/test/rubygems/test_gem_commands_cert_command.rb
index 901bf5aed6..ffcc14ffbb 100644
--- a/test/rubygems/test_gem_commands_cert_command.rb
+++ b/test/rubygems/test_gem_commands_cert_command.rb
@@ -1,28 +1,28 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/cert_command'
+require_relative "helper"
+require "rubygems/commands/cert_command"
unless Gem::HAVE_OPENSSL
- warn 'Skipping `gem cert` tests. openssl not found.'
+ warn "Skipping `gem cert` tests. openssl not found."
end
if Gem.java_platform?
- warn 'Skipping `gem cert` tests on jruby.'
+ warn "Skipping `gem cert` tests on jruby."
end
class TestGemCommandsCertCommand < Gem::TestCase
- ALTERNATE_CERT = load_cert 'alternate'
- EXPIRED_PUBLIC_CERT = load_cert 'expired'
+ ALTERNATE_CERT = load_cert "alternate"
+ EXPIRED_PUBLIC_CERT = load_cert "expired"
- ALTERNATE_KEY_FILE = key_path 'alternate'
- PRIVATE_KEY_FILE = key_path 'private'
- PRIVATE_EC_KEY_FILE = key_path 'private_ec'
- PUBLIC_KEY_FILE = key_path 'public'
+ ALTERNATE_KEY_FILE = key_path "alternate"
+ PRIVATE_KEY_FILE = key_path "private"
+ PRIVATE_EC_KEY_FILE = key_path "private_ec"
+ PUBLIC_KEY_FILE = key_path "public"
- ALTERNATE_CERT_FILE = cert_path 'alternate'
- CHILD_CERT_FILE = cert_path 'child'
- PUBLIC_CERT_FILE = cert_path 'public'
- EXPIRED_PUBLIC_CERT_FILE = cert_path 'expired'
+ ALTERNATE_CERT_FILE = cert_path "alternate"
+ CHILD_CERT_FILE = cert_path "child"
+ PUBLIC_CERT_FILE = cert_path "public"
+ EXPIRED_PUBLIC_CERT_FILE = cert_path "expired"
def setup
super
@@ -44,7 +44,7 @@ class TestGemCommandsCertCommand < Gem::TestCase
@trust_dir.trust_cert PUBLIC_CERT
@trust_dir.trust_cert ALTERNATE_CERT
- matches = @cmd.certificates_matching ''
+ matches = @cmd.certificates_matching ""
# HACK OpenSSL::X509::Certificate#== is Object#==, so do this the hard way
match = matches.next
@@ -64,7 +64,7 @@ class TestGemCommandsCertCommand < Gem::TestCase
@trust_dir.trust_cert PUBLIC_CERT
@trust_dir.trust_cert ALTERNATE_CERT
- matches = @cmd.certificates_matching 'alternate'
+ matches = @cmd.certificates_matching "alternate"
match = matches.next
assert_equal ALTERNATE_CERT.to_pem, match.first.to_pem
@@ -91,7 +91,7 @@ class TestGemCommandsCertCommand < Gem::TestCase
end
def test_execute_add_twice
- self.class.cert_path 'alternate'
+ self.class.cert_path "alternate"
@cmd.handle_options %W[
--add #{PUBLIC_CERT_FILE}
@@ -112,7 +112,7 @@ Added '/CN=alternate/DC=example'
end
def test_execute_build
- passphrase = 'Foo bar'
+ passphrase = "Foo bar"
@cmd.handle_options %W[--build nobody@example.com]
@@ -139,12 +139,12 @@ Added '/CN=alternate/DC=example'
assert_empty output
assert_empty @build_ui.error
- assert_path_exist File.join(@tempdir, 'gem-private_key.pem')
- assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
+ assert_path_exist File.join(@tempdir, "gem-private_key.pem")
+ assert_path_exist File.join(@tempdir, "gem-public_cert.pem")
end
def test_execute_build_key_algorithm_ec_key
- passphrase = 'Foo bar'
+ passphrase = "Foo bar"
@cmd.handle_options %W[--build nobody@example.com --key-algorithm ec]
@@ -171,16 +171,16 @@ Added '/CN=alternate/DC=example'
assert_empty output
assert_empty @build_ui.error
- assert_path_exist File.join(@tempdir, 'gem-private_key.pem')
+ assert_path_exist File.join(@tempdir, "gem-private_key.pem")
- cert_path = File.join(@tempdir, 'gem-public_cert.pem')
+ cert_path = File.join(@tempdir, "gem-public_cert.pem")
assert_path_exist cert_path
cert = OpenSSL::X509::Certificate.new(File.read(cert_path))
assert cert.public_key.is_a? OpenSSL::PKey::EC
end
def test_execute_build_bad_email_address
- passphrase = 'Foo bar'
+ passphrase = "Foo bar"
email = "nobody@"
@cmd.handle_options %W[--build #{email}]
@@ -188,7 +188,6 @@ Added '/CN=alternate/DC=example'
@build_ui = Gem::MockGemUi.new "#{passphrase}\n#{passphrase}"
use_ui @build_ui do
-
e = assert_raise Gem::CommandLineError do
@cmd.execute
end
@@ -196,13 +195,13 @@ Added '/CN=alternate/DC=example'
assert_equal "Invalid email address #{email}",
e.message
- assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
- assert_path_not_exist File.join(@tempdir, 'gem-public_cert.pem')
+ assert_path_not_exist File.join(@tempdir, "gem-private_key.pem")
+ assert_path_not_exist File.join(@tempdir, "gem-public_cert.pem")
end
end
def test_execute_build_expiration_days
- passphrase = 'Foo bar'
+ passphrase = "Foo bar"
@cmd.handle_options %W[
--build nobody@example.com
@@ -232,8 +231,8 @@ Added '/CN=alternate/DC=example'
assert_empty output
assert_empty @build_ui.error
- assert_path_exist File.join(@tempdir, 'gem-private_key.pem')
- assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
+ assert_path_exist File.join(@tempdir, "gem-private_key.pem")
+ assert_path_exist File.join(@tempdir, "gem-public_cert.pem")
pem = File.read("#{@tempdir}/gem-public_cert.pem")
cert = OpenSSL::X509::Certificate.new(pem)
@@ -243,8 +242,8 @@ Added '/CN=alternate/DC=example'
end
def test_execute_build_bad_passphrase_confirmation
- passphrase = 'Foo bar'
- passphrase_confirmation = 'Fu bar'
+ passphrase = "Foo bar"
+ passphrase_confirmation = "Fu bar"
@cmd.handle_options %W[--build nobody@example.com]
@@ -266,11 +265,10 @@ Added '/CN=alternate/DC=example'
assert_equal "Passphrase and passphrase confirmation don't match",
e.message
-
end
- assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
- assert_path_not_exist File.join(@tempdir, 'gem-public_cert.pem')
+ assert_path_not_exist File.join(@tempdir, "gem-private_key.pem")
+ assert_path_not_exist File.join(@tempdir, "gem-public_cert.pem")
end
def test_execute_build_key
@@ -291,8 +289,8 @@ Added '/CN=alternate/DC=example'
assert_empty output
assert_empty @ui.error
- assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
- assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
+ assert_path_exist File.join(@tempdir, "gem-public_cert.pem")
+ assert_path_not_exist File.join(@tempdir, "gem-private_key.pem")
end
def test_execute_build_encrypted_key
@@ -313,7 +311,7 @@ Added '/CN=alternate/DC=example'
assert_empty output
assert_empty @ui.error
- assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
+ assert_path_exist File.join(@tempdir, "gem-public_cert.pem")
end
def test_execute_build_ec_key
@@ -334,8 +332,8 @@ Added '/CN=alternate/DC=example'
assert_empty output
assert_empty @ui.error
- assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
- assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
+ assert_path_exist File.join(@tempdir, "gem-public_cert.pem")
+ assert_path_not_exist File.join(@tempdir, "gem-private_key.pem")
end
def test_execute_certificate
@@ -343,8 +341,8 @@ Added '/CN=alternate/DC=example'
@cmd.handle_options %W[--certificate #{PUBLIC_CERT_FILE}]
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.output
+ assert_equal "", @ui.error
assert_equal PUBLIC_CERT.to_pem, @cmd.options[:issuer_cert].to_pem
end
@@ -383,8 +381,8 @@ Added '/CN=alternate/DC=example'
@cmd.send :handle_options, %W[--private-key #{PRIVATE_KEY_FILE}]
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.output
+ assert_equal "", @ui.error
assert_equal PRIVATE_KEY.to_pem, @cmd.options[:key].to_pem
end
@@ -394,8 +392,8 @@ Added '/CN=alternate/DC=example'
@cmd.send :handle_options, %W[--private-key #{ENCRYPTED_PRIVATE_KEY_PATH}]
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.output
+ assert_equal "", @ui.error
assert_equal ENCRYPTED_PRIVATE_KEY.to_pem, @cmd.options[:key].to_pem
end
@@ -414,7 +412,7 @@ Added '/CN=alternate/DC=example'
end
assert_equal "Removed '/CN=nobody/DC=example'\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
assert_path_not_exist cert_path
end
@@ -441,7 +439,7 @@ Removed '/CN=nobody/DC=example'
EXPECTED
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
assert_path_not_exist public_path
assert_path_not_exist alternate_path
@@ -469,17 +467,17 @@ Removed '/CN=alternate/DC=example'
EXPECTED
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
assert_path_not_exist public_path
assert_path_not_exist alternate_path
end
def test_execute_sign
- path = File.join @tempdir, 'cert.pem'
+ path = File.join @tempdir, "cert.pem"
Gem::Security.write ALTERNATE_CERT, path, 0600
- assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+ assert_equal "/CN=alternate/DC=example", ALTERNATE_CERT.issuer.to_s
@cmd.handle_options %W[
--private-key #{PRIVATE_KEY_FILE}
@@ -492,12 +490,12 @@ Removed '/CN=alternate/DC=example'
@cmd.execute
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.output
+ assert_equal "", @ui.error
cert = OpenSSL::X509::Certificate.new File.read path
- assert_equal '/CN=nobody/DC=example', cert.issuer.to_s
+ assert_equal "/CN=nobody/DC=example", cert.issuer.to_s
mask = 0100600 & (~File.umask)
@@ -505,10 +503,10 @@ Removed '/CN=alternate/DC=example'
end
def test_execute_sign_encrypted_key
- path = File.join @tempdir, 'cert.pem'
+ path = File.join @tempdir, "cert.pem"
Gem::Security.write ALTERNATE_CERT, path, 0600
- assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+ assert_equal "/CN=alternate/DC=example", ALTERNATE_CERT.issuer.to_s
@cmd.handle_options %W[
--private-key #{ENCRYPTED_PRIVATE_KEY_PATH}
@@ -521,12 +519,12 @@ Removed '/CN=alternate/DC=example'
@cmd.execute
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.output
+ assert_equal "", @ui.error
cert = OpenSSL::X509::Certificate.new File.read path
- assert_equal '/CN=nobody/DC=example', cert.issuer.to_s
+ assert_equal "/CN=nobody/DC=example", cert.issuer.to_s
mask = 0100600 & (~File.umask)
@@ -534,18 +532,18 @@ Removed '/CN=alternate/DC=example'
end
def test_execute_sign_default
- FileUtils.mkdir_p File.join Gem.user_home, '.gem'
+ FileUtils.mkdir_p File.join Gem.user_home, ".gem"
- private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ private_key_path = File.join Gem.user_home, ".gem", "gem-private_key.pem"
Gem::Security.write PRIVATE_KEY, private_key_path
- public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ public_cert_path = File.join Gem.user_home, ".gem", "gem-public_cert.pem"
Gem::Security.write PUBLIC_CERT, public_cert_path
- path = File.join @tempdir, 'cert.pem'
+ path = File.join @tempdir, "cert.pem"
Gem::Security.write ALTERNATE_CERT, path, 0600
- assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+ assert_equal "/CN=alternate/DC=example", ALTERNATE_CERT.issuer.to_s
@cmd.handle_options %W[--sign #{path}]
@@ -553,12 +551,12 @@ Removed '/CN=alternate/DC=example'
@cmd.execute
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.output
+ assert_equal "", @ui.error
cert = OpenSSL::X509::Certificate.new File.read path
- assert_equal '/CN=nobody/DC=example', cert.issuer.to_s
+ assert_equal "/CN=nobody/DC=example", cert.issuer.to_s
mask = 0100600 & (~File.umask)
@@ -566,18 +564,18 @@ Removed '/CN=alternate/DC=example'
end
def test_execute_sign_default_encrypted_key
- FileUtils.mkdir_p File.join(Gem.user_home, '.gem')
+ FileUtils.mkdir_p File.join(Gem.user_home, ".gem")
- private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ private_key_path = File.join Gem.user_home, ".gem", "gem-private_key.pem"
Gem::Security.write ENCRYPTED_PRIVATE_KEY, private_key_path, 0600, PRIVATE_KEY_PASSPHRASE
- public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ public_cert_path = File.join Gem.user_home, ".gem", "gem-public_cert.pem"
Gem::Security.write PUBLIC_CERT, public_cert_path
- path = File.join @tempdir, 'cert.pem'
+ path = File.join @tempdir, "cert.pem"
Gem::Security.write ALTERNATE_CERT, path, 0600
- assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+ assert_equal "/CN=alternate/DC=example", ALTERNATE_CERT.issuer.to_s
@cmd.handle_options %W[--sign #{path}]
@@ -585,12 +583,12 @@ Removed '/CN=alternate/DC=example'
@cmd.execute
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.output
+ assert_equal "", @ui.error
cert = OpenSSL::X509::Certificate.new File.read path
- assert_equal '/CN=nobody/DC=example', cert.issuer.to_s
+ assert_equal "/CN=nobody/DC=example", cert.issuer.to_s
mask = 0100600 & (~File.umask)
@@ -598,15 +596,15 @@ Removed '/CN=alternate/DC=example'
end
def test_execute_sign_no_cert
- FileUtils.mkdir_p File.join Gem.user_home, '.gem'
+ FileUtils.mkdir_p File.join Gem.user_home, ".gem"
- private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ private_key_path = File.join Gem.user_home, ".gem", "gem-private_key.pem"
Gem::Security.write PRIVATE_KEY, private_key_path
- path = File.join @tempdir, 'cert.pem'
+ path = File.join @tempdir, "cert.pem"
Gem::Security.write ALTERNATE_CERT, path, 0600
- assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+ assert_equal "/CN=alternate/DC=example", ALTERNATE_CERT.issuer.to_s
@cmd.handle_options %W[--sign #{path}]
@@ -616,7 +614,7 @@ Removed '/CN=alternate/DC=example'
end
end
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
expected = <<-EXPECTED
ERROR: --certificate not specified and ~/.gem/gem-public_cert.pem does not exist
@@ -626,15 +624,15 @@ ERROR: --certificate not specified and ~/.gem/gem-public_cert.pem does not exis
end
def test_execute_sign_no_key
- FileUtils.mkdir_p File.join Gem.user_home, '.gem'
+ FileUtils.mkdir_p File.join Gem.user_home, ".gem"
- public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ public_cert_path = File.join Gem.user_home, ".gem", "gem-public_cert.pem"
Gem::Security.write PUBLIC_CERT, public_cert_path
- path = File.join @tempdir, 'cert.pem'
+ path = File.join @tempdir, "cert.pem"
Gem::Security.write ALTERNATE_CERT, path, 0600
- assert_equal '/CN=alternate/DC=example', ALTERNATE_CERT.issuer.to_s
+ assert_equal "/CN=alternate/DC=example", ALTERNATE_CERT.issuer.to_s
@cmd.handle_options %W[--sign #{path}]
@@ -644,7 +642,7 @@ ERROR: --certificate not specified and ~/.gem/gem-public_cert.pem does not exis
end
end
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
expected = <<-EXPECTED
ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exist
@@ -657,10 +655,10 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
gem_path = File.join Gem.user_home, ".gem"
Dir.mkdir gem_path
- path = File.join @tempdir, 'cert.pem'
+ path = File.join @tempdir, "cert.pem"
Gem::Security.write EXPIRED_PUBLIC_CERT, path, 0600
- assert_equal '/CN=nobody/DC=example', EXPIRED_PUBLIC_CERT.issuer.to_s
+ assert_equal "/CN=nobody/DC=example", EXPIRED_PUBLIC_CERT.issuer.to_s
tmp_expired_cert_file = File.join(Dir.tmpdir, File.basename(EXPIRED_PUBLIC_CERT_FILE))
@cleanup << tmp_expired_cert_file
@@ -682,17 +680,17 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
/INFO: Your certificate #{tmp_expired_cert_file} has been re-signed\nINFO: Your expired certificate will be located at: #{expected_path}\.[0-9]+/,
@ui.output
)
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_re_sign_with_cert_expiration_length_days
gem_path = File.join Gem.user_home, ".gem"
Dir.mkdir gem_path
- path = File.join @tempdir, 'cert.pem'
+ path = File.join @tempdir, "cert.pem"
Gem::Security.write EXPIRED_PUBLIC_CERT, path, 0600
- assert_equal '/CN=nobody/DC=example', EXPIRED_PUBLIC_CERT.issuer.to_s
+ assert_equal "/CN=nobody/DC=example", EXPIRED_PUBLIC_CERT.issuer.to_s
tmp_expired_cert_file = File.join(Dir.tmpdir, File.basename(EXPIRED_PUBLIC_CERT_FILE))
@cleanup << tmp_expired_cert_file
@@ -714,7 +712,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
cert_days_to_expire = (re_signed_cert.not_after - re_signed_cert.not_before).to_i / (24 * 60 * 60)
assert_equal(28, cert_days_to_expire)
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_handle_options
@@ -740,11 +738,11 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
assert_equal %w[nobody@example other@example],
@cmd.options[:build].map {|name| name.to_s }
- assert_equal ['', 'example'], @cmd.options[:list]
+ assert_equal ["", "example"], @cmd.options[:list]
end
def test_handle_options_add_bad
- nonexistent = File.join @tempdir, 'nonexistent'
+ nonexistent = File.join @tempdir, "nonexistent"
e = assert_raise Gem::OptionParser::InvalidArgument do
@cmd.handle_options %W[--add #{nonexistent}]
end
@@ -752,7 +750,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
assert_equal "invalid argument: --add #{nonexistent}: does not exist",
e.message
- bad = File.join @tempdir, 'bad'
+ bad = File.join @tempdir, "bad"
FileUtils.touch bad
e = assert_raise Gem::OptionParser::InvalidArgument do
@@ -764,7 +762,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
end
def test_handle_options_certificate
- nonexistent = File.join @tempdir, 'nonexistent'
+ nonexistent = File.join @tempdir, "nonexistent"
e = assert_raise Gem::OptionParser::InvalidArgument do
@cmd.handle_options %W[--certificate #{nonexistent}]
end
@@ -772,7 +770,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
assert_equal "invalid argument: --certificate #{nonexistent}: does not exist",
e.message
- bad = File.join @tempdir, 'bad'
+ bad = File.join @tempdir, "bad"
FileUtils.touch bad
e = assert_raise Gem::OptionParser::InvalidArgument do
@@ -785,7 +783,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
end
def test_handle_options_key_bad
- nonexistent = File.join @tempdir, 'nonexistent'
+ nonexistent = File.join @tempdir, "nonexistent"
e = assert_raise Gem::OptionParser::InvalidArgument do
@cmd.handle_options %W[--private-key #{nonexistent}]
end
@@ -794,7 +792,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
"--private-key #{nonexistent}: does not exist",
e.message
- bad = File.join @tempdir, 'bad'
+ bad = File.join @tempdir, "bad"
FileUtils.touch bad
e = assert_raise Gem::OptionParser::InvalidArgument do
@@ -850,7 +848,7 @@ ERROR: --private-key not specified and ~/.gem/gem-private_key.pem does not exis
end
def test_handle_options_sign_nonexistent
- nonexistent = File.join @tempdir, 'nonexistent'
+ nonexistent = File.join @tempdir, "nonexistent"
e = assert_raise Gem::OptionParser::InvalidArgument do
@cmd.handle_options %W[
--private-key #{ALTERNATE_KEY_FILE}
diff --git a/test/rubygems/test_gem_commands_check_command.rb b/test/rubygems/test_gem_commands_check_command.rb
index f280b060c4..9233f7b5ce 100644
--- a/test/rubygems/test_gem_commands_check_command.rb
+++ b/test/rubygems/test_gem_commands_check_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/check_command'
+require_relative "helper"
+require "rubygems/commands/check_command"
class TestGemCommandsCheckCommand < Gem::TestCase
def setup
@@ -45,8 +45,8 @@ class TestGemCommandsCheckCommand < Gem::TestCase
end
def test_doctor
- gem 'a'
- b = gem 'b'
+ gem "a"
+ b = gem "b"
FileUtils.rm b.spec_file
diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb
index fc98998012..51d59df58c 100644
--- a/test/rubygems/test_gem_commands_cleanup_command.rb
+++ b/test/rubygems/test_gem_commands_cleanup_command.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/cleanup_command'
-require 'rubygems/installer'
+require_relative "helper"
+require "rubygems/commands/cleanup_command"
+require "rubygems/installer"
class TestGemCommandsCleanupCommand < Gem::TestCase
def setup
@@ -9,8 +9,8 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd = Gem::Commands::CleanupCommand.new
- @a_1 = util_spec 'a', 1
- @a_2 = util_spec 'a', 2
+ @a_1 = util_spec "a", 1
+ @a_2 = util_spec "a", 2
install_gem @a_1
install_gem @a_2
@@ -66,12 +66,12 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_all_dependencies
- @b_1 = util_spec 'b', 1 do |s|
- s.add_dependency 'a', '1'
+ @b_1 = util_spec "b", 1 do |s|
+ s.add_dependency "a", "1"
end
- @b_2 = util_spec 'b', 2 do |s|
- s.add_dependency 'a', '2'
+ @b_2 = util_spec "b", 2 do |s|
+ s.add_dependency "a", "2"
end
install_gem @b_1
@@ -86,12 +86,12 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_dev_dependencies
- @b_1 = util_spec 'b', 1 do |s|
- s.add_development_dependency 'a', '1'
+ @b_1 = util_spec "b", 1 do |s|
+ s.add_development_dependency "a", "1"
end
- @c_1 = util_spec 'c', 1 do |s|
- s.add_development_dependency 'a', '2'
+ @c_1 = util_spec "c", 1 do |s|
+ s.add_development_dependency "a", "2"
end
install_gem @b_1
@@ -105,12 +105,12 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_without_dev_dependencies
- @b_1 = util_spec 'b', 1 do |s|
- s.add_development_dependency 'a', '1'
+ @b_1 = util_spec "b", 1 do |s|
+ s.add_development_dependency "a", "1"
end
- @c_1 = util_spec 'c', 1 do |s|
- s.add_development_dependency 'a', '2'
+ @c_1 = util_spec "c", 1 do |s|
+ s.add_development_dependency "a", "2"
end
install_gem @b_1
@@ -124,14 +124,14 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_all
- gemhome2 = File.join @tempdir, 'gemhome2'
+ gemhome2 = File.join @tempdir, "gemhome2"
Gem.ensure_gem_subdirectories gemhome2
Gem.use_paths @gemhome, gemhome2
- @b_1 = util_spec 'b', 1
- @b_2 = util_spec 'b', 2
+ @b_1 = util_spec "b", 1
+ @b_2 = util_spec "b", 2
install_gem @b_1
install_gem @b_2
@@ -140,15 +140,15 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
@cmd.execute
- assert_equal @gemhome, Gem.dir, 'GEM_HOME'
- assert_equal [@gemhome, gemhome2], Gem.path.sort, 'GEM_PATH'
+ assert_equal @gemhome, Gem.dir, "GEM_HOME"
+ assert_equal [@gemhome, gemhome2], Gem.path.sort, "GEM_PATH"
assert_path_not_exist @a_1.gem_dir
assert_path_not_exist @b_1.gem_dir
end
def test_execute_all_user
- @a_1_1, = util_gem 'a', '1.1'
+ @a_1_1, = util_gem "a", "1.1"
@a_1_1 = install_gem @a_1_1 # pick up user install path
Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
@@ -167,7 +167,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
def test_execute_all_user_no_sudo
FileUtils.chmod 0555, @gemhome
- @a_1_1, = util_gem 'a', '1.1'
+ @a_1_1, = util_gem "a", "1.1"
@a_1_1 = install_gem @a_1_1, :user_install => true # pick up user install path
Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
@@ -195,11 +195,11 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_keeps_older_versions_with_deps
- @b_1 = util_spec 'b', 1
- @b_2 = util_spec 'b', 2
+ @b_1 = util_spec "b", 1
+ @b_2 = util_spec "b", 2
- @c = util_spec 'c', 1 do |s|
- s.add_dependency 'b', '1'
+ @c = util_spec "c", 1 do |s|
+ s.add_dependency "b", "1"
end
install_gem @b_1
@@ -216,9 +216,9 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
def test_execute_ignore_default_gem_verbose
Gem.configuration.verbose = :really
- @b_1 = util_spec 'b', 1
+ @b_1 = util_spec "b", 1
@b_default = new_default_spec "b", "2"
- @b_2 = util_spec 'b', 3
+ @b_2 = util_spec "b", 3
install_gem @b_1
install_default_gems @b_default
@@ -235,12 +235,12 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_remove_gem_home_only
- c_1, = util_gem 'c', '1'
- c_2, = util_gem 'c', '2'
- d_1, = util_gem 'd', '1'
- d_2, = util_gem 'd', '2'
- e_1, = util_gem 'e', '1'
- e_2, = util_gem 'e', '2'
+ c_1, = util_gem "c", "1"
+ c_2, = util_gem "c", "2"
+ d_1, = util_gem "d", "1"
+ d_2, = util_gem "d", "2"
+ e_1, = util_gem "e", "1"
+ e_2, = util_gem "e", "2"
c_1 = install_gem c_1, :user_install => true # pick up user install path
c_2 = install_gem c_2
@@ -263,11 +263,11 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_user_install
- c_1, = util_gem 'c', '1.0'
- c_2, = util_gem 'c', '1.1'
+ c_1, = util_gem "c", "1.0"
+ c_2, = util_gem "c", "1.1"
- d_1, = util_gem 'd', '1.0'
- d_2, = util_gem 'd', '1.1'
+ d_1, = util_gem "d", "1.0"
+ d_2, = util_gem "d", "1.1"
c_1 = install_gem c_1, :user_install => true # pick up user install path
c_2 = install_gem c_2, :user_install => true # pick up user install path
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb
index cf93d81e7e..1b9da8a92e 100644
--- a/test/rubygems/test_gem_commands_contents_command.rb
+++ b/test/rubygems/test_gem_commands_contents_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/contents_command'
+require_relative "helper"
+require "rubygems/commands/contents_command"
class TestGemCommandsContentsCommand < Gem::TestCase
def setup
@@ -20,7 +20,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute
@cmd.options[:args] = %w[foo]
- gem 'foo'
+ gem "foo"
use_ui @ui do
@cmd.execute
@@ -34,8 +34,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute_all
@cmd.options[:all] = true
- gem 'foo'
- gem 'bar'
+ gem "foo"
+ gem "bar"
use_ui @ui do
@cmd.execute
@@ -63,8 +63,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute_exact_match
@cmd.options[:args] = %w[foo]
- gem 'foo'
- gem 'bar'
+ gem "foo"
+ gem "bar"
use_ui @ui do
@cmd.execute
@@ -79,7 +79,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
@cmd.options[:args] = %w[foo]
@cmd.options[:lib_only] = true
- gem 'foo'
+ gem "foo"
use_ui @ui do
@cmd.execute
@@ -106,9 +106,9 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute_missing_version
@cmd.options[:args] = %w[foo]
- @cmd.options[:version] = Gem::Requirement.new '= 2'
+ @cmd.options[:version] = Gem::Requirement.new "= 2"
- gem 'foo', 1
+ gem "foo", 1
assert_raise Gem::MockGemUi::TermError do
use_ui @ui do
@@ -123,7 +123,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute_missing_multiple
@cmd.options[:args] = %w[foo bar]
- gem 'foo'
+ gem "foo"
use_ui @ui do
@cmd.execute
@@ -138,8 +138,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute_multiple
@cmd.options[:args] = %w[foo bar]
- gem 'foo'
- gem 'bar'
+ gem "foo"
+ gem "bar"
use_ui @ui do
@cmd.execute
@@ -155,13 +155,13 @@ class TestGemCommandsContentsCommand < Gem::TestCase
@cmd.options[:args] = %w[foo]
@cmd.options[:show_install_dir] = true
- gem 'foo'
+ gem "foo"
use_ui @ui do
@cmd.execute
end
- expected = File.join @gemhome, 'gems', 'foo-2'
+ expected = File.join @gemhome, "gems", "foo-2"
assert_equal "#{expected}\n", @ui.output
assert_equal "", @ui.error
@@ -171,14 +171,14 @@ class TestGemCommandsContentsCommand < Gem::TestCase
@cmd.options[:args] = %w[foo]
@cmd.options[:show_install_dir] = true
- gem 'foo', 1
- gem 'foo', 2
+ gem "foo", 1
+ gem "foo", 2
use_ui @ui do
@cmd.execute
end
- expected = File.join @gemhome, 'gems', 'foo-2'
+ expected = File.join @gemhome, "gems", "foo-2"
assert_equal "#{expected}\n", @ui.output
assert_equal "", @ui.error
@@ -187,16 +187,16 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute_show_install_dir_version
@cmd.options[:args] = %w[foo]
@cmd.options[:show_install_dir] = true
- @cmd.options[:version] = Gem::Requirement.new '= 1'
+ @cmd.options[:version] = Gem::Requirement.new "= 1"
- gem 'foo', 1
- gem 'foo', 2
+ gem "foo", 1
+ gem "foo", 2
use_ui @ui do
@cmd.execute
end
- expected = File.join @gemhome, 'gems', 'foo-1'
+ expected = File.join @gemhome, "gems", "foo-1"
assert_equal "#{expected}\n", @ui.output
assert_equal "", @ui.error
@@ -206,7 +206,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
@cmd.options[:args] = %w[foo]
@cmd.options[:prefix] = false
- gem 'foo'
+ gem "foo"
use_ui @ui do
@cmd.execute
@@ -236,9 +236,9 @@ lib/foo.rb
end
expected = [
- [RbConfig::CONFIG['bindir'], 'default_command'],
- [RbConfig::CONFIG['rubylibdir'], 'default/gem.rb'],
- [RbConfig::CONFIG['archdir'], 'default_gem.so'],
+ [RbConfig::CONFIG["bindir"], "default_command"],
+ [RbConfig::CONFIG["rubylibdir"], "default/gem.rb"],
+ [RbConfig::CONFIG["archdir"], "default_gem.so"],
].sort.map {|a|File.join a }.join "\n"
assert_equal expected, @ui.output.chomp
@@ -264,7 +264,7 @@ lib/foo.rb
assert @cmd.options[:lib_only]
refute @cmd.options[:prefix]
assert_equal %w[foo], @cmd.options[:specdirs]
- assert_equal Gem::Requirement.new('0.0.2'), @cmd.options[:version]
+ assert_equal Gem::Requirement.new("0.0.2"), @cmd.options[:version]
assert @cmd.options[:show_install_dir]
end
end
diff --git a/test/rubygems/test_gem_commands_dependency_command.rb b/test/rubygems/test_gem_commands_dependency_command.rb
index 13c7c065b5..d9571275cb 100644
--- a/test/rubygems/test_gem_commands_dependency_command.rb
+++ b/test/rubygems/test_gem_commands_dependency_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/dependency_command'
+require_relative "helper"
+require "rubygems/commands/dependency_command"
class TestGemCommandsDependencyCommand < Gem::TestCase
def setup
@@ -11,9 +11,9 @@ class TestGemCommandsDependencyCommand < Gem::TestCase
end
def test_execute
- quick_gem 'foo' do |gem|
- gem.add_dependency 'bar', '> 1'
- gem.add_dependency 'baz', '> 1'
+ quick_gem "foo" do |gem|
+ gem.add_dependency "bar", "> 1"
+ gem.add_dependency "baz", "> 1"
end
@cmd.options[:args] = %w[foo]
@@ -24,16 +24,16 @@ class TestGemCommandsDependencyCommand < Gem::TestCase
assert_equal "Gem foo-2\n bar (> 1)\n baz (> 1)\n\n",
@stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_no_args
- install_specs util_spec 'x', '2'
+ install_specs util_spec "x", "2"
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '2.a'
- fetcher.spec 'dep_x', 1, 'x' => '>= 1'
+ fetcher.spec "a", 1
+ fetcher.spec "a", "2.a"
+ fetcher.spec "dep_x", 1, "x" => ">= 1"
fetcher.legacy_platform
end
@@ -58,7 +58,7 @@ Gem x-2
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_no_match
@@ -71,14 +71,14 @@ Gem x-2
end
assert_equal "No gems found matching foo (>= 0)\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_pipe_format
- spec = util_spec 'foo' do |gem|
- gem.add_dependency 'bar', '> 1'
+ spec = util_spec "foo" do |gem|
+ gem.add_dependency "bar", "> 1"
end
- install_specs util_spec 'bar', 2
+ install_specs util_spec "bar", 2
install_specs spec
@cmd.options[:args] = %w[foo]
@@ -89,15 +89,15 @@ Gem x-2
end
assert_equal "bar --version '> 1'\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_regexp
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '2.a'
- fetcher.spec 'a_evil', 9
- fetcher.spec 'b', 2
+ fetcher.spec "a", 1
+ fetcher.spec "a", "2.a"
+ fetcher.spec "a_evil", 9
+ fetcher.spec "b", 2
end
@cmd.options[:args] = %w[[ab]]
@@ -118,17 +118,17 @@ Gem b-2
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_reverse
# FIX: this shouldn't need to write out, but fails if you switch it
- quick_gem 'foo' do |gem|
- gem.add_dependency 'bar', '> 1'
+ quick_gem "foo" do |gem|
+ gem.add_dependency "bar", "> 1"
end
- quick_gem 'baz' do |gem|
- gem.add_dependency 'foo'
+ quick_gem "baz" do |gem|
+ gem.add_dependency "foo"
end
@cmd.options[:args] = %w[foo]
@@ -147,7 +147,7 @@ Gem foo-2
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_reverse_remote
@@ -165,15 +165,15 @@ Gem foo-2
ERROR: Only reverse dependencies for local gems are supported.
EOF
- assert_equal '', @stub_ui.output
+ assert_equal "", @stub_ui.output
assert_equal expected, @stub_ui.error
end
def test_execute_remote
- install_specs util_spec 'bar', '2'
+ install_specs util_spec "bar", "2"
spec_fetcher do |fetcher|
- fetcher.spec 'foo', 2, 'bar' => '> 1'
+ fetcher.spec "foo", 2, "bar" => "> 1"
end
@cmd.options[:args] = %w[foo]
@@ -184,7 +184,7 @@ ERROR: Only reverse dependencies for local gems are supported.
end
assert_equal "Gem foo-2\n bar (> 1)\n\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_remote_version
@@ -192,25 +192,25 @@ ERROR: Only reverse dependencies for local gems are supported.
Gem::RemoteFetcher.fetcher = @fetcher
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
end
@cmd.options[:args] = %w[a]
@cmd.options[:domain] = :remote
- @cmd.options[:version] = req '= 1'
+ @cmd.options[:version] = req "= 1"
use_ui @stub_ui do
@cmd.execute
end
assert_equal "Gem a-1\n\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_prerelease
spec_fetcher do |fetcher|
- fetcher.spec 'a', '2.a'
+ fetcher.spec "a", "2.a"
end
@cmd.options[:args] = %w[a]
@@ -222,6 +222,6 @@ ERROR: Only reverse dependencies for local gems are supported.
end
assert_equal "Gem a-2.a\n\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
end
diff --git a/test/rubygems/test_gem_commands_environment_command.rb b/test/rubygems/test_gem_commands_environment_command.rb
index eeddb2befe..91ed774cb6 100644
--- a/test/rubygems/test_gem_commands_environment_command.rb
+++ b/test/rubygems/test_gem_commands_environment_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/environment_command'
+require_relative "helper"
+require "rubygems/commands/environment_command"
class TestGemCommandsEnvironmentCommand < Gem::TestCase
def setup
@@ -11,9 +11,9 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
def test_execute
orig_sources = Gem.sources.dup
- orig_path, ENV['PATH'] = ENV['PATH'], %w[/usr/local/bin /usr/bin /bin].join(File::PATH_SEPARATOR)
+ orig_path, ENV["PATH"] = ENV["PATH"], %w[/usr/local/bin /usr/bin /bin].join(File::PATH_SEPARATOR)
Gem.sources.replace %w[http://gems.example.com]
- Gem.configuration['gemcutter_key'] = 'blah'
+ Gem.configuration["gemcutter_key"] = "blah"
@cmd.send :handle_options, %w[]
@@ -51,7 +51,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
ensure
Gem.sources.replace orig_sources
- ENV['PATH'] = orig_path
+ ENV["PATH"] = orig_path
end
def test_execute_gemdir
@@ -62,7 +62,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
end
assert_equal "#{@gemhome}\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_user_gemdir
@@ -73,7 +73,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
end
assert_equal "#{Gem.user_dir}\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_user_gemhome
@@ -84,7 +84,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
end
assert_equal "#{Gem.user_dir}\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_gempath
@@ -95,13 +95,13 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
end
assert_equal "#{@gemhome}\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_gempath_multiple
Gem.clear_paths
path = [@gemhome, "#{@gemhome}2"].join File::PATH_SEPARATOR
- ENV['GEM_PATH'] = path
+ ENV["GEM_PATH"] = path
@cmd.send :handle_options, %w[gempath]
@@ -110,7 +110,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
end
assert_equal "#{Gem.path.join File::PATH_SEPARATOR}\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_remotesources
@@ -124,7 +124,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
end
assert_equal "http://gems.example.com\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
ensure
Gem.sources.replace orig_sources
@@ -139,8 +139,8 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
end
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.output
+ assert_equal "", @ui.error
end
def test_execute_version
@@ -151,7 +151,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
end
assert_equal "#{Gem::VERSION}\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_platform
@@ -162,6 +162,6 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
end
assert_equal "#{Gem.platforms.join File::PATH_SEPARATOR}\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
end
diff --git a/test/rubygems/test_gem_commands_fetch_command.rb b/test/rubygems/test_gem_commands_fetch_command.rb
index 7d4c77afaa..f2a4464c7d 100644
--- a/test/rubygems/test_gem_commands_fetch_command.rb
+++ b/test/rubygems/test_gem_commands_fetch_command.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/package'
-require 'rubygems/security'
-require 'rubygems/commands/fetch_command'
+require_relative "helper"
+require "rubygems/package"
+require "rubygems/security"
+require "rubygems/commands/fetch_command"
class TestGemCommandsFetchCommand < Gem::TestCase
def setup
@@ -13,10 +13,10 @@ class TestGemCommandsFetchCommand < Gem::TestCase
def test_execute
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
- assert_path_not_exist File.join(@tempdir, 'cache'), 'sanity check'
+ assert_path_not_exist File.join(@tempdir, "cache"), "sanity check"
@cmd.options[:args] = %w[a]
@@ -26,24 +26,24 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- a2 = specs['a-2']
+ a2 = specs["a-2"]
assert_path_exist(File.join(@tempdir, a2.file_name),
"#{a2.full_name} not fetched")
- assert_path_not_exist File.join(@tempdir, 'cache'),
- 'gem repository directories must not be created'
+ assert_path_not_exist File.join(@tempdir, "cache"),
+ "gem repository directories must not be created"
end
def test_execute_latest
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'a', 2
+ fetcher.gem "a", 1
+ fetcher.gem "a", 2
end
- assert_path_not_exist File.join(@tempdir, 'cache'), 'sanity check'
+ assert_path_not_exist File.join(@tempdir, "cache"), "sanity check"
@cmd.options[:args] = %w[a]
- @cmd.options[:version] = req('>= 0.1')
+ @cmd.options[:version] = req(">= 0.1")
use_ui @ui do
Dir.chdir @tempdir do
@@ -51,17 +51,17 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- a2 = specs['a-2']
+ a2 = specs["a-2"]
assert_path_exist(File.join(@tempdir, a2.file_name),
"#{a2.full_name} not fetched")
- assert_path_not_exist File.join(@tempdir, 'cache'),
- 'gem repository directories must not be created'
+ assert_path_not_exist File.join(@tempdir, "cache"),
+ "gem repository directories must not be created"
end
def test_execute_prerelease
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
- fetcher.gem 'a', '2.a'
+ fetcher.gem "a", 2
+ fetcher.gem "a", "2.a"
end
@cmd.options[:args] = %w[a]
@@ -73,7 +73,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- a2 = specs['a-2']
+ a2 = specs["a-2"]
assert_path_exist(File.join(@tempdir, a2.file_name),
"#{a2.full_name} not fetched")
@@ -83,7 +83,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
a2_spec, a2 = util_gem("a", "2")
a2_universal_darwin_spec, a2_universal_darwin = util_gem("a", "2") do |s|
- s.platform = 'universal-darwin'
+ s.platform = "universal-darwin"
end
Gem::RemoteFetcher.fetcher = @fetcher = Gem::FakeFetcher.new
@@ -103,7 +103,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
@fetcher.data["#{@gem_repo}gems/#{a2_universal_darwin_spec.file_name}"] = Gem.read_binary(a2_universal_darwin)
FileUtils.cp a2_universal_darwin, a2_universal_darwin_spec.cache_file
- util_set_arch 'arm64-darwin20' do
+ util_set_arch "arm64-darwin20" do
use_ui @ui do
Dir.chdir @tempdir do
@cmd.execute
@@ -117,8 +117,8 @@ class TestGemCommandsFetchCommand < Gem::TestCase
def test_execute_specific_prerelease
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
- fetcher.gem 'a', '2.a'
+ fetcher.gem "a", 2
+ fetcher.gem "a", "2.a"
end
@cmd.options[:args] = %w[a]
@@ -131,7 +131,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- a2_pre = specs['a-2.a']
+ a2_pre = specs["a-2.a"]
assert_path_exist(File.join(@tempdir, a2_pre.file_name),
"#{a2_pre.full_name} not fetched")
@@ -139,12 +139,12 @@ class TestGemCommandsFetchCommand < Gem::TestCase
def test_execute_version
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'a', 2
+ fetcher.gem "a", 1
+ fetcher.gem "a", 2
end
@cmd.options[:args] = %w[a]
- @cmd.options[:version] = Gem::Requirement.new '1'
+ @cmd.options[:version] = Gem::Requirement.new "1"
use_ui @ui do
Dir.chdir @tempdir do
@@ -152,7 +152,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- a1 = specs['a-1']
+ a1 = specs["a-1"]
assert_path_exist(File.join(@tempdir, a1.file_name),
"#{a1.full_name} not fetched")
@@ -160,7 +160,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
def test_execute_version_specified_by_colon
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
+ fetcher.gem "a", 1
end
@cmd.options[:args] = %w[a:1]
@@ -171,7 +171,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- a1 = specs['a-1']
+ a1 = specs["a-1"]
assert_path_exist(File.join(@tempdir, a1.file_name),
"#{a1.full_name} not fetched")
@@ -179,7 +179,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
def test_execute_two_version
@cmd.options[:args] = %w[a b]
- @cmd.options[:version] = Gem::Requirement.new '1'
+ @cmd.options[:version] = Gem::Requirement.new "1"
use_ui @ui do
assert_raise Gem::MockGemUi::TermError, @ui.error do
@@ -196,8 +196,8 @@ class TestGemCommandsFetchCommand < Gem::TestCase
def test_execute_two_version_specified_by_colon
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'b', 1
+ fetcher.gem "a", 1
+ fetcher.gem "b", 1
end
@cmd.options[:args] = %w[a:1 b:1]
@@ -208,8 +208,8 @@ class TestGemCommandsFetchCommand < Gem::TestCase
end
end
- a1 = specs['a-1']
- b1 = specs['b-1']
+ a1 = specs["a-1"]
+ b1 = specs["b-1"]
assert_path_exist(File.join(@tempdir, a1.file_name),
"#{a1.full_name} not fetched")
@@ -219,7 +219,7 @@ class TestGemCommandsFetchCommand < Gem::TestCase
def test_execute_version_nonexistent
spec_fetcher do |fetcher|
- fetcher.spec 'foo', 1
+ fetcher.spec "foo", 1
end
@cmd.options[:args] = %w[foo:2]
@@ -238,7 +238,7 @@ ERROR: Possible alternatives: foo
def test_execute_nonexistent_hint_disabled
spec_fetcher do |fetcher|
- fetcher.spec 'foo', 1
+ fetcher.spec "foo", 1
end
@cmd.options[:args] = %w[foo:2]
diff --git a/test/rubygems/test_gem_commands_generate_index_command.rb b/test/rubygems/test_gem_commands_generate_index_command.rb
index 5b7b37a446..c0e18119ed 100644
--- a/test/rubygems/test_gem_commands_generate_index_command.rb
+++ b/test/rubygems/test_gem_commands_generate_index_command.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/indexer'
-require 'rubygems/commands/generate_index_command'
+require_relative "helper"
+require "rubygems/indexer"
+require "rubygems/commands/generate_index_command"
class TestGemCommandsGenerateIndexCommand < Gem::TestCase
def setup
@@ -35,21 +35,21 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase
def test_handle_options_directory
return if win_platform?
- refute_equal '/nonexistent', @cmd.options[:directory]
+ refute_equal "/nonexistent", @cmd.options[:directory]
@cmd.handle_options %w[--directory /nonexistent]
- assert_equal '/nonexistent', @cmd.options[:directory]
+ assert_equal "/nonexistent", @cmd.options[:directory]
end
def test_handle_options_directory_windows
return unless win_platform?
- refute_equal '/nonexistent', @cmd.options[:directory]
+ refute_equal "/nonexistent", @cmd.options[:directory]
@cmd.handle_options %w[--directory C:/nonexistent]
- assert_equal 'C:/nonexistent', @cmd.options[:directory]
+ assert_equal "C:/nonexistent", @cmd.options[:directory]
end
def test_handle_options_update
diff --git a/test/rubygems/test_gem_commands_help_command.rb b/test/rubygems/test_gem_commands_help_command.rb
index 98e5b62be0..b84bc4f7ef 100644
--- a/test/rubygems/test_gem_commands_help_command.rb
+++ b/test/rubygems/test_gem_commands_help_command.rb
@@ -11,41 +11,41 @@ class TestGemCommandsHelpCommand < Gem::TestCase
@cmd = Gem::Commands::HelpCommand.new
- load File.expand_path('rubygems_plugin.rb', __dir__) unless Gem::Commands.const_defined? :InterruptCommand
+ load File.expand_path("rubygems_plugin.rb", __dir__) unless Gem::Commands.const_defined? :InterruptCommand
end
def test_gem_help_bad
- util_gem 'bad' do |out, err|
- assert_equal('', out)
+ util_gem "bad" do |out, err|
+ assert_equal("", out)
assert_match "Unknown command bad", err
end
end
def test_gem_help_gem_dependencies
- util_gem 'gem_dependencies' do |out, err|
- assert_match 'gem.deps.rb', out
- assert_equal '', err
+ util_gem "gem_dependencies" do |out, err|
+ assert_match "gem.deps.rb", out
+ assert_equal "", err
end
end
def test_gem_help_platforms
- util_gem 'platforms' do |out, err|
+ util_gem "platforms" do |out, err|
assert_match(/x86-freebsd/, out)
- assert_equal '', err
+ assert_equal "", err
end
end
def test_gem_help_build
- util_gem 'build' do |out, err|
+ util_gem "build" do |out, err|
assert_match(/-C PATH *Run as if gem build was started in <PATH>/, out)
- assert_equal '', err
+ assert_equal "", err
end
end
def test_gem_help_commands
mgr = Gem::CommandManager.new
- util_gem 'commands' do |out, err|
+ util_gem "commands" do |out, err|
mgr.command_names.each do |cmd|
unless mgr[cmd].deprecated?
assert_match(/\s+#{cmd}\s+\S+/, out)
@@ -63,7 +63,7 @@ class TestGemCommandsHelpCommand < Gem::TestCase
def test_gem_help_commands_omits_deprecated_commands
mgr = Gem::CommandManager.new
- util_gem 'commands' do |out, err|
+ util_gem "commands" do |out, err|
deprecated_commands = mgr.command_names.select {|cmd| mgr[cmd].deprecated? }
deprecated_commands.each do |cmd|
refute_match(/\A\s+#{cmd}\s+\S+\z/, out)
@@ -75,7 +75,7 @@ class TestGemCommandsHelpCommand < Gem::TestCase
util_gem do |out, err|
assert_match(/Usage:/, out)
assert_match(/gem install/, out)
- assert_equal '', err
+ assert_equal "", err
end
end
diff --git a/test/rubygems/test_gem_commands_info_command.rb b/test/rubygems/test_gem_commands_info_command.rb
index 462075f98c..b18b405da6 100644
--- a/test/rubygems/test_gem_commands_info_command.rb
+++ b/test/rubygems/test_gem_commands_info_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/info_command'
+require_relative "helper"
+require "rubygems/commands/info_command"
class TestGemCommandsInfoCommand < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 6127fcc124..7a58bcd7cb 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/install_command'
-require 'rubygems/request_set'
-require 'rubygems/rdoc'
+require_relative "helper"
+require "rubygems/commands/install_command"
+require "rubygems/request_set"
+require "rubygems/rdoc"
class TestGemCommandsInstallCommand < Gem::TestCase
def setup
@@ -30,8 +30,8 @@ class TestGemCommandsInstallCommand < Gem::TestCase
def test_execute_exclude_prerelease
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
- fetcher.gem 'a', '2.pre'
+ fetcher.gem "a", 2
+ fetcher.gem "a", "2.pre"
end
@cmd.options[:args] = %w[a]
@@ -47,13 +47,13 @@ class TestGemCommandsInstallCommand < Gem::TestCase
def test_execute_explicit_version_includes_prerelease
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
- fetcher.gem 'a', '2.a'
+ fetcher.gem "a", 2
+ fetcher.gem "a", "2.a"
end
- a2_pre = specs['a-2.a']
+ a2_pre = specs["a-2.a"]
- @cmd.handle_options [a2_pre.name, '--version', a2_pre.version.to_s,
+ @cmd.handle_options [a2_pre.name, "--version", a2_pre.version.to_s,
"--no-document"]
assert @cmd.options[:prerelease]
assert @cmd.options[:version].satisfied_by?(a2_pre.version)
@@ -69,12 +69,12 @@ class TestGemCommandsInstallCommand < Gem::TestCase
def test_execute_local
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
@cmd.options[:domain] = :local
- FileUtils.mv specs['a-2'].cache_file, @tempdir
+ FileUtils.mv specs["a-2"].cache_file, @tempdir
@cmd.options[:args] = %w[a]
@@ -97,14 +97,14 @@ class TestGemCommandsInstallCommand < Gem::TestCase
def test_execute_local_dependency_nonexistent
specs = spec_fetcher do |fetcher|
- fetcher.gem 'foo', 2, 'bar' => '0.5'
+ fetcher.gem "foo", 2, "bar" => "0.5"
end
@cmd.options[:domain] = :local
- FileUtils.mv specs['foo-2'].cache_file, @tempdir
+ FileUtils.mv specs["foo-2"].cache_file, @tempdir
- @cmd.options[:args] = ['foo']
+ @cmd.options[:args] = ["foo"]
use_ui @ui do
orig_dir = Dir.pwd
@@ -128,15 +128,15 @@ ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in a
def test_execute_local_dependency_nonexistent_ignore_dependencies
specs = spec_fetcher do |fetcher|
- fetcher.gem 'foo', 2, 'bar' => '0.5'
+ fetcher.gem "foo", 2, "bar" => "0.5"
end
@cmd.options[:domain] = :local
@cmd.options[:ignore_dependencies] = true
- FileUtils.mv specs['foo-2'].cache_file, @tempdir
+ FileUtils.mv specs["foo-2"].cache_file, @tempdir
- @cmd.options[:args] = ['foo']
+ @cmd.options[:args] = ["foo"]
use_ui @ui do
orig_dir = Dir.pwd
@@ -155,16 +155,16 @@ ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in a
def test_execute_local_transitive_prerelease
specs = spec_fetcher do |fetcher|
- fetcher.download 'a', 2, 'b' => "2.a", 'c' => '3'
- fetcher.download 'b', '2.a'
- fetcher.download 'c', '3'
+ fetcher.download "a", 2, "b" => "2.a", "c" => "3"
+ fetcher.download "b", "2.a"
+ fetcher.download "c", "3"
end
@cmd.options[:domain] = :local
- FileUtils.mv specs['a-2'].cache_file, @tempdir
- FileUtils.mv specs['b-2.a'].cache_file, @tempdir
- FileUtils.mv specs['c-3'].cache_file, @tempdir
+ FileUtils.mv specs["a-2"].cache_file, @tempdir
+ FileUtils.mv specs["b-2.a"].cache_file, @tempdir
+ FileUtils.mv specs["c-3"].cache_file, @tempdir
@cmd.options[:args] = %w[a]
@@ -187,16 +187,16 @@ 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 in root privilege' if Process.uid.zero?
+ pend "skipped on MS Windows (chmod has no effect)" if win_platform?
+ pend "skipped in root privilege" if Process.uid.zero?
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
@cmd.options[:user_install] = false
- FileUtils.mv specs['a-2'].cache_file, @tempdir
+ FileUtils.mv specs["a-2"].cache_file, @tempdir
@cmd.options[:args] = %w[a]
@@ -295,10 +295,10 @@ ERROR: Could not find a valid gem 'bar' (= 0.5) (required by 'foo' (>= 0)) in a
def test_execute_dependency_nonexistent
spec_fetcher do |fetcher|
- fetcher.spec 'foo', 2, 'bar' => '0.5'
+ fetcher.spec "foo", 2, "bar" => "0.5"
end
- @cmd.options[:args] = ['foo']
+ @cmd.options[:args] = ["foo"]
use_ui @ui do
e = assert_raise Gem::MockGemUi::TermError do
@@ -451,8 +451,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_prerelease_skipped_when_no_flag_set
spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'a', '3.a'
+ fetcher.gem "a", 1
+ fetcher.gem "a", "3.a"
end
@cmd.options[:prerelease] = false
@@ -469,8 +469,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_prerelease_wins_over_previous_ver
spec_fetcher do |fetcher|
- fetcher.download 'a', 1
- fetcher.download 'a', '2.a'
+ fetcher.download "a", 1
+ fetcher.download "a", "2.a"
end
@cmd.options[:prerelease] = true
@@ -487,8 +487,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_with_version_specified_by_colon
spec_fetcher do |fetcher|
- fetcher.download 'a', 1
- fetcher.download 'a', 2
+ fetcher.download "a", 1
+ fetcher.download "a", 2
end
@cmd.options[:args] = %w[a:1]
@@ -504,8 +504,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_prerelease_skipped_when_non_pre_available
spec_fetcher do |fetcher|
- fetcher.gem 'a', '2.pre'
- fetcher.gem 'a', 2
+ fetcher.gem "a", "2.pre"
+ fetcher.gem "a", 2
end
@cmd.options[:prerelease] = true
@@ -525,15 +525,15 @@ ERROR: Possible alternatives: non_existent_with_hint
local = Gem::Platform.local
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
- fetcher.download 'a', 2 do |s|
+ fetcher.download "a", 2
+ fetcher.download "a", 2 do |s|
s.required_ruby_version = "< #{RUBY_VERSION}.a"
s.platform = local
end
- fetcher.download 'a', 3 do |s|
+ fetcher.download "a", 3 do |s|
s.required_ruby_version = ">= #{next_ruby}"
end
- fetcher.download 'a', 3 do |s|
+ fetcher.download "a", 3 do |s|
s.required_ruby_version = ">= #{next_ruby}"
s.platform = local
end
@@ -553,8 +553,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_required_ruby_version_upper_bound
local = Gem::Platform.local
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2.0
- fetcher.gem 'a', 2.0 do |s|
+ fetcher.gem "a", 2.0
+ fetcher.gem "a", 2.0 do |s|
s.required_ruby_version = "< #{RUBY_VERSION}.a"
s.platform = local
end
@@ -573,8 +573,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_required_ruby_version_specific_not_met
spec_fetcher do |fetcher|
- fetcher.gem 'a', '1.0' do |s|
- s.required_ruby_version = '= 1.4.6'
+ fetcher.gem "a", "1.0" do |s|
+ s.required_ruby_version = "= 1.4.6"
end
end
@@ -593,8 +593,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_required_ruby_version_specific_prerelease_met
spec_fetcher do |fetcher|
- fetcher.gem 'a', '1.0' do |s|
- s.required_ruby_version = '>= 1.4.6.preview2'
+ fetcher.gem "a", "1.0" do |s|
+ s.required_ruby_version = ">= 1.4.6.preview2"
end
end
@@ -613,7 +613,7 @@ ERROR: Possible alternatives: non_existent_with_hint
next_ruby_pre = Gem.ruby_version.segments.map.with_index {|n, i| i == 1 ? n + 1 : n }.join(".") + ".a"
spec_fetcher do |fetcher|
- fetcher.gem 'a', '1.0' do |s|
+ fetcher.gem "a", "1.0" do |s|
s.required_ruby_version = "> #{next_ruby_pre}"
end
end
@@ -633,8 +633,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_required_rubygems_version_wrong
spec_fetcher do |fetcher|
- fetcher.gem 'a', '1.0' do |s|
- s.required_rubygems_version = '< 0'
+ fetcher.gem "a", "1.0" do |s|
+ s.required_rubygems_version = "< 0"
end
end
@@ -653,7 +653,7 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_rdoc
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
@@ -661,7 +661,7 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:document] = %w[rdoc ri]
@cmd.options[:domain] = :local
- a2 = specs['a-2']
+ a2 = specs["a-2"]
FileUtils.mv a2.cache_file, @tempdir
@cmd.options[:args] = %w[a]
@@ -683,22 +683,22 @@ ERROR: Possible alternatives: non_existent_with_hint
wait_for_child_process_to_exit
- assert_path_exist File.join(a2.doc_dir, 'ri')
- assert_path_exist File.join(a2.doc_dir, 'rdoc')
+ assert_path_exist File.join(a2.doc_dir, "ri")
+ assert_path_exist File.join(a2.doc_dir, "rdoc")
end
def test_execute_rdoc_with_path
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
@cmd.options[:document] = %w[rdoc ri]
@cmd.options[:domain] = :local
- @cmd.options[:install_dir] = 'whatever'
+ @cmd.options[:install_dir] = "whatever"
- a2 = specs['a-2']
+ a2 = specs["a-2"]
FileUtils.mv a2.cache_file, @tempdir
@cmd.options[:args] = %w[a]
@@ -720,19 +720,19 @@ ERROR: Possible alternatives: non_existent_with_hint
wait_for_child_process_to_exit
- assert_path_exist 'whatever/doc/a-2', 'documentation not installed'
+ assert_path_exist "whatever/doc/a-2", "documentation not installed"
end
def test_execute_saves_build_args
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
args = %w[--with-awesome=true --more-awesome=yes]
Gem::Command.build_args = args
- a2 = specs['a-2']
+ a2 = specs["a-2"]
FileUtils.mv a2.cache_file, @tempdir
@cmd.options[:domain] = :local
@@ -762,7 +762,7 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_remote
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
@cmd.options[:args] = %w[a]
@@ -782,7 +782,7 @@ ERROR: Possible alternatives: non_existent_with_hint
FileUtils.touch("a.gem")
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
@cmd.options[:args] = %w[a]
@@ -800,7 +800,7 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_remote_truncates_existing_gemspecs
spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
+ fetcher.gem "a", 1
end
@cmd.options[:domain] = :remote
@@ -816,7 +816,7 @@ ERROR: Possible alternatives: non_existent_with_hint
assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
assert_match "1 gem installed", @ui.output
- a1_gemspec = File.join(@gemhome, 'specifications', "a-1.gemspec")
+ a1_gemspec = File.join(@gemhome, "specifications", "a-1.gemspec")
initial_a1_gemspec_content = File.read(a1_gemspec)
modified_a1_gemspec_content = initial_a1_gemspec_content + "\n # AAAAAAA\n"
@@ -833,14 +833,14 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_remote_ignores_files
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'a', 2
+ fetcher.gem "a", 1
+ fetcher.gem "a", 2
end
@cmd.options[:domain] = :remote
- a1 = specs['a-1']
- a2 = specs['a-2']
+ a1 = specs["a-1"]
+ a2 = specs["a-2"]
FileUtils.mv a2.cache_file, @tempdir
@@ -849,7 +849,7 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:args] = [a2.name]
- gemdir = File.join @gemhome, 'specifications'
+ gemdir = File.join @gemhome, "specifications"
a2_gemspec = File.join(gemdir, "a-2.gemspec")
a1_gemspec = File.join(gemdir, "a-1.gemspec")
@@ -878,12 +878,12 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_two
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
- fetcher.gem 'b', 2
+ fetcher.gem "a", 2
+ fetcher.gem "b", 2
end
- FileUtils.mv specs['a-2'].cache_file, @tempdir
- FileUtils.mv specs['b-2'].cache_file, @tempdir
+ FileUtils.mv specs["a-2"].cache_file, @tempdir
+ FileUtils.mv specs["b-2"].cache_file, @tempdir
@cmd.options[:domain] = :local
@@ -929,10 +929,10 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_two_version_specified_by_colon
spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'a', 2
- fetcher.gem 'b', 1
- fetcher.gem 'b', 2
+ fetcher.gem "a", 1
+ fetcher.gem "a", 2
+ fetcher.gem "b", 1
+ fetcher.gem "b", 2
end
@cmd.options[:args] = %w[a:1 b:1]
@@ -948,9 +948,9 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_conservative
spec_fetcher do |fetcher|
- fetcher.download 'b', 2
+ fetcher.download "b", 2
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
@cmd.options[:conservative] = true
@@ -981,7 +981,7 @@ ERROR: Possible alternatives: non_existent_with_hint
done_installing = true
end
- spec = util_spec 'a', 2
+ spec = util_spec "a", 2
util_build_gem spec
@@ -989,21 +989,21 @@ ERROR: Possible alternatives: non_existent_with_hint
@cmd.options[:ignore_dependencies] = true
- @cmd.install_gem 'a', '>= 0'
+ @cmd.install_gem "a", ">= 0"
assert_equal %w[a-2], @cmd.installed_specs.map {|s| s.full_name }
- assert done_installing, 'documentation was not generated'
+ assert done_installing, "documentation was not generated"
end
def test_install_gem_ignore_dependencies_remote
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
@cmd.options[:ignore_dependencies] = true
- @cmd.install_gem 'a', '>= 0'
+ @cmd.install_gem "a", ">= 0"
assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
end
@@ -1011,22 +1011,22 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_install_gem_ignore_dependencies_remote_platform_local
local = Gem::Platform.local
spec_fetcher do |fetcher|
- fetcher.gem 'a', 3
+ fetcher.gem "a", 3
- fetcher.gem 'a', 3 do |s|
+ fetcher.gem "a", 3 do |s|
s.platform = local
end
end
@cmd.options[:ignore_dependencies] = true
- @cmd.install_gem 'a', '>= 0'
+ @cmd.install_gem "a", ">= 0"
assert_equal %W[a-3-#{local}], @cmd.installed_specs.map {|spec| spec.full_name }
end
def test_install_gem_ignore_dependencies_specific_file
- spec = util_spec 'a', 2
+ spec = util_spec "a", 2
util_build_gem spec
@@ -1041,8 +1041,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_parses_requirement_from_gemname
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
- fetcher.gem 'b', 2
+ fetcher.gem "a", 2
+ fetcher.gem "b", 2
end
@cmd.options[:domain] = :local
@@ -1088,12 +1088,12 @@ ERROR: Possible alternatives: non_existent_with_hint
assert_equal 2, e.exit_code
- assert_match 'Unable to download data', @ui.error
+ assert_match "Unable to download data", @ui.error
end
def test_show_source_problems_even_on_success
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
+ fetcher.download "a", 2
end
Gem.sources << "http://nonexistent.example"
@@ -1118,7 +1118,7 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_redact_credentials_from_uri_on_warning
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
+ fetcher.download "a", 2
end
Gem.sources << "http://username:SECURE_TOKEN@nonexistent.example"
@@ -1143,7 +1143,7 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_uses_from_a_gemdeps
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
File.open @gemdeps, "w" do |f|
@@ -1166,7 +1166,7 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_uses_from_a_gemdeps_with_no_lock
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
File.open @gemdeps, "w" do |f|
@@ -1190,8 +1190,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_installs_from_a_gemdeps_with_conservative
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
- fetcher.gem 'a', 1
+ fetcher.download "a", 2
+ fetcher.gem "a", 1
end
File.open @gemdeps, "w" do |f|
@@ -1214,7 +1214,7 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_installs_from_a_gemdeps
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
+ fetcher.download "a", 2
end
File.open @gemdeps, "w" do |f|
@@ -1236,8 +1236,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_installs_deps_a_gemdeps
spec_fetcher do |fetcher|
- fetcher.download 'q', '1.0'
- fetcher.download 'r', '2.0', 'q' => nil
+ fetcher.download "q", "1.0"
+ fetcher.download "r", "2.0", "q" => nil
end
File.open @gemdeps, "w" do |f|
@@ -1262,9 +1262,9 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_uses_deps_a_gemdeps
spec_fetcher do |fetcher|
- fetcher.download 'r', '2.0', 'q' => nil
+ fetcher.download "r", "2.0", "q" => nil
- fetcher.spec 'q', '1.0'
+ fetcher.spec "q", "1.0"
end
File.open @gemdeps, "w" do |f|
@@ -1289,8 +1289,8 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_installs_deps_a_gemdeps_into_a_path
spec_fetcher do |fetcher|
- fetcher.download 'q', '1.0'
- fetcher.download 'r', '2.0', 'q' => nil
+ fetcher.download "q", "1.0"
+ fetcher.download "r", "2.0", "q" => nil
end
File.open @gemdeps, "w" do |f|
@@ -1319,11 +1319,11 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_with_gemdeps_path_ignores_system
specs = spec_fetcher do |fetcher|
- fetcher.download 'q', '1.0'
- fetcher.download 'r', '2.0', 'q' => nil
+ fetcher.download "q", "1.0"
+ fetcher.download "r", "2.0", "q" => nil
end
- install_specs specs['q-1.0']
+ install_specs specs["q-1.0"]
File.open @gemdeps, "w" do |f|
f << "gem 'r'"
@@ -1351,11 +1351,11 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_execute_uses_deps_a_gemdeps_with_a_path
specs = spec_fetcher do |fetcher|
- fetcher.gem 'q', '1.0'
- fetcher.gem 'r', '2.0', 'q' => nil
+ fetcher.gem "q", "1.0"
+ fetcher.gem "r", "2.0", "q" => nil
end
- i = Gem::Installer.at specs['q-1.0'].cache_file, :install_dir => "gf-path"
+ i = Gem::Installer.at specs["q-1.0"].cache_file, :install_dir => "gf-path"
i.install
assert File.file?("gf-path/specifications/q-1.0.gemspec"), "not installed"
@@ -1382,39 +1382,39 @@ ERROR: Possible alternatives: non_existent_with_hint
end
def test_handle_options_file
- FileUtils.touch 'Gemfile'
+ FileUtils.touch "Gemfile"
@cmd.handle_options %w[-g Gemfile]
- assert_equal 'Gemfile', @cmd.options[:gemdeps]
+ assert_equal "Gemfile", @cmd.options[:gemdeps]
- FileUtils.rm 'Gemfile'
+ FileUtils.rm "Gemfile"
- FileUtils.touch 'gem.deps.rb'
+ FileUtils.touch "gem.deps.rb"
@cmd.handle_options %w[--file gem.deps.rb]
- assert_equal 'gem.deps.rb', @cmd.options[:gemdeps]
+ assert_equal "gem.deps.rb", @cmd.options[:gemdeps]
- FileUtils.rm 'gem.deps.rb'
+ FileUtils.rm "gem.deps.rb"
- FileUtils.touch 'Isolate'
+ FileUtils.touch "Isolate"
@cmd.handle_options %w[-g]
- assert_equal 'Isolate', @cmd.options[:gemdeps]
+ assert_equal "Isolate", @cmd.options[:gemdeps]
- FileUtils.touch 'Gemfile'
+ FileUtils.touch "Gemfile"
@cmd.handle_options %w[-g]
- assert_equal 'Gemfile', @cmd.options[:gemdeps]
+ assert_equal "Gemfile", @cmd.options[:gemdeps]
- FileUtils.touch 'gem.deps.rb'
+ FileUtils.touch "gem.deps.rb"
@cmd.handle_options %w[-g]
- assert_equal 'gem.deps.rb', @cmd.options[:gemdeps]
+ assert_equal "gem.deps.rb", @cmd.options[:gemdeps]
end
def test_handle_options_suggest
@@ -1442,9 +1442,9 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_explain_platform_local
local = Gem::Platform.local
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
+ fetcher.spec "a", 2
- fetcher.spec 'a', 2 do |s|
+ fetcher.spec "a", 2 do |s|
s.platform = local
end
end
@@ -1468,9 +1468,9 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_explain_platform_local_ignore_dependencies
local = Gem::Platform.local
spec_fetcher do |fetcher|
- fetcher.spec 'a', 3
+ fetcher.spec "a", 3
- fetcher.spec 'a', 3 do |s|
+ fetcher.spec "a", 3 do |s|
s.platform = local
end
end
@@ -1495,9 +1495,9 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_explain_platform_ruby
local = Gem::Platform.local
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
+ fetcher.spec "a", 2
- fetcher.spec 'a', 2 do |s|
+ fetcher.spec "a", 2 do |s|
s.platform = local
end
end
@@ -1524,9 +1524,9 @@ ERROR: Possible alternatives: non_existent_with_hint
def test_explain_platform_ruby_ignore_dependencies
local = Gem::Platform.local
spec_fetcher do |fetcher|
- fetcher.spec 'a', 3
+ fetcher.spec "a", 3
- fetcher.spec 'a', 3 do |s|
+ fetcher.spec "a", 3 do |s|
s.platform = local
end
end
diff --git a/test/rubygems/test_gem_commands_list_command.rb b/test/rubygems/test_gem_commands_list_command.rb
index d8cffce7a3..ec3f2517bf 100644
--- a/test/rubygems/test_gem_commands_list_command.rb
+++ b/test/rubygems/test_gem_commands_list_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/list_command'
+require_relative "helper"
+require "rubygems/commands/list_command"
class TestGemCommandsListCommand < Gem::TestCase
def setup
@@ -9,7 +9,7 @@ class TestGemCommandsListCommand < Gem::TestCase
@cmd = Gem::Commands::ListCommand.new
spec_fetcher do |fetcher|
- fetcher.spec 'c', 1
+ fetcher.spec "c", 1
end
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
@@ -27,6 +27,6 @@ class TestGemCommandsListCommand < Gem::TestCase
end
assert_equal "true\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
end
diff --git a/test/rubygems/test_gem_commands_lock_command.rb b/test/rubygems/test_gem_commands_lock_command.rb
index f8afca1e29..b785cbcfdd 100644
--- a/test/rubygems/test_gem_commands_lock_command.rb
+++ b/test/rubygems/test_gem_commands_lock_command.rb
@@ -1,18 +1,18 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/lock_command'
+require_relative "helper"
+require "rubygems/commands/lock_command"
class TestGemCommandsLockCommand < Gem::TestCase
def setup
super
- @a1 = quick_gem 'a', '1'
- @b1 = quick_gem 'b', '1' do |s|
- s.add_runtime_dependency 'a'
+ @a1 = quick_gem "a", "1"
+ @b1 = quick_gem "b", "1" do |s|
+ s.add_runtime_dependency "a"
end
- @d1 = quick_gem 'd', '1' do |s|
- s.add_runtime_dependency 'z'
+ @d1 = quick_gem "d", "1" do |s|
+ s.add_runtime_dependency "z"
end
@cmd = Gem::Commands::LockCommand.new
@@ -32,7 +32,7 @@ gem 'a', '= 1'
EXPECTED
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_missing_dependency
@@ -49,7 +49,7 @@ gem 'd', '= 1'
EXPECTED
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_strict
@@ -61,6 +61,6 @@ gem 'd', '= 1'
end
end
- assert_equal 'Could not find gem c-1, try using the full name', e.message
+ assert_equal "Could not find gem c-1, try using the full name", e.message
end
end
diff --git a/test/rubygems/test_gem_commands_mirror.rb b/test/rubygems/test_gem_commands_mirror.rb
index 470f1c30fa..423aba2656 100644
--- a/test/rubygems/test_gem_commands_mirror.rb
+++ b/test/rubygems/test_gem_commands_mirror.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/mirror_command'
+require_relative "helper"
+require "rubygems/commands/mirror_command"
class TestGemCommandsMirrorCommand < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_commands_open_command.rb b/test/rubygems/test_gem_commands_open_command.rb
index 29cff1ed97..f970ca12d6 100644
--- a/test/rubygems/test_gem_commands_open_command.rb
+++ b/test/rubygems/test_gem_commands_open_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/open_command'
+require_relative "helper"
+require "rubygems/commands/open_command"
class TestGemCommandsOpenCommand < Gem::TestCase
def setup
@@ -23,8 +23,8 @@ class TestGemCommandsOpenCommand < Gem::TestCase
@cmd.options[:args] = %w[foo]
@cmd.options[:editor] = "#{ruby_with_rubygems_in_load_path} -eexit --"
- gem 'foo', '1.0.0'
- spec = gem 'foo', '1.0.1'
+ gem "foo", "1.0.0"
+ spec = gem "foo", "1.0.1"
assert_nothing_raised Gem::MockGemUi::TermError do
Dir.stub(:chdir, spec.full_gem_path) do
diff --git a/test/rubygems/test_gem_commands_outdated_command.rb b/test/rubygems/test_gem_commands_outdated_command.rb
index dc5c40a782..4ed111a0e7 100644
--- a/test/rubygems/test_gem_commands_outdated_command.rb
+++ b/test/rubygems/test_gem_commands_outdated_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/outdated_command'
+require_relative "helper"
+require "rubygems/commands/outdated_command"
class TestGemCommandsOutdatedCommand < Gem::TestCase
def setup
@@ -15,10 +15,10 @@ class TestGemCommandsOutdatedCommand < Gem::TestCase
def test_execute
spec_fetcher do |fetcher|
- fetcher.download 'foo', '1.0'
- fetcher.download 'foo', '2.0'
- fetcher.gem 'foo', '0.1'
- fetcher.gem 'foo', '0.2'
+ fetcher.download "foo", "1.0"
+ fetcher.download "foo", "2.0"
+ fetcher.gem "foo", "0.1"
+ fetcher.gem "foo", "0.2"
end
use_ui @ui do
@@ -31,10 +31,10 @@ class TestGemCommandsOutdatedCommand < Gem::TestCase
def test_execute_with_up_to_date_platform_specific_gem
spec_fetcher do |fetcher|
- fetcher.download 'foo', '2.0'
+ fetcher.download "foo", "2.0"
- fetcher.gem 'foo', '1.0'
- fetcher.gem 'foo', '2.0' do |s|
+ fetcher.gem "foo", "1.0"
+ fetcher.gem "foo", "2.0" do |s|
s.platform = Gem::Platform.local
end
end
diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb
index 5b06b628c2..ca77041000 100644
--- a/test/rubygems/test_gem_commands_owner_command.rb
+++ b/test/rubygems/test_gem_commands_owner_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/owner_command'
+require_relative "helper"
+require "rubygems/commands/owner_command"
class TestGemCommandsOwnerCommand < Gem::TestCase
def setup
@@ -36,7 +36,7 @@ class TestGemCommandsOwnerCommand < Gem::TestCase
- id: 4
EOF
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, "OK"]
use_ui @stub_ui do
@cmd.show_owners("freewill")
@@ -66,7 +66,7 @@ EOF
- id: 4
EOF
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, "OK"]
assert_raise Psych::DisallowedClass do
use_ui @ui do
@@ -80,7 +80,7 @@ EOF
host = "http://rubygems.example"
ENV["RUBYGEMS_HOST"] = host
- @stub_fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
+ @stub_fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, "OK"]
use_ui @stub_ui do
@cmd.show_owners("freewill")
@@ -95,7 +95,7 @@ EOF
host = "http://rubygems.example"
@cmd.host = host
- @stub_fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
+ @stub_fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, "OK"]
use_ui @stub_ui do
@cmd.show_owners("freewill")
@@ -107,7 +107,7 @@ EOF
def test_show_owners_denied
response = "You don't have permission to push to this gem"
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 403, 'Forbidden']
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 403, "Forbidden"]
assert_raise Gem::MockGemUi::TermError do
use_ui @stub_ui do
@@ -120,21 +120,21 @@ EOF
def test_show_owners_key
response = "- email: user1@example.com\n"
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
- File.open Gem.configuration.credentials_path, 'a' do |f|
- f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, "OK"]
+ File.open Gem.configuration.credentials_path, "a" do |f|
+ f.write ":other: 701229f217cdf23b1344c7b4b54ca97"
end
Gem.configuration.load_api_keys
@cmd.handle_options %w[-k other]
- @cmd.show_owners('freewill')
+ @cmd.show_owners("freewill")
- assert_equal '701229f217cdf23b1344c7b4b54ca97', @stub_fetcher.last_request['Authorization']
+ assert_equal "701229f217cdf23b1344c7b4b54ca97", @stub_fetcher.last_request["Authorization"]
end
def test_add_owners
response = "Owner added successfully."
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, "OK"]
use_ui @stub_ui do
@cmd.add_owners("freewill", ["user-new1@example.com"])
@@ -149,7 +149,7 @@ EOF
def test_add_owners_denied
response = "You don't have permission to push to this gem"
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, 'Forbidden']
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, "Forbidden"]
use_ui @stub_ui do
@cmd.add_owners("freewill", ["user-new1@example.com"])
@@ -162,8 +162,8 @@ EOF
host = "http://rubygems.example"
add_owner_response = "Owner added successfully."
show_owners_response = "- email: user1@example.com\n"
- @stub_fetcher.data["#{host}/api/v1/gems/freewill/owners"] = [add_owner_response, 200, 'OK']
- @stub_fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [show_owners_response, 200, 'OK']
+ @stub_fetcher.data["#{host}/api/v1/gems/freewill/owners"] = [add_owner_response, 200, "OK"]
+ @stub_fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [show_owners_response, 200, "OK"]
@cmd.handle_options %W[--host #{host} --add user-new1@example.com freewill]
@@ -178,21 +178,21 @@ EOF
def test_add_owners_key
response = "Owner added successfully."
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
- File.open Gem.configuration.credentials_path, 'a' do |f|
- f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, "OK"]
+ File.open Gem.configuration.credentials_path, "a" do |f|
+ f.write ":other: 701229f217cdf23b1344c7b4b54ca97"
end
Gem.configuration.load_api_keys
@cmd.handle_options %w[-k other]
- @cmd.add_owners('freewill', ['user-new1@example.com'])
+ @cmd.add_owners("freewill", ["user-new1@example.com"])
- assert_equal '701229f217cdf23b1344c7b4b54ca97', @stub_fetcher.last_request['Authorization']
+ assert_equal "701229f217cdf23b1344c7b4b54ca97", @stub_fetcher.last_request["Authorization"]
end
def test_remove_owners
response = "Owner removed successfully."
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, "OK"]
use_ui @stub_ui do
@cmd.remove_owners("freewill", ["user-remove1@example.com"])
@@ -207,7 +207,7 @@ EOF
def test_remove_owners_denied
response = "You don't have permission to push to this gem"
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, 'Forbidden']
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, "Forbidden"]
use_ui @stub_ui do
@cmd.remove_owners("freewill", ["user-remove1@example.com"])
@@ -218,21 +218,21 @@ EOF
def test_remove_owners_key
response = "Owner removed successfully."
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
- File.open Gem.configuration.credentials_path, 'a' do |f|
- f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, "OK"]
+ File.open Gem.configuration.credentials_path, "a" do |f|
+ f.write ":other: 701229f217cdf23b1344c7b4b54ca97"
end
Gem.configuration.load_api_keys
@cmd.handle_options %w[-k other]
- @cmd.remove_owners('freewill', ['user-remove1@example.com'])
+ @cmd.remove_owners("freewill", ["user-remove1@example.com"])
- assert_equal '701229f217cdf23b1344c7b4b54ca97', @stub_fetcher.last_request['Authorization']
+ assert_equal "701229f217cdf23b1344c7b4b54ca97", @stub_fetcher.last_request["Authorization"]
end
def test_remove_owners_missing
- response = 'Owner could not be found.'
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 404, 'Not Found']
+ response = "Owner could not be found."
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 404, "Not Found"]
use_ui @stub_ui do
@cmd.remove_owners("freewill", ["missing@example"])
@@ -246,8 +246,8 @@ EOF
response_success = "Owner added successfully."
@stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [
- [response_fail, 401, 'Unauthorized'],
- [response_success, 200, 'OK'],
+ [response_fail, 401, "Unauthorized"],
+ [response_success, 200, "OK"],
]
@otp_ui = Gem::MockGemUi.new "111111\n"
@@ -255,15 +255,15 @@ EOF
@cmd.add_owners("freewill", ["user-new1@example.com"])
end
- assert_match 'You have enabled multi-factor authentication. Please enter OTP code.', @otp_ui.output
- assert_match '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 response_success, @otp_ui.output
- assert_equal '111111', @stub_fetcher.last_request['OTP']
+ assert_equal "111111", @stub_fetcher.last_request["OTP"]
end
def test_otp_verified_failure
response = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
- @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 401, 'Unauthorized']
+ @stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 401, "Unauthorized"]
@otp_ui = Gem::MockGemUi.new "111111\n"
use_ui @otp_ui do
@@ -271,9 +271,9 @@ EOF
end
assert_match response, @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_equal '111111', @stub_fetcher.last_request['OTP']
+ assert_match "You have enabled multi-factor authentication. Please enter OTP code.", @otp_ui.output
+ assert_match "Code: ", @otp_ui.output
+ assert_equal "111111", @stub_fetcher.last_request["OTP"]
end
def test_remove_owners_unathorized_api_key
@@ -281,7 +281,7 @@ EOF
response_success = "Owner removed successfully."
@stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [
- [response_forbidden, 403, 'Forbidden'],
+ [response_forbidden, 403, "Forbidden"],
[response_success, 200, "OK"],
]
@stub_fetcher.data["#{Gem.host}/api/v1/api_key"] = ["", 200, "OK"]
@@ -305,7 +305,7 @@ EOF
response_success = "Owner added successfully."
@stub_fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [
- [response_forbidden, 403, 'Forbidden'],
+ [response_forbidden, 403, "Forbidden"],
[response_success, 200, "OK"],
]
@stub_fetcher.data["#{Gem.host}/api/v1/api_key"] = ["", 200, "OK"]
diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb
index 0ee67be391..5bf1d27eb9 100644
--- a/test/rubygems/test_gem_commands_pristine_command.rb
+++ b/test/rubygems/test_gem_commands_pristine_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/pristine_command'
+require_relative "helper"
+require "rubygems/commands/pristine_command"
class TestGemCommandsPristineCommand < Gem::TestCase
def setup
@@ -11,29 +11,29 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute
- a = util_spec 'a' do |s|
+ a = util_spec "a" do |s|
s.executables = %w[foo]
s.files = %w[bin/foo lib/a.rb]
end
- write_file File.join(@tempdir, 'lib', 'a.rb') do |fp|
+ write_file File.join(@tempdir, "lib", "a.rb") do |fp|
fp.puts "puts __FILE__"
end
- write_file File.join(@tempdir, 'bin', 'foo') do |fp|
+ write_file File.join(@tempdir, "bin", "foo") do |fp|
fp.puts "#!/usr/bin/ruby"
end
install_gem a
- foo_path = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo'
- a_rb_path = File.join @gemhome, 'gems', a.full_name, 'lib', 'a.rb'
+ foo_path = File.join @gemhome, "gems", a.full_name, "bin", "foo"
+ a_rb_path = File.join @gemhome, "gems", a.full_name, "lib", "a.rb"
write_file foo_path do |io|
- io.puts 'I changed it!'
+ io.puts "I changed it!"
end
write_file a_rb_path do |io|
- io.puts 'I changed it!'
+ io.puts "I changed it!"
end
@cmd.options[:args] = %w[a]
@@ -102,18 +102,18 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_all
- a = util_spec 'a' do |s|
+ a = util_spec "a" do |s|
s.executables = %w[foo]
end
- write_file File.join(@tempdir, 'bin', 'foo') do |fp|
+ write_file File.join(@tempdir, "bin", "foo") do |fp|
fp.puts "#!/usr/bin/ruby"
end
install_gem a
- gem_bin = File.join @gemhome, 'gems', a.full_name, 'bin', 'foo'
- gem_stub = File.join @gemhome, 'bin', 'foo'
+ gem_bin = File.join @gemhome, "gems", a.full_name, "bin", "foo"
+ gem_stub = File.join @gemhome, "bin", "foo"
FileUtils.rm gem_bin
FileUtils.rm gem_stub
@@ -135,17 +135,17 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_env_shebang
- a = util_spec 'a' do |s|
+ a = util_spec "a" do |s|
s.executables = %w[foo]
s.files = %w[bin/foo]
end
- write_file File.join(@tempdir, 'bin', 'foo') do |fp|
+ write_file File.join(@tempdir, "bin", "foo") do |fp|
fp.puts "#!/usr/bin/ruby"
end
install_gem a
- gem_exec = File.join @gemhome, 'bin', 'foo'
+ gem_exec = File.join @gemhome, "bin", "foo"
FileUtils.rm gem_exec
@@ -157,7 +157,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
assert_path_exist gem_exec
- ruby_exec = sprintf Gem.default_exec_format, 'ruby'
+ ruby_exec = sprintf Gem.default_exec_format, "ruby"
bin_env = win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " "
@@ -165,11 +165,11 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_extensions_explicit
- a = util_spec 'a' do |s|
- s.extensions << 'ext/a/extconf.rb'
+ a = util_spec "a" do |s|
+ s.extensions << "ext/a/extconf.rb"
end
- ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
+ ext_path = File.join @tempdir, "ext", "a", "extconf.rb"
write_file ext_path do |io|
io.write <<-'RUBY'
File.open "Makefile", "w" do |f|
@@ -180,7 +180,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
RUBY
end
- b = util_spec 'b'
+ b = util_spec "b"
install_gem a
install_gem b
@@ -195,19 +195,19 @@ class TestGemCommandsPristineCommand < Gem::TestCase
out = @ui.output.split "\n"
- assert_equal 'Restoring gems to pristine condition...', out.shift
- assert_equal 'Building native extensions. This could take a while...',
+ assert_equal "Restoring gems to pristine condition...", out.shift
+ assert_equal "Building native extensions. This could take a while...",
out.shift
assert_equal "Restored #{a.full_name}", out.shift
assert_empty out, out.inspect
end
def test_execute_no_extension
- a = util_spec 'a' do |s|
- s.extensions << 'ext/a/extconf.rb'
+ a = util_spec "a" do |s|
+ s.extensions << "ext/a/extconf.rb"
end
- ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
+ ext_path = File.join @tempdir, "ext", "a", "extconf.rb"
write_file ext_path do |io|
io.write "# extconf.rb\nrequire 'mkmf'; create_makefile 'a'"
end
@@ -223,18 +223,18 @@ class TestGemCommandsPristineCommand < Gem::TestCase
out = @ui.output.split "\n"
- assert_equal 'Restoring gems to pristine condition...', out.shift
+ assert_equal "Restoring gems to pristine condition...", out.shift
assert_equal "Skipped #{a.full_name}, it needs to compile an extension",
out.shift
assert_empty out, out.inspect
end
def test_execute_with_extension_with_build_args
- a = util_spec 'a' do |s|
- s.extensions << 'ext/a/extconf.rb'
+ a = util_spec "a" do |s|
+ s.extensions << "ext/a/extconf.rb"
end
- ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
+ ext_path = File.join @tempdir, "ext", "a", "extconf.rb"
write_file ext_path do |io|
io.write <<-'RUBY'
File.open "Makefile", "w" do |f|
@@ -257,7 +257,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
out = @ui.output.split "\n"
- assert_equal 'Restoring gems to pristine condition...', out.shift
+ assert_equal "Restoring gems to pristine condition...", out.shift
assert_equal "Building native extensions with: '--with-awesome=true --sweet'", out.shift
assert_equal "This could take a while...", out.shift
assert_equal "Restored #{a.full_name}", out.shift
@@ -265,8 +265,8 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_many
- a = util_spec 'a'
- b = util_spec 'b'
+ a = util_spec "a"
+ b = util_spec "b"
install_gem a
install_gem b
@@ -286,14 +286,14 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_skip
- a = util_spec 'a'
- b = util_spec 'b'
+ a = util_spec "a"
+ b = util_spec "b"
install_gem a
install_gem b
@cmd.options[:args] = %w[a b]
- @cmd.options[:skip] = 'a'
+ @cmd.options[:skip] = "a"
use_ui @ui do
@cmd.execute
@@ -308,16 +308,16 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_skip_many_gems
- a = util_spec 'a'
- b = util_spec 'b'
- c = util_spec 'c'
+ a = util_spec "a"
+ b = util_spec "b"
+ c = util_spec "c"
install_gem a
install_gem b
install_gem c
@cmd.options[:args] = %w[a b c]
- @cmd.options[:skip] = ['a', 'c']
+ @cmd.options[:skip] = ["a", "c"]
use_ui @ui do
@cmd.execute
@@ -333,14 +333,14 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_many_multi_repo
- a = util_spec 'a'
+ a = util_spec "a"
install_gem a
Gem.clear_paths
- gemhome2 = File.join @tempdir, 'gemhome2'
+ gemhome2 = File.join @tempdir, "gemhome2"
Gem.use_paths gemhome2, [gemhome2, @gemhome]
- b = util_spec 'b'
+ b = util_spec "b"
install_gem b
@cmd.options[:args] = %w[a b]
@@ -356,21 +356,21 @@ class TestGemCommandsPristineCommand < Gem::TestCase
assert_equal "Restored #{b.full_name}", out.shift
assert_empty out, out.inspect
- assert_path_exist File.join(@gemhome, "gems", 'a-2')
- assert_path_not_exist File.join(gemhome2, "gems", 'a-2')
- assert_path_exist File.join(gemhome2, "gems", 'b-2')
- assert_path_not_exist File.join(@gemhome, "gems", 'b-2')
+ assert_path_exist File.join(@gemhome, "gems", "a-2")
+ assert_path_not_exist File.join(gemhome2, "gems", "a-2")
+ assert_path_exist File.join(gemhome2, "gems", "b-2")
+ assert_path_not_exist File.join(@gemhome, "gems", "b-2")
end
def test_execute_missing_cache_gem
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'a', 2
- fetcher.gem 'a', 3
- fetcher.gem 'a', '3.a'
+ fetcher.gem "a", 1
+ fetcher.gem "a", 2
+ fetcher.gem "a", 3
+ fetcher.gem "a", "3.a"
end
- FileUtils.rm specs['a-2'].cache_file
+ FileUtils.rm specs["a-2"].cache_file
@cmd.options[:args] = %w[a]
@@ -396,22 +396,22 @@ class TestGemCommandsPristineCommand < Gem::TestCase
def test_execute_missing_cache_gem_when_multi_repo
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'b', 1
+ fetcher.gem "a", 1
+ fetcher.gem "b", 1
end
- FileUtils.rm_rf File.join(@gemhome, 'gems', 'a-1')
- FileUtils.rm_rf File.join(@gemhome, 'gems', 'b-1')
+ FileUtils.rm_rf File.join(@gemhome, "gems", "a-1")
+ FileUtils.rm_rf File.join(@gemhome, "gems", "b-1")
install_gem specs["a-1"]
- FileUtils.rm File.join(@gemhome, 'cache', 'a-1.gem')
+ FileUtils.rm File.join(@gemhome, "cache", "a-1.gem")
Gem.clear_paths
- gemhome2 = File.join(@tempdir, 'gemhome2')
+ gemhome2 = File.join(@tempdir, "gemhome2")
Gem.use_paths gemhome2, [gemhome2, @gemhome]
install_gem specs["b-1"]
- FileUtils.rm File.join(gemhome2, 'cache', 'b-1.gem')
+ FileUtils.rm File.join(gemhome2, "cache", "b-1.gem")
Gem::Specification.reset
@cmd.options[:args] = %w[a b]
@@ -435,15 +435,15 @@ class TestGemCommandsPristineCommand < Gem::TestCase
assert_empty out, out.inspect
assert_empty @ui.error
- assert_path_exist File.join(@gemhome, "cache", 'a-1.gem')
- assert_path_not_exist File.join(gemhome2, "cache", 'a-2.gem')
- assert_path_exist File.join(@gemhome, "gems", 'a-1')
- assert_path_not_exist File.join(gemhome2, "gems", 'a-1')
+ assert_path_exist File.join(@gemhome, "cache", "a-1.gem")
+ assert_path_not_exist File.join(gemhome2, "cache", "a-2.gem")
+ assert_path_exist File.join(@gemhome, "gems", "a-1")
+ assert_path_not_exist File.join(gemhome2, "gems", "a-1")
- assert_path_exist File.join(gemhome2, "cache", 'b-1.gem')
- assert_path_not_exist File.join(@gemhome, "cache", 'b-2.gem')
- assert_path_exist File.join(gemhome2, "gems", 'b-1')
- assert_path_not_exist File.join(@gemhome, "gems", 'b-1')
+ assert_path_exist File.join(gemhome2, "cache", "b-1.gem")
+ assert_path_not_exist File.join(@gemhome, "cache", "b-2.gem")
+ assert_path_exist File.join(gemhome2, "gems", "b-1")
+ assert_path_not_exist File.join(@gemhome, "gems", "b-1")
end
def test_execute_no_gem
@@ -459,21 +459,21 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_only_executables
- a = util_spec 'a' do |s|
+ a = util_spec "a" do |s|
s.executables = %w[foo]
s.files = %w[bin/foo lib/a.rb]
end
- write_file File.join(@tempdir, 'lib', 'a.rb') do |fp|
+ write_file File.join(@tempdir, "lib", "a.rb") do |fp|
fp.puts "puts __FILE__"
end
- write_file File.join(@tempdir, 'bin', 'foo') do |fp|
+ write_file File.join(@tempdir, "bin", "foo") do |fp|
fp.puts "#!/usr/bin/ruby"
end
install_gem a
- gem_lib = File.join @gemhome, 'gems', a.full_name, 'lib', 'a.rb'
- gem_exec = File.join @gemhome, 'bin', 'foo'
+ gem_lib = File.join @gemhome, "gems", a.full_name, "lib", "a.rb"
+ gem_exec = File.join @gemhome, "bin", "foo"
FileUtils.rm gem_exec
FileUtils.rm gem_lib
@@ -489,25 +489,25 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_only_plugins
- a = util_spec 'a' do |s|
+ a = util_spec "a" do |s|
s.executables = %w[foo]
s.files = %w[bin/foo lib/a.rb lib/rubygems_plugin.rb]
end
- write_file File.join(@tempdir, 'lib', 'a.rb') do |fp|
+ write_file File.join(@tempdir, "lib", "a.rb") do |fp|
fp.puts "puts __FILE__"
end
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |fp|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |fp|
fp.puts "puts __FILE__"
end
- write_file File.join(@tempdir, 'bin', 'foo') do |fp|
+ write_file File.join(@tempdir, "bin", "foo") do |fp|
fp.puts "#!/usr/bin/ruby"
end
install_gem a
- gem_lib = File.join @gemhome, 'gems', a.full_name, 'lib', 'a.rb'
- gem_plugin = File.join @gemhome, 'plugins', 'a_plugin.rb'
- gem_exec = File.join @gemhome, 'bin', 'foo'
+ gem_lib = File.join @gemhome, "gems", a.full_name, "lib", "a.rb"
+ gem_plugin = File.join @gemhome, "plugins", "a_plugin.rb"
+ gem_exec = File.join @gemhome, "bin", "foo"
FileUtils.rm gem_exec
FileUtils.rm gem_plugin
@@ -525,24 +525,24 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_bindir
- a = util_spec 'a' do |s|
+ a = util_spec "a" do |s|
s.name = "test_gem"
s.executables = %w[foo]
s.files = %w[bin/foo]
end
- write_file File.join(@tempdir, 'bin', 'foo') do |fp|
+ write_file File.join(@tempdir, "bin", "foo") do |fp|
fp.puts "#!/usr/bin/ruby"
end
- write_file File.join(@tempdir, 'test_bin', 'foo') do |fp|
+ write_file File.join(@tempdir, "test_bin", "foo") do |fp|
fp.puts "#!/usr/bin/ruby"
end
install_gem a
- gem_exec = File.join @gemhome, 'bin', 'foo'
- gem_bindir = File.join @tempdir, 'test_bin', 'foo'
+ gem_exec = File.join @gemhome, "bin", "foo"
+ gem_bindir = File.join @tempdir, "test_bin", "foo"
FileUtils.rm gem_exec
FileUtils.rm gem_bindir
@@ -558,7 +558,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_unknown_gem_at_remote_source
- install_specs util_spec 'a'
+ install_specs util_spec "a"
@cmd.options[:args] = %w[a]
@@ -597,16 +597,16 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_multi_platform
- a = util_spec 'a' do |s|
- s.extensions << 'ext/a/extconf.rb'
+ a = util_spec "a" do |s|
+ s.extensions << "ext/a/extconf.rb"
end
- b = util_spec 'b' do |s|
- s.extensions << 'ext/a/extconf.rb'
+ b = util_spec "b" do |s|
+ s.extensions << "ext/a/extconf.rb"
s.platform = Gem::Platform.new("java")
end
- ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
+ ext_path = File.join @tempdir, "ext", "a", "extconf.rb"
write_file ext_path do |io|
io.write <<-'RUBY'
File.open "Makefile", "w" do |f|
@@ -632,8 +632,8 @@ class TestGemCommandsPristineCommand < Gem::TestCase
out = @ui.output.split "\n"
- assert_equal 'Restoring gems to pristine condition...', out.shift
- assert_equal 'Building native extensions. This could take a while...',
+ assert_equal "Restoring gems to pristine condition...", out.shift
+ assert_equal "Building native extensions. This could take a while...",
out.shift
assert_equal "Restored #{a.full_name}", out.shift
assert_empty out, out.inspect
diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb
index 1bbd341eca..f38a2ae7a1 100644
--- a/test/rubygems/test_gem_commands_push_command.rb
+++ b/test/rubygems/test_gem_commands_push_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/push_command'
+require_relative "helper"
+require "rubygems/commands/push_command"
class TestGemCommandsPushCommand < Gem::TestCase
def setup
@@ -12,7 +12,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
Gem.host = Gem::DEFAULT_HOST
Gem.configuration.disable_default_gem_server = false
- @gems_dir = File.join @tempdir, 'gems'
+ @gems_dir = File.join @tempdir, "gems"
@cache_dir = File.join @gemhome, "cache"
FileUtils.mkdir @gems_dir
@@ -21,7 +21,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
"ed244fbf2b1a52e012da8616c512fa47f9aa5250"
@spec, @path = util_gem "freewill", "1.0.0"
- @host = 'https://rubygems.example'
+ @host = "https://rubygems.example"
@api_key = Gem.configuration.rubygems_api_key
@fetcher = Gem::FakeFetcher.new
@@ -68,7 +68,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
def test_execute
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{Gem.host}/api/v1/gems"] = [@response, 200, "OK"]
@cmd.options[:args] = [@path]
@@ -81,12 +81,12 @@ class TestGemCommandsPushCommand < Gem::TestCase
end
def test_execute_host
- host = 'https://other.example'
+ host = "https://other.example"
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{host}/api/v1/gems"] = [@response, 200, "OK"]
@fetcher.data["#{Gem.host}/api/v1/gems"] =
- ['fail', 500, 'Internal Server Error']
+ ["fail", 500, "Internal Server Error"]
@cmd.options[:host] = host
@cmd.options[:args] = [@path]
@@ -101,13 +101,13 @@ class TestGemCommandsPushCommand < Gem::TestCase
def test_execute_allowed_push_host
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
- spec.metadata['allowed_push_host'] = "https://privategemserver.example"
+ spec.metadata["allowed_push_host"] = "https://privategemserver.example"
end
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{@spec.metadata['allowed_push_host']}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@spec.metadata['allowed_push_host']}/api/v1/gems"] = [@response, 200, "OK"]
@fetcher.data["#{Gem.host}/api/v1/gems"] =
- ['fail', 500, 'Internal Server Error']
+ ["fail", 500, "Internal Server Error"]
@cmd.options[:args] = [@path]
@@ -136,7 +136,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
ENV["RUBYGEMS_HOST"] = @host
Gem.configuration.disable_default_gem_server = true
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, "OK"]
send_battery
end
@@ -145,17 +145,17 @@ class TestGemCommandsPushCommand < Gem::TestCase
@host = "http://privategemserver.example"
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
- spec.metadata['default_gem_server'] = @host
+ spec.metadata["default_gem_server"] = @host
end
@api_key = "EYKEY"
keys = {
- :rubygems_api_key => 'KEY',
+ :rubygems_api_key => "KEY",
@host => @api_key,
}
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write keys.to_yaml
end
Gem.configuration.load_api_keys
@@ -163,14 +163,14 @@ class TestGemCommandsPushCommand < Gem::TestCase
FileUtils.rm Gem.configuration.credentials_path
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, "OK"]
send_battery
end
def test_sending_gem
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, "OK"]
send_battery
end
@@ -179,17 +179,17 @@ class TestGemCommandsPushCommand < Gem::TestCase
@host = "http://privategemserver.example"
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
- spec.metadata['allowed_push_host'] = @host
+ spec.metadata["allowed_push_host"] = @host
end
@api_key = "PRIVKEY"
keys = {
- :rubygems_api_key => 'KEY',
+ :rubygems_api_key => "KEY",
@host => @api_key,
}
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write keys.to_yaml
end
Gem.configuration.load_api_keys
@@ -197,7 +197,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
FileUtils.rm Gem.configuration.credentials_path
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, "OK"]
send_battery
end
@@ -205,14 +205,14 @@ class TestGemCommandsPushCommand < Gem::TestCase
@host = "http://privategemserver.example"
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
- spec.metadata['allowed_push_host'] = @host
+ spec.metadata["allowed_push_host"] = @host
end
@api_key = "PRIVKEY"
ENV["GEM_HOST_API_KEY"] = "PRIVKEY"
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, "OK"]
send_battery
end
@@ -221,7 +221,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
@host = "http://user:password@privategemserver.example"
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
- spec.metadata['allowed_push_host'] = @sanitized_host
+ spec.metadata["allowed_push_host"] = @sanitized_host
end
@api_key = "DOESNTMATTER"
@@ -230,7 +230,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
:rubygems_api_key => @api_key,
}
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write keys.to_yaml
end
Gem.configuration.load_api_keys
@@ -238,13 +238,13 @@ class TestGemCommandsPushCommand < Gem::TestCase
FileUtils.rm Gem.configuration.credentials_path
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, "OK"]
send_battery
end
def test_sending_gem_to_disallowed_default_host
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
- spec.metadata['allowed_push_host'] = "https://privategemserver.example"
+ spec.metadata["allowed_push_host"] = "https://privategemserver.example"
end
response = %(ERROR: "#{@host}" is not allowed by the gemspec, which only allows "https://privategemserver.example")
@@ -261,17 +261,17 @@ class TestGemCommandsPushCommand < Gem::TestCase
push_host = "https://privategemserver.example"
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
- spec.metadata['allowed_push_host'] = push_host
+ spec.metadata["allowed_push_host"] = push_host
end
@api_key = "PRIVKEY"
keys = {
- :rubygems_api_key => 'KEY',
+ :rubygems_api_key => "KEY",
@host => @api_key,
}
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write keys.to_yaml
end
Gem.configuration.load_api_keys
@@ -291,8 +291,8 @@ class TestGemCommandsPushCommand < Gem::TestCase
host = "http://privategemserver.example"
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
- spec.metadata.delete('default_gem_server')
- spec.metadata['allowed_push_host'] = host
+ spec.metadata.delete("default_gem_server")
+ spec.metadata["allowed_push_host"] = host
end
api_key = "PRIVKEY"
@@ -301,7 +301,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
host => api_key,
}
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write keys.to_yaml
end
Gem.configuration.load_api_keys
@@ -309,7 +309,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
FileUtils.rm Gem.configuration.credentials_path
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{host}/api/v1/gems"] = [@response, 200, "OK"]
# do not set @host
use_ui(@ui) { @cmd.send_gem(@path) }
@@ -334,7 +334,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
def test_sending_gem_denied
response = "You don't have permission to push to this gem"
- @fetcher.data["#{@host}/api/v1/gems"] = [response, 403, 'Forbidden']
+ @fetcher.data["#{@host}/api/v1/gems"] = [response, 403, "Forbidden"]
@cmd.instance_variable_set :@host, @host
assert_raise Gem::MockGemUi::TermError do
@@ -349,8 +349,8 @@ class TestGemCommandsPushCommand < Gem::TestCase
def test_sending_gem_key
@response = "Successfully registered gem: freewill (1.0.0)"
@fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, "OK"]
- File.open Gem.configuration.credentials_path, 'a' do |f|
- f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
+ File.open Gem.configuration.credentials_path, "a" do |f|
+ f.write ":other: 701229f217cdf23b1344c7b4b54ca97"
end
Gem.configuration.load_api_keys
@@ -364,11 +364,11 @@ class TestGemCommandsPushCommand < Gem::TestCase
def test_otp_verified_success
response_fail = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
- response_success = 'Successfully registered gem: freewill (1.0.0)'
+ response_success = "Successfully registered gem: freewill (1.0.0)"
@fetcher.data["#{Gem.host}/api/v1/gems"] = [
- [response_fail, 401, 'Unauthorized'],
- [response_success, 200, 'OK'],
+ [response_fail, 401, "Unauthorized"],
+ [response_success, 200, "OK"],
]
@otp_ui = Gem::MockGemUi.new "111111\n"
@@ -376,15 +376,15 @@ class TestGemCommandsPushCommand < Gem::TestCase
@cmd.send_gem(@path)
end
- assert_match 'You have enabled multi-factor authentication. Please enter OTP code.', @otp_ui.output
- assert_match '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 response_success, @otp_ui.output
- assert_equal '111111', @fetcher.last_request['OTP']
+ assert_equal "111111", @fetcher.last_request["OTP"]
end
def test_otp_verified_failure
response = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
- @fetcher.data["#{Gem.host}/api/v1/gems"] = [response, 401, 'Unauthorized']
+ @fetcher.data["#{Gem.host}/api/v1/gems"] = [response, 401, "Unauthorized"]
@otp_ui = Gem::MockGemUi.new "111111\n"
assert_raise Gem::MockGemUi::TermError do
@@ -394,19 +394,19 @@ class TestGemCommandsPushCommand < Gem::TestCase
end
assert_match response, @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_equal '111111', @fetcher.last_request['OTP']
+ assert_match "You have enabled multi-factor authentication. Please enter OTP code.", @otp_ui.output
+ assert_match "Code: ", @otp_ui.output
+ assert_equal "111111", @fetcher.last_request["OTP"]
end
def test_sending_gem_unathorized_api_key_with_mfa_enabled
response_mfa_enabled = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
response_forbidden = "The API key doesn't have access"
- response_success = 'Successfully registered gem: freewill (1.0.0)'
+ response_success = "Successfully registered gem: freewill (1.0.0)"
@fetcher.data["#{@host}/api/v1/gems"] = [
- [response_mfa_enabled, 401, 'Unauthorized'],
- [response_forbidden, 403, 'Forbidden'],
+ [response_mfa_enabled, 401, "Unauthorized"],
+ [response_forbidden, 403, "Forbidden"],
[response_success, 200, "OK"],
]
@@ -427,14 +427,14 @@ class TestGemCommandsPushCommand < Gem::TestCase
assert_match "Password:", @ui.output
assert_match "Added push_rubygem scope to the existing API key", @ui.output
assert_match response_success, @ui.output
- assert_equal '11111', @fetcher.last_request['OTP']
+ assert_equal "11111", @fetcher.last_request["OTP"]
end
def test_sending_gem_with_no_local_creds
Gem.configuration.rubygems_api_key = nil
response_mfa_enabled = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
- response_success = 'Successfully registered gem: freewill (1.0.0)'
+ response_success = "Successfully registered gem: freewill (1.0.0)"
response_profile = "mfa: disabled\n"
@fetcher.data["#{@host}/api/v1/gems"] = [
@@ -442,7 +442,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
]
@fetcher.data["#{@host}/api/v1/api_key"] = [
- [response_mfa_enabled, 401, 'Unauthorized'],
+ [response_mfa_enabled, 401, "Unauthorized"],
["", 200, "OK"],
]
@@ -466,7 +466,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
assert_match "Password:", @ui.output
assert_match "Signed in with API key:", @ui.output
assert_match response_success, @ui.output
- assert_equal '11111', @fetcher.last_request['OTP']
+ assert_equal "11111", @fetcher.last_request["OTP"]
end
private
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb
index 0cc88b1685..6882098c53 100644
--- a/test/rubygems/test_gem_commands_query_command.rb
+++ b/test/rubygems/test_gem_commands_query_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/query_command'
+require_relative "helper"
+require "rubygems/commands/query_command"
module TestGemCommandsQueryCommandSetup
def setup
@@ -41,7 +41,7 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_all
@@ -64,7 +64,7 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_all_prerelease
@@ -87,15 +87,15 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_details
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2 do |s|
- s.summary = 'This is a lot of text. ' * 4
- s.authors = ['Abraham Lincoln', 'Hirohito']
- s.homepage = 'http://a.example.com/'
+ fetcher.spec "a", 2 do |s|
+ s.summary = "This is a lot of text. " * 4
+ s.authors = ["Abraham Lincoln", "Hirohito"]
+ s.homepage = "http://a.example.com/"
end
fetcher.legacy_platform
@@ -127,13 +127,13 @@ pl (1)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_details_cleans_text
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2 do |s|
- s.summary = 'This is a lot of text. ' * 4
+ fetcher.spec "a", 2 do |s|
+ s.summary = "This is a lot of text. " * 4
s.authors = ["Abraham Lincoln \x01", "\x02 Hirohito"]
s.homepage = "http://a.example.com/\x03"
end
@@ -167,13 +167,13 @@ pl (1)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_details_truncates_summary
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2 do |s|
- s.summary = 'This is a lot of text. ' * 10_000
+ fetcher.spec "a", 2 do |s|
+ s.summary = "This is a lot of text. " * 10_000
s.authors = ["Abraham Lincoln \x01", "\x02 Hirohito"]
s.homepage = "http://a.example.com/\x03"
end
@@ -207,7 +207,7 @@ pl (1)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_installed
@@ -220,7 +220,7 @@ pl (1)
end
assert_equal "true\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_installed_inverse
@@ -233,7 +233,7 @@ pl (1)
end
assert_equal "false\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
assert_equal 1, e.exit_code
end
@@ -248,7 +248,7 @@ pl (1)
end
assert_equal "true\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_installed_no_name
@@ -260,7 +260,7 @@ pl (1)
end
end
- assert_equal '', @stub_ui.output
+ assert_equal "", @stub_ui.output
assert_equal "ERROR: You must specify a gem name\n", @stub_ui.error
assert_equal 4, e.exit_code
@@ -276,7 +276,7 @@ pl (1)
end
assert_equal "false\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
assert_equal 1, e.exit_code
end
@@ -291,7 +291,7 @@ pl (1)
end
assert_equal "true\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_installed_version_not_installed
@@ -304,7 +304,7 @@ pl (1)
end
assert_equal "false\n", @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
assert_equal 1, e.exit_code
end
@@ -329,7 +329,7 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_local_notty
@@ -351,7 +351,7 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_local_quiet
@@ -372,7 +372,7 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_no_versions
@@ -395,7 +395,7 @@ pl
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_notty
@@ -417,7 +417,7 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_prerelease
@@ -435,7 +435,7 @@ a (3.a)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_prerelease_local
@@ -502,7 +502,7 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_remote_notty
@@ -524,7 +524,7 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_remote_quiet
@@ -545,16 +545,16 @@ pl (1 i386-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_make_entry
- a_2_name = @specs['a-2'].original_name
+ a_2_name = @specs["a-2"].original_name
@stub_fetcher.data.delete \
"#{@gem_repo}quick/Marshal.#{Gem.marshal_version}/#{a_2_name}.gemspec.rz"
- a2 = @specs['a-2']
+ a2 = @specs["a-2"]
entry_tuples = [
[Gem::NameTuple.new(a2.name, a2.version, a2.platform),
Gem.sources.first],
@@ -564,7 +564,7 @@ pl (1 i386-linux)
entry = @cmd.send :make_entry, entry_tuples, platforms
- assert_equal 'a (2)', entry
+ assert_equal "a (2)", entry
end
# Test for multiple args handling!
@@ -581,7 +581,7 @@ pl (1 i386-linux)
assert_match %r{^a }, @stub_ui.output
assert_match %r{^pl }, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_show_gems
@@ -601,9 +601,9 @@ pl (1 i386-linux)
def add_gems_to_fetcher
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'a', '3.a'
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "a", "3.a"
end
end
end
@@ -613,13 +613,13 @@ class TestGemCommandsQueryCommandWithoutInstalledGems < Gem::TestCase
def test_execute_platform
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 1 do |s|
- s.platform = 'x86-linux'
+ fetcher.spec "a", 1
+ fetcher.spec "a", 1 do |s|
+ s.platform = "x86-linux"
end
- fetcher.spec 'a', 2 do |s|
- s.platform = 'universal-darwin'
+ fetcher.spec "a", 2 do |s|
+ s.platform = "universal-darwin"
end
end
@@ -637,13 +637,13 @@ a (2 universal-darwin, 1 ruby x86-linux)
EOF
assert_equal expected, @stub_ui.output
- assert_equal '', @stub_ui.error
+ assert_equal "", @stub_ui.error
end
def test_execute_show_default_gems
- spec_fetcher {|fetcher| fetcher.spec 'a', 2 }
+ spec_fetcher {|fetcher| fetcher.spec "a", 2 }
- a1 = new_default_spec 'a', 1
+ a1 = new_default_spec "a", 1
install_default_gems a1
use_ui @stub_ui do
@@ -661,8 +661,8 @@ EOF
end
def test_execute_show_default_gems_with_platform
- a1 = new_default_spec 'a', 1
- a1.platform = 'java'
+ a1 = new_default_spec "a", 1
+ a1.platform = "java"
install_default_gems a1
use_ui @stub_ui do
@@ -681,10 +681,10 @@ EOF
def test_execute_default_details
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
+ fetcher.spec "a", 2
end
- a1 = new_default_spec 'a', 1
+ a1 = new_default_spec "a", 1
install_default_gems a1
@cmd.handle_options %w[-l -d]
@@ -711,15 +711,15 @@ a (2, 1)
def test_execute_local_details
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1 do |s|
- s.platform = 'x86-linux'
+ fetcher.spec "a", 1 do |s|
+ s.platform = "x86-linux"
end
- fetcher.spec 'a', 2 do |s|
- s.summary = 'This is a lot of text. ' * 4
- s.authors = ['Abraham Lincoln', 'Hirohito']
- s.homepage = 'http://a.example.com/'
- s.platform = 'universal-darwin'
+ fetcher.spec "a", 2 do |s|
+ s.summary = "This is a lot of text. " * 4
+ s.authors = ["Abraham Lincoln", "Hirohito"]
+ s.homepage = "http://a.example.com/"
+ s.platform = "universal-darwin"
end
fetcher.legacy_platform
@@ -766,9 +766,9 @@ pl (1)
def test_execute_exact_remote
spec_fetcher do |fetcher|
- fetcher.spec 'coolgem-omg', 3
- fetcher.spec 'coolgem', '4.2.1'
- fetcher.spec 'wow_coolgem', 1
+ fetcher.spec "coolgem-omg", 3
+ fetcher.spec "coolgem", "4.2.1"
+ fetcher.spec "wow_coolgem", 1
end
@cmd.handle_options %w[--remote --exact coolgem]
@@ -789,9 +789,9 @@ coolgem (4.2.1)
def test_execute_exact_local
spec_fetcher do |fetcher|
- fetcher.spec 'coolgem-omg', 3
- fetcher.spec 'coolgem', '4.2.1'
- fetcher.spec 'wow_coolgem', 1
+ fetcher.spec "coolgem-omg", 3
+ fetcher.spec "coolgem", "4.2.1"
+ fetcher.spec "wow_coolgem", 1
end
@cmd.handle_options %w[--exact coolgem]
@@ -812,13 +812,13 @@ coolgem (4.2.1)
def test_execute_exact_multiple
spec_fetcher do |fetcher|
- fetcher.spec 'coolgem-omg', 3
- fetcher.spec 'coolgem', '4.2.1'
- fetcher.spec 'wow_coolgem', 1
+ fetcher.spec "coolgem-omg", 3
+ fetcher.spec "coolgem", "4.2.1"
+ fetcher.spec "wow_coolgem", 1
- fetcher.spec 'othergem-omg', 3
- fetcher.spec 'othergem', '1.2.3'
- fetcher.spec 'wow_othergem', 1
+ fetcher.spec "othergem-omg", 3
+ fetcher.spec "othergem", "1.2.3"
+ fetcher.spec "wow_othergem", 1
end
@cmd.handle_options %w[--exact coolgem othergem]
@@ -849,9 +849,9 @@ othergem (1.2.3)
def add_gems_to_fetcher
spec_fetcher do |fetcher|
- fetcher.download 'a', 1
- fetcher.download 'a', 2
- fetcher.download 'a', '3.a'
+ fetcher.download "a", 1
+ fetcher.download "a", 2
+ fetcher.download "a", "3.a"
end
end
end
diff --git a/test/rubygems/test_gem_commands_search_command.rb b/test/rubygems/test_gem_commands_search_command.rb
index 6397dbd4d4..afa6ff8d13 100644
--- a/test/rubygems/test_gem_commands_search_command.rb
+++ b/test/rubygems/test_gem_commands_search_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/search_command'
+require_relative "helper"
+require "rubygems/commands/search_command"
class TestGemCommandsSearchCommand < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_commands_server_command.rb b/test/rubygems/test_gem_commands_server_command.rb
index 96c328f93f..1becde3ae2 100644
--- a/test/rubygems/test_gem_commands_server_command.rb
+++ b/test/rubygems/test_gem_commands_server_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/server_command'
+require_relative "helper"
+require "rubygems/commands/server_command"
class TestGemCommandsServerCommand < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index ab563b28ee..1c0963ee96 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -1,10 +1,10 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/setup_command'
+require_relative "helper"
+require "rubygems/commands/setup_command"
class TestGemCommandsSetupCommand < Gem::TestCase
- bundler_gemspec = File.expand_path('../../bundler/lib/bundler/version.rb', __dir__)
+ bundler_gemspec = File.expand_path("../../bundler/lib/bundler/version.rb", __dir__)
if File.exist?(bundler_gemspec)
BUNDLER_VERS = File.read(bundler_gemspec).match(/VERSION = "(#{Gem::Version::VERSION_PATTERN})"/)[1]
else
@@ -42,11 +42,11 @@ class TestGemCommandsSetupCommand < Gem::TestCase
gemspec.bindir = "exe"
gemspec.executables = ["bundle", "bundler"]
- File.open 'bundler/bundler.gemspec', 'w' do |io|
+ File.open "bundler/bundler.gemspec", "w" do |io|
io.puts gemspec.to_ruby
end
- File.open(File.join(Gem.default_specifications_dir, "bundler-1.15.4.gemspec"), 'w') do |io|
+ File.open(File.join(Gem.default_specifications_dir, "bundler-1.15.4.gemspec"), "w") do |io|
gemspec.version = "1.15.4"
io.puts gemspec.to_ruby
end
@@ -54,16 +54,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
spec_fetcher do |fetcher|
fetcher.download "bundler", "1.15.4"
- fetcher.gem "bundler", BUNDLER_VERS
+ fetcher.gem "bundler", bundler_version
fetcher.gem "bundler-audit", "1.0.0"
end
end
def test_execute_regenerate_binstubs
- gem_bin_path = gem_install 'a'
+ gem_bin_path = gem_install "a"
write_file gem_bin_path do |io|
- io.puts 'I changed it!'
+ io.puts "I changed it!"
end
@cmd.options[:document] = []
@@ -73,9 +73,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
def test_execute_no_regenerate_binstubs
- gem_bin_path = gem_install 'a'
+ gem_bin_path = gem_install "a"
write_file gem_bin_path do |io|
- io.puts 'I changed it!'
+ io.puts "I changed it!"
end
@cmd.options[:document] = []
@@ -86,9 +86,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
def test_execute_regenerate_plugins
- gem_plugin_path = gem_install_with_plugin 'a'
+ gem_plugin_path = gem_install_with_plugin "a"
write_file gem_plugin_path do |io|
- io.puts 'I changed it!'
+ io.puts "I changed it!"
end
@cmd.options[:document] = []
@@ -98,9 +98,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
def test_execute_no_regenerate_plugins
- gem_plugin_path = gem_install_with_plugin 'a'
+ gem_plugin_path = gem_install_with_plugin "a"
write_file gem_plugin_path do |io|
- io.puts 'I changed it!'
+ io.puts "I changed it!"
end
@cmd.options[:document] = []
@@ -111,7 +111,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
def test_execute_regenerate_plugins_creates_plugins_dir_if_not_there
- gem_plugin_path = gem_install_with_plugin 'a'
+ gem_plugin_path = gem_install_with_plugin "a"
# Simulate gem installed with an older rubygems without a plugins layout
FileUtils.rm_rf Gem.plugindir
@@ -138,16 +138,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
def test_env_shebang_flag
- gem_bin_path = gem_install 'a'
+ gem_bin_path = gem_install "a"
write_file gem_bin_path do |io|
- io.puts 'I changed it!'
+ io.puts "I changed it!"
end
@cmd.options[:document] = []
@cmd.options[:env_shebang] = true
@cmd.execute
- ruby_exec = sprintf Gem.default_exec_format, 'ruby'
+ ruby_exec = sprintf Gem.default_exec_format, "ruby"
bin_env = 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)
@@ -159,47 +159,44 @@ class TestGemCommandsSetupCommand < Gem::TestCase
def test_destdir_flag_does_not_try_to_write_to_the_default_gem_home
FileUtils.chmod "-w", File.join(@gemhome, "plugins")
- destdir = File.join(@tempdir, 'foo')
+ destdir = File.join(@tempdir, "foo")
@cmd.options[:destdir] = destdir
@cmd.execute
- spec = Gem::Specification.load("bundler/bundler.gemspec")
-
- spec.executables.each do |e|
- assert_path_exist File.join destdir, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'gems', spec.full_name, spec.bindir, e
+ bundler_spec.executables.each do |e|
+ assert_path_exist prepend_destdir(destdir, File.join(@gemhome, "gems", bundler_spec.full_name, bundler_spec.bindir, e))
end
end
def test_files_in
assert_equal %w[rubygems.rb rubygems/requirement.rb rubygems/ssl_certs/rubygems.org/foo.pem],
- @cmd.files_in('lib').sort
+ @cmd.files_in("lib").sort
end
def test_install_lib
@cmd.extend FileUtils
- Dir.mktmpdir 'lib' do |dir|
+ Dir.mktmpdir "lib" do |dir|
@cmd.install_lib dir
- assert_path_exist File.join(dir, 'rubygems.rb')
- assert_path_exist File.join(dir, 'rubygems/ssl_certs/rubygems.org/foo.pem')
+ assert_path_exist File.join(dir, "rubygems.rb")
+ assert_path_exist File.join(dir, "rubygems/ssl_certs/rubygems.org/foo.pem")
- assert_path_exist File.join(dir, 'bundler.rb')
- assert_path_exist File.join(dir, 'bundler/b.rb')
+ assert_path_exist File.join(dir, "bundler.rb")
+ assert_path_exist File.join(dir, "bundler/b.rb")
- assert_path_exist File.join(dir, 'bundler/templates/.circleci/config.yml')
- assert_path_exist File.join(dir, 'bundler/templates/.travis.yml')
+ assert_path_exist File.join(dir, "bundler/templates/.circleci/config.yml")
+ assert_path_exist File.join(dir, "bundler/templates/.travis.yml")
end
end
def test_install_default_bundler_gem
@cmd.extend FileUtils
- bin_dir = File.join(@gemhome, 'bin')
+ bin_dir = File.join(@gemhome, "bin")
@cmd.install_default_bundler_gem bin_dir
- bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
default_spec_path = File.join(Gem.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
spec = Gem::Specification.load(default_spec_path)
@@ -211,32 +208,46 @@ class TestGemCommandsSetupCommand < Gem::TestCase
assert_path_exist File.join bin_dir, e
end
- default_dir = Gem.default_specifications_dir
-
# expect to remove other versions of bundler gemspecs on default specification directory.
- assert_path_not_exist File.join(default_dir, "bundler-1.15.4.gemspec")
- assert_path_exist File.join(default_dir, "bundler-#{BUNDLER_VERS}.gemspec")
+ assert_path_not_exist previous_bundler_specification_path
+ assert_path_exist new_bundler_specification_path
# expect to not remove bundler-* gemspecs.
assert_path_exist File.join(Gem.dir, "specifications", "bundler-audit-1.0.0.gemspec")
# expect to remove normal gem that was same version. because it's promoted default gems.
- assert_path_not_exist File.join(Gem.dir, "specifications", "bundler-#{BUNDLER_VERS}.gemspec")
+ assert_path_not_exist File.join(Gem.dir, "specifications", "bundler-#{bundler_version}.gemspec")
- assert_path_exist "#{Gem.dir}/gems/bundler-#{BUNDLER_VERS}"
+ assert_path_exist "#{Gem.dir}/gems/bundler-#{bundler_version}"
assert_path_exist "#{Gem.dir}/gems/bundler-1.15.4"
assert_path_exist "#{Gem.dir}/gems/bundler-audit-1.0.0"
end
+ def test_install_default_bundler_gem_with_default_gems_not_installed_at_default_dir
+ @cmd.extend FileUtils
+
+ gemhome2 = File.join(@tempdir, "gemhome2")
+ Gem.instance_variable_set(:@default_dir, gemhome2)
+
+ FileUtils.mkdir_p gemhome2
+ bin_dir = File.join(gemhome2, "bin")
+
+ @cmd.install_default_bundler_gem bin_dir
+
+ # expect to remove other versions of bundler gemspecs on default specification directory.
+ assert_path_not_exist previous_bundler_specification_path
+ assert_path_exist new_bundler_specification_path
+ end
+
def test_install_default_bundler_gem_with_force_flag
@cmd.extend FileUtils
- bin_dir = File.join(@gemhome, 'bin')
- bundle_bin = File.join(bin_dir, 'bundle')
+ bin_dir = File.join(@gemhome, "bin")
+ bundle_bin = File.join(bin_dir, "bundle")
write_file bundle_bin do |f|
- f.puts '#!/usr/bin/ruby'
- f.puts ''
+ f.puts "#!/usr/bin/ruby"
+ f.puts ""
f.puts 'echo "hello"'
end
@@ -244,7 +255,6 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.install_default_bundler_gem bin_dir
- bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
default_spec_path = File.join(Gem.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
spec = Gem::Specification.load(default_spec_path)
@@ -262,17 +272,23 @@ class TestGemCommandsSetupCommand < Gem::TestCase
FileUtils.chmod "-w", @gemhome
- destdir = File.join(@tempdir, 'foo')
- bin_dir = File.join(destdir, 'bin')
+ destdir = File.join(@tempdir, "foo")
+ bin_dir = File.join(destdir, "bin")
@cmd.options[:destdir] = destdir
@cmd.install_default_bundler_gem bin_dir
- spec = Gem::Specification.load("bundler/bundler.gemspec")
+ # leaves other versions of bundler gemspecs on default specification directory.
+ assert_path_exist previous_bundler_specification_path
+ assert_path_not_exist new_bundler_specification_path
- spec.executables.each do |e|
- assert_path_exist File.join destdir, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'gems', spec.full_name, spec.bindir, e
+ # installs the updated bundler gemspec to destdir
+ assert_path_not_exist prepend_destdir(destdir, previous_bundler_specification_path)
+ assert_path_exist prepend_destdir(destdir, new_bundler_specification_path)
+
+ bundler_spec.executables.each do |e|
+ assert_path_exist prepend_destdir(destdir, File.join(@gemhome, "gems", bundler_spec.full_name, bundler_spec.bindir, e))
end
ensure
FileUtils.chmod "+w", @gemhome
@@ -281,39 +297,37 @@ class TestGemCommandsSetupCommand < Gem::TestCase
def test_install_default_bundler_gem_with_destdir_and_prefix_flags
@cmd.extend FileUtils
- destdir = File.join(@tempdir, 'foo')
- bin_dir = File.join(destdir, 'bin')
+ destdir = File.join(@tempdir, "foo")
+ bin_dir = File.join(destdir, "bin")
@cmd.options[:destdir] = destdir
@cmd.options[:prefix] = "/"
@cmd.install_default_bundler_gem bin_dir
- spec = Gem::Specification.load("bundler/bundler.gemspec")
-
- spec.executables.each do |e|
- assert_path_exist File.join destdir, 'gems', spec.full_name, spec.bindir, e
+ bundler_spec.executables.each do |e|
+ assert_path_exist File.join destdir, "gems", bundler_spec.full_name, bundler_spec.bindir, e
end
end
def test_remove_old_lib_files
lib = RbConfig::CONFIG["sitelibdir"]
- lib_rubygems = File.join lib, 'rubygems'
- lib_bundler = File.join lib, 'bundler'
- lib_rubygems_defaults = File.join lib_rubygems, 'defaults'
- lib_bundler_templates = File.join lib_bundler, 'templates'
+ lib_rubygems = File.join lib, "rubygems"
+ lib_bundler = File.join lib, "bundler"
+ lib_rubygems_defaults = File.join lib_rubygems, "defaults"
+ lib_bundler_templates = File.join lib_bundler, "templates"
- securerandom_rb = File.join lib, 'securerandom.rb'
+ securerandom_rb = File.join lib, "securerandom.rb"
- engine_defaults_rb = File.join lib_rubygems_defaults, 'jruby.rb'
- os_defaults_rb = File.join lib_rubygems_defaults, 'operating_system.rb'
+ engine_defaults_rb = File.join lib_rubygems_defaults, "jruby.rb"
+ os_defaults_rb = File.join lib_rubygems_defaults, "operating_system.rb"
- old_gauntlet_rubygems_rb = File.join lib, 'gauntlet_rubygems.rb'
+ old_gauntlet_rubygems_rb = File.join lib, "gauntlet_rubygems.rb"
- old_builder_rb = File.join lib_rubygems, 'builder.rb'
- old_format_rb = File.join lib_rubygems, 'format.rb'
- old_bundler_c_rb = File.join lib_bundler, 'c.rb'
- old_bundler_ci = File.join lib_bundler_templates, '.lecacy_ci', 'config.yml'
+ old_builder_rb = File.join lib_rubygems, "builder.rb"
+ old_format_rb = File.join lib_rubygems, "format.rb"
+ old_bundler_c_rb = File.join lib_bundler, "c.rb"
+ old_bundler_ci = File.join lib_bundler_templates, ".lecacy_ci", "config.yml"
files_that_go = [old_gauntlet_rubygems_rb, old_builder_rb, old_format_rb, old_bundler_c_rb, old_bundler_ci]
files_that_stay = [securerandom_rb, engine_defaults_rb, os_defaults_rb]
@@ -328,15 +342,15 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
def test_remove_old_man_files
- man = File.join RbConfig::CONFIG['mandir'], 'man'
+ man = File.join RbConfig::CONFIG["mandir"], "man"
- ruby_1 = File.join man, 'man1', 'ruby.1'
- bundle_b_1 = File.join man, 'man1', 'bundle-b.1'
- bundle_b_1_ronn = File.join man, 'man1', 'bundle-b.1.ronn'
- bundle_b_1_txt = File.join man, 'man1', 'bundle-b.1.txt'
- gemfile_5 = File.join man, 'man5', 'gemfile.5'
- gemfile_5_ronn = File.join man, 'man5', 'gemfile.5.ronn'
- gemfile_5_txt = File.join man, 'man5', 'gemfile.5.txt'
+ ruby_1 = File.join man, "man1", "ruby.1"
+ bundle_b_1 = File.join man, "man1", "bundle-b.1"
+ bundle_b_1_ronn = File.join man, "man1", "bundle-b.1.ronn"
+ bundle_b_1_txt = File.join man, "man1", "bundle-b.1.txt"
+ gemfile_5 = File.join man, "man5", "gemfile.5"
+ gemfile_5_ronn = File.join man, "man5", "gemfile.5.ronn"
+ gemfile_5_txt = File.join man, "man5", "gemfile.5.txt"
files_that_go = [bundle_b_1, bundle_b_1_txt, bundle_b_1_ronn, gemfile_5, gemfile_5_txt, gemfile_5_ronn]
files_that_stay = [ruby_1]
@@ -354,9 +368,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@default_external = @ui.outs.external_encoding
@ui.outs.set_encoding Encoding::US_ASCII
- @cmd.options[:previous_version] = Gem::Version.new '2.0.2'
+ @cmd.options[:previous_version] = Gem::Version.new "2.0.2"
- File.open 'CHANGELOG.md', 'w' do |io|
+ File.open "CHANGELOG.md", "w" do |io|
io.puts <<-HISTORY_TXT
# #{Gem::VERSION} / 2013-03-26
@@ -403,7 +417,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
list.each do |file|
FileUtils.mkdir_p File.dirname(file)
- File.open file, 'w' do |io|
+ File.open file, "w" do |io|
io.puts "# #{File.basename(file)}"
end
end
@@ -414,18 +428,18 @@ class TestGemCommandsSetupCommand < Gem::TestCase
s.executables = [name]
s.files = %W[bin/#{name}]
end
- write_file File.join @tempdir, 'bin', name do |f|
- f.puts '#!/usr/bin/ruby'
+ write_file File.join @tempdir, "bin", name do |f|
+ f.puts "#!/usr/bin/ruby"
end
install_gem gem
- File.join @gemhome, 'bin', name
+ File.join @gemhome, "bin", name
end
def gem_install_with_plugin(name)
gem = util_spec name do |s|
s.files = %W[lib/rubygems_plugin.rb]
end
- write_file File.join @tempdir, 'lib', 'rubygems_plugin.rb' do |f|
+ write_file File.join @tempdir, "lib", "rubygems_plugin.rb" do |f|
f.puts "require '#{gem.plugins.first}'"
end
install_gem gem
@@ -434,14 +448,34 @@ class TestGemCommandsSetupCommand < Gem::TestCase
end
def default_gem_bin_path
- File.join RbConfig::CONFIG['bindir'], 'gem'
+ File.join RbConfig::CONFIG["bindir"], "gem"
end
def default_bundle_bin_path
- File.join RbConfig::CONFIG['bindir'], 'bundle'
+ File.join RbConfig::CONFIG["bindir"], "bundle"
end
def default_bundler_bin_path
- File.join RbConfig::CONFIG['bindir'], 'bundler'
+ File.join RbConfig::CONFIG["bindir"], "bundler"
+ end
+
+ def previous_bundler_specification_path
+ File.join(Gem.default_specifications_dir, "bundler-1.15.4.gemspec")
+ end
+
+ def new_bundler_specification_path
+ File.join(Gem.default_specifications_dir, "bundler-#{bundler_version}.gemspec")
+ end
+
+ def bundler_spec
+ Gem::Specification.load("bundler/bundler.gemspec")
+ end
+
+ def bundler_version
+ bundler_spec.version
+ end
+
+ def prepend_destdir(destdir, path)
+ File.join(destdir, path.gsub(/^[a-zA-Z]:/, ""))
end
end unless Gem.java_platform?
diff --git a/test/rubygems/test_gem_commands_signin_command.rb b/test/rubygems/test_gem_commands_signin_command.rb
index cfc0b570e3..ce745bff20 100644
--- a/test/rubygems/test_gem_commands_signin_command.rb
+++ b/test/rubygems/test_gem_commands_signin_command.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/signin_command'
-require 'rubygems/installer'
+require_relative "helper"
+require "rubygems/commands/signin_command"
+require "rubygems/installer"
class TestGemCommandsSigninCommand < Gem::TestCase
def setup
@@ -34,7 +34,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
end
def test_execute_when_already_signed_in_with_same_host
- host = 'http://some-gemcutter-compatible-host.org'
+ host = "http://some-gemcutter-compatible-host.org"
util_capture(nil, host) { @cmd.execute }
old_credentials = load_yaml_file Gem.configuration.credentials_path
@@ -46,10 +46,10 @@ class TestGemCommandsSigninCommand < Gem::TestCase
end
def test_execute_when_already_signed_in_with_different_host
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf04045xxxx'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf04045xxxx"
util_capture(nil, nil, api_key) { @cmd.execute }
- host = 'http://some-gemcutter-compatible-host.org'
+ host = "http://some-gemcutter-compatible-host.org"
util_capture(nil, host, api_key) { @cmd.execute }
credentials = load_yaml_file Gem.configuration.credentials_path
@@ -60,13 +60,13 @@ class TestGemCommandsSigninCommand < Gem::TestCase
end
def test_execute_with_host_supplied
- host = 'http://some-gemcutter-compatible-host.org'
+ host = "http://some-gemcutter-compatible-host.org"
sign_in_ui = util_capture(nil, host) { @cmd.execute }
assert_match %r{Enter your #{host} credentials.}, sign_in_ui.output
assert_match %r{Signed in.}, sign_in_ui.output
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
credentials = load_yaml_file Gem.configuration.credentials_path
assert_equal api_key, credentials[host]
end
@@ -74,16 +74,16 @@ class TestGemCommandsSigninCommand < Gem::TestCase
def test_execute_with_valid_creds_set_for_default_host
util_capture { @cmd.execute }
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
credentials = load_yaml_file Gem.configuration.credentials_path
assert_equal api_key, credentials[:rubygems_api_key]
end
def test_execute_with_key_name_and_scope
- email = 'you@example.com'
- password = 'secret'
- api_key = '1234'
+ email = "you@example.com"
+ password = "secret"
+ api_key = "1234"
fetcher = Gem::RemoteFetcher.fetcher
key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\n"
@@ -106,9 +106,9 @@ class TestGemCommandsSigninCommand < Gem::TestCase
end
def test_execute_with_key_name_scope_and_mfa_level_of_ui_only
- email = 'you@example.com'
- password = 'secret'
- api_key = '1234'
+ email = "you@example.com"
+ password = "secret"
+ api_key = "1234"
fetcher = Gem::RemoteFetcher.fetcher
mfa_level = "ui_only"
@@ -133,9 +133,9 @@ class TestGemCommandsSigninCommand < Gem::TestCase
end
def test_execute_with_key_name_scope_and_mfa_level_of_gem_signin
- email = 'you@example.com'
- password = 'secret'
- api_key = '1234'
+ email = "you@example.com"
+ password = "secret"
+ api_key = "1234"
fetcher = Gem::RemoteFetcher.fetcher
mfa_level = "ui_and_gem_signin"
@@ -159,20 +159,34 @@ class TestGemCommandsSigninCommand < Gem::TestCase
assert_equal api_key, credentials[:rubygems_api_key]
end
+ def test_execute_with_warnings
+ email = "you@example.com"
+ password = "secret"
+ api_key = "1234"
+ fetcher = Gem::RemoteFetcher.fetcher
+ mfa_level = "disabled"
+ warning = "/[WARNING/] For protection of your account and gems"
+
+ key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\ny"
+ util_capture(key_name_ui, nil, api_key, fetcher, mfa_level, warning) { @cmd.execute }
+
+ assert_match warning, key_name_ui.output
+ end
+
def test_execute_on_gemserver_without_profile_me_endpoint
- host = 'http://some-gemcutter-compatible-host.org'
+ host = "http://some-gemcutter-compatible-host.org"
- email = 'you@example.com'
- password = 'secret'
- api_key = '1234'
+ email = "you@example.com"
+ password = "secret"
+ api_key = "1234"
fetcher = Gem::RemoteFetcher.fetcher
key_name_ui = Gem::MockGemUi.new "#{email}\n#{password}\ntest-key\n\ny\n\n\n\n\n\ny"
# Set the expected response for the Web-API supplied
- ENV['RUBYGEMS_HOST'] = host
+ ENV["RUBYGEMS_HOST"] = host
data_key = "#{ENV['RUBYGEMS_HOST']}/api/v1/api_key"
- fetcher.data[data_key] = [api_key, 200, 'OK']
+ fetcher.data[data_key] = [api_key, 200, "OK"]
use_ui key_name_ui do
@cmd.execute
@@ -193,15 +207,15 @@ class TestGemCommandsSigninCommand < Gem::TestCase
# Utility method to capture IO/UI within the block passed
- def util_capture(ui_stub = nil, host = nil, api_key = nil, fetcher = Gem::FakeFetcher.new, mfa_level = "disabled")
- api_key ||= 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
- response = [api_key, 200, 'OK']
- profile_response = [ "mfa: #{mfa_level}\n" , 200, 'OK']
- email = 'you@example.com'
- password = 'secret'
+ def util_capture(ui_stub = nil, host = nil, api_key = nil, fetcher = Gem::FakeFetcher.new, mfa_level = "disabled", warning = nil)
+ api_key ||= "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
+ response = [api_key, 200, "OK"]
+ profile_response = [ "mfa: #{mfa_level}\nwarning: #{warning}" , 200, "OK"]
+ email = "you@example.com"
+ password = "secret"
# Set the expected response for the Web-API supplied
- ENV['RUBYGEMS_HOST'] = host || Gem::DEFAULT_HOST
+ ENV["RUBYGEMS_HOST"] = host || Gem::DEFAULT_HOST
data_key = "#{ENV['RUBYGEMS_HOST']}/api/v1/api_key"
fetcher.data[data_key] = response
profile = "#{ENV['RUBYGEMS_HOST']}/api/v1/profile/me.yaml"
diff --git a/test/rubygems/test_gem_commands_signout_command.rb b/test/rubygems/test_gem_commands_signout_command.rb
index aa6300b6ab..992b127a94 100644
--- a/test/rubygems/test_gem_commands_signout_command.rb
+++ b/test/rubygems/test_gem_commands_signout_command.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/signout_command'
-require 'rubygems/installer'
+require_relative "helper"
+require "rubygems/commands/signout_command"
+require "rubygems/installer"
class TestGemCommandsSignoutCommand < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
index 6a5d8b06f5..b7c164c0e6 100644
--- a/test/rubygems/test_gem_commands_sources_command.rb
+++ b/test/rubygems/test_gem_commands_sources_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/sources_command'
+require_relative "helper"
+require "rubygems/commands/sources_command"
class TestGemCommandsSourcesCommand < Gem::TestCase
def setup
@@ -20,7 +20,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
end
def test_initialize_proxy
- assert @cmd.handles?(['--http-proxy', 'http://proxy.example.com'])
+ assert @cmd.handles?(["--http-proxy", "http://proxy.example.com"])
end
def test_execute
@@ -37,12 +37,12 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_add
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
specs = Gem::Specification.map do |spec|
@@ -70,7 +70,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_add_allow_typo_squatting_source
@@ -161,7 +161,6 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
ui = Gem::MockGemUi.new("n")
use_ui ui do
-
assert_raise Gem::MockGemUi::TermError do
@cmd.execute
end
@@ -182,7 +181,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
uri = "http://beta-gems.example.com/specs.#{@marshal_version}.gz"
@fetcher.data[uri] = proc do
- raise Gem::RemoteFetcher::FetchError.new('it died', uri)
+ raise Gem::RemoteFetcher::FetchError.new("it died", uri)
end
@cmd.handle_options %w[--add http://beta-gems.example.com]
@@ -199,7 +198,7 @@ Error fetching http://beta-gems.example.com:
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_add_existent_source_invalid_uri
@@ -209,7 +208,7 @@ Error fetching http://beta-gems.example.com:
@cmd.handle_options %w[--add https://u:p@example.com]
@fetcher.data[uri] = proc do
- raise Gem::RemoteFetcher::FetchError.new('it died', uri)
+ raise Gem::RemoteFetcher::FetchError.new("it died", uri)
end
use_ui @ui do
@@ -224,7 +223,7 @@ Error fetching https://u:REDACTED@example.com:
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_add_existent_source_invalid_uri_with_error_by_chance_including_the_uri_password
@@ -234,7 +233,7 @@ Error fetching https://u:REDACTED@example.com:
@cmd.handle_options %w[--add https://u:secret@example.com]
@fetcher.data[uri] = proc do
- raise Gem::RemoteFetcher::FetchError.new('it secretly died', uri)
+ raise Gem::RemoteFetcher::FetchError.new("it secretly died", uri)
end
use_ui @ui do
@@ -249,7 +248,7 @@ Error fetching https://u:REDACTED@example.com:
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_add_redundant_source
@@ -268,7 +267,7 @@ source #{@gem_repo} already present in the cache
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_add_redundant_source_trailing_slash
@@ -288,7 +287,7 @@ source #{@gem_repo} already present in the cache
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
# Re-add pre-existing gem source (w/o slash)
repo_without_slash = "http://gems.example.com"
@@ -305,7 +304,7 @@ http://gems.example.com added to sources
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
# Re-add original gem source (w/ slash)
@cmd.handle_options %W[--add #{repo_with_slash}]
@@ -322,14 +321,14 @@ source http://gems.example.com/ already present in the cache
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_add_http_rubygems_org
- http_rubygems_org = 'http://rubygems.org/'
+ http_rubygems_org = "http://rubygems.org/"
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
specs = Gem::Specification.map do |spec|
@@ -394,10 +393,10 @@ source http://gems.example.com/ already present in the cache
end
def test_execute_add_https_rubygems_org
- https_rubygems_org = 'https://rubygems.org/'
+ https_rubygems_org = "https://rubygems.org/"
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
specs = Gem::Specification.map do |spec|
@@ -447,7 +446,7 @@ beta-gems.example.com is not a URI
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_clear_all
@@ -462,10 +461,10 @@ beta-gems.example.com is not a URI
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
dir = Gem.spec_cache_dir
- refute File.exist?(dir), 'cache dir removed'
+ refute File.exist?(dir), "cache dir removed"
end
def test_execute_list
@@ -482,7 +481,7 @@ beta-gems.example.com is not a URI
EOF
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_remove
@@ -495,7 +494,7 @@ beta-gems.example.com is not a URI
expected = "#{@gem_repo} removed from sources\n"
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_remove_no_network
@@ -514,14 +513,14 @@ beta-gems.example.com is not a URI
expected = "#{@gem_repo} removed from sources\n"
assert_equal expected, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_update
@cmd.handle_options %w[--update]
spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
+ fetcher.gem "a", 1
end
use_ui @ui do
@@ -529,6 +528,6 @@ beta-gems.example.com is not a URI
end
assert_equal "source cache successfully updated\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
end
diff --git a/test/rubygems/test_gem_commands_specification_command.rb b/test/rubygems/test_gem_commands_specification_command.rb
index c8cb7df32e..7564baa2ca 100644
--- a/test/rubygems/test_gem_commands_specification_command.rb
+++ b/test/rubygems/test_gem_commands_specification_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/specification_command'
+require_relative "helper"
+require "rubygems/commands/specification_command"
class TestGemCommandsSpecificationCommand < Gem::TestCase
def setup
@@ -10,7 +10,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute
- foo = util_spec 'foo'
+ foo = util_spec "foo"
install_specs foo
@@ -22,12 +22,12 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
assert_match %r{Gem::Specification}, @ui.output
assert_match %r{name: foo}, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_all
- install_specs util_spec 'foo', '0.0.1'
- install_specs util_spec 'foo', '0.0.2'
+ install_specs util_spec "foo", "0.0.1"
+ install_specs util_spec "foo", "0.0.2"
@cmd.options[:args] = %w[foo]
@cmd.options[:all] = true
@@ -40,12 +40,12 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
assert_match %r{name: foo}, @ui.output
assert_match %r{version: 0.0.1}, @ui.output
assert_match %r{version: 0.0.2}, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_all_conflicts_with_version
- util_spec 'foo', '0.0.1'
- util_spec 'foo', '0.0.2'
+ util_spec "foo", "0.0.1"
+ util_spec "foo", "0.0.2"
@cmd.options[:args] = %w[foo]
@cmd.options[:all] = true
@@ -57,7 +57,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
end
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
assert_equal "ERROR: Specify --all or -v, not both\n", @ui.error
end
@@ -70,7 +70,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
end
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
assert_equal "ERROR: No gem matching 'foo (>= 0)' found\n", @ui.error
end
@@ -84,13 +84,13 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
end
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
assert_equal "ERROR: No gem matching 'foo (= 1.3.2)' found\n", @ui.error
end
def test_execute_exact_match
- install_specs util_spec 'foo'
- install_specs util_spec 'foo_bar'
+ install_specs util_spec "foo"
+ install_specs util_spec "foo_bar"
@cmd.options[:args] = %w[foo]
@@ -100,11 +100,11 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
assert_match %r{Gem::Specification}, @ui.output
assert_match %r{name: foo}, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_field
- foo = util_spec 'foo', '2'
+ foo = util_spec "foo", "2"
install_specs foo
@@ -118,7 +118,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_file
- foo = util_spec 'foo' do |s|
+ foo = util_spec "foo" do |s|
s.files = %w[lib/code.rb]
end
@@ -132,11 +132,11 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
assert_match %r{Gem::Specification}, @ui.output
assert_match %r{name: foo}, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_marshal
- foo = util_spec 'foo', '2'
+ foo = util_spec "foo", "2"
install_specs foo
@@ -148,12 +148,12 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
assert_equal foo, Marshal.load(@ui.output)
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_remote
spec_fetcher do |fetcher|
- fetcher.spec 'foo', 1
+ fetcher.spec "foo", 1
end
@cmd.options[:args] = %w[foo]
@@ -169,8 +169,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
def test_execute_remote_with_version
spec_fetcher do |fetcher|
- fetcher.spec 'foo', "1"
- fetcher.spec 'foo', "2"
+ fetcher.spec "foo", "1"
+ fetcher.spec "foo", "2"
end
@cmd.options[:args] = %w[foo]
@@ -190,9 +190,9 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
original_platforms = Gem.platforms.dup
spec_fetcher do |fetcher|
- fetcher.spec 'foo', "1"
- fetcher.spec 'foo', "1" do |s|
- s.platform = 'x86_64-linux'
+ fetcher.spec "foo", "1"
+ fetcher.spec "foo", "1" do |s|
+ s.platform = "x86_64-linux"
end
end
@@ -216,8 +216,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
def test_execute_remote_without_prerelease
spec_fetcher do |fetcher|
- fetcher.spec 'foo', '2.0.0'
- fetcher.spec 'foo', '2.0.1.pre'
+ fetcher.spec "foo", "2.0.0"
+ fetcher.spec "foo", "2.0.1.pre"
end
@cmd.options[:args] = %w[foo]
@@ -237,8 +237,8 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
def test_execute_remote_with_prerelease
spec_fetcher do |fetcher|
- fetcher.spec 'foo', '2.0.0'
- fetcher.spec 'foo', '2.0.1.pre'
+ fetcher.spec "foo", "2.0.0"
+ fetcher.spec "foo", "2.0.1.pre"
end
@cmd.options[:args] = %w[foo]
@@ -258,7 +258,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_ruby
- foo = util_spec 'foo'
+ foo = util_spec "foo"
install_specs foo
@@ -271,6 +271,6 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
assert_match %r{Gem::Specification.new}, @ui.output
assert_match %r{s.name = "foo"}, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
end
diff --git a/test/rubygems/test_gem_commands_stale_command.rb b/test/rubygems/test_gem_commands_stale_command.rb
index 83bd3e5def..99eb23fb30 100644
--- a/test/rubygems/test_gem_commands_stale_command.rb
+++ b/test/rubygems/test_gem_commands_stale_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/stale_command'
+require_relative "helper"
+require "rubygems/commands/stale_command"
class TestGemCommandsStaleCommand < Gem::TestCase
def setup
@@ -11,12 +11,12 @@ class TestGemCommandsStaleCommand < Gem::TestCase
def test_execute_sorts
files = %w[lib/foo_bar.rb Rakefile]
- foo_bar = util_spec 'foo_bar' do |gem|
+ foo_bar = util_spec "foo_bar" do |gem|
gem.files = files
end
install_specs foo_bar
- bar_baz = util_spec 'bar_baz' do |gem|
+ bar_baz = util_spec "bar_baz" do |gem|
gem.files = files
end
install_specs bar_baz
diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb
index 5bd2c40d59..083b831c98 100644
--- a/test/rubygems/test_gem_commands_uninstall_command.rb
+++ b/test/rubygems/test_gem_commands_uninstall_command.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require_relative 'installer_test_case'
-require 'rubygems/commands/uninstall_command'
+require_relative "installer_test_case"
+require "rubygems/commands/uninstall_command"
class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
def setup
super
@cmd = Gem::Commands::UninstallCommand.new
- @executable = File.join(@gemhome, 'bin', 'executable')
+ @executable = File.join(@gemhome, "bin", "executable")
end
def test_execute_all_named
@@ -14,20 +14,20 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
util_make_gems
- default = new_default_spec 'default', '1'
+ default = new_default_spec "default", "1"
install_default_gems default
gemhome2 = "#{@gemhome}2"
- a_4, = util_gem 'a', 4
+ a_4, = util_gem "a", 4
install_gem a_4, :install_dir => gemhome2
Gem::Specification.dirs = [@gemhome, gemhome2]
- assert_includes Gem::Specification.all_names, 'a-1'
- assert_includes Gem::Specification.all_names, 'a-4'
- assert_includes Gem::Specification.all_names, 'b-2'
- assert_includes Gem::Specification.all_names, 'default-1'
+ assert_includes Gem::Specification.all_names, "a-1"
+ assert_includes Gem::Specification.all_names, "a-4"
+ assert_includes Gem::Specification.all_names, "b-2"
+ assert_includes Gem::Specification.all_names, "default-1"
@cmd.options[:all] = true
@cmd.options[:args] = %w[a]
@@ -41,10 +41,10 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
end
def test_execute_all_named_default_single
- z_1 = new_default_spec 'z', '1'
+ z_1 = new_default_spec "z", "1"
install_default_gems z_1
- assert_includes Gem::Specification.all_names, 'z-1'
+ assert_includes Gem::Specification.all_names, "z-1"
@cmd.options[:all] = true
@cmd.options[:args] = %w[z]
@@ -57,18 +57,18 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
output = @ui.output.split "\n"
- assert_equal 'Gem z-1 cannot be uninstalled because it is a default gem', output.shift
+ assert_equal "Gem z-1 cannot be uninstalled because it is a default gem", output.shift
end
def test_execute_all_named_default_multiple
- z_1 = new_default_spec 'z', '1'
+ z_1 = new_default_spec "z", "1"
install_default_gems z_1
- z_2, = util_gem 'z', 2
+ z_2, = util_gem "z", 2
install_gem z_2
- assert_includes Gem::Specification.all_names, 'z-1'
- assert_includes Gem::Specification.all_names, 'z-2'
+ assert_includes Gem::Specification.all_names, "z-1"
+ assert_includes Gem::Specification.all_names, "z-2"
@cmd.options[:all] = true
@cmd.options[:args] = %w[z]
@@ -81,15 +81,15 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
output = @ui.output.split "\n"
- assert_equal 'Gem z-1 cannot be uninstalled because it is a default gem', output.shift
- assert_equal 'Successfully uninstalled z-2', output.shift
+ assert_equal "Gem z-1 cannot be uninstalled because it is a default gem", output.shift
+ assert_equal "Successfully uninstalled z-2", output.shift
end
def test_execute_dependency_order
initial_install
- c = quick_gem 'c' do |spec|
- spec.add_dependency 'a'
+ c = quick_gem "c" do |spec|
+ spec.add_dependency "a"
end
util_build_gem c
@@ -110,9 +110,9 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
output = ui.output.split "\n"
- assert_equal 'Successfully uninstalled c-2', output.shift
+ assert_equal "Successfully uninstalled c-2", output.shift
assert_equal "Removing executable", output.shift
- assert_equal 'Successfully uninstalled a-2', output.shift
+ assert_equal "Successfully uninstalled a-2", output.shift
end
def test_execute_removes_executable
@@ -149,12 +149,12 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
FileUtils.rm_f @executable # Wish this didn't happen in #setup
- Gem::Installer.exec_format = 'foo-%s-bar'
+ Gem::Installer.exec_format = "foo-%s-bar"
installer.format_executable = true
installer.install
- formatted_executable = File.join @gemhome, 'bin', 'foo-executable-bar'
+ formatted_executable = File.join @gemhome, "bin", "foo-executable-bar"
assert_equal true, File.exist?(formatted_executable)
@cmd.options[:executables] = true
@@ -197,19 +197,19 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
util_make_gems
- assert_equal 3, Gem::Specification.find_all_by_name('a').length
+ assert_equal 3, Gem::Specification.find_all_by_name("a").length
- @cmd.options[:version] = '1'
+ @cmd.options[:version] = "1"
@cmd.options[:force] = true
- @cmd.options[:args] = ['a']
+ @cmd.options[:args] = ["a"]
use_ui ui do
@cmd.execute
end
- assert_equal 2, Gem::Specification.find_all_by_name('a').length
+ assert_equal 2, Gem::Specification.find_all_by_name("a").length
- assert File.exist? File.join(@gemhome, 'bin', 'executable')
+ assert File.exist? File.join(@gemhome, "bin", "executable")
end
def test_execute_with_version_specified_as_colon
@@ -219,18 +219,18 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
util_make_gems
- assert_equal 3, Gem::Specification.find_all_by_name('a').length
+ assert_equal 3, Gem::Specification.find_all_by_name("a").length
@cmd.options[:force] = true
- @cmd.options[:args] = ['a:1']
+ @cmd.options[:args] = ["a:1"]
use_ui ui do
@cmd.execute
end
- assert_equal 2, Gem::Specification.find_all_by_name('a').length
+ assert_equal 2, Gem::Specification.find_all_by_name("a").length
- assert File.exist? File.join(@gemhome, 'bin', 'executable')
+ assert File.exist? File.join(@gemhome, "bin", "executable")
end
def test_uninstall_selection
@@ -238,22 +238,22 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
util_make_gems
- list = Gem::Specification.find_all_by_name 'a'
+ list = Gem::Specification.find_all_by_name "a"
- @cmd.options[:args] = ['a']
+ @cmd.options[:args] = ["a"]
use_ui ui do
@cmd.execute
end
- updated_list = Gem::Specification.find_all_by_name('a')
+ updated_list = Gem::Specification.find_all_by_name("a")
assert_equal list.length - 1, updated_list.length
- assert_match ' 1. a-1', ui.output
- assert_match ' 2. a-2', ui.output
- assert_match ' 3. a-3.a', ui.output
- assert_match ' 4. All versions', ui.output
- assert_match 'uninstalled a-1', ui.output
+ assert_match " 1. a-1", ui.output
+ assert_match " 2. a-2", ui.output
+ assert_match " 3. a-3.a", ui.output
+ assert_match " 4. All versions", ui.output
+ assert_match "uninstalled a-1", ui.output
end
def test_uninstall_selection_multiple_gems
@@ -261,31 +261,31 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
util_make_gems
- a_list = Gem::Specification.find_all_by_name('a')
- b_list = Gem::Specification.find_all_by_name('b')
+ a_list = Gem::Specification.find_all_by_name("a")
+ b_list = Gem::Specification.find_all_by_name("b")
list = a_list + b_list
- @cmd.options[:args] = ['a', 'b']
+ @cmd.options[:args] = ["a", "b"]
use_ui ui do
@cmd.execute
end
- updated_a_list = Gem::Specification.find_all_by_name('a')
- updated_b_list = Gem::Specification.find_all_by_name('b')
+ updated_a_list = Gem::Specification.find_all_by_name("a")
+ updated_b_list = Gem::Specification.find_all_by_name("b")
updated_list = updated_a_list + updated_b_list
assert_equal list.length - 2, updated_list.length
out = ui.output.split("\n")
- assert_match 'uninstalled b-2', out.shift
- assert_match '', out.shift
- assert_match 'Select gem to uninstall:', out.shift
- assert_match ' 1. a-1', out.shift
- assert_match ' 2. a-2', out.shift
- assert_match ' 3. a-3.a', out.shift
- assert_match ' 4. All versions', out.shift
- assert_match 'uninstalled a-1', out.shift
+ assert_match "uninstalled b-2", out.shift
+ assert_match "", out.shift
+ assert_match "Select gem to uninstall:", out.shift
+ assert_match " 1. a-1", out.shift
+ assert_match " 2. a-2", out.shift
+ assert_match " 3. a-3.a", out.shift
+ assert_match " 4. All versions", out.shift
+ assert_match "uninstalled a-1", out.shift
assert_empty out
end
@@ -294,22 +294,22 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
ui = Gem::MockGemUi.new "y\n"
- a_1, = util_gem 'a', 1
+ a_1, = util_gem "a", 1
install_gem a_1
- a_3a, = util_gem 'a', '3.a'
+ a_3a, = util_gem "a", "3.a"
install_gem a_3a
- assert_equal 3, Gem::Specification.find_all_by_name('a').length
+ assert_equal 3, Gem::Specification.find_all_by_name("a").length
@cmd.options[:force] = true
- @cmd.options[:args] = ['a']
+ @cmd.options[:args] = ["a"]
use_ui ui do
@cmd.execute
end
- assert_empty Gem::Specification.find_all_by_name('a')
+ assert_empty Gem::Specification.find_all_by_name("a")
assert_match "Removing executable", ui.output
refute File.exist? @executable
end
@@ -321,36 +321,36 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
util_make_gems
- assert Gem::Specification.find_all_by_name('dep_x').length > 0
- assert Gem::Specification.find_all_by_name('x').length > 0
+ assert Gem::Specification.find_all_by_name("dep_x").length > 0
+ assert Gem::Specification.find_all_by_name("x").length > 0
@cmd.options[:force] = true
- @cmd.options[:args] = ['x']
+ @cmd.options[:args] = ["x"]
use_ui ui do
@cmd.execute
end
- assert Gem::Specification.find_all_by_name('dep_x').length > 0
- assert Gem::Specification.find_all_by_name('x').length.zero?
+ assert Gem::Specification.find_all_by_name("dep_x").length > 0
+ assert Gem::Specification.find_all_by_name("x").length.zero?
end
def test_execute_all
util_make_gems
- default = new_default_spec 'default', '1'
+ default = new_default_spec "default", "1"
install_default_gems default
gemhome2 = "#{@gemhome}2"
- a_4, = util_gem 'a', 4
+ a_4, = util_gem "a", 4
install_gem a_4
Gem::Specification.dirs = [@gemhome, gemhome2]
- assert_includes Gem::Specification.all_names, 'a-1'
- assert_includes Gem::Specification.all_names, 'a-4'
- assert_includes Gem::Specification.all_names, 'default-1'
+ assert_includes Gem::Specification.all_names, "a-1"
+ assert_includes Gem::Specification.all_names, "a-4"
+ assert_includes Gem::Specification.all_names, "default-1"
@cmd.options[:all] = true
@cmd.options[:args] = []
@@ -368,14 +368,14 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
gemhome2 = "#{@gemhome}2"
- a_4, = util_gem 'a', 4
+ a_4, = util_gem "a", 4
install_gem a_4 , :install_dir => gemhome2
Gem::Specification.dirs = [@gemhome, gemhome2]
- assert_includes Gem::Specification.all_names, 'a-4'
+ assert_includes Gem::Specification.all_names, "a-4"
- @cmd.options[:args] = ['a:4']
+ @cmd.options[:args] = ["a:4"]
e = assert_raise Gem::InstallError do
use_ui ui do
@@ -397,7 +397,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
end
def test_handle_options_vendor
- vendordir(File.join(@tempdir, 'vendor')) do
+ vendordir(File.join(@tempdir, "vendor")) do
use_ui @ui do
@cmd.handle_options %w[--vendor]
end
@@ -440,7 +440,7 @@ WARNING: Use your OS package manager to uninstall vendor gems
@cmd.handle_options %w[--vendor]
end
- assert_equal 'invalid option: --vendor your platform is not supported',
+ assert_equal "invalid option: --vendor your platform is not supported",
e.message
refute @cmd.options[:vendor]
@@ -449,7 +449,7 @@ WARNING: Use your OS package manager to uninstall vendor gems
end
def test_execute_with_gem_not_installed
- @cmd.options[:args] = ['d']
+ @cmd.options[:args] = ["d"]
use_ui ui do
@cmd.execute
diff --git a/test/rubygems/test_gem_commands_unpack_command.rb b/test/rubygems/test_gem_commands_unpack_command.rb
index 55369f1eeb..1d9d0b6bd0 100644
--- a/test/rubygems/test_gem_commands_unpack_command.rb
+++ b/test/rubygems/test_gem_commands_unpack_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/unpack_command'
+require_relative "helper"
+require "rubygems/commands/unpack_command"
class TestGemCommandsUnpackCommand < Gem::TestCase
def setup
@@ -17,28 +17,28 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
assert_equal(
@cmd.find_in_cache(File.basename @a1.cache_file),
@a1.cache_file,
- 'found a-1.gem in the cache'
+ "found a-1.gem in the cache"
)
end
def test_get_path
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
+ fetcher.gem "a", 1
end
- dep = Gem::Dependency.new 'a', 1
+ dep = Gem::Dependency.new "a", 1
assert_equal(
@cmd.get_path(dep),
- specs['a-1'].cache_file,
- 'fetches a-1 and returns the cache path'
+ specs["a-1"].cache_file,
+ "fetches a-1 and returns the cache path"
)
- FileUtils.rm specs['a-1'].cache_file
+ FileUtils.rm specs["a-1"].cache_file
assert_equal(
@cmd.get_path(dep),
- specs['a-1'].cache_file,
- 'when removed from cache, refetches a-1'
+ specs["a-1"].cache_file,
+ "when removed from cache, refetches a-1"
)
end
@@ -53,18 +53,18 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, 'a-3.a')), 'a should be unpacked'
- assert File.exist?(File.join(@tempdir, 'b-2')), 'b should be unpacked'
+ assert File.exist?(File.join(@tempdir, "a-3.a")), "a should be unpacked"
+ assert File.exist?(File.join(@tempdir, "b-2")), "b should be unpacked"
end
def test_execute_gem_path
spec_fetcher do |fetcher|
- fetcher.gem 'a', '3.a'
+ fetcher.gem "a", "3.a"
end
Gem.clear_paths
- gemhome2 = File.join @tempdir, 'gemhome2'
+ gemhome2 = File.join @tempdir, "gemhome2"
Gem.use_paths gemhome2, [gemhome2, @gemhome]
@@ -76,7 +76,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, 'a-3.a'))
+ assert File.exist?(File.join(@tempdir, "a-3.a"))
end
def test_execute_gem_path_missing
@@ -84,7 +84,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
Gem.clear_paths
- gemhome2 = File.join @tempdir, 'gemhome2'
+ gemhome2 = File.join @tempdir, "gemhome2"
Gem.use_paths gemhome2, [gemhome2, @gemhome]
@@ -96,13 +96,13 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
end
def test_execute_remote
spec_fetcher do |fetcher|
- fetcher.download 'a', 1
- fetcher.download 'a', 2
+ fetcher.download "a", 1
+ fetcher.download "a", 2
end
Gem.configuration.verbose = :really
@@ -114,7 +114,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, 'a-2')), 'a should be unpacked'
+ assert File.exist?(File.join(@tempdir, "a-2")), "a should be unpacked"
end
def test_execute_spec
@@ -129,15 +129,15 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, 'a-3.a.gemspec'))
- assert File.exist?(File.join(@tempdir, 'b-2.gemspec'))
+ assert File.exist?(File.join(@tempdir, "a-3.a.gemspec"))
+ assert File.exist?(File.join(@tempdir, "b-2.gemspec"))
end
def test_execute_spec_target
util_make_gems
@cmd.options[:args] = %w[a b]
- @cmd.options[:target] = 'specs'
+ @cmd.options[:target] = "specs"
@cmd.options[:spec] = true
use_ui @ui do
@@ -146,12 +146,12 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, 'specs/a-3.a.gemspec'))
- assert File.exist?(File.join(@tempdir, 'specs/b-2.gemspec'))
+ assert File.exist?(File.join(@tempdir, "specs/a-3.a.gemspec"))
+ assert File.exist?(File.join(@tempdir, "specs/b-2.gemspec"))
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 win_platform?
util_make_gems
@@ -165,7 +165,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, 'b-2')), 'b should be unpacked'
+ assert File.exist?(File.join(@tempdir, "b-2")), "b should be unpacked"
ensure
FileUtils.chmod 0755, @gemhome
end
@@ -173,7 +173,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
def test_execute_with_target_option
util_make_gems
- target = 'with_target'
+ target = "with_target"
@cmd.options[:args] = %w[a]
@cmd.options[:target] = target
@@ -183,12 +183,12 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
end
end
- assert File.exist?(File.join(@tempdir, target, 'a-3.a'))
+ assert File.exist?(File.join(@tempdir, target, "a-3.a"))
end
def test_execute_exact_match
- foo_spec = util_spec 'foo'
- foo_bar_spec = util_spec 'foo_bar'
+ foo_spec = util_spec "foo"
+ foo_bar_spec = util_spec "foo_bar"
use_ui @ui do
Dir.chdir @tempdir do
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index 1d8dcb2e64..58bc7576da 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/update_command'
+require_relative "helper"
+require "rubygems/commands/update_command"
class TestGemCommandsUpdateCommand < Gem::TestCase
def setup
@@ -12,20 +12,20 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
@cmd.options[:document] = []
@specs = spec_fetcher do |fetcher|
- fetcher.download 'a', 1
- fetcher.download 'a', 2
- fetcher.download 'a', '3.a'
+ fetcher.download "a", 1
+ fetcher.download "a", 2
+ fetcher.download "a", "3.a"
end
- @a1_path = @specs['a-1'].cache_file
- @a2_path = @specs['a-1'].cache_file
- @a3a_path = @specs['a-3.a'].cache_file
+ @a1_path = @specs["a-1"].cache_file
+ @a2_path = @specs["a-1"].cache_file
+ @a3a_path = @specs["a-3.a"].cache_file
end
def test_execute
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
- fetcher.spec 'a', 1
+ fetcher.download "a", 2
+ fetcher.spec "a", 1
end
@cmd.options[:args] = []
@@ -43,11 +43,11 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_multiple
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
- fetcher.download 'ab', 2
+ fetcher.download "a", 2
+ fetcher.download "ab", 2
- fetcher.spec 'a', 1
- fetcher.spec 'ab', 1
+ fetcher.spec "a", 1
+ fetcher.spec "ab", 1
end
@cmd.options[:args] = %w[a]
@@ -65,7 +65,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 9 do |s|
+ fetcher.download "rubygems-update", 9 do |s|
s.files = %w[setup.rb]
end
end
@@ -87,7 +87,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_at_latest
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', Gem::VERSION do |s|
+ fetcher.download "rubygems-update", Gem::VERSION do |s|
s.files = %w[setup.rb]
end
end
@@ -108,9 +108,9 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_when_latest_does_not_support_your_ruby
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 9 do |s|
+ fetcher.download "rubygems-update", 9 do |s|
s.files = %w[setup.rb]
- s.required_ruby_version = '> 9'
+ s.required_ruby_version = "> 9"
end
end
@@ -133,11 +133,11 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_multiple
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 8 do |s|
+ fetcher.download "rubygems-update", 8 do |s|
s.files = %w[setup.rb]
end
- fetcher.download 'rubygems-update', 9 do |s|
+ fetcher.download "rubygems-update", 9 do |s|
s.files = %w[setup.rb]
end
end
@@ -159,7 +159,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_update_installed
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 8 do |s|
+ fetcher.download "rubygems-update", 8 do |s|
s.files = %w[setup.rb]
end
end
@@ -170,7 +170,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
@cmd.execute
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 9 do |s|
+ fetcher.download "rubygems-update", 9 do |s|
s.files = %w[setup.rb]
end
end
@@ -193,7 +193,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_update_installed_in_non_default_gem_path
rubygems_update_spec = quick_gem "rubygems-update", 9 do |s|
- write_file File.join(@tempdir, 'setup.rb')
+ write_file File.join(@tempdir, "setup.rb")
s.files += %w[setup.rb]
end
@@ -224,11 +224,11 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_specific
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 8 do |s|
+ fetcher.download "rubygems-update", 8 do |s|
s.files = %w[setup.rb]
end
- fetcher.download 'rubygems-update', 9 do |s|
+ fetcher.download "rubygems-update", 9 do |s|
s.files = %w[setup.rb]
end
end
@@ -250,7 +250,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_specific_older_than_minimum_supported_rubygems
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', "2.5.1" do |s|
+ fetcher.download "rubygems-update", "2.5.1" do |s|
s.files = %w[setup.rb]
end
end
@@ -279,7 +279,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_specific_older_than_3_2_removes_plugins_dir
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 3.1 do |s|
+ fetcher.download "rubygems-update", 3.1 do |s|
s.files = %w[setup.rb]
end
end
@@ -297,7 +297,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
@cmd.options[:system] = "3.1"
FileUtils.mkdir_p Gem.plugindir
- write_file File.join(Gem.plugindir, 'a_plugin.rb')
+ write_file File.join(Gem.plugindir, "a_plugin.rb")
@cmd.execute
@@ -306,7 +306,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_specific_newer_than_or_equal_to_3_2_leaves_plugins_dir_alone
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', "3.2.a" do |s|
+ fetcher.download "rubygems-update", "3.2.a" do |s|
s.files = %w[setup.rb]
end
end
@@ -324,7 +324,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
@cmd.options[:system] = "3.2.a"
FileUtils.mkdir_p Gem.plugindir
- plugin_file = File.join(Gem.plugindir, 'a_plugin.rb')
+ plugin_file = File.join(Gem.plugindir, "a_plugin.rb")
write_file plugin_file
@cmd.execute
@@ -335,11 +335,11 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_specifically_to_latest_version
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 8 do |s|
+ fetcher.download "rubygems-update", 8 do |s|
s.files = %w[setup.rb]
end
- fetcher.download 'rubygems-update', 9 do |s|
+ fetcher.download "rubygems-update", 9 do |s|
s.files = %w[setup.rb]
end
end
@@ -400,12 +400,12 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
@cmd.options[:system] = true
@cmd.options[:silent] = true
- assert_equal true, @cmd.update_rubygems_arguments.include?('--silent')
+ assert_equal true, @cmd.update_rubygems_arguments.include?("--silent")
end
def test_execute_system_silent
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 9 do |s|
+ fetcher.download "rubygems-update", 9 do |s|
s.files = %w[setup.rb]
end
end
@@ -429,12 +429,12 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_dependencies
spec_fetcher do |fetcher|
- fetcher.download 'a', 2, 'b' => 2, 'c' => 2
- fetcher.download 'b', 2
- fetcher.download 'c', 2
+ fetcher.download "a", 2, "b" => 2, "c" => 2
+ fetcher.download "b", 2
+ fetcher.download "c", 2
- fetcher.spec 'a', 1, 'c' => '1.2'
- fetcher.spec 'c', '1.2'
+ fetcher.spec "a", 1, "c" => "1.2"
+ fetcher.spec "c", "1.2"
end
Gem::Specification.reset
@@ -456,8 +456,8 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_rdoc
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
- fetcher.spec 'a', 1
+ fetcher.download "a", 2
+ fetcher.spec "a", 1
end
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
@@ -472,16 +472,16 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
wait_for_child_process_to_exit
- a2 = @specs['a-2']
+ a2 = @specs["a-2"]
- assert_path_exist File.join(a2.doc_dir, 'rdoc')
+ assert_path_exist File.join(a2.doc_dir, "rdoc")
end
def test_execute_named
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
+ fetcher.download "a", 2
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
@cmd.options[:args] = %w[a]
@@ -500,10 +500,10 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_named_some_up_to_date
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
- fetcher.spec 'a', 1
+ fetcher.download "a", 2
+ fetcher.spec "a", 1
- fetcher.spec 'b', 2
+ fetcher.spec "b", 2
end
@cmd.options[:args] = %w[a b]
@@ -523,7 +523,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_named_up_to_date
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
+ fetcher.spec "a", 2
end
@cmd.options[:args] = %w[a]
@@ -542,9 +542,9 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_named_up_to_date_prerelease
spec_fetcher do |fetcher|
- fetcher.download 'a', '3.a'
+ fetcher.download "a", "3.a"
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
@cmd.options[:args] = %w[a]
@@ -564,7 +564,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_up_to_date
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
@cmd.options[:args] = []
@@ -606,63 +606,63 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_fetch_remote_gems
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'a', 2
+ fetcher.gem "a", 1
+ fetcher.gem "a", 2
end
expected = [
- [Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
+ [Gem::NameTuple.new("a", v(2), Gem::Platform::RUBY),
Gem::Source.new(@gem_repo)],
]
- assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
+ assert_equal expected, @cmd.fetch_remote_gems(specs["a-1"])
end
def test_fetch_remote_gems_error
Gem.sources.replace %w[http://nonexistent.example]
assert_raise Gem::RemoteFetcher::FetchError do
- @cmd.fetch_remote_gems @specs['a-1']
+ @cmd.fetch_remote_gems @specs["a-1"]
end
end
def test_fetch_remote_gems_mismatch
- platform = Gem::Platform.new 'x86-freebsd9'
+ platform = Gem::Platform.new "x86-freebsd9"
specs = spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
- fetcher.spec 'a', 2 do |s|
+ fetcher.spec "a", 2 do |s|
s.platform = platform
end
end
expected = [
- [Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
+ [Gem::NameTuple.new("a", v(2), Gem::Platform::RUBY),
Gem::Source.new(@gem_repo)],
]
- assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
+ assert_equal expected, @cmd.fetch_remote_gems(specs["a-1"])
end
def test_fetch_remote_gems_prerelease
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'a', 2
- fetcher.gem 'a', '3.a'
+ fetcher.gem "a", 1
+ fetcher.gem "a", 2
+ fetcher.gem "a", "3.a"
end
@cmd.options[:prerelease] = true
expected = [
- [Gem::NameTuple.new('a', v(2), Gem::Platform::RUBY),
+ [Gem::NameTuple.new("a", v(2), Gem::Platform::RUBY),
Gem::Source.new(@gem_repo)],
- [Gem::NameTuple.new('a', v('3.a'), Gem::Platform::RUBY),
+ [Gem::NameTuple.new("a", v("3.a"), Gem::Platform::RUBY),
Gem::Source.new(@gem_repo)],
]
- assert_equal expected, @cmd.fetch_remote_gems(specs['a-1'])
+ assert_equal expected, @cmd.fetch_remote_gems(specs["a-1"])
end
def test_handle_options_system
@@ -699,11 +699,11 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_update_gem_prerelease
spec_fetcher do |fetcher|
- fetcher.spec 'a', '1.a'
- fetcher.gem 'a', '1.b'
+ fetcher.spec "a", "1.a"
+ fetcher.gem "a", "1.b"
end
- @cmd.update_gem 'a', Gem::Requirement.new('= 1.b')
+ @cmd.update_gem "a", Gem::Requirement.new("= 1.b")
refute_empty @cmd.updated
@@ -712,15 +712,15 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_update_gem_unresolved_dependency
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.gem 'a', 2 do |s|
- s.add_dependency 'b', '>= 2'
+ fetcher.spec "a", 1
+ fetcher.gem "a", 2 do |s|
+ s.add_dependency "b", ">= 2"
end
- fetcher.spec 'b', 1
+ fetcher.spec "b", 1
end
- @cmd.update_gem 'a'
+ @cmd.update_gem "a"
assert_empty @cmd.updated
end
@@ -730,18 +730,18 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
arguments = @cmd.update_rubygems_arguments
- assert_equal '--prefix', arguments.shift
+ assert_equal "--prefix", arguments.shift
assert_equal Gem.prefix, arguments.shift
- assert_equal '--no-document', arguments.shift
- assert_equal '--previous-version', arguments.shift
+ assert_equal "--no-document", arguments.shift
+ assert_equal "--previous-version", arguments.shift
assert_equal Gem::VERSION, arguments.shift
assert_empty arguments
end
def test_explain
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
- fetcher.spec 'a', 1
+ fetcher.download "a", 2
+ fetcher.spec "a", 1
end
@cmd.options[:explain] = true
@@ -761,13 +761,13 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_explain_platform_local
local = Gem::Platform.local
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
+ fetcher.download "a", 2
- fetcher.download 'a', 2 do |s|
+ fetcher.download "a", 2 do |s|
s.platform = local
end
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
@cmd.options[:explain] = true
@@ -787,13 +787,13 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_explain_platform_ruby
local = Gem::Platform.local
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
+ fetcher.download "a", 2
- fetcher.download 'a', 2 do |s|
+ fetcher.download "a", 2 do |s|
s.platform = local
end
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
# equivalent to --platform=ruby
@@ -815,7 +815,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_named_not_installed_and_no_update
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
+ fetcher.spec "a", 2
end
@cmd.options[:args] = %w[a b]
diff --git a/test/rubygems/test_gem_commands_which_command.rb b/test/rubygems/test_gem_commands_which_command.rb
index a398dc5708..46e95bf619 100644
--- a/test/rubygems/test_gem_commands_which_command.rb
+++ b/test/rubygems/test_gem_commands_which_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/which_command'
+require_relative "helper"
+require "rubygems/commands/which_command"
class TestGemCommandsWhichCommand < Gem::TestCase
def setup
@@ -19,7 +19,7 @@ class TestGemCommandsWhichCommand < Gem::TestCase
end
assert_equal "#{@foo_bar.full_gem_path}/lib/foo_bar.rb\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_execute_directory
@@ -31,7 +31,7 @@ class TestGemCommandsWhichCommand < Gem::TestCase
end
end
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
assert_match %r{Can.t find Ruby library file or shared library directory\n},
@ui.error
end
@@ -63,14 +63,14 @@ class TestGemCommandsWhichCommand < Gem::TestCase
end
end
- assert_equal '', @ui.output
+ assert_equal "", @ui.output
assert_match %r{Can.t find Ruby library file or shared library missinglib\n},
@ui.error
end
def util_foo_bar
files = %w[lib/foo_bar.rb lib/directory/baz.rb Rakefile]
- @foo_bar = util_spec 'foo_bar' do |gem|
+ @foo_bar = util_spec "foo_bar" do |gem|
gem.files = files
end
install_specs @foo_bar
diff --git a/test/rubygems/test_gem_commands_yank_command.rb b/test/rubygems/test_gem_commands_yank_command.rb
index b798eb3689..878b52416e 100644
--- a/test/rubygems/test_gem_commands_yank_command.rb
+++ b/test/rubygems/test_gem_commands_yank_command.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/commands/yank_command'
+require_relative "helper"
+require "rubygems/commands/yank_command"
class TestGemCommandsYankCommand < Gem::TestCase
def setup
@@ -9,12 +9,12 @@ class TestGemCommandsYankCommand < Gem::TestCase
credential_setup
@cmd = Gem::Commands::YankCommand.new
- @cmd.options[:host] = 'http://example'
+ @cmd.options[:host] = "http://example"
@fetcher = Gem::RemoteFetcher.fetcher
- Gem.configuration.rubygems_api_key = 'key'
- Gem.configuration.api_keys[:KEY] = 'other'
+ Gem.configuration.rubygems_api_key = "key"
+ Gem.configuration.api_keys[:KEY] = "other"
end
def teardown
@@ -30,7 +30,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
assert_equal :KEY, @cmd.options[:key]
assert_equal "HOST", @cmd.options[:host]
assert_nil @cmd.options[:platform]
- assert_equal req('= 1.0'), @cmd.options[:version]
+ assert_equal req("= 1.0"), @cmd.options[:version]
end
def test_handle_options_missing_argument
@@ -42,12 +42,12 @@ class TestGemCommandsYankCommand < Gem::TestCase
end
def test_execute
- yank_uri = 'http://example/api/v1/gems/yank'
- @fetcher.data[yank_uri] = ['Successfully yanked', 200, 'OK']
+ yank_uri = "http://example/api/v1/gems/yank"
+ @fetcher.data[yank_uri] = ["Successfully yanked", 200, "OK"]
@cmd.options[:args] = %w[a]
@cmd.options[:added_platform] = true
- @cmd.options[:version] = req('= 1.0')
+ @cmd.options[:version] = req("= 1.0")
use_ui @ui do
@cmd.execute
@@ -57,82 +57,82 @@ class TestGemCommandsYankCommand < Gem::TestCase
assert_match %r{Successfully yanked}, @ui.output
platform = Gem.platforms[1]
- body = @fetcher.last_request.body.split('&').sort
+ body = @fetcher.last_request.body.split("&").sort
assert_equal %W[gem_name=a platform=#{platform} version=1.0], body
- assert_equal 'key', @fetcher.last_request['Authorization']
+ assert_equal "key", @fetcher.last_request["Authorization"]
assert_equal [yank_uri], @fetcher.paths
end
def test_execute_with_otp_success
- response_fail = 'You have enabled multifactor authentication but your request doesn\'t have the correct OTP code. Please check it and retry.'
- yank_uri = 'http://example/api/v1/gems/yank'
+ response_fail = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
+ yank_uri = "http://example/api/v1/gems/yank"
@fetcher.data[yank_uri] = [
- [response_fail, 401, 'Unauthorized'],
- ['Successfully yanked', 200, 'OK'],
+ [response_fail, 401, "Unauthorized"],
+ ["Successfully yanked", 200, "OK"],
]
@cmd.options[:args] = %w[a]
@cmd.options[:added_platform] = true
- @cmd.options[:version] = req('= 1.0')
+ @cmd.options[:version] = req("= 1.0")
@otp_ui = Gem::MockGemUi.new "111111\n"
use_ui @otp_ui do
@cmd.execute
end
- assert_match 'You have enabled multi-factor authentication. Please enter OTP code.', @otp_ui.output
- assert_match '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 %r{Yanking gem from http://example}, @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
def test_execute_with_otp_failure
- response = 'You have enabled multifactor authentication but your request doesn\'t have the correct OTP code. Please check it and retry.'
- yank_uri = 'http://example/api/v1/gems/yank'
- @fetcher.data[yank_uri] = [response, 401, 'Unauthorized']
+ response = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
+ yank_uri = "http://example/api/v1/gems/yank"
+ @fetcher.data[yank_uri] = [response, 401, "Unauthorized"]
@cmd.options[:args] = %w[a]
@cmd.options[:added_platform] = true
- @cmd.options[:version] = req('= 1.0')
+ @cmd.options[:version] = req("= 1.0")
@otp_ui = Gem::MockGemUi.new "111111\n"
use_ui @otp_ui do
@cmd.execute
end
- 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 response, @otp_ui.output
- assert_match 'Code: ', @otp_ui.output
- assert_equal '111111', @fetcher.last_request['OTP']
+ assert_match "Code: ", @otp_ui.output
+ assert_equal "111111", @fetcher.last_request["OTP"]
end
def test_execute_key
- yank_uri = 'http://example/api/v1/gems/yank'
- @fetcher.data[yank_uri] = ['Successfully yanked', 200, 'OK']
+ yank_uri = "http://example/api/v1/gems/yank"
+ @fetcher.data[yank_uri] = ["Successfully yanked", 200, "OK"]
@cmd.options[:args] = %w[a]
- @cmd.options[:version] = req('= 1.0')
+ @cmd.options[:version] = req("= 1.0")
@cmd.options[:key] = :KEY
use_ui @ui do
@cmd.execute
end
- 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 'other', @fetcher.last_request['Authorization']
+ assert_equal "other", @fetcher.last_request["Authorization"]
end
def test_execute_host
- host = 'https://other.example'
+ host = "https://other.example"
yank_uri = "#{host}/api/v1/gems/yank"
- @fetcher.data[yank_uri] = ['Successfully yanked', 200, 'OK']
+ @fetcher.data[yank_uri] = ["Successfully yanked", 200, "OK"]
@cmd.options[:args] = %w[a]
- @cmd.options[:version] = req('= 1.0')
+ @cmd.options[:version] = req("= 1.0")
@cmd.options[:host] = host
use_ui @ui do
@@ -142,26 +142,26 @@ class TestGemCommandsYankCommand < Gem::TestCase
assert_match %r{Yanking gem from https://other.example}, @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 'key', @fetcher.last_request['Authorization']
+ assert_equal "key", @fetcher.last_request["Authorization"]
assert_equal [yank_uri], @fetcher.paths
end
def test_yank_gem_unathorized_api_key
response_forbidden = "The API key doesn't have access"
- response_success = 'Successfully yanked'
- host = 'http://example'
+ response_success = "Successfully yanked"
+ host = "http://example"
@fetcher.data["#{host}/api/v1/gems/yank"] = [
- [response_forbidden, 403, 'Forbidden'],
+ [response_forbidden, 403, "Forbidden"],
[response_success, 200, "OK"],
]
@fetcher.data["#{host}/api/v1/api_key"] = ["", 200, "OK"]
@cmd.options[:args] = %w[a]
@cmd.options[:added_platform] = true
- @cmd.options[:version] = req('= 1.0')
+ @cmd.options[:version] = req("= 1.0")
@cmd.instance_variable_set :@host, host
@cmd.instance_variable_set :@scope, :yank_rubygem
diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb
index 3e09079df8..fbc7c85757 100644
--- a/test/rubygems/test_gem_config_file.rb
+++ b/test/rubygems/test_gem_config_file.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/config_file'
+require_relative "helper"
+require "rubygems/config_file"
class TestGemConfigFile < Gem::TestCase
def setup
@@ -8,15 +8,15 @@ class TestGemConfigFile < Gem::TestCase
credential_setup
- @temp_conf = File.join @tempdir, '.gemrc'
+ @temp_conf = File.join @tempdir, ".gemrc"
@cfg_args = %W[--config-file #{@temp_conf}]
Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.clear
Gem::ConfigFile::PLATFORM_DEFAULTS.clear
- @env_gemrc = ENV['GEMRC']
- ENV['GEMRC'] = ''
+ @env_gemrc = ENV["GEMRC"]
+ ENV["GEMRC"] = ""
util_config_file
end
@@ -25,7 +25,7 @@ class TestGemConfigFile < Gem::TestCase
Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS.clear
Gem::ConfigFile::PLATFORM_DEFAULTS.clear
- ENV['GEMRC'] = @env_gemrc
+ ENV["GEMRC"] = @env_gemrc
credential_teardown
@@ -43,7 +43,7 @@ class TestGemConfigFile < Gem::TestCase
assert_equal 365, @cfg.cert_expiration_length_days
assert_equal false, @cfg.ipv4_fallback_enabled
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts ":backtrace: true"
fp.puts ":update_sources: false"
fp.puts ":bulk_threshold: 10"
@@ -66,17 +66,17 @@ class TestGemConfigFile < Gem::TestCase
assert_equal false, @cfg.verbose
assert_equal false, @cfg.update_sources
assert_equal %w[http://more-gems.example.com], @cfg.sources
- assert_equal '--wrappers', @cfg[:install]
- assert_equal(['/usr/ruby/1.8/lib/ruby/gems/1.8', '/var/ruby/1.8/gem_home'],
+ assert_equal "--wrappers", @cfg[:install]
+ assert_equal(["/usr/ruby/1.8/lib/ruby/gems/1.8", "/var/ruby/1.8/gem_home"],
@cfg.path)
assert_equal 0, @cfg.ssl_verify_mode
- assert_equal '/etc/ssl/certs', @cfg.ssl_ca_cert
+ assert_equal "/etc/ssl/certs", @cfg.ssl_ca_cert
assert_equal 28, @cfg.cert_expiration_length_days
assert_equal true, @cfg.ipv4_fallback_enabled
end
def test_initialize_ipv4_fallback_enabled_env
- ENV['IPV4_FALLBACK_ENABLED'] = 'true'
+ ENV["IPV4_FALLBACK_ENABLED"] = "true"
util_config_file %W[--config-file #{@temp_conf}]
assert_equal true, @cfg.ipv4_fallback_enabled
@@ -102,37 +102,37 @@ class TestGemConfigFile < Gem::TestCase
def test_initialize_operating_system_override
Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS[:bulk_threshold] = 1
- Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS['install'] = '--no-env-shebang'
+ Gem::ConfigFile::OPERATING_SYSTEM_DEFAULTS["install"] = "--no-env-shebang"
Gem::ConfigFile::PLATFORM_DEFAULTS[:bulk_threshold] = 2
util_config_file
assert_equal 2, @cfg.bulk_threshold
- assert_equal '--no-env-shebang', @cfg[:install]
+ assert_equal "--no-env-shebang", @cfg[:install]
end
def test_initialize_platform_override
Gem::ConfigFile::PLATFORM_DEFAULTS[:bulk_threshold] = 2
- Gem::ConfigFile::PLATFORM_DEFAULTS['install'] = '--no-env-shebang'
+ Gem::ConfigFile::PLATFORM_DEFAULTS["install"] = "--no-env-shebang"
- File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, 'w' do |fp|
+ File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, "w" do |fp|
fp.puts ":bulk_threshold: 3"
end
util_config_file
assert_equal 3, @cfg.bulk_threshold
- assert_equal '--no-env-shebang', @cfg[:install]
+ assert_equal "--no-env-shebang", @cfg[:install]
end
def test_initialize_system_wide_override
- File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, 'w' do |fp|
+ File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, "w" do |fp|
fp.puts ":backtrace: false"
fp.puts ":bulk_threshold: 2048"
end
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts ":backtrace: true"
end
@@ -143,28 +143,28 @@ class TestGemConfigFile < Gem::TestCase
end
def test_initialize_environment_variable_override
- File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, 'w' do |fp|
- fp.puts ':backtrace: false'
- fp.puts ':verbose: false'
- fp.puts ':bulk_threshold: 2048'
+ File.open Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE, "w" do |fp|
+ fp.puts ":backtrace: false"
+ fp.puts ":verbose: false"
+ fp.puts ":bulk_threshold: 2048"
end
- conf1 = File.join @tempdir, 'gemrc1'
- File.open conf1, 'w' do |fp|
- fp.puts ':backtrace: true'
+ conf1 = File.join @tempdir, "gemrc1"
+ File.open conf1, "w" do |fp|
+ fp.puts ":backtrace: true"
end
- conf2 = File.join @tempdir, 'gemrc2'
- File.open conf2, 'w' do |fp|
- fp.puts ':verbose: true'
+ conf2 = File.join @tempdir, "gemrc2"
+ File.open conf2, "w" do |fp|
+ fp.puts ":verbose: true"
end
- conf3 = File.join @tempdir, 'gemrc3'
- File.open conf3, 'w' do |fp|
- fp.puts ':verbose: :loud'
+ conf3 = File.join @tempdir, "gemrc3"
+ File.open conf3, "w" do |fp|
+ fp.puts ":verbose: :loud"
end
ps = File::PATH_SEPARATOR
- ENV['GEMRC'] = conf1 + ps + conf2 + ps + conf3
+ ENV["GEMRC"] = conf1 + ps + conf2 + ps + conf3
util_config_file
@@ -174,7 +174,7 @@ class TestGemConfigFile < Gem::TestCase
end
def test_set_config_file_name_from_environment_variable
- ENV['GEMRC'] = "/tmp/.gemrc"
+ ENV["GEMRC"] = "/tmp/.gemrc"
cfg = Gem::ConfigFile.new([])
assert_equal cfg.config_file_name, "/tmp/.gemrc"
end
@@ -182,22 +182,22 @@ class TestGemConfigFile < Gem::TestCase
def test_api_keys
assert_nil @cfg.instance_variable_get :@api_keys
- temp_cred = File.join Gem.user_home, '.gem', 'credentials'
+ temp_cred = File.join Gem.user_home, ".gem", "credentials"
FileUtils.mkdir_p File.dirname(temp_cred)
- File.open temp_cred, 'w', 0600 do |fp|
- fp.puts ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97'
+ File.open temp_cred, "w", 0600 do |fp|
+ fp.puts ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
end
util_config_file
- assert_equal({ :rubygems => '701229f217cdf23b1344c7b4b54ca97' },
+ assert_equal({ :rubygems => "701229f217cdf23b1344c7b4b54ca97" },
@cfg.api_keys)
end
def test_check_credentials_permissions
- pend 'chmod not supported' if win_platform?
+ pend "chmod not supported" if win_platform?
- @cfg.rubygems_api_key = 'x'
+ @cfg.rubygems_api_key = "x"
File.chmod 0644, @cfg.credentials_path
@@ -257,7 +257,7 @@ if you believe they were disclosed to a third party.
@cfg.handle_arguments args
end
- assert_match 'NOTE', err
+ assert_match "NOTE", err
assert_equal true, $DEBUG
ensure
@@ -265,7 +265,7 @@ if you believe they were disclosed to a third party.
end
def test_handle_arguments_override
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts ":backtrace: false"
end
@@ -287,7 +287,7 @@ if you believe they were disclosed to a third party.
def test_handle_arguments_norc
assert_equal @temp_conf, @cfg.config_file_name
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts ":backtrace: true"
fp.puts ":update_sources: false"
fp.puts ":bulk_threshold: 10"
@@ -308,23 +308,23 @@ if you believe they were disclosed to a third party.
end
def test_load_api_keys
- temp_cred = File.join Gem.user_home, '.gem', 'credentials'
+ temp_cred = File.join Gem.user_home, ".gem", "credentials"
FileUtils.mkdir_p File.dirname(temp_cred)
- File.open temp_cred, 'w', 0600 do |fp|
+ File.open temp_cred, "w", 0600 do |fp|
fp.puts ":rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97"
fp.puts ":other: a5fdbb6ba150cbb83aad2bb2fede64c"
end
util_config_file
- assert_equal({ :rubygems => '701229f217cdf23b1344c7b4b54ca97',
- :other => 'a5fdbb6ba150cbb83aad2bb2fede64c' }, @cfg.api_keys)
+ assert_equal({ :rubygems => "701229f217cdf23b1344c7b4b54ca97",
+ :other => "a5fdbb6ba150cbb83aad2bb2fede64c" }, @cfg.api_keys)
end
def test_load_api_keys_bad_permission
- pend 'chmod not supported' if win_platform?
+ pend "chmod not supported" if win_platform?
- @cfg.rubygems_api_key = 'x'
+ @cfg.rubygems_api_key = "x"
File.chmod 0644, @cfg.credentials_path
@@ -346,12 +346,12 @@ if you believe they were disclosed to a third party.
end
def test_rubygems_api_key_equals
- @cfg.rubygems_api_key = 'x'
+ @cfg.rubygems_api_key = "x"
- assert_equal 'x', @cfg.rubygems_api_key
+ assert_equal "x", @cfg.rubygems_api_key
expected = {
- :rubygems_api_key => 'x',
+ :rubygems_api_key => "x",
}
assert_equal expected, load_yaml_file(@cfg.credentials_path)
@@ -364,18 +364,18 @@ 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 win_platform?
- @cfg.rubygems_api_key = 'x'
+ @cfg.rubygems_api_key = "x"
File.chmod 0644, @cfg.credentials_path
assert_raise Gem::MockGemUi::TermError do
- @cfg.rubygems_api_key = 'y'
+ @cfg.rubygems_api_key = "y"
end
expected = {
- :rubygems_api_key => 'x',
+ :rubygems_api_key => "x",
}
assert_equal expected, load_yaml_file(@cfg.credentials_path)
@@ -391,27 +391,27 @@ if you believe they were disclosed to a third party.
@cfg.bulk_threshold = 10
@cfg.verbose = false
Gem.sources.replace %w[http://more-gems.example.com]
- @cfg[:install] = '--wrappers'
+ @cfg[:install] = "--wrappers"
@cfg.write
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'
- assert_equal true, @cfg.verbose, 'verbose'
+ "bulk_threshold"
+ assert_equal true, @cfg.update_sources, "update_sources"
+ assert_equal true, @cfg.verbose, "verbose"
- assert_equal '--wrappers', @cfg[:install], 'install'
+ assert_equal "--wrappers", @cfg[:install], "install"
# this should be written out to the config file.
assert_equal %w[http://more-gems.example.com], Gem.sources
end
def test_write_from_hash
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts ":backtrace: true"
fp.puts ":bulk_threshold: 10"
fp.puts ":update_sources: false"
@@ -431,29 +431,29 @@ if you believe they were disclosed to a third party.
@cfg.bulk_threshold = 20
@cfg.verbose = :junk
Gem.sources.replace %w[http://even-more-gems.example.com]
- @cfg[:install] = '--wrappers --no-rdoc'
+ @cfg[:install] = "--wrappers --no-rdoc"
@cfg.write
util_config_file
# These should not be written out to the config file
- assert_equal true, @cfg.backtrace, 'backtrace'
- assert_equal 10, @cfg.bulk_threshold, 'bulk_threshold'
- assert_equal false, @cfg.update_sources, 'update_sources'
- assert_equal false, @cfg.verbose, 'verbose'
+ assert_equal true, @cfg.backtrace, "backtrace"
+ assert_equal 10, @cfg.bulk_threshold, "bulk_threshold"
+ assert_equal false, @cfg.update_sources, "update_sources"
+ assert_equal false, @cfg.verbose, "verbose"
assert_equal 2, @cfg.ssl_verify_mode
- assert_equal '/nonexistent/ca_cert.pem', @cfg.ssl_ca_cert
- assert_equal '/nonexistent/client_cert.pem', @cfg.ssl_client_cert
+ assert_equal "/nonexistent/ca_cert.pem", @cfg.ssl_ca_cert
+ assert_equal "/nonexistent/client_cert.pem", @cfg.ssl_client_cert
- assert_equal '--wrappers --no-rdoc', @cfg[:install], 'install'
+ assert_equal "--wrappers --no-rdoc", @cfg[:install], "install"
assert_equal %w[http://even-more-gems.example.com], Gem.sources
end
def test_ignore_invalid_config_file
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts "invalid: yaml:"
end
@@ -467,7 +467,7 @@ if you believe they were disclosed to a third party.
end
def test_load_ssl_verify_mode_from_config
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts ":ssl_verify_mode: 1"
end
util_config_file
@@ -475,19 +475,19 @@ if you believe they were disclosed to a third party.
end
def test_load_ssl_ca_cert_from_config
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts ":ssl_ca_cert: /home/me/certs"
end
util_config_file
- assert_equal('/home/me/certs', @cfg.ssl_ca_cert)
+ assert_equal("/home/me/certs", @cfg.ssl_ca_cert)
end
def test_load_ssl_client_cert_from_config
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts ":ssl_client_cert: /home/me/mine.pem"
end
util_config_file
- assert_equal('/home/me/mine.pem', @cfg.ssl_client_cert)
+ assert_equal("/home/me/mine.pem", @cfg.ssl_client_cert)
end
def util_config_file(args = @cfg_args)
@@ -495,7 +495,7 @@ if you believe they were disclosed to a third party.
end
def test_disable_default_gem_server
- File.open @temp_conf, 'w' do |fp|
+ File.open @temp_conf, "w" do |fp|
fp.puts ":disable_default_gem_server: true"
end
util_config_file
diff --git a/test/rubygems/test_gem_dependency.rb b/test/rubygems/test_gem_dependency.rb
index 5551966da2..c585e87087 100644
--- a/test/rubygems/test_gem_dependency.rb
+++ b/test/rubygems/test_gem_dependency.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/dependency'
+require_relative "helper"
+require "rubygems/dependency"
class TestGemDependency < Gem::TestCase
def setup
@@ -18,7 +18,7 @@ class TestGemDependency < Gem::TestCase
def test_initialize_type_bad
e = assert_raise ArgumentError do
- Gem::Dependency.new 'monkey' => '1.0'
+ Gem::Dependency.new "monkey" => "1.0"
end
assert_equal 'dependency name must be a String, was {"monkey"=>"1.0"}',
@@ -36,11 +36,11 @@ class TestGemDependency < Gem::TestCase
end
def test_initialize_prerelease
- d = dep 'd', '1.a'
+ d = dep "d", "1.a"
assert d.prerelease?
- d = dep 'd', '= 1.a'
+ d = dep "d", "= 1.a"
assert d.prerelease?
end
@@ -105,8 +105,8 @@ class TestGemDependency < Gem::TestCase
def test_equals_tilde_object
o = Object.new
- def o.name ; 'a' end
- def o.version ; '0' end
+ def o.name ; "a" end
+ def o.version ; "0" end
assert_match dep("a"), o
end
@@ -133,142 +133,142 @@ class TestGemDependency < Gem::TestCase
end
def test_match_eh_name_tuple
- a_dep = dep 'a'
+ a_dep = dep "a"
- a_tup = Gem::NameTuple.new 'a', 1
- b_tup = Gem::NameTuple.new 'b', 2
- c_tup = Gem::NameTuple.new 'c', '2.a'
+ a_tup = Gem::NameTuple.new "a", 1
+ b_tup = Gem::NameTuple.new "b", 2
+ c_tup = Gem::NameTuple.new "c", "2.a"
assert a_dep.match? a_tup
refute a_dep.match? b_tup
- b_dep = dep 'b', '>= 3'
+ b_dep = dep "b", ">= 3"
refute b_dep.match? b_tup
- c_dep = dep 'c', '>= 1'
+ c_dep = dep "c", ">= 1"
refute c_dep.match? c_tup
- c_dep = dep 'c'
+ c_dep = dep "c"
refute c_dep.match? c_tup
- c_dep = dep 'c', '2.a'
+ c_dep = dep "c", "2.a"
assert c_dep.match? c_tup
end
def test_match_eh_allow_prerelease
- a_dep = dep 'a'
+ a_dep = dep "a"
- a_tup = Gem::NameTuple.new 'a', 1
- b_tup = Gem::NameTuple.new 'b', 2
- c_tup = Gem::NameTuple.new 'c', '2.a'
+ a_tup = Gem::NameTuple.new "a", 1
+ b_tup = Gem::NameTuple.new "b", 2
+ c_tup = Gem::NameTuple.new "c", "2.a"
assert a_dep.match? a_tup, nil, true
refute a_dep.match? b_tup, nil, true
- b_dep = dep 'b', '>= 3'
+ b_dep = dep "b", ">= 3"
refute b_dep.match? b_tup, nil, true
- c_dep = dep 'c', '>= 1'
+ c_dep = dep "c", ">= 1"
assert c_dep.match? c_tup, nil, true
- c_dep = dep 'c'
+ c_dep = dep "c"
assert c_dep.match? c_tup, nil, true
- c_dep = dep 'c', '2.a'
+ c_dep = dep "c", "2.a"
assert c_dep.match? c_tup, nil, true
end
def test_match_eh_specification
- a_dep = dep 'a'
+ a_dep = dep "a"
- a_spec = util_spec 'a', 1
- b_spec = util_spec 'b', 2
- c_spec = util_spec 'c', '2.a'
+ a_spec = util_spec "a", 1
+ b_spec = util_spec "b", 2
+ c_spec = util_spec "c", "2.a"
assert a_dep.match? a_spec
refute a_dep.match? b_spec
- b_dep = dep 'b', '>= 3'
+ b_dep = dep "b", ">= 3"
refute b_dep.match? b_spec
- c_dep = dep 'c', '>= 1'
+ c_dep = dep "c", ">= 1"
refute c_dep.match? c_spec
- c_dep = dep 'c'
+ c_dep = dep "c"
refute c_dep.match? c_spec
- c_dep = dep 'c', '2.a'
+ c_dep = dep "c", "2.a"
assert c_dep.match? c_spec
end
def test_matches_spec_eh
- spec = util_spec 'b', 2
+ spec = util_spec "b", 2
- refute dep('a') .matches_spec?(spec), 'name mismatch'
- assert dep('b') .matches_spec?(spec), 'name match'
- refute dep('b', '= 1') .matches_spec?(spec), 'requirement mismatch'
- assert dep('b', '~> 2').matches_spec?(spec), 'requirement match'
+ refute dep("a") .matches_spec?(spec), "name mismatch"
+ assert dep("b") .matches_spec?(spec), "name match"
+ refute dep("b", "= 1") .matches_spec?(spec), "requirement mismatch"
+ assert dep("b", "~> 2").matches_spec?(spec), "requirement match"
end
def test_matches_spec_eh_prerelease
- spec = util_spec 'b', '2.1.a'
+ spec = util_spec "b", "2.1.a"
- refute dep('a') .matches_spec?(spec), 'name mismatch'
- assert dep('b') .matches_spec?(spec), 'name match'
- refute dep('b', '= 1') .matches_spec?(spec), 'requirement mismatch'
- assert dep('b', '~> 2') .matches_spec?(spec), 'requirement match'
- assert dep('b', '~> 2.a').matches_spec?(spec), 'prerelease requirement'
+ refute dep("a") .matches_spec?(spec), "name mismatch"
+ assert dep("b") .matches_spec?(spec), "name match"
+ refute dep("b", "= 1") .matches_spec?(spec), "requirement mismatch"
+ assert dep("b", "~> 2") .matches_spec?(spec), "requirement match"
+ assert dep("b", "~> 2.a").matches_spec?(spec), "prerelease requirement"
end
def test_merge
- a1 = dep 'a', '~> 1.0'
- a2 = dep 'a', '= 1.0'
+ a1 = dep "a", "~> 1.0"
+ a2 = dep "a", "= 1.0"
a3 = a1.merge a2
- assert_equal dep('a', '~> 1.0', '= 1.0'), a3
+ assert_equal dep("a", "~> 1.0", "= 1.0"), a3
end
def test_merge_default
- a1 = dep 'a'
- a2 = dep 'a', '1'
+ a1 = dep "a"
+ a2 = dep "a", "1"
a3 = a1.merge a2
- assert_equal dep('a', '1'), a3
+ assert_equal dep("a", "1"), a3
end
def test_merge_name_mismatch
- a = dep 'a'
- b = dep 'b'
+ a = dep "a"
+ b = dep "b"
e = assert_raise ArgumentError do
a.merge b
end
- assert_equal 'a (>= 0) and b (>= 0) have different names',
+ assert_equal "a (>= 0) and b (>= 0) have different names",
e.message
end
def test_merge_other_default
- a1 = dep 'a', '1'
- a2 = dep 'a'
+ a1 = dep "a", "1"
+ a2 = dep "a"
a3 = a1.merge a2
- assert_equal dep('a', '1'), a3
+ assert_equal dep("a", "1"), a3
end
def test_prerelease_eh
@@ -294,44 +294,44 @@ class TestGemDependency < Gem::TestCase
end
def test_specific
- refute dep('a', '> 1').specific?
+ refute dep("a", "> 1").specific?
- assert dep('a', '= 1').specific?
+ assert dep("a", "= 1").specific?
end
def test_to_spec
- a_1 = util_spec 'a', '1'
- a_2 = util_spec 'a', '2'
+ a_1 = util_spec "a", "1"
+ a_2 = util_spec "a", "2"
- a_dep = dep 'a', '>= 0'
+ a_dep = dep "a", ">= 0"
install_specs a_1, a_2
assert_equal a_2, a_dep.to_spec
end
def test_to_spec_prerelease
- a_1 = util_spec 'a', '1'
- a_1_1_a = util_spec 'a', '1.1.a'
+ a_1 = util_spec "a", "1"
+ a_1_1_a = util_spec "a", "1.1.a"
- a_dep = dep 'a', '>= 0'
+ a_dep = dep "a", ">= 0"
install_specs a_1, a_1_1_a
assert_equal a_1, a_dep.to_spec
- a_pre_dep = dep 'a', '>= 0'
+ a_pre_dep = dep "a", ">= 0"
a_pre_dep.prerelease = true
assert_equal a_1_1_a, a_pre_dep.to_spec
end
def test_to_specs_suggests_other_versions
- a = util_spec 'a', '1.0'
+ a = util_spec "a", "1.0"
install_specs a
- a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
+ a_file = File.join a.gem_dir, "lib", "a_file.rb"
write_file a_file do |io|
- io.puts '# a_file.rb'
+ io.puts "# a_file.rb"
end
dep = Gem::Dependency.new "a", "= 2.0"
@@ -344,14 +344,14 @@ class TestGemDependency < Gem::TestCase
end
def test_to_specs_respects_bundler_version
- b = util_spec 'bundler', '2.0.0.pre.1'
- b_1 = util_spec 'bundler', '1'
+ b = util_spec "bundler", "2.0.0.pre.1"
+ b_1 = util_spec "bundler", "1"
install_specs b, b_1
- b_file = File.join b.gem_dir, 'lib', 'bundler', 'setup.rb'
+ b_file = File.join b.gem_dir, "lib", "bundler", "setup.rb"
write_file b_file do |io|
- io.puts '# setup.rb'
+ io.puts "# setup.rb"
end
dep = Gem::Dependency.new "bundler", ">= 0.a"
@@ -368,13 +368,13 @@ class TestGemDependency < Gem::TestCase
end
def test_to_specs_indicates_total_gem_set_size
- a = util_spec 'a', '1.0'
+ a = util_spec "a", "1.0"
install_specs a
- a_file = File.join a.gem_dir, 'lib', 'a_file.rb'
+ a_file = File.join a.gem_dir, "lib", "a_file.rb"
write_file a_file do |io|
- io.puts '# a_file.rb'
+ io.puts "# a_file.rb"
end
dep = Gem::Dependency.new "b", "= 2.0"
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index f2404d61c7..9db904ba53 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -1,15 +1,15 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/dependency_installer'
-require 'rubygems/security'
+require_relative "helper"
+require "rubygems/dependency_installer"
+require "rubygems/security"
class TestGemDependencyInstaller < Gem::TestCase
def setup
super
common_installer_setup
- @gems_dir = File.join @tempdir, 'gems'
- @cache_dir = File.join @gemhome, 'cache'
+ @gems_dir = File.join @tempdir, "gems"
+ @cache_dir = File.join @gemhome, "cache"
FileUtils.mkdir @gems_dir
@@ -25,23 +25,23 @@ class TestGemDependencyInstaller < Gem::TestCase
end
def util_setup_gems
- @a1, @a1_gem = util_gem 'a', '1' do |s|
- s.executables << 'a_bin'
+ @a1, @a1_gem = util_gem "a", "1" do |s|
+ s.executables << "a_bin"
end
- @a1_pre, @a1_pre_gem = util_gem 'a', '1.a'
+ @a1_pre, @a1_pre_gem = util_gem "a", "1.a"
- @b1, @b1_gem = util_gem 'b', '1' do |s|
- s.add_dependency 'a'
- s.add_development_dependency 'aa'
+ @b1, @b1_gem = util_gem "b", "1" do |s|
+ s.add_dependency "a"
+ s.add_development_dependency "aa"
end
- @c1, @c1_gem = util_gem 'c', '1' do |s|
- s.add_development_dependency 'b'
+ @c1, @c1_gem = util_gem "c", "1" do |s|
+ s.add_development_dependency "b"
end
- @d1, @d1_gem = util_gem 'd', '1' do |s|
- s.add_development_dependency 'c'
+ @d1, @d1_gem = util_gem "d", "1" do |s|
+ s.add_development_dependency "c"
end
util_setup_spec_fetcher(@a1, @a1_pre, @b1, @d1)
@@ -55,7 +55,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
- inst.install 'a'
+ inst.install "a"
end
assert_equal %w[a-1], Gem::Specification.map(&:full_name)
@@ -65,13 +65,13 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_prerelease
util_setup_gems
- p1a, gem = util_gem 'a', '10.a'
+ p1a, gem = util_gem "a", "10.a"
util_setup_spec_fetcher(p1a, @a1, @a1_pre)
p1a_data = Gem.read_binary(gem)
- @fetcher.data['http://gems.example.com/gems/a-10.a.gem'] = p1a_data
+ @fetcher.data["http://gems.example.com/gems/a-10.a.gem"] = p1a_data
dep = Gem::Dependency.new "a"
inst = Gem::DependencyInstaller.new :prerelease => true
@@ -83,18 +83,18 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_prerelease_bug_990
spec_fetcher do |fetcher|
- fetcher.gem 'a', '1.b' do |s|
- s.add_dependency 'b', '~> 1.a'
+ fetcher.gem "a", "1.b" do |s|
+ s.add_dependency "b", "~> 1.a"
end
- fetcher.gem 'b', '1.b' do |s|
- s.add_dependency 'c', '>= 1'
+ fetcher.gem "b", "1.b" do |s|
+ s.add_dependency "c", ">= 1"
end
- fetcher.gem 'c', '1.1.b'
+ fetcher.gem "c", "1.1.b"
end
- dep = Gem::Dependency.new 'a'
+ dep = Gem::Dependency.new "a"
inst = Gem::DependencyInstaller.new :prerelease => true
inst.install dep
@@ -103,13 +103,13 @@ class TestGemDependencyInstaller < Gem::TestCase
end
def test_install_when_only_prerelease
- p1a, gem = util_gem 'p', '1.a'
+ p1a, gem = util_gem "p", "1.a"
util_setup_spec_fetcher(p1a)
p1a_data = Gem.read_binary(gem)
- @fetcher.data['http://gems.example.com/gems/p-1.a.gem'] = p1a_data
+ @fetcher.data["http://gems.example.com/gems/p-1.a.gem"] = p1a_data
dep = Gem::Dependency.new "p"
inst = Gem::DependencyInstaller.new
@@ -128,7 +128,7 @@ class TestGemDependencyInstaller < Gem::TestCase
p1a_data = Gem.read_binary(@a1_gem)
- @fetcher.data['http://gems.example.com/gems/a-1.gem'] = p1a_data
+ @fetcher.data["http://gems.example.com/gems/a-1.gem"] = p1a_data
dep = Gem::Dependency.new "a"
inst = Gem::DependencyInstaller.new :prerelease => true
@@ -141,8 +141,8 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_all_dependencies
util_setup_gems
- _, e1_gem = util_gem 'e', '1' do |s|
- s.add_dependency 'b'
+ _, e1_gem = util_gem "e", "1" do |s|
+ s.add_dependency "b"
end
FileUtils.mv @a1_gem, @tempdir
@@ -153,15 +153,15 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :ignore_dependencies => true
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
- 'sanity check'
+ "sanity check"
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
- inst.install 'e'
+ inst.install "e"
end
assert_equal %w[a-1 e-1], inst.installed_gems.map {|s| s.full_name }
@@ -178,7 +178,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir dir do
inst = Gem::DependencyInstaller.new :cache_dir => @tempdir
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
@@ -190,9 +190,9 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_dependencies_satisfied
util_setup_gems
- a2, a2_gem = util_gem 'a', '2'
+ a2, a2_gem = util_gem "a", "2"
- FileUtils.rm_rf File.join(@gemhome, 'gems')
+ FileUtils.rm_rf File.join(@gemhome, "gems")
Gem::Specification.reset
@@ -203,17 +203,17 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
- inst.install 'a', req("= 2")
+ inst.install "a", req("= 2")
end
assert_equal %w[a-2], inst.installed_gems.map {|s| s.full_name },
- 'sanity check'
+ "sanity check"
FileUtils.rm File.join(@tempdir, a2.file_name)
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[a-2 b-1], Gem::Specification.map(&:full_name)
@@ -226,12 +226,12 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_doesnt_upgrade_installed_dependencies
util_setup_gems
- a2, a2_gem = util_gem 'a', '2'
- a3, a3_gem = util_gem 'a', '3'
+ a2, a2_gem = util_gem "a", "2"
+ a3, a3_gem = util_gem "a", "3"
util_setup_spec_fetcher @a1, a3, @b1
- FileUtils.rm_rf File.join(@gemhome, 'gems')
+ FileUtils.rm_rf File.join(@gemhome, "gems")
Gem::Specification.reset
@@ -241,7 +241,7 @@ class TestGemDependencyInstaller < Gem::TestCase
FileUtils.mv a3_gem, @tempdir
Dir.chdir @tempdir do
- Gem::DependencyInstaller.new.install 'a', req("= 2")
+ Gem::DependencyInstaller.new.install "a", req("= 2")
end
FileUtils.rm File.join(@tempdir, a2.file_name)
@@ -250,7 +250,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[a-2 b-1], Gem::Specification.map(&:full_name)
@@ -274,18 +274,18 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new(:build_docs_in_background => false)
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
- assert done_installing_ran, 'post installs hook was not run'
+ assert done_installing_ran, "post installs hook was not run"
end
def test_install_dependency_development
util_setup_gems
- @aa1, @aa1_gem = util_gem 'aa', '1'
+ @aa1, @aa1_gem = util_gem "aa", "1"
FileUtils.mv @a1_gem, @tempdir
FileUtils.mv @aa1_gem, @tempdir
@@ -294,7 +294,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new(:development => true)
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[a-1 aa-1 b-1], inst.installed_gems.map {|s| s.full_name }
@@ -303,7 +303,7 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_dependency_development_deep
util_setup_gems
- @aa1, @aa1_gem = util_gem 'aa', '1'
+ @aa1, @aa1_gem = util_gem "aa", "1"
FileUtils.mv @a1_gem, @tempdir
FileUtils.mv @aa1_gem, @tempdir
@@ -314,7 +314,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new(:development => true)
- inst.install 'd'
+ inst.install "d"
end
assert_equal %w[a-1 aa-1 b-1 c-1 d-1], inst.installed_gems.map {|s| s.full_name }
@@ -323,7 +323,7 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_dependency_development_shallow
util_setup_gems
- @aa1, @aa1_gem = util_gem 'aa', '1'
+ @aa1, @aa1_gem = util_gem "aa", "1"
FileUtils.mv @a1_gem, @tempdir
FileUtils.mv @aa1_gem, @tempdir
@@ -334,7 +334,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new(:development => true, :dev_shallow => true)
- inst.install 'd'
+ inst.install "d"
end
assert_equal %w[c-1 d-1], inst.installed_gems.map {|s| s.full_name }
@@ -350,29 +350,29 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
end
def test_install_dependency_existing_extension
- extconf_rb = File.join @gemhome, 'gems', 'e-1', 'extconf.rb'
+ extconf_rb = File.join @gemhome, "gems", "e-1", "extconf.rb"
FileUtils.mkdir_p File.dirname extconf_rb
- File.open extconf_rb, 'w' do |io|
+ File.open extconf_rb, "w" do |io|
io.write <<-EXTCONF_RB
require 'mkmf'
create_makefile 'e'
EXTCONF_RB
end
- e1 = util_spec 'e', '1', nil, 'extconf.rb' do |s|
- s.extensions << 'extconf.rb'
+ e1 = util_spec "e", "1", nil, "extconf.rb" do |s|
+ s.extensions << "extconf.rb"
end
e1_gem = e1.cache_file
- _, f1_gem = util_gem 'f', '1', 'e' => nil
+ _, f1_gem = util_gem "f", "1", "e" => nil
Gem::Installer.at(e1_gem).install
FileUtils.rm_r e1.extension_dir
@@ -385,7 +385,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir
begin
inst = Gem::DependencyInstaller.new
- inst.install 'f'
+ inst.install "f"
ensure
Dir.chdir pwd
end
@@ -396,9 +396,9 @@ class TestGemDependencyInstaller < Gem::TestCase
end
def test_install_dependency_old
- _, e1_gem = util_gem 'e', '1'
- _, f1_gem = util_gem 'f', '1', 'e' => nil
- _, f2_gem = util_gem 'f', '2'
+ _, e1_gem = util_gem "e", "1"
+ _, f1_gem = util_gem "f", "1", "e" => nil
+ _, f2_gem = util_gem "f", "2"
FileUtils.mv e1_gem, @tempdir
FileUtils.mv f1_gem, @tempdir
@@ -407,7 +407,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
- inst.install 'f'
+ inst.install "f"
end
assert_equal %w[f-2], inst.installed_gems.map {|s| s.full_name }
@@ -421,7 +421,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :domain => :local
- inst.install 'a-1.gem'
+ inst.install "a-1.gem"
end
assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
@@ -435,7 +435,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :domain => :local
- inst.install 'a-1.a.gem'
+ inst.install "a-1.a.gem"
end
assert_equal %w[a-1.a], inst.installed_gems.map {|s| s.full_name }
@@ -451,7 +451,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :domain => :local
- inst.install 'b-1.gem'
+ inst.install "b-1.gem"
end
assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
@@ -466,10 +466,10 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = nil
Dir.chdir @tempdir do
- Gem::Installer.at('a-1.gem').install
+ Gem::Installer.at("a-1.gem").install
inst = Gem::DependencyInstaller.new :domain => :local
- inst.install 'b-1.gem'
+ inst.install "b-1.gem"
end
assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
@@ -482,7 +482,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :domain => :local
- inst.install 'gems/a-1.gem'
+ inst.install "gems/a-1.gem"
end
assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
@@ -491,12 +491,12 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_minimal_deps
util_setup_gems
- _, e1_gem = util_gem 'e', '1' do |s|
- s.add_dependency 'b'
+ _, e1_gem = util_gem "e", "1" do |s|
+ s.add_dependency "b"
end
- _, b2_gem = util_gem 'b', '2' do |s|
- s.add_dependency 'a'
+ _, b2_gem = util_gem "b", "2" do |s|
+ s.add_dependency "a"
end
FileUtils.mv @a1_gem, @tempdir
@@ -508,15 +508,15 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :ignore_dependencies => true
- inst.install 'b', req('= 1')
+ inst.install "b", req("= 1")
end
assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
- 'sanity check'
+ "sanity check"
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :minimal_deps => true
- inst.install 'e'
+ inst.install "e"
end
assert_equal %w[a-1 e-1], inst.installed_gems.map {|s| s.full_name }
@@ -525,12 +525,12 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_no_minimal_deps
util_setup_gems
- _, e1_gem = util_gem 'e', '1' do |s|
- s.add_dependency 'b'
+ _, e1_gem = util_gem "e", "1" do |s|
+ s.add_dependency "b"
end
- _, b2_gem = util_gem 'b', '2' do |s|
- s.add_dependency 'a'
+ _, b2_gem = util_gem "b", "2" do |s|
+ s.add_dependency "a"
end
FileUtils.mv @a1_gem, @tempdir
@@ -542,15 +542,15 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :ignore_dependencies => true
- inst.install 'b', req('= 1')
+ inst.install "b", req("= 1")
end
assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name },
- 'sanity check'
+ "sanity check"
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :minimal_deps => false
- inst.install 'e'
+ inst.install "e"
end
assert_equal %w[a-1 b-2 e-1], inst.installed_gems.map {|s| s.full_name }
@@ -581,13 +581,13 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :env_shebang => true, :wrappers => true, :format_executable => false
- inst.install 'a'
+ inst.install "a"
end
env = "/\\S+/env" unless Gem.win_platform?
assert_match %r{\A#!#{env} #{RbConfig::CONFIG['ruby_install_name']}\n},
- File.read(File.join(@gemhome, 'bin', 'a_bin'))
+ File.read(File.join(@gemhome, "bin", "a_bin"))
end
def test_install_force
@@ -595,12 +595,12 @@ class TestGemDependencyInstaller < Gem::TestCase
FileUtils.mv @b1_gem, @tempdir
si = util_setup_spec_fetcher @b1
- @fetcher.data['http://gems.example.com/gems/yaml'] = si.to_yaml
+ @fetcher.data["http://gems.example.com/gems/yaml"] = si.to_yaml
inst = nil
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :force => true
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
@@ -616,7 +616,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new(
:build_args => build_args)
- inst.install 'a'
+ inst.install "a"
end
assert_equal build_args.join("\n"), File.read(inst.installed_gems.first.build_info_file).strip
@@ -630,7 +630,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :ignore_dependencies => true
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
@@ -645,37 +645,37 @@ class TestGemDependencyInstaller < Gem::TestCase
inst = Gem::Installer.at @a1.file_name
inst.install
- gemhome2 = File.join @tempdir, 'gemhome2'
+ gemhome2 = File.join @tempdir, "gemhome2"
Dir.mkdir gemhome2
inst = nil
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :install_dir => gemhome2
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
- assert File.exist?(File.join(gemhome2, 'specifications', @a1.spec_name))
- assert File.exist?(File.join(gemhome2, 'cache', @a1.file_name))
+ assert File.exist?(File.join(gemhome2, "specifications", @a1.spec_name))
+ assert File.exist?(File.join(gemhome2, "cache", @a1.file_name))
end
def test_install_domain_both
util_setup_gems
a1_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
- @fetcher.data['http://gems.example.com/gems/a-1.gem'] = a1_data
+ @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data
FileUtils.mv @b1_gem, @tempdir
inst = nil
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :domain => :both
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
@@ -699,7 +699,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :domain => :both
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[a-1 b-1], inst.installed_gems.map {|s| s.full_name }
@@ -714,7 +714,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
e = assert_raise Gem::UnsatisfiableDependencyError do
inst = Gem::DependencyInstaller.new :domain => :local
- inst.install 'b'
+ inst.install "b"
end
expected = "Unable to resolve dependency: 'b (>= 0)' requires 'a (>= 0)'"
@@ -728,14 +728,14 @@ class TestGemDependencyInstaller < Gem::TestCase
util_setup_gems
a1_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
- @fetcher.data['http://gems.example.com/gems/a-1.gem'] = a1_data
+ @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data
inst = Gem::DependencyInstaller.new :domain => :remote
- inst.install 'a'
+ inst.install "a"
assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
end
@@ -751,19 +751,19 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :install_dir => gemhome2
- inst.install 'a'
+ inst.install "a"
end
assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name },
- 'sanity check'
+ "sanity check"
- ENV['GEM_HOME'] = @gemhome
- ENV['GEM_PATH'] = [@gemhome, gemhome2].join File::PATH_SEPARATOR
+ ENV["GEM_HOME"] = @gemhome
+ ENV["GEM_PATH"] = [@gemhome, gemhome2].join File::PATH_SEPARATOR
Gem.clear_paths
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new
- inst.install 'b'
+ inst.install "b"
end
assert_equal %w[b-1], inst.installed_gems.map {|s| s.full_name }
@@ -778,7 +778,7 @@ class TestGemDependencyInstaller < Gem::TestCase
Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :force => true
- inst.install 'a'
+ inst.install "a"
end
assert_equal %w[a-1], Gem::Specification.map(&:full_name)
@@ -789,16 +789,16 @@ class TestGemDependencyInstaller < Gem::TestCase
util_setup_gems
a1_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
- @fetcher.data['http://gems.example.com/gems/a-1.gem'] = a1_data
+ @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data
inst = Gem::DependencyInstaller.new
Dir.chdir @tempdir do
- inst.install 'a'
+ inst.install "a"
end
assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
@@ -808,11 +808,11 @@ class TestGemDependencyInstaller < Gem::TestCase
util_setup_gems
a1_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
- @fetcher.data['http://gems.example.com/gems/a-1.gem'] = a1_data
+ @fetcher.data["http://gems.example.com/gems/a-1.gem"] = a1_data
inst = Gem::DependencyInstaller.new
@@ -827,22 +827,22 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_remote_platform_newer
util_setup_gems
- a2_o, a2_o_gem = util_gem 'a', '2' do |s|
+ a2_o, a2_o_gem = util_gem "a", "2" do |s|
s.platform = Gem::Platform.new %w[cpu other_platform 1]
end
si = util_setup_spec_fetcher @a1, a2_o
- @fetcher.data['http://gems.example.com/gems/yaml'] = si.to_yaml
+ @fetcher.data["http://gems.example.com/gems/yaml"] = si.to_yaml
a1_data = nil
a2_o_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
- File.open a2_o_gem, 'rb' do |fp|
+ File.open a2_o_gem, "rb" do |fp|
a2_o_data = fp.read
end
@@ -852,13 +852,13 @@ class TestGemDependencyInstaller < Gem::TestCase
a2_o_data
inst = Gem::DependencyInstaller.new :domain => :remote
- inst.install 'a'
+ inst.install "a"
assert_equal %w[a-1], inst.installed_gems.map {|s| s.full_name }
end
def test_install_platform_is_ignored_when_a_file_is_specified
- _, a_gem = util_gem 'a', '1' do |s|
+ _, a_gem = util_gem "a", "1" do |s|
s.platform = Gem::Platform.new %w[cpu other_platform 1]
end
@@ -868,26 +868,26 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[a-1-cpu-other_platform-1], inst.installed_gems.map {|s| s.full_name }
end
- require 'rubygems/openssl'
+ require "rubygems/openssl"
if Gem::HAVE_OPENSSL
def test_install_security_policy
util_setup_gems
- data = File.open(@a1_gem, 'rb') {|f| f.read }
- @fetcher.data['http://gems.example.com/gems/a-1.gem'] = data
+ data = File.open(@a1_gem, "rb") {|f| f.read }
+ @fetcher.data["http://gems.example.com/gems/a-1.gem"] = data
- data = File.open(@b1_gem, 'rb') {|f| f.read }
- @fetcher.data['http://gems.example.com/gems/b-1.gem'] = data
+ data = File.open(@b1_gem, "rb") {|f| f.read }
+ @fetcher.data["http://gems.example.com/gems/b-1.gem"] = data
policy = Gem::Security::HighSecurity
inst = Gem::DependencyInstaller.new :security_policy => policy
e = assert_raise Gem::Security::Exception do
- inst.install 'b'
+ inst.install "b"
end
- assert_equal 'unsigned gems are not allowed by the High Security policy',
+ assert_equal "unsigned gems are not allowed by the High Security policy",
e.message
assert_equal %w[], inst.installed_gems.map {|s| s.full_name }
@@ -899,28 +899,28 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_no_wrappers
util_setup_gems
- @fetcher.data['http://gems.example.com/gems/a-1.gem'] = read_binary(@a1_gem)
+ @fetcher.data["http://gems.example.com/gems/a-1.gem"] = read_binary(@a1_gem)
inst = Gem::DependencyInstaller.new :wrappers => false, :format_executable => false
- inst.install 'a'
+ inst.install "a"
refute_match(%r{This file was generated by RubyGems.},
- File.read(File.join(@gemhome, 'bin', 'a_bin')))
+ File.read(File.join(@gemhome, "bin", "a_bin")))
end
end
def test_install_version
util_setup_d
- data = File.open(@d2_gem, 'rb') {|f| f.read }
- @fetcher.data['http://gems.example.com/gems/d-2.gem'] = data
+ data = File.open(@d2_gem, "rb") {|f| f.read }
+ @fetcher.data["http://gems.example.com/gems/d-2.gem"] = data
- data = File.open(@d1_gem, 'rb') {|f| f.read }
- @fetcher.data['http://gems.example.com/gems/d-1.gem'] = data
+ data = File.open(@d1_gem, "rb") {|f| f.read }
+ @fetcher.data["http://gems.example.com/gems/d-1.gem"] = data
inst = Gem::DependencyInstaller.new
- inst.install 'd', '= 1'
+ inst.install "d", "= 1"
assert_equal %w[d-1], inst.installed_gems.map {|s| s.full_name }
end
@@ -928,26 +928,26 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_install_version_default
util_setup_d
- data = File.open(@d2_gem, 'rb') {|f| f.read }
- @fetcher.data['http://gems.example.com/gems/d-2.gem'] = data
+ data = File.open(@d2_gem, "rb") {|f| f.read }
+ @fetcher.data["http://gems.example.com/gems/d-2.gem"] = data
- data = File.open(@d1_gem, 'rb') {|f| f.read }
- @fetcher.data['http://gems.example.com/gems/d-1.gem'] = data
+ data = File.open(@d1_gem, "rb") {|f| f.read }
+ @fetcher.data["http://gems.example.com/gems/d-1.gem"] = data
inst = Gem::DependencyInstaller.new
- inst.install 'd'
+ inst.install "d"
assert_equal %w[d-2], inst.installed_gems.map {|s| s.full_name }
end
def test_install_legacy_spec_with_nil_required_ruby_version
- path = File.expand_path 'data/null-required-ruby-version.gemspec.rz', __dir__
+ path = File.expand_path "data/null-required-ruby-version.gemspec.rz", __dir__
spec = Marshal.load Gem.read_binary(path)
def spec.validate(*args); end
util_build_gem spec
- cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
+ cache_file = File.join @tempdir, "gems", "#{spec.original_name}.gem"
FileUtils.mkdir_p File.dirname cache_file
FileUtils.mv spec.cache_file, cache_file
@@ -955,9 +955,9 @@ class TestGemDependencyInstaller < Gem::TestCase
data = Gem.read_binary(cache_file)
- @fetcher.data['http://gems.example.com/gems/activesupport-1.0.0.gem'] = data
+ @fetcher.data["http://gems.example.com/gems/activesupport-1.0.0.gem"] = data
- dep = Gem::Dependency.new 'activesupport'
+ dep = Gem::Dependency.new "activesupport"
inst = Gem::DependencyInstaller.new
inst.install dep
@@ -966,13 +966,13 @@ class TestGemDependencyInstaller < Gem::TestCase
end
def test_install_legacy_spec_with_nil_required_rubygems_version
- path = File.expand_path 'data/null-required-rubygems-version.gemspec.rz', __dir__
+ path = File.expand_path "data/null-required-rubygems-version.gemspec.rz", __dir__
spec = Marshal.load Gem.read_binary(path)
def spec.validate(*args); end
util_build_gem spec
- cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
+ cache_file = File.join @tempdir, "gems", "#{spec.original_name}.gem"
FileUtils.mkdir_p File.dirname cache_file
FileUtils.mv spec.cache_file, cache_file
@@ -980,9 +980,9 @@ class TestGemDependencyInstaller < Gem::TestCase
data = Gem.read_binary(cache_file)
- @fetcher.data['http://gems.example.com/gems/activesupport-1.0.0.gem'] = data
+ @fetcher.data["http://gems.example.com/gems/activesupport-1.0.0.gem"] = data
- dep = Gem::Dependency.new 'activesupport'
+ dep = Gem::Dependency.new "activesupport"
inst = Gem::DependencyInstaller.new
inst.install dep
@@ -994,7 +994,7 @@ class TestGemDependencyInstaller < Gem::TestCase
util_setup_gems
inst = Gem::DependencyInstaller.new
- dep = Gem::Dependency.new 'b', '>= 0'
+ dep = Gem::Dependency.new "b", ">= 0"
Gem::Specification.reset
@@ -1015,7 +1015,7 @@ class TestGemDependencyInstaller < Gem::TestCase
FileUtils.mv @a1_gem, @tempdir
inst = Gem::DependencyInstaller.new
- dep = Gem::Dependency.new 'a', '>= 0'
+ dep = Gem::Dependency.new "a", ">= 0"
set = nil
Dir.chdir @tempdir do
@@ -1030,12 +1030,12 @@ class TestGemDependencyInstaller < Gem::TestCase
remote, local = gems
- assert_equal 'a-1', local.spec.full_name, 'local spec'
+ assert_equal "a-1", local.spec.full_name, "local spec"
assert_equal File.join(@tempdir, @a1.file_name),
- local.source.download(local.spec), 'local path'
+ local.source.download(local.spec), "local path"
- assert_equal 'a-1', remote.spec.full_name, 'remote spec'
- assert_equal Gem::Source.new(@gem_repo), remote.source, 'remote path'
+ assert_equal "a-1", remote.spec.full_name, "remote spec"
+ assert_equal Gem::Source.new(@gem_repo), remote.source, "remote path"
end
def test_find_gems_with_sources_prerelease
@@ -1043,7 +1043,7 @@ class TestGemDependencyInstaller < Gem::TestCase
installer = Gem::DependencyInstaller.new
- dependency = Gem::Dependency.new('a', Gem::Requirement.default)
+ dependency = Gem::Dependency.new("a", Gem::Requirement.default)
set = Gem::Deprecate.skip_during do
installer.find_gems_with_sources(dependency)
@@ -1051,8 +1051,8 @@ class TestGemDependencyInstaller < Gem::TestCase
releases = set.all_specs
- assert releases.any? {|s| s.name == 'a' and s.version.to_s == '1' }
- refute releases.any? {|s| s.name == 'a' and s.version.to_s == '1.a' }
+ assert releases.any? {|s| s.name == "a" and s.version.to_s == "1" }
+ refute releases.any? {|s| s.name == "a" and s.version.to_s == "1.a" }
dependency.prerelease = true
@@ -1067,15 +1067,15 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_find_gems_with_sources_with_best_only_and_platform
util_setup_gems
- a1_x86_mingw32, = util_gem 'a', '1' do |s|
- s.platform = 'x86-mingw32'
+ a1_x86_mingw32, = util_gem "a", "1" do |s|
+ s.platform = "x86-mingw32"
end
util_setup_spec_fetcher @a1, a1_x86_mingw32
- Gem.platforms << Gem::Platform.new('x86-mingw32')
+ Gem.platforms << Gem::Platform.new("x86-mingw32")
installer = Gem::DependencyInstaller.new
- dependency = Gem::Dependency.new('a', Gem::Requirement.default)
+ dependency = Gem::Dependency.new("a", Gem::Requirement.default)
set = Gem::Deprecate.skip_during do
installer.find_gems_with_sources(dependency, true)
@@ -1091,7 +1091,7 @@ class TestGemDependencyInstaller < Gem::TestCase
installer = Gem::DependencyInstaller.new
- dep = Gem::Dependency.new('a')
+ dep = Gem::Dependency.new("a")
out = Gem::Deprecate.skip_during do
installer.find_gems_with_sources(dep)
@@ -1108,7 +1108,7 @@ class TestGemDependencyInstaller < Gem::TestCase
FileUtils.mv @b1_gem, @tempdir
inst = Gem::DependencyInstaller.new
- request_set = inst.resolve_dependencies 'b', req('>= 0')
+ request_set = inst.resolve_dependencies "b", req(">= 0")
requests = request_set.sorted_requests.map {|req| req.full_name }
@@ -1122,7 +1122,7 @@ class TestGemDependencyInstaller < Gem::TestCase
FileUtils.mv @b1_gem, @tempdir
inst = Gem::DependencyInstaller.new :ignore_dependencies => true
- request_set = inst.resolve_dependencies 'b', req('>= 0')
+ request_set = inst.resolve_dependencies "b", req(">= 0")
requests = request_set.sorted_requests.map {|req| req.full_name }
@@ -1134,12 +1134,12 @@ class TestGemDependencyInstaller < Gem::TestCase
def test_resolve_dependencies_local
util_setup_gems
- @a2, @a2_gem = util_gem 'a', '2'
+ @a2, @a2_gem = util_gem "a", "2"
FileUtils.mv @a1_gem, @tempdir
FileUtils.mv @a2_gem, @tempdir
inst = Gem::DependencyInstaller.new
- request_set = inst.resolve_dependencies 'a-1.gem', req('>= 0')
+ request_set = inst.resolve_dependencies "a-1.gem", req(">= 0")
requests = request_set.sorted_requests.map {|req| req.full_name }
@@ -1147,8 +1147,8 @@ class TestGemDependencyInstaller < Gem::TestCase
end
def util_setup_d
- @d1, @d1_gem = util_gem 'd', '1'
- @d2, @d2_gem = util_gem 'd', '2'
+ @d1, @d1_gem = util_gem "d", "1"
+ @d2, @d2_gem = util_gem "d", "2"
util_setup_spec_fetcher(@d1, @d2)
end
diff --git a/test/rubygems/test_gem_dependency_list.rb b/test/rubygems/test_gem_dependency_list.rb
index 15c50de199..0dca8f8c3a 100644
--- a/test/rubygems/test_gem_dependency_list.rb
+++ b/test/rubygems/test_gem_dependency_list.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/dependency_list'
+require_relative "helper"
+require "rubygems/dependency_list"
class TestGemDependencyList < Gem::TestCase
def setup
@@ -9,26 +9,26 @@ class TestGemDependencyList < Gem::TestCase
@deplist = Gem::DependencyList.new
# TODO: switch to util_spec
- @a1 = util_spec 'a', '1'
- @a2 = util_spec 'a', '2'
- @a3 = util_spec 'a', '3'
+ @a1 = util_spec "a", "1"
+ @a2 = util_spec "a", "2"
+ @a3 = util_spec "a", "3"
- @b1 = util_spec 'b', '1' do |s|
- s.add_dependency 'a', '>= 1'
+ @b1 = util_spec "b", "1" do |s|
+ s.add_dependency "a", ">= 1"
end
- @b2 = util_spec 'b', '2' do |s|
- s.add_dependency 'a', '>= 1'
+ @b2 = util_spec "b", "2" do |s|
+ s.add_dependency "a", ">= 1"
end
- @c1 = util_spec 'c', '1' do |s|
- s.add_dependency 'b', '>= 1'
+ @c1 = util_spec "c", "1" do |s|
+ s.add_dependency "b", ">= 1"
end
- @c2 = util_spec 'c', '2'
+ @c2 = util_spec "c", "2"
- @d1 = util_spec 'd', '1' do |s|
- s.add_dependency 'c', '>= 1'
+ @d1 = util_spec "d", "1" do |s|
+ s.add_dependency "c", ">= 1"
end
end
@@ -56,7 +56,7 @@ class TestGemDependencyList < Gem::TestCase
end
def test_dependency_order_circle
- @a1.add_dependency 'c', '>= 1'
+ @a1.add_dependency "c", ">= 1"
@deplist.add @a1, @b1, @c1
order = @deplist.dependency_order
@@ -65,14 +65,14 @@ class TestGemDependencyList < Gem::TestCase
end
def test_dependency_order_development
- e1 = util_spec 'e', '1'
- f1 = util_spec 'f', '1'
- g1 = util_spec 'g', '1'
+ e1 = util_spec "e", "1"
+ f1 = util_spec "f", "1"
+ g1 = util_spec "g", "1"
- @a1.add_dependency 'e'
- @a1.add_dependency 'f'
- @a1.add_dependency 'g'
- g1.add_development_dependency 'a'
+ @a1.add_dependency "e"
+ @a1.add_dependency "f"
+ @a1.add_dependency "g"
+ g1.add_development_dependency "a"
deplist = Gem::DependencyList.new true
deplist.add @a1, e1, f1, g1
@@ -80,7 +80,7 @@ class TestGemDependencyList < Gem::TestCase
order = deplist.dependency_order
assert_equal %w[g-1 a-1 f-1 e-1], order.map {|s| s.full_name },
- 'development on'
+ "development on"
deplist2 = Gem::DependencyList.new
deplist2.add @a1, e1, f1, g1
@@ -88,19 +88,19 @@ class TestGemDependencyList < Gem::TestCase
order = deplist2.dependency_order
assert_equal %w[a-1 g-1 f-1 e-1], order.map {|s| s.full_name },
- 'development off'
+ "development off"
end
def test_dependency_order_diamond
util_diamond
- e1 = util_spec 'e', '1'
+ e1 = util_spec "e", "1"
@deplist.add e1
- @a1.add_dependency 'e', '>= 1'
+ @a1.add_dependency "e", ">= 1"
order = @deplist.dependency_order
assert_equal %w[d-1 c-2 b-1 a-2 e-1], order.map {|s| s.full_name },
- 'deps of trimmed specs not included'
+ "deps of trimmed specs not included"
end
def test_dependency_order_no_dependencies
@@ -121,15 +121,15 @@ class TestGemDependencyList < Gem::TestCase
end
def test_ok_eh
- assert @deplist.ok?, 'no dependencies'
+ assert @deplist.ok?, "no dependencies"
@deplist.add @b2
- refute @deplist.ok?, 'unsatisfied dependency'
+ refute @deplist.ok?, "unsatisfied dependency"
@deplist.add @a1
- assert @deplist.ok?, 'satisfied dependency'
+ assert @deplist.ok?, "satisfied dependency"
end
def test_why_not_ok_eh
@@ -147,13 +147,13 @@ class TestGemDependencyList < Gem::TestCase
end
def test_why_not_ok_eh_old_dependency
- a = util_spec 'a', '1',
- 'b' => '~> 1.0'
+ a = util_spec "a", "1",
+ "b" => "~> 1.0"
- b0 = util_spec 'b', '1.0',
- 'd' => '>= 0'
+ b0 = util_spec "b", "1.0",
+ "d" => ">= 0"
- b1 = util_spec 'b', '1.1'
+ b1 = util_spec "b", "1.1"
util_clear_gems
@@ -165,25 +165,25 @@ class TestGemDependencyList < Gem::TestCase
end
def test_ok_eh_mismatch
- a1 = util_spec 'a', '1'
- a2 = util_spec 'a', '2'
+ a1 = util_spec "a", "1"
+ a2 = util_spec "a", "2"
- b = util_spec 'b', '1' do |s|
- s.add_dependency 'a', '= 1'
+ b = util_spec "b", "1" do |s|
+ s.add_dependency "a", "= 1"
end
- c = util_spec 'c', '1' do |s|
- s.add_dependency 'a', '= 2'
+ c = util_spec "c", "1" do |s|
+ s.add_dependency "a", "= 2"
end
- d = util_spec 'd', '1' do |s|
- s.add_dependency 'b'
- s.add_dependency 'c'
+ d = util_spec "d", "1" do |s|
+ s.add_dependency "b"
+ s.add_dependency "c"
end
@deplist.add a1, a2, b, c, d
- assert @deplist.ok?, 'this will break on require'
+ assert @deplist.ok?, "this will break on require"
end
def test_ok_eh_redundant
@@ -256,8 +256,8 @@ class TestGemDependencyList < Gem::TestCase
# d1 -> b1 -> a1
# d1 -> c2 -> a2
def util_diamond
- @c2.add_dependency 'a', '>= 2'
- @d1.add_dependency 'b'
+ @c2.add_dependency "a", ">= 2"
+ @d1.add_dependency "b"
@deplist.add @a1, @a2, @b1, @c2, @d1
end
diff --git a/test/rubygems/test_gem_dependency_resolution_error.rb b/test/rubygems/test_gem_dependency_resolution_error.rb
index 0e4a2fe31a..26b9e4ddc0 100644
--- a/test/rubygems/test_gem_dependency_resolution_error.rb
+++ b/test/rubygems/test_gem_dependency_resolution_error.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemDependencyResolutionError < Gem::TestCase
def setup
@@ -7,10 +7,10 @@ class TestGemDependencyResolutionError < Gem::TestCase
@DR = Gem::Resolver
- @spec = util_spec 'a', 2
+ @spec = util_spec "a", 2
- @a1_req = @DR::DependencyRequest.new dep('a', '= 1'), nil
- @a2_req = @DR::DependencyRequest.new dep('a', '= 2'), nil
+ @a1_req = @DR::DependencyRequest.new dep("a", "= 1"), nil
+ @a2_req = @DR::DependencyRequest.new dep("a", "= 2"), nil
@activated = @DR::ActivationRequest.new @spec, @a2_req
diff --git a/test/rubygems/test_gem_doctor.rb b/test/rubygems/test_gem_doctor.rb
index 583c735dd3..d26a6ee310 100644
--- a/test/rubygems/test_gem_doctor.rb
+++ b/test/rubygems/test_gem_doctor.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/doctor'
+require_relative "helper"
+require "rubygems/doctor"
class TestGemDoctor < Gem::TestCase
def gem(name)
@@ -15,20 +15,20 @@ class TestGemDoctor < Gem::TestCase
end
def test_doctor
- a = gem 'a'
- b = gem 'b'
- c = gem 'c'
+ a = gem "a"
+ b = gem "b"
+ c = gem "c"
Gem.use_paths @userhome, @gemhome
FileUtils.rm b.spec_file
- File.open c.spec_file, 'w' do |io|
- io.write 'this will raise an exception when evaluated.'
+ File.open c.spec_file, "w" do |io|
+ io.write "this will raise an exception when evaluated."
end
- assert_path_exist File.join(a.gem_dir, 'Rakefile')
- assert_path_exist File.join(a.gem_dir, 'lib', 'a.rb')
+ assert_path_exist File.join(a.gem_dir, "Rakefile")
+ assert_path_exist File.join(a.gem_dir, "lib", "a.rb")
assert_path_exist b.gem_dir
assert_path_not_exist b.spec_file
@@ -44,8 +44,8 @@ class TestGemDoctor < Gem::TestCase
end
end
- assert_path_exist File.join(a.gem_dir, 'Rakefile')
- assert_path_exist File.join(a.gem_dir, 'lib', 'a.rb')
+ assert_path_exist File.join(a.gem_dir, "Rakefile")
+ assert_path_exist File.join(a.gem_dir, "lib", "a.rb")
assert_path_not_exist b.gem_dir
assert_path_not_exist b.spec_file
@@ -68,20 +68,20 @@ Removed directory gems/c-2
end
def test_doctor_dry_run
- a = gem 'a'
- b = gem 'b'
- c = gem 'c'
+ a = gem "a"
+ b = gem "b"
+ c = gem "c"
Gem.use_paths @userhome, @gemhome
FileUtils.rm b.spec_file
- File.open c.spec_file, 'w' do |io|
- io.write 'this will raise an exception when evaluated.'
+ File.open c.spec_file, "w" do |io|
+ io.write "this will raise an exception when evaluated."
end
- assert_path_exist File.join(a.gem_dir, 'Rakefile')
- assert_path_exist File.join(a.gem_dir, 'lib', 'a.rb')
+ assert_path_exist File.join(a.gem_dir, "Rakefile")
+ assert_path_exist File.join(a.gem_dir, "lib", "a.rb")
assert_path_exist b.gem_dir
assert_path_not_exist b.spec_file
@@ -97,8 +97,8 @@ Removed directory gems/c-2
end
end
- assert_path_exist File.join(a.gem_dir, 'Rakefile')
- assert_path_exist File.join(a.gem_dir, 'lib', 'a.rb')
+ assert_path_exist File.join(a.gem_dir, "Rakefile")
+ assert_path_exist File.join(a.gem_dir, "lib", "a.rb")
assert_path_exist b.gem_dir
assert_path_not_exist b.spec_file
@@ -121,7 +121,7 @@ Extra directory gems/c-2
end
def test_doctor_non_gem_home
- other_dir = File.join @tempdir, 'other', 'dir'
+ other_dir = File.join @tempdir, "other", "dir"
FileUtils.mkdir_p other_dir
@@ -147,13 +147,13 @@ This directory does not appear to be a RubyGems repository, skipping
def test_doctor_child_missing
doctor = Gem::Doctor.new @gemhome
- doctor.doctor_child 'missing', ''
+ doctor.doctor_child "missing", ""
assert true # count
end
def test_doctor_badly_named_plugins
- gem 'a'
+ gem "a"
Gem.use_paths @gemhome.to_s
@@ -183,12 +183,12 @@ Removed file plugins/a_badly_named_file.rb
def test_gem_repository_eh
doctor = Gem::Doctor.new @gemhome
- refute doctor.gem_repository?, 'no gems installed'
+ refute doctor.gem_repository?, "no gems installed"
- install_specs util_spec 'a'
+ install_specs util_spec "a"
doctor = Gem::Doctor.new @gemhome
- assert doctor.gem_repository?, 'gems installed'
+ assert doctor.gem_repository?, "gems installed"
end
end
diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb
index 7e19782e61..6adfd42550 100644
--- a/test/rubygems/test_gem_ext_builder.rb
+++ b/test/rubygems/test_gem_ext_builder.rb
@@ -1,38 +1,38 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/ext'
-require 'rubygems/installer'
+require_relative "helper"
+require "rubygems/ext"
+require "rubygems/installer"
class TestGemExtBuilder < Gem::TestCase
def setup
super
- @ext = File.join @tempdir, 'ext'
- @dest_path = File.join @tempdir, 'prefix'
+ @ext = File.join @tempdir, "ext"
+ @dest_path = File.join @tempdir, "prefix"
FileUtils.mkdir_p @ext
FileUtils.mkdir_p @dest_path
- @orig_DESTDIR = ENV['DESTDIR']
- @orig_make = ENV['make']
+ @orig_DESTDIR = ENV["DESTDIR"]
+ @orig_make = ENV["make"]
- @spec = util_spec 'a'
+ @spec = util_spec "a"
- @builder = Gem::Ext::Builder.new @spec, ''
+ @builder = Gem::Ext::Builder.new @spec, ""
end
def teardown
- ENV['DESTDIR'] = @orig_DESTDIR
- ENV['make'] = @orig_make
+ ENV["DESTDIR"] = @orig_DESTDIR
+ ENV["make"] = @orig_make
super
end
def test_class_make
- ENV['DESTDIR'] = 'destination'
+ ENV["DESTDIR"] = "destination"
results = []
- File.open File.join(@ext, 'Makefile'), 'w' do |io|
+ File.open File.join(@ext, "Makefile"), "w" do |io|
io.puts <<-MAKEFILE
all:
\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}"
@@ -61,10 +61,10 @@ install:
end
def test_class_make_no_clean
- ENV['DESTDIR'] = 'destination'
+ ENV["DESTDIR"] = "destination"
results = []
- File.open File.join(@ext, 'Makefile'), 'w' do |io|
+ File.open File.join(@ext, "Makefile"), "w" do |io|
io.puts <<-MAKEFILE
all:
\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}"
@@ -84,9 +84,9 @@ install:
end
def test_custom_make_with_options
- ENV['make'] = 'make V=1'
+ ENV["make"] = "make V=1"
results = []
- File.open File.join(@ext, 'Makefile'), 'w' do |io|
+ File.open File.join(@ext, "Makefile"), "w" do |io|
io.puts <<-MAKEFILE
all:
\t@#{Gem.ruby} -e "puts 'all: OK'"
@@ -106,16 +106,16 @@ install:
end
def test_build_extensions
- pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
- @spec.extensions << 'ext/extconf.rb'
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
+ @spec.extensions << "ext/extconf.rb"
- ext_dir = File.join @spec.gem_dir, 'ext'
+ ext_dir = File.join @spec.gem_dir, "ext"
FileUtils.mkdir_p ext_dir
- extconf_rb = File.join ext_dir, 'extconf.rb'
+ extconf_rb = File.join ext_dir, "extconf.rb"
- File.open extconf_rb, 'w' do |f|
+ File.open extconf_rb, "w" do |f|
f.write <<-'RUBY'
require 'mkmf'
@@ -123,11 +123,11 @@ install:
RUBY
end
- ext_lib_dir = File.join ext_dir, 'lib'
+ ext_lib_dir = File.join ext_dir, "lib"
FileUtils.mkdir ext_lib_dir
- FileUtils.touch File.join ext_lib_dir, 'a.rb'
- FileUtils.mkdir File.join ext_lib_dir, 'a'
- FileUtils.touch File.join ext_lib_dir, 'a', 'b.rb'
+ FileUtils.touch File.join ext_lib_dir, "a.rb"
+ FileUtils.mkdir File.join ext_lib_dir, "a"
+ FileUtils.touch File.join ext_lib_dir, "a", "b.rb"
use_ui @ui do
@builder.build_extensions
@@ -135,20 +135,20 @@ install:
assert_path_exist @spec.extension_dir
assert_path_exist @spec.gem_build_complete_path
- assert_path_exist File.join @spec.extension_dir, 'gem_make.out'
- assert_path_exist File.join @spec.extension_dir, 'a.rb'
- assert_path_exist File.join @spec.gem_dir, 'lib', 'a.rb'
- assert_path_exist File.join @spec.gem_dir, 'lib', 'a', 'b.rb'
+ assert_path_exist File.join @spec.extension_dir, "gem_make.out"
+ assert_path_exist File.join @spec.extension_dir, "a.rb"
+ assert_path_exist File.join @spec.gem_dir, "lib", "a.rb"
+ assert_path_exist File.join @spec.gem_dir, "lib", "a", "b.rb"
end
def test_build_extensions_with_gemhome_with_space
- pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
- new_gemhome = File.join @tempdir, 'gem home'
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
+ new_gemhome = File.join @tempdir, "gem home"
File.rename(@gemhome, new_gemhome)
@gemhome = new_gemhome
Gem.use_paths(@gemhome)
- @spec = util_spec 'a'
- @builder = Gem::Ext::Builder.new @spec, ''
+ @spec = util_spec "a"
+ @builder = Gem::Ext::Builder.new @spec, ""
test_build_extensions
end
@@ -163,17 +163,17 @@ install:
false
end
end
- pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
- @spec.extensions << 'ext/extconf.rb'
+ @spec.extensions << "ext/extconf.rb"
- ext_dir = File.join @spec.gem_dir, 'ext'
+ ext_dir = File.join @spec.gem_dir, "ext"
FileUtils.mkdir_p ext_dir
- extconf_rb = File.join ext_dir, 'extconf.rb'
+ extconf_rb = File.join ext_dir, "extconf.rb"
- File.open extconf_rb, 'w' do |f|
+ File.open extconf_rb, "w" do |f|
f.write <<-'RUBY'
require 'mkmf'
@@ -181,11 +181,11 @@ install:
RUBY
end
- ext_lib_dir = File.join ext_dir, 'lib'
+ ext_lib_dir = File.join ext_dir, "lib"
FileUtils.mkdir ext_lib_dir
- FileUtils.touch File.join ext_lib_dir, 'a.rb'
- FileUtils.mkdir File.join ext_lib_dir, 'a'
- FileUtils.touch File.join ext_lib_dir, 'a', 'b.rb'
+ FileUtils.touch File.join ext_lib_dir, "a.rb"
+ FileUtils.mkdir File.join ext_lib_dir, "a"
+ FileUtils.touch File.join ext_lib_dir, "a", "b.rb"
use_ui @ui do
@builder.build_extensions
@@ -193,10 +193,10 @@ install:
assert_path_exist @spec.extension_dir
assert_path_exist @spec.gem_build_complete_path
- assert_path_exist File.join @spec.extension_dir, 'gem_make.out'
- assert_path_exist File.join @spec.extension_dir, 'a.rb'
- assert_path_not_exist File.join @spec.gem_dir, 'lib', 'a.rb'
- assert_path_not_exist File.join @spec.gem_dir, 'lib', 'a', 'b.rb'
+ assert_path_exist File.join @spec.extension_dir, "gem_make.out"
+ assert_path_exist File.join @spec.extension_dir, "a.rb"
+ assert_path_not_exist File.join @spec.gem_dir, "lib", "a.rb"
+ assert_path_not_exist File.join @spec.gem_dir, "lib", "a", "b.rb"
ensure
class << Gem
remove_method :install_extension_in_lib
@@ -210,10 +210,10 @@ install:
@builder.build_extensions
end
- assert_equal '', @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.output
+ assert_equal "", @ui.error
- assert_path_not_exist File.join @spec.extension_dir, 'gem_make.out'
+ assert_path_not_exist File.join @spec.extension_dir, "gem_make.out"
end
def test_build_extensions_rebuild_failure
@@ -234,7 +234,7 @@ install:
def test_build_extensions_extconf_bad
cwd = Dir.pwd
- @spec.extensions << 'extconf.rb'
+ @spec.extensions << "extconf.rb"
FileUtils.mkdir_p @spec.gem_dir
@@ -246,9 +246,9 @@ install:
assert_match(/\AERROR: Failed to build gem native extension.$/, e.message)
assert_equal "Building native extensions. This could take a while...\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
- gem_make_out = File.join @spec.extension_dir, 'gem_make.out'
+ gem_make_out = File.join @spec.extension_dir, "gem_make.out"
cmd_make_out = File.read(gem_make_out)
assert_match %r{#{Regexp.escape Gem.ruby} .* extconf\.rb}, cmd_make_out
@@ -261,7 +261,7 @@ install:
def test_build_extensions_unsupported
FileUtils.mkdir_p @spec.gem_dir
- gem_make_out = File.join @spec.extension_dir, 'gem_make.out'
+ gem_make_out = File.join @spec.extension_dir, "gem_make.out"
@spec.extensions << nil
e = assert_raise Gem::Ext::BuildError do
@@ -272,7 +272,7 @@ install:
assert_match(/^\s*No builder for extension ''$/, e.message)
assert_equal "Building native extensions. This could take a while...\n", @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
assert_equal "No builder for extension ''\n", File.read(gem_make_out)
@@ -284,7 +284,7 @@ install:
def test_build_extensions_with_build_args
args = ["--aa", "--bb"]
@builder.build_args = args
- @spec.extensions << 'extconf.rb'
+ @spec.extensions << "extconf.rb"
FileUtils.mkdir_p @spec.gem_dir
@@ -315,14 +315,14 @@ install:
end
def test_initialize
- build_info_dir = File.join @gemhome, 'build_info'
+ build_info_dir = File.join @gemhome, "build_info"
FileUtils.mkdir_p build_info_dir
build_info_file = File.join build_info_dir, "#{@spec.full_name}.info"
- File.open build_info_file, 'w' do |io|
- io.puts '--with-foo-dir=/nonexistent'
+ File.open build_info_file, "w" do |io|
+ io.puts "--with-foo-dir=/nonexistent"
end
builder = Gem::Ext::Builder.new @spec
diff --git a/test/rubygems/test_gem_ext_cargo_builder.rb b/test/rubygems/test_gem_ext_cargo_builder.rb
index 2da98c03e2..5a940b07a8 100644
--- a/test/rubygems/test_gem_ext_cargo_builder.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder.rb
@@ -1,21 +1,21 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/ext'
+require_relative "helper"
+require "rubygems/ext"
class TestGemExtCargoBuilder < Gem::TestCase
def setup
super
@rust_envs = {
- 'CARGO_HOME' => ENV.fetch('CARGO_HOME', File.join(@orig_env['HOME'], '.cargo')),
- 'RUSTUP_HOME' => ENV.fetch('RUSTUP_HOME', File.join(@orig_env['HOME'], '.rustup')),
+ "CARGO_HOME" => ENV.fetch("CARGO_HOME", File.join(@orig_env["HOME"], ".cargo")),
+ "RUSTUP_HOME" => ENV.fetch("RUSTUP_HOME", File.join(@orig_env["HOME"], ".rustup")),
}
end
def setup_rust_gem(name)
- @ext = File.join(@tempdir, 'ext')
- @dest_path = File.join(@tempdir, 'prefix')
+ @ext = File.join(@tempdir, "ext")
+ @dest_path = File.join(@tempdir, "prefix")
@fixture_dir = Pathname.new(File.expand_path("test_gem_ext_cargo_builder/#{name}/", __dir__))
FileUtils.mkdir_p @dest_path
@@ -26,14 +26,14 @@ class TestGemExtCargoBuilder < Gem::TestCase
skip_unsupported_platforms!
setup_rust_gem "rust_ruby_example"
- content = @fixture_dir.join('Cargo.toml').read.gsub("cdylib", "staticlib")
- File.write(File.join(@ext, 'Cargo.toml'), content)
+ content = @fixture_dir.join("Cargo.toml").read.gsub("cdylib", "staticlib")
+ File.write(File.join(@ext, "Cargo.toml"), content)
output = []
Dir.chdir @ext do
ENV.update(@rust_envs)
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
assert_raise(Gem::Ext::CargoBuilder::DylibNotFoundError) do
builder.build nil, @dest_path, output
@@ -49,7 +49,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
Dir.chdir @ext do
ENV.update(@rust_envs)
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
builder.build nil, @dest_path, output
end
@@ -58,7 +58,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
bundle = File.join(@dest_path, "release/rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}")
assert_match "Finished release [optimized] target(s)", output
- assert_ffi_handle bundle, 'Init_rust_ruby_example'
+ assert_ffi_handle bundle, "Init_rust_ruby_example"
rescue Exception => e
pp output if output
@@ -73,7 +73,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
Dir.chdir @ext do
ENV.update(@rust_envs)
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
builder.profile = :dev
builder.build nil, @dest_path, output
@@ -83,7 +83,7 @@ class TestGemExtCargoBuilder < Gem::TestCase
bundle = File.join(@dest_path, "debug/rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}")
assert_match "Finished dev [unoptimized + debuginfo] target(s)", output
- assert_ffi_handle bundle, 'Init_rust_ruby_example'
+ assert_ffi_handle bundle, "Init_rust_ruby_example"
rescue Exception => e
pp output if output
@@ -96,12 +96,12 @@ class TestGemExtCargoBuilder < Gem::TestCase
output = []
- FileUtils.rm(File.join(@ext, 'src/lib.rs'))
+ FileUtils.rm(File.join(@ext, "src/lib.rs"))
error = assert_raise(Gem::InstallError) do
Dir.chdir @ext do
ENV.update(@rust_envs)
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
builder.build nil, @dest_path, output
end
@@ -109,20 +109,20 @@ class TestGemExtCargoBuilder < Gem::TestCase
output = output.join "\n"
- assert_match 'cargo failed', error.message
+ assert_match "cargo failed", error.message
end
def test_full_integration
skip_unsupported_platforms!
setup_rust_gem "rust_ruby_example"
- require 'open3'
+ require "open3"
Dir.chdir @ext do
- require 'tmpdir'
+ require "tmpdir"
env_for_subprocess = @rust_envs.merge("GEM_HOME" => Gem.paths.home)
- gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)]
+ gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path("../../bin/gem", __dir__)]
Dir.mktmpdir("rust_ruby_example") do |dir|
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
@@ -141,10 +141,10 @@ class TestGemExtCargoBuilder < Gem::TestCase
setup_rust_gem "custom_name"
Dir.chdir @ext do
- require 'tmpdir'
+ require "tmpdir"
env_for_subprocess = @rust_envs.merge("GEM_HOME" => Gem.paths.home)
- gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path('../../bin/gem', __dir__)]
+ gem = [env_for_subprocess, *ruby_with_rubygems_in_load_path, File.expand_path("../../bin/gem", __dir__)]
Dir.mktmpdir("custom_name") do |dir|
built_gem = File.expand_path(File.join(dir, "custom_name.gem"))
@@ -163,15 +163,15 @@ class TestGemExtCargoBuilder < Gem::TestCase
def skip_unsupported_platforms!
pend "jruby not supported" if java_platform?
- pend "truffleruby not supported (yet)" if RUBY_ENGINE == 'truffleruby'
- pend "mswin not supported (yet)" if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS')
- system(@rust_envs, 'cargo', '-V', out: IO::NULL, err: [:child, :out])
- pend 'cargo not present' unless $?.success?
+ pend "truffleruby not supported (yet)" if RUBY_ENGINE == "truffleruby"
+ pend "mswin not supported (yet)" if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS")
+ system(@rust_envs, "cargo", "-V", out: IO::NULL, err: [:child, :out])
+ pend "cargo not present" unless $?.success?
pend "ruby.h is not provided by ruby repo" if ruby_repo?
end
def assert_ffi_handle(bundle, name)
- require 'fiddle'
+ require "fiddle"
dylib_handle = Fiddle.dlopen bundle
assert_nothing_raised { dylib_handle[name] }
end
diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock
index 1ba4ae4afc..498ee26c7e 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock
+++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock
@@ -105,9 +105,9 @@ dependencies = [
[[package]]
name = "linkify"
-version = "0.8.1"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28d9967eb7d0bc31c39c6f52e8fce42991c0cd1f7a2078326f0b7a399a584c8d"
+checksum = "96dd5884008358112bc66093362197c7248ece00d46624e2cf71e50029f8cff5"
dependencies = [
"memchr",
]
@@ -160,9 +160,9 @@ dependencies = [
[[package]]
name = "rb-sys"
-version = "0.9.19"
+version = "0.9.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8df6990035ed930322a6b8a73783ea6af88acffd2b4322932b0eb0766a5a8673"
+checksum = "723f7560e878bec9d1d49538a17fb6a4e3a04688c1dc6f14eef17918634a54e4"
dependencies = [
"bindgen",
"linkify",
@@ -171,9 +171,9 @@ dependencies = [
[[package]]
name = "rb-sys-build"
-version = "0.9.19"
+version = "0.9.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9c3c88da760bbc2f26bbfd1acbfe9de3faa87be55feaf3413a33539d066ff3c"
+checksum = "2ccd93f0d9767385cd7a23076c47e3dca4c86144e510ea4c61d04dbce0cbac7e"
dependencies = [
"regex",
"shell-words",
diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml
index 4b3f7acd8b..b144f930e5 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml
+++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml
@@ -7,4 +7,4 @@ edition = "2021"
crate-type = ["cdylib"]
[dependencies]
-rb-sys = { version = "0.9.19", features = ["gem"] }
+rb-sys = { version = "0.9.26", features = ["gem"] }
diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb b/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
index 63ac2e5ce6..21c4fd1c8d 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
@@ -1,17 +1,17 @@
-if ENV['RUBYOPT'] or defined? Gem
- ENV.delete 'RUBYOPT'
+if ENV["RUBYOPT"] or defined? Gem
+ ENV.delete "RUBYOPT"
- require 'rbconfig'
- cmd = [RbConfig.ruby, '--disable-gems', 'build.rb', *ARGV]
+ require "rbconfig"
+ cmd = [RbConfig.ruby, "--disable-gems", "build.rb", *ARGV]
exec(*cmd)
end
-require 'tmpdir'
+require "tmpdir"
-lp = File.expand_path('../../../../lib', __dir__)
-gem = ["ruby", "-I#{lp}", File.expand_path('../../../../bin/gem', __dir__)]
-gemspec = File.expand_path('custom_name.gemspec', __dir__)
+lp = File.expand_path("../../../../lib", __dir__)
+gem = ["ruby", "-I#{lp}", File.expand_path("../../../../bin/gem", __dir__)]
+gemspec = File.expand_path("custom_name.gemspec", __dir__)
Dir.mktmpdir("custom_name") do |dir|
built_gem = File.expand_path(File.join(dir, "custom_name.gem"))
diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec b/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec
index 1ecdae2c33..1f8e270e96 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec
+++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec
@@ -6,5 +6,5 @@ Gem::Specification.new do |s|
s.authors = ["Ian Ker-Seymer"]
s.files = ["Cargo.toml", "Cargo.lock", "src/lib.rs"]
- s.metadata['cargo_crate_name'] = 'custom-name-ext'
+ s.metadata["cargo_crate_name"] = "custom-name-ext"
end
diff --git a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock
index 315fbf9a5d..376d11cf3e 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock
+++ b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock
@@ -98,9 +98,9 @@ dependencies = [
[[package]]
name = "linkify"
-version = "0.8.1"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28d9967eb7d0bc31c39c6f52e8fce42991c0cd1f7a2078326f0b7a399a584c8d"
+checksum = "96dd5884008358112bc66093362197c7248ece00d46624e2cf71e50029f8cff5"
dependencies = [
"memchr",
]
@@ -153,9 +153,9 @@ dependencies = [
[[package]]
name = "rb-sys"
-version = "0.9.19"
+version = "0.9.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8df6990035ed930322a6b8a73783ea6af88acffd2b4322932b0eb0766a5a8673"
+checksum = "723f7560e878bec9d1d49538a17fb6a4e3a04688c1dc6f14eef17918634a54e4"
dependencies = [
"bindgen",
"linkify",
@@ -164,9 +164,9 @@ dependencies = [
[[package]]
name = "rb-sys-build"
-version = "0.9.19"
+version = "0.9.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9c3c88da760bbc2f26bbfd1acbfe9de3faa87be55feaf3413a33539d066ff3c"
+checksum = "2ccd93f0d9767385cd7a23076c47e3dca4c86144e510ea4c61d04dbce0cbac7e"
dependencies = [
"regex",
"shell-words",
diff --git a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml
index 27d3e39faf..7d3cd133a8 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml
+++ b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml
@@ -7,4 +7,4 @@ edition = "2021"
crate-type = ["cdylib"]
[dependencies]
-rb-sys = { version = "0.9.19", features = ["gem"] }
+rb-sys = { version = "0.9.26", features = ["gem"] }
diff --git a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
index 869bbb5de8..81b12f99ec 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
@@ -1,17 +1,17 @@
-if ENV['RUBYOPT'] or defined? Gem
- ENV.delete 'RUBYOPT'
+if ENV["RUBYOPT"] or defined? Gem
+ ENV.delete "RUBYOPT"
- require 'rbconfig'
- cmd = [RbConfig.ruby, '--disable-gems', 'build.rb', *ARGV]
+ require "rbconfig"
+ cmd = [RbConfig.ruby, "--disable-gems", "build.rb", *ARGV]
exec(*cmd)
end
-require 'tmpdir'
+require "tmpdir"
-lp = File.expand_path('../../../../lib', __dir__)
-gem = ["ruby", "-I#{lp}", File.expand_path('../../../../bin/gem', __dir__)]
-gemspec = File.expand_path('rust_ruby_example.gemspec', __dir__)
+lp = File.expand_path("../../../../lib", __dir__)
+gem = ["ruby", "-I#{lp}", File.expand_path("../../../../bin/gem", __dir__)]
+gemspec = File.expand_path("rust_ruby_example.gemspec", __dir__)
Dir.mktmpdir("rust_ruby_example") do |dir|
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
diff --git a/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb b/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
index 3abcb83fa9..88581ea4d8 100644
--- a/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/ext'
-require 'rubygems/ext/cargo_builder/link_flag_converter'
+require_relative "helper"
+require "rubygems/ext"
+require "rubygems/ext/cargo_builder/link_flag_converter"
class TestGemExtCargoBuilderLinkFlagConverter < Gem::TestCase
CASES = {
diff --git a/test/rubygems/test_gem_ext_cargo_builder_unit.rb b/test/rubygems/test_gem_ext_cargo_builder_unit.rb
index f6712e44a1..4484f48ca9 100644
--- a/test/rubygems/test_gem_ext_cargo_builder_unit.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder_unit.rb
@@ -1,72 +1,72 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/ext'
+require_relative "helper"
+require "rubygems/ext"
class TestGemExtCargoBuilderUnit < Gem::TestCase
def test_cargo_command_passes_args
skip_unsupported_platforms!
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
- command = builder.cargo_command(Dir.pwd, @tempdir, ['--all-features'])
+ command = builder.cargo_command(Dir.pwd, @tempdir, ["--all-features"])
- assert_includes command, '--all-features'
+ assert_includes command, "--all-features"
end
def test_cargo_command_locks_in_release_profile
skip_unsupported_platforms!
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
builder.profile = :release
command = builder.cargo_command(Dir.pwd, @tempdir)
- assert_includes command, '--locked'
+ assert_includes command, "--locked"
end
def test_cargo_command_does_not_lock_in_dev_profile
skip_unsupported_platforms!
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
builder.profile = :dev
command = builder.cargo_command(Dir.pwd, @tempdir)
- assert_not_includes command, '--locked'
+ assert_not_includes command, "--locked"
end
def test_cargo_command_passes_respects_cargo_env_var
skip_unsupported_platforms!
- old_cargo = ENV['CARGO']
- ENV['CARGO'] = 'mycargo'
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ old_cargo = ENV["CARGO"]
+ ENV["CARGO"] = "mycargo"
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
command = builder.cargo_command(Dir.pwd, @tempdir)
- assert_includes command, 'mycargo'
+ assert_includes command, "mycargo"
ensure
- ENV['CARGO'] = old_cargo
+ ENV["CARGO"] = old_cargo
end
def test_build_env_includes_rbconfig
skip_unsupported_platforms!
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
env = builder.build_env
- assert_equal env.fetch('RBCONFIG_RUBY_SO_NAME'), RbConfig::CONFIG['RUBY_SO_NAME']
+ assert_equal env.fetch("RBCONFIG_RUBY_SO_NAME"), RbConfig::CONFIG["RUBY_SO_NAME"]
end
def test_cargo_command_passes_respects_cargo_build_target
skip_unsupported_platforms!
- old_cargo = ENV['CARGO_BUILD_TARGET']
- ENV['CARGO_BUILD_TARGET'] = 'x86_64-unknown-linux-gnu'
- spec = Gem::Specification.new 'rust_ruby_example', '0.1.0'
+ old_cargo = ENV["CARGO_BUILD_TARGET"]
+ ENV["CARGO_BUILD_TARGET"] = "x86_64-unknown-linux-gnu"
+ spec = Gem::Specification.new "rust_ruby_example", "0.1.0"
builder = Gem::Ext::CargoBuilder.new(spec)
- command = builder.cargo_command(Dir.pwd, @tempdir, ['--locked'])
+ command = builder.cargo_command(Dir.pwd, @tempdir, ["--locked"])
- assert_includes command, '--target'
- assert_includes command, 'x86_64-unknown-linux-gnu'
+ assert_includes command, "--target"
+ assert_includes command, "x86_64-unknown-linux-gnu"
ensure
- ENV['CARGO_BUILD_TARGET'] = old_cargo
+ ENV["CARGO_BUILD_TARGET"] = old_cargo
end
def skip_unsupported_platforms!
diff --git a/test/rubygems/test_gem_ext_cmake_builder.rb b/test/rubygems/test_gem_ext_cmake_builder.rb
index b4d7cf2d30..ee84b8e728 100644
--- a/test/rubygems/test_gem_ext_cmake_builder.rb
+++ b/test/rubygems/test_gem_ext_cmake_builder.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/ext'
+require_relative "helper"
+require "rubygems/ext"
class TestGemExtCmakeBuilder < Gem::TestCase
def setup
@@ -12,21 +12,21 @@ class TestGemExtCmakeBuilder < Gem::TestCase
require "open3"
begin
- _, status = Open3.capture2e('cmake')
- pend 'cmake not present' unless status.success?
+ _, status = Open3.capture2e("cmake")
+ pend "cmake not present" unless status.success?
rescue Errno::ENOENT
- pend 'cmake not present'
+ pend "cmake not present"
end
- @ext = File.join @tempdir, 'ext'
- @dest_path = File.join @tempdir, 'prefix'
+ @ext = File.join @tempdir, "ext"
+ @dest_path = File.join @tempdir, "prefix"
FileUtils.mkdir_p @ext
FileUtils.mkdir_p @dest_path
end
def test_self_build
- File.open File.join(@ext, 'CMakeLists.txt'), 'w' do |cmakelists|
+ File.open File.join(@ext, "CMakeLists.txt"), "w" do |cmakelists|
cmakelists.write <<-EO_CMAKE
cmake_minimum_required(VERSION 2.6)
project(self_build NONE)
@@ -34,7 +34,7 @@ install (FILES test.txt DESTINATION bin)
EO_CMAKE
end
- FileUtils.touch File.join(@ext, 'test.txt')
+ FileUtils.touch File.join(@ext, "test.txt")
output = []
@@ -44,8 +44,8 @@ install (FILES test.txt DESTINATION bin)
assert_match %r{^cmake \. -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}}, output
assert_match %r{#{Regexp.escape @ext}}, output
- assert_contains_make_command '', output
- assert_contains_make_command 'install', output
+ assert_contains_make_command "", output
+ assert_contains_make_command "install", output
assert_match %r{test\.txt}, output
end
@@ -60,14 +60,14 @@ install (FILES test.txt DESTINATION bin)
shell_error_msg = %r{(CMake Error: .*)}
- assert_match 'cmake failed', error.message
+ assert_match "cmake failed", error.message
assert_match %r{^cmake . -DCMAKE_INSTALL_PREFIX\\=#{Regexp.escape @dest_path}}, output
assert_match %r{#{shell_error_msg}}, output
end
def test_self_build_has_makefile
- File.open File.join(@ext, 'Makefile'), 'w' do |makefile|
+ File.open File.join(@ext, "Makefile"), "w" do |makefile|
makefile.puts "all:\n\t@echo ok\ninstall:\n\t@echo ok"
end
@@ -77,7 +77,7 @@ install (FILES test.txt DESTINATION bin)
output = output.join "\n"
- assert_contains_make_command '', output
- assert_contains_make_command 'install', output
+ assert_contains_make_command "", output
+ assert_contains_make_command "install", output
end
end
diff --git a/test/rubygems/test_gem_ext_configure_builder.rb b/test/rubygems/test_gem_ext_configure_builder.rb
index 76ccfe2dc4..191b332dda 100644
--- a/test/rubygems/test_gem_ext_configure_builder.rb
+++ b/test/rubygems/test_gem_ext_configure_builder.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/ext'
+require_relative "helper"
+require "rubygems/ext"
class TestGemExtConfigureBuilder < Gem::TestCase
def setup
@@ -9,8 +9,8 @@ class TestGemExtConfigureBuilder < Gem::TestCase
@makefile_body =
"clean:\n\t@echo ok\nall:\n\t@echo ok\ninstall:\n\t@echo ok"
- @ext = File.join @tempdir, 'ext'
- @dest_path = File.join @tempdir, 'prefix'
+ @ext = File.join @tempdir, "ext"
+ @dest_path = File.join @tempdir, "prefix"
FileUtils.mkdir_p @ext
FileUtils.mkdir_p @dest_path
@@ -19,7 +19,7 @@ class TestGemExtConfigureBuilder < Gem::TestCase
def test_self_build
pend("test_self_build skipped on MS Windows (VC++)") if vc_windows?
- File.open File.join(@ext, './configure'), 'w' do |configure|
+ File.open File.join(@ext, "./configure"), "w" do |configure|
configure.puts "#!/bin/sh\necho \"#{@makefile_body}\" > Makefile"
end
@@ -31,13 +31,13 @@ class TestGemExtConfigureBuilder < Gem::TestCase
assert_equal "sh ./configure --prefix\\=#{@dest_path}", output.shift
assert_equal "", output.shift
assert_match(/^current directory:/, output.shift)
- assert_contains_make_command 'clean', output.shift
+ assert_contains_make_command "clean", output.shift
assert_match(/^ok$/m, output.shift)
assert_match(/^current directory:/, output.shift)
- assert_contains_make_command '', output.shift
+ assert_contains_make_command "", output.shift
assert_match(/^ok$/m, output.shift)
assert_match(/^current directory:/, output.shift)
- assert_contains_make_command 'install', output.shift
+ assert_contains_make_command "install", output.shift
assert_match(/^ok$/m, output.shift)
end
@@ -52,7 +52,7 @@ class TestGemExtConfigureBuilder < Gem::TestCase
shell_error_msg = %r{(\./configure: .*)|((?:[Cc]an't|cannot) open '?\./configure'?(?:: No such file or directory)?)}
sh_prefix_configure = "sh ./configure --prefix\\="
- assert_match 'configure failed', error.message
+ assert_match "configure failed", error.message
assert_match(/^current directory:/, output.shift)
assert_equal "#{sh_prefix_configure}#{@dest_path}", output.shift
@@ -65,15 +65,15 @@ class TestGemExtConfigureBuilder < Gem::TestCase
pend("test_self_build_has_makefile skipped - nmake not found")
end
- File.open File.join(@ext, 'Makefile'), 'w' do |makefile|
+ File.open File.join(@ext, "Makefile"), "w" do |makefile|
makefile.puts @makefile_body
end
output = []
Gem::Ext::ConfigureBuilder.build nil, @dest_path, output, [], nil, @ext
- assert_contains_make_command 'clean', output[1]
- assert_contains_make_command '', output[4]
- assert_contains_make_command 'install', output[7]
+ assert_contains_make_command "clean", output[1]
+ assert_contains_make_command "", output[4]
+ assert_contains_make_command "install", output[7]
end
end
diff --git a/test/rubygems/test_gem_ext_ext_conf_builder.rb b/test/rubygems/test_gem_ext_ext_conf_builder.rb
index 10a544cbbc..e6b980a96b 100644
--- a/test/rubygems/test_gem_ext_ext_conf_builder.rb
+++ b/test/rubygems/test_gem_ext_ext_conf_builder.rb
@@ -1,14 +1,14 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/ext'
+require_relative "helper"
+require "rubygems/ext"
class TestGemExtExtConfBuilder < Gem::TestCase
def setup
super
- @ext = File.join @tempdir, 'ext'
- @dest_path = File.join @tempdir, 'prefix'
+ @ext = File.join @tempdir, "ext"
+ @dest_path = File.join @tempdir, "prefix"
FileUtils.mkdir_p @ext
FileUtils.mkdir_p @dest_path
@@ -23,13 +23,13 @@ class TestGemExtExtConfBuilder < Gem::TestCase
pend("test_class_build skipped - nmake not found")
end
- File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
+ File.open File.join(@ext, "extconf.rb"), "w" do |extconf|
extconf.puts "require 'mkmf'\ncreate_makefile 'foo'"
end
output = []
- result = Gem::Ext::ExtConfBuilder.build 'extconf.rb', @dest_path, output, [], nil, @ext
+ result = Gem::Ext::ExtConfBuilder.build "extconf.rb", @dest_path, output, [], nil, @ext
assert_same result, output
@@ -37,11 +37,11 @@ class TestGemExtExtConfBuilder < Gem::TestCase
assert_match(/^#{Gem.ruby}.* extconf.rb/, output[1])
assert_equal "creating Makefile\n", output[2]
assert_match(/^current directory:/, output[3])
- assert_contains_make_command 'clean', output[4]
- assert_contains_make_command '', output[7]
- assert_contains_make_command 'install', output[10]
- assert_empty Dir.glob(File.join(@ext, 'siteconf*.rb'))
- assert_empty Dir.glob(File.join(@ext, '.gem.*'))
+ assert_contains_make_command "clean", output[4]
+ assert_contains_make_command "", output[7]
+ assert_contains_make_command "install", output[10]
+ assert_empty Dir.glob(File.join(@ext, "siteconf*.rb"))
+ assert_empty Dir.glob(File.join(@ext, ".gem.*"))
end
def test_class_build_rbconfig_make_prog
@@ -50,50 +50,49 @@ class TestGemExtExtConfBuilder < Gem::TestCase
end
configure_args do
-
- File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
+ File.open File.join(@ext, "extconf.rb"), "w" do |extconf|
extconf.puts "require 'mkmf'\ncreate_makefile 'foo'"
end
output = []
- Gem::Ext::ExtConfBuilder.build 'extconf.rb', @dest_path, output, [], nil, @ext
+ Gem::Ext::ExtConfBuilder.build "extconf.rb", @dest_path, output, [], nil, @ext
assert_equal "creating Makefile\n", output[2]
- assert_contains_make_command 'clean', output[4]
- assert_contains_make_command '', output[7]
- assert_contains_make_command 'install', output[10]
+ assert_contains_make_command "clean", output[4]
+ assert_contains_make_command "", output[7]
+ assert_contains_make_command "install", output[10]
end
end
def test_class_build_env_MAKE
- env_make = ENV.delete 'make'
- ENV['make'] = nil
+ env_make = ENV.delete "make"
+ ENV["make"] = nil
- env_MAKE = ENV.delete 'MAKE'
- ENV['MAKE'] = 'anothermake'
+ env_MAKE = ENV.delete "MAKE"
+ ENV["MAKE"] = "anothermake"
if java_platform?
pend("failing on jruby")
end
- configure_args '' do
- File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
+ configure_args "" do
+ File.open File.join(@ext, "extconf.rb"), "w" do |extconf|
extconf.puts "require 'mkmf'\ncreate_makefile 'foo'"
end
output = []
assert_raise Gem::InstallError do
- Gem::Ext::ExtConfBuilder.build 'extconf.rb', @dest_path, output, [], nil, @ext
+ Gem::Ext::ExtConfBuilder.build "extconf.rb", @dest_path, output, [], nil, @ext
end
assert_equal "creating Makefile\n", output[2]
- assert_contains_make_command 'clean', output[4]
+ assert_contains_make_command "clean", output[4]
end
ensure
- ENV['MAKE'] = env_MAKE
- ENV['make'] = env_make
+ ENV["MAKE"] = env_MAKE
+ ENV["make"] = env_make
end
def test_class_build_extconf_fail
@@ -101,7 +100,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
pend("test_class_build_extconf_fail skipped - nmake not found")
end
- File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
+ File.open File.join(@ext, "extconf.rb"), "w" do |extconf|
extconf.puts "require 'mkmf'"
extconf.puts "have_library 'nonexistent' or abort 'need libnonexistent'"
extconf.puts "create_makefile 'foo'"
@@ -110,16 +109,16 @@ class TestGemExtExtConfBuilder < Gem::TestCase
output = []
error = assert_raise Gem::InstallError do
- Gem::Ext::ExtConfBuilder.build 'extconf.rb', @dest_path, output, [], nil, @ext
+ Gem::Ext::ExtConfBuilder.build "extconf.rb", @dest_path, output, [], nil, @ext
end
- assert_equal 'extconf failed, exit code 1', error.message
+ assert_equal "extconf failed, exit code 1", error.message
assert_match(/^#{Gem.ruby}.* extconf.rb/, output[1])
- assert_match(File.join(@dest_path, 'mkmf.log'), output[4])
+ assert_match(File.join(@dest_path, "mkmf.log"), output[4])
assert_includes(output, "To see why this extension failed to compile, please check the mkmf.log which can be found here:\n")
- assert_path_exist File.join @dest_path, 'mkmf.log'
+ assert_path_exist File.join @dest_path, "mkmf.log"
end
def test_class_build_extconf_success_without_warning
@@ -127,7 +126,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
pend("test_class_build_extconf_fail skipped - nmake not found")
end
- File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
+ File.open File.join(@ext, "extconf.rb"), "w" do |extconf|
extconf.puts "require 'mkmf'"
extconf.puts "File.open('mkmf.log', 'w'){|f| f.write('a')}"
extconf.puts "create_makefile 'foo'"
@@ -135,11 +134,11 @@ class TestGemExtExtConfBuilder < Gem::TestCase
output = []
- Gem::Ext::ExtConfBuilder.build 'extconf.rb', @dest_path, output, [], nil, @ext
+ Gem::Ext::ExtConfBuilder.build "extconf.rb", @dest_path, output, [], nil, @ext
refute_includes(output, "To see why this extension failed to compile, please check the mkmf.log which can be found here:\n")
- assert_path_exist File.join @dest_path, 'mkmf.log'
+ assert_path_exist File.join @dest_path, "mkmf.log"
end
def test_class_build_unconventional
@@ -147,7 +146,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
pend("test_class_build skipped - nmake not found")
end
- File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
+ File.open File.join(@ext, "extconf.rb"), "w" do |extconf|
extconf.puts <<-'EXTCONF'
include RbConfig
@@ -175,12 +174,12 @@ end
output = []
- Gem::Ext::ExtConfBuilder.build 'extconf.rb', @dest_path, output, [], nil, @ext
+ Gem::Ext::ExtConfBuilder.build "extconf.rb", @dest_path, output, [], nil, @ext
- assert_contains_make_command 'clean', output[4]
- assert_contains_make_command '', output[7]
- assert_contains_make_command 'install', output[10]
- assert_empty Dir.glob(File.join(@ext, 'siteconf*.rb'))
+ assert_contains_make_command "clean", output[4]
+ assert_contains_make_command "", output[7]
+ assert_contains_make_command "install", output[10]
+ assert_empty Dir.glob(File.join(@ext, "siteconf*.rb"))
end
def test_class_make
@@ -189,8 +188,8 @@ end
end
output = []
- makefile_path = File.join(@ext, 'Makefile')
- File.open makefile_path, 'w' do |makefile|
+ makefile_path = File.join(@ext, "Makefile")
+ File.open makefile_path, "w" do |makefile|
makefile.puts "# π"
makefile.puts "RUBYARCHDIR = $(foo)$(target_prefix)"
makefile.puts "RUBYLIBDIR = $(bar)$(target_prefix)"
@@ -201,30 +200,30 @@ end
Gem::Ext::ExtConfBuilder.make @ext, output, @ext
- assert_contains_make_command 'clean', output[1]
- assert_contains_make_command '', output[4]
- assert_contains_make_command 'install', output[7]
+ assert_contains_make_command "clean", output[1]
+ assert_contains_make_command "", output[4]
+ assert_contains_make_command "install", output[7]
end
def test_class_make_no_Makefile
error = assert_raise Gem::InstallError do
- Gem::Ext::ExtConfBuilder.make @ext, ['output'], @ext
+ Gem::Ext::ExtConfBuilder.make @ext, ["output"], @ext
end
- assert_equal 'Makefile not found', error.message
+ assert_equal "Makefile not found", error.message
end
def configure_args(args = nil)
- configure_args = RbConfig::CONFIG['configure_args']
- RbConfig::CONFIG['configure_args'] = args if args
+ configure_args = RbConfig::CONFIG["configure_args"]
+ RbConfig::CONFIG["configure_args"] = args if args
yield
ensure
if configure_args
- RbConfig::CONFIG['configure_args'] = configure_args
+ RbConfig::CONFIG["configure_args"] = configure_args
else
- RbConfig::CONFIG.delete 'configure_args'
+ RbConfig::CONFIG.delete "configure_args"
end
end
end
diff --git a/test/rubygems/test_gem_ext_rake_builder.rb b/test/rubygems/test_gem_ext_rake_builder.rb
index 3d8922eed5..3ed818a7f8 100644
--- a/test/rubygems/test_gem_ext_rake_builder.rb
+++ b/test/rubygems/test_gem_ext_rake_builder.rb
@@ -1,24 +1,24 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/ext'
+require_relative "helper"
+require "rubygems/ext"
class TestGemExtRakeBuilder < Gem::TestCase
def setup
super
- @ext = File.join @tempdir, 'ext'
- @dest_path = File.join @tempdir, 'prefix'
+ @ext = File.join @tempdir, "ext"
+ @dest_path = File.join @tempdir, "prefix"
FileUtils.mkdir_p @ext
FileUtils.mkdir_p @dest_path
end
def test_class_build
- create_temp_mkrf_file('task :default')
+ create_temp_mkrf_file("task :default")
output = []
build_rake_in do |rake|
- Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', @dest_path, output, [], nil, @ext
+ Gem::Ext::RakeBuilder.build "mkrf_conf.rb", @dest_path, output, [], nil, @ext
output = output.join "\n"
@@ -32,12 +32,12 @@ class TestGemExtRakeBuilder < Gem::TestCase
#
# It should not fail with a non-empty args list either
def test_class_build_with_args
- create_temp_mkrf_file('task :default')
+ create_temp_mkrf_file("task :default")
output = []
build_rake_in do |rake|
- non_empty_args_list = ['']
- Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', @dest_path, output, non_empty_args_list, nil, @ext
+ non_empty_args_list = [""]
+ Gem::Ext::RakeBuilder.build "mkrf_conf.rb", @dest_path, output, non_empty_args_list, nil, @ext
output = output.join "\n"
@@ -48,25 +48,25 @@ class TestGemExtRakeBuilder < Gem::TestCase
end
def test_class_no_openssl_override
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
- create_temp_mkrf_file('task :default')
+ create_temp_mkrf_file("task :default")
- rake = util_spec 'rake' do |s|
+ rake = util_spec "rake" do |s|
s.executables = %w[rake]
s.files = %w[bin/rake]
end
output = []
- write_file File.join(@tempdir, 'bin', 'rake') do |fp|
+ write_file File.join(@tempdir, "bin", "rake") do |fp|
fp.puts "#!/usr/bin/ruby"
fp.puts "require 'openssl'; puts OpenSSL"
end
install_gem rake
- Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', @dest_path, output, [''], nil, @ext
+ Gem::Ext::RakeBuilder.build "mkrf_conf.rb", @dest_path, output, [""], nil, @ext
output = output.join "\n"
@@ -101,7 +101,7 @@ class TestGemExtRakeBuilder < Gem::TestCase
end
def create_temp_mkrf_file(rakefile_content)
- File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
+ File.open File.join(@ext, "mkrf_conf.rb"), "w" do |mkrf_conf|
mkrf_conf.puts <<-EO_MKRF
File.open("Rakefile","w") do |f|
f.puts "#{rakefile_content}"
diff --git a/test/rubygems/test_gem_gem_runner.rb b/test/rubygems/test_gem_gem_runner.rb
index 6f5361cf2f..f0128febc8 100644
--- a/test/rubygems/test_gem_gem_runner.rb
+++ b/test/rubygems/test_gem_gem_runner.rb
@@ -1,16 +1,16 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemGemRunner < Gem::TestCase
def setup
super
- require 'rubygems/command'
+ require "rubygems/command"
@orig_args = Gem::Command.build_args
@orig_specific_extra_args = Gem::Command.specific_extra_args_hash.dup
@orig_extra_args = Gem::Command.extra_args.dup
- require 'rubygems/gem_runner'
+ require "rubygems/gem_runner"
@runner = Gem::GemRunner.new
end
@@ -25,15 +25,15 @@ class TestGemGemRunner < Gem::TestCase
def test_do_configuration
Gem.clear_paths
- temp_conf = File.join @tempdir, '.gemrc'
+ temp_conf = File.join @tempdir, ".gemrc"
- other_gem_path = File.join @tempdir, 'other_gem_path'
- other_gem_home = File.join @tempdir, 'other_gem_home'
+ other_gem_path = File.join @tempdir, "other_gem_path"
+ other_gem_home = File.join @tempdir, "other_gem_home"
Gem.ensure_gem_subdirectories other_gem_path
Gem.ensure_gem_subdirectories other_gem_home
- File.open temp_conf, 'w' do |fp|
+ File.open temp_conf, "w" do |fp|
fp.puts "gem: --commands"
fp.puts "gemhome: #{other_gem_home}"
fp.puts "gempath:"
diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb
index 9bfc22a202..2ca5b402d9 100644
--- a/test/rubygems/test_gem_gemcutter_utilities.rb
+++ b/test/rubygems/test_gem_gemcutter_utilities.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems'
-require 'rubygems/command'
-require 'rubygems/gemcutter_utilities'
+require_relative "helper"
+require "rubygems"
+require "rubygems/command"
+require "rubygems/gemcutter_utilities"
class TestGemGemcutterUtilities < Gem::TestCase
def setup
@@ -13,17 +13,17 @@ class TestGemGemcutterUtilities < Gem::TestCase
# below needed for random testing, class property
Gem.configuration.disable_default_gem_server = nil
- ENV['RUBYGEMS_HOST'] = nil
- ENV['GEM_HOST_OTP_CODE'] = nil
+ ENV["RUBYGEMS_HOST"] = nil
+ ENV["GEM_HOST_OTP_CODE"] = nil
Gem.configuration.rubygems_api_key = nil
- @cmd = Gem::Command.new '', 'summary'
+ @cmd = Gem::Command.new "", "summary"
@cmd.extend Gem::GemcutterUtilities
end
def teardown
- ENV['RUBYGEMS_HOST'] = nil
- ENV['GEM_HOST_OTP_CODE'] = nil
+ ENV["RUBYGEMS_HOST"] = nil
+ ENV["GEM_HOST_OTP_CODE"] = nil
Gem.configuration.rubygems_api_key = nil
credential_teardown
@@ -33,11 +33,11 @@ class TestGemGemcutterUtilities < Gem::TestCase
def test_alternate_key_alternate_host
keys = {
- :rubygems_api_key => 'KEY',
+ :rubygems_api_key => "KEY",
"http://rubygems.engineyard.com" => "EYKEY",
}
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write keys.to_yaml
end
@@ -45,25 +45,25 @@ class TestGemGemcutterUtilities < Gem::TestCase
Gem.configuration.load_api_keys
- assert_equal 'EYKEY', @cmd.api_key
+ assert_equal "EYKEY", @cmd.api_key
end
def test_api_key
- keys = { :rubygems_api_key => 'KEY' }
+ keys = { :rubygems_api_key => "KEY" }
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write keys.to_yaml
end
Gem.configuration.load_api_keys
- assert_equal 'KEY', @cmd.api_key
+ assert_equal "KEY", @cmd.api_key
end
def test_api_key_override
- keys = { :rubygems_api_key => 'KEY', :other => 'OTHER' }
+ keys = { :rubygems_api_key => "KEY", :other => "OTHER" }
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write keys.to_yaml
end
@@ -72,28 +72,28 @@ class TestGemGemcutterUtilities < Gem::TestCase
@cmd.add_key_option
@cmd.handle_options %w[--key other]
- assert_equal 'OTHER', @cmd.api_key
+ assert_equal "OTHER", @cmd.api_key
end
def test_host
- assert_equal 'https://rubygems.org', @cmd.host
+ assert_equal "https://rubygems.org", @cmd.host
end
def test_host_RUBYGEMS_HOST
- ENV['RUBYGEMS_HOST'] = 'https://other.example'
+ ENV["RUBYGEMS_HOST"] = "https://other.example"
- assert_equal 'https://other.example', @cmd.host
+ assert_equal "https://other.example", @cmd.host
end
def test_host_RUBYGEMS_HOST_empty
- ENV['RUBYGEMS_HOST'] = ''
+ ENV["RUBYGEMS_HOST"] = ""
- assert_equal 'https://rubygems.org', @cmd.host
+ assert_equal "https://rubygems.org", @cmd.host
end
def test_sign_in
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
- util_sign_in [api_key, 200, 'OK']
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
+ util_sign_in [api_key, 200, "OK"]
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
assert @fetcher.last_request["authorization"]
@@ -104,9 +104,9 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_sign_in_with_host
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
- util_sign_in [api_key, 200, 'OK'], 'http://example.com', ['http://example.com']
+ util_sign_in [api_key, 200, "OK"], "http://example.com", ["http://example.com"]
assert_match "Enter your http://example.com credentials.",
@sign_in_ui.output
@@ -114,13 +114,13 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_match %r{Signed in.}, @sign_in_ui.output
credentials = load_yaml_file Gem.configuration.credentials_path
- assert_equal api_key, credentials['http://example.com']
+ assert_equal api_key, credentials["http://example.com"]
end
def test_sign_in_with_host_nil
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
- util_sign_in [api_key, 200, 'OK'], nil, [nil]
+ util_sign_in [api_key, 200, "OK"], nil, [nil]
assert_match "Enter your RubyGems.org credentials.",
@sign_in_ui.output
@@ -132,8 +132,8 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_sign_in_with_host_ENV
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
- util_sign_in [api_key, 200, 'OK'], 'http://example.com'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
+ util_sign_in [api_key, 200, "OK"], "http://example.com"
assert_match "Enter your http://example.com credentials.",
@sign_in_ui.output
@@ -141,35 +141,35 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_match %r{Signed in.}, @sign_in_ui.output
credentials = load_yaml_file Gem.configuration.credentials_path
- assert_equal api_key, credentials['http://example.com']
+ assert_equal api_key, credentials["http://example.com"]
end
def test_sign_in_skips_with_existing_credentials
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
Gem.configuration.rubygems_api_key = api_key
- util_sign_in [api_key, 200, 'OK']
+ util_sign_in [api_key, 200, "OK"]
assert_equal "", @sign_in_ui.output
end
def test_sign_in_skips_with_key_override
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
- Gem.configuration.api_keys[:KEY] = 'other'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
+ Gem.configuration.api_keys[:KEY] = "other"
@cmd.options[:key] = :KEY
- util_sign_in [api_key, 200, 'OK']
+ util_sign_in [api_key, 200, "OK"]
assert_equal "", @sign_in_ui.output
end
def test_sign_in_with_other_credentials_doesnt_overwrite_other_keys
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
- other_api_key = 'f46dbb18bb6a9c97cdc61b5b85c186a17403cdcbf'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
+ other_api_key = "f46dbb18bb6a9c97cdc61b5b85c186a17403cdcbf"
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write Hash[:other_api_key, other_api_key].to_yaml
end
- util_sign_in [api_key, 200, 'OK']
+ util_sign_in [api_key, 200, "OK"]
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
assert_match %r{Signed in.}, @sign_in_ui.output
@@ -181,7 +181,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
def test_sign_in_with_bad_credentials
assert_raise Gem::MockGemUi::TermError do
- util_sign_in ['Access Denied.', 403, 'Forbidden']
+ util_sign_in ["Access Denied.", 403, "Forbidden"]
end
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
@@ -189,50 +189,50 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_signin_with_env_otp_code
- ENV['GEM_HOST_OTP_CODE'] = '111111'
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ ENV["GEM_HOST_OTP_CODE"] = "111111"
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
- util_sign_in [api_key, 200, 'OK']
+ util_sign_in [api_key, 200, "OK"]
- assert_match 'Signed in with API key:', @sign_in_ui.output
- assert_equal '111111', @fetcher.last_request['OTP']
+ assert_match "Signed in with API key:", @sign_in_ui.output
+ assert_equal "111111", @fetcher.last_request["OTP"]
end
def test_sign_in_with_correct_otp_code
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = "a5fdbb6ba150cbb83aad2bb2fede64cf040453903"
response_fail = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
util_sign_in(proc do
@call_count ||= 0
- (@call_count += 1).odd? ? [response_fail, 401, 'Unauthorized'] : [api_key, 200, 'OK']
+ (@call_count += 1).odd? ? [response_fail, 401, "Unauthorized"] : [api_key, 200, "OK"]
end, nil, [], "111111\n")
- assert_match 'You have enabled multi-factor authentication. Please enter OTP code.', @sign_in_ui.output
- assert_match 'Code: ', @sign_in_ui.output
- assert_match 'Signed in with API key:', @sign_in_ui.output
- assert_equal '111111', @fetcher.last_request['OTP']
+ assert_match "You have enabled multi-factor authentication. Please enter OTP code.", @sign_in_ui.output
+ assert_match "Code: ", @sign_in_ui.output
+ assert_match "Signed in with API key:", @sign_in_ui.output
+ assert_equal "111111", @fetcher.last_request["OTP"]
end
def test_sign_in_with_incorrect_otp_code
response = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
assert_raise Gem::MockGemUi::TermError do
- util_sign_in [response, 401, 'Unauthorized'], nil, [], "111111\n"
+ util_sign_in [response, 401, "Unauthorized"], nil, [], "111111\n"
end
- assert_match 'You have enabled multi-factor authentication. Please enter OTP code.', @sign_in_ui.output
- assert_match 'Code: ', @sign_in_ui.output
+ assert_match "You have enabled multi-factor authentication. Please enter OTP code.", @sign_in_ui.output
+ assert_match "Code: ", @sign_in_ui.output
assert_match response, @sign_in_ui.output
- assert_equal '111111', @fetcher.last_request['OTP']
+ assert_equal "111111", @fetcher.last_request["OTP"]
end
- def util_sign_in(response, host = nil, args = [], extra_input = '')
- email = 'you@example.com'
- password = 'secret'
- profile_response = [ "mfa: disabled\n" , 200, 'OK']
+ def util_sign_in(response, host = nil, args = [], extra_input = "")
+ email = "you@example.com"
+ password = "secret"
+ profile_response = [ "mfa: disabled\n" , 200, "OK"]
if host
- ENV['RUBYGEMS_HOST'] = host
+ ENV["RUBYGEMS_HOST"] = host
else
host = Gem.host
end
@@ -254,13 +254,13 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_verify_api_key
- keys = { :other => 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903' }
- File.open Gem.configuration.credentials_path, 'w' do |f|
+ keys = { :other => "a5fdbb6ba150cbb83aad2bb2fede64cf040453903" }
+ File.open Gem.configuration.credentials_path, "w" do |f|
f.write keys.to_yaml
end
Gem.configuration.load_api_keys
- assert_equal 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903',
+ assert_equal "a5fdbb6ba150cbb83aad2bb2fede64cf040453903",
@cmd.verify_api_key(:other)
end
diff --git a/test/rubygems/test_gem_impossible_dependencies_error.rb b/test/rubygems/test_gem_impossible_dependencies_error.rb
index 971be151df..59395f0bbd 100644
--- a/test/rubygems/test_gem_impossible_dependencies_error.rb
+++ b/test/rubygems/test_gem_impossible_dependencies_error.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemImpossibleDependenciesError < Gem::TestCase
def test_message_conflict
- request = dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
+ request = dependency_request dep("net-ssh", ">= 2.0.13"), "rye", "0.9.8"
conflicts = []
@@ -11,9 +11,9 @@ class TestGemImpossibleDependenciesError < Gem::TestCase
# requested-by entries, but they are suitable for testing the message.
# See #485 to construct a correct conflict.
net_ssh_2_2_2 =
- dependency_request dep('net-ssh', '>= 2.6.5'), 'net-ssh', '2.2.2', request
+ dependency_request dep("net-ssh", ">= 2.6.5"), "net-ssh", "2.2.2", request
net_ssh_2_6_5 =
- dependency_request dep('net-ssh', '~> 2.2.2'), 'net-ssh', '2.6.5', request
+ dependency_request dep("net-ssh", "~> 2.2.2"), "net-ssh", "2.6.5", request
conflict1 = Gem::Resolver::Conflict.new \
net_ssh_2_6_5, net_ssh_2_6_5.requester
diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb
index 24afae5fcc..cfdff6e4c5 100644
--- a/test/rubygems/test_gem_indexer.rb
+++ b/test/rubygems/test_gem_indexer.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/indexer'
+require_relative "helper"
+require "rubygems/indexer"
class TestGemIndexer < Gem::TestCase
def setup
@@ -8,25 +8,25 @@ class TestGemIndexer < Gem::TestCase
util_make_gems
- @d2_0 = util_spec 'd', '2.0' do |s|
+ @d2_0 = util_spec "d", "2.0" do |s|
s.date = Gem::Specification::TODAY - 86400 * 3
end
util_build_gem @d2_0
- @d2_0_a = util_spec 'd', '2.0.a'
+ @d2_0_a = util_spec "d", "2.0.a"
util_build_gem @d2_0_a
- @d2_0_b = util_spec 'd', '2.0.b'
+ @d2_0_b = util_spec "d", "2.0.b"
util_build_gem @d2_0_b
- @default = new_default_spec 'default', 2
+ @default = new_default_spec "default", 2
install_default_gems @default
- @indexerdir = File.join(@tempdir, 'indexer')
+ @indexerdir = File.join(@tempdir, "indexer")
- gems = File.join(@indexerdir, 'gems')
+ gems = File.join(@indexerdir, "gems")
FileUtils.mkdir_p gems
- FileUtils.mv Dir[File.join(@gemhome, "cache", '*.gem')], gems
+ FileUtils.mv Dir[File.join(@gemhome, "cache", "*.gem")], gems
@indexer = Gem::Indexer.new(@indexerdir)
end
@@ -79,7 +79,7 @@ class TestGemIndexer < Gem::TestCase
["pl", Gem::Version.new("1"), "i386-linux"],
["x", Gem::Version.new("1"), "ruby"]]
- assert_equal expected, latest_specs, 'latest_specs'
+ assert_equal expected, latest_specs, "latest_specs"
end
def test_generate_index
@@ -87,7 +87,7 @@ class TestGemIndexer < Gem::TestCase
@indexer.generate_index
end
- quickdir = File.join @indexerdir, 'quick'
+ quickdir = File.join @indexerdir, "quick"
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
assert_directory_exists quickdir
@@ -114,15 +114,15 @@ class TestGemIndexer < Gem::TestCase
@indexer.generate_index
end
- refute_indexed @indexerdir, 'yaml'
- refute_indexed @indexerdir, 'yaml.Z'
+ refute_indexed @indexerdir, "yaml"
+ refute_indexed @indexerdir, "yaml.Z"
refute_indexed @indexerdir, "Marshal.#{@marshal_version}"
refute_indexed @indexerdir, "Marshal.#{@marshal_version}.Z"
- quickdir = File.join @indexerdir, 'quick'
+ quickdir = File.join @indexerdir, "quick"
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
- assert_directory_exists quickdir, 'quickdir should be directory'
+ assert_directory_exists quickdir, "quickdir should be directory"
assert_directory_exists marshal_quickdir
refute_indexed quickdir, "index"
@@ -165,7 +165,7 @@ class TestGemIndexer < Gem::TestCase
use_ui @ui do
@indexer.generate_index
end
- quickdir = File.join @indexerdir, 'quick'
+ quickdir = File.join @indexerdir, "quick"
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
assert_directory_exists quickdir
@@ -196,7 +196,7 @@ class TestGemIndexer < Gem::TestCase
assert_match %r{^Complete$}, @ui.output
assert_match %r{^Compressing indices$}, @ui.output
- assert_equal '', @ui.error
+ assert_equal "", @ui.error
end
def test_generate_index_specs
@@ -210,30 +210,30 @@ class TestGemIndexer < Gem::TestCase
specs = Marshal.load specs_dump
expected = [
- ['a', Gem::Version.new(1), 'ruby'],
- ['a', Gem::Version.new(2), 'ruby'],
- ['a_evil', Gem::Version.new(9), 'ruby'],
- ['b', Gem::Version.new(2), 'ruby'],
- ['c', Gem::Version.new('1.2'), 'ruby'],
- ['d', Gem::Version.new('2.0'), 'ruby'],
- ['dep_x', Gem::Version.new(1), 'ruby'],
- ['pl', Gem::Version.new(1), 'i386-linux'],
- ['x', Gem::Version.new(1), 'ruby'],
+ ["a", Gem::Version.new(1), "ruby"],
+ ["a", Gem::Version.new(2), "ruby"],
+ ["a_evil", Gem::Version.new(9), "ruby"],
+ ["b", Gem::Version.new(2), "ruby"],
+ ["c", Gem::Version.new("1.2"), "ruby"],
+ ["d", Gem::Version.new("2.0"), "ruby"],
+ ["dep_x", Gem::Version.new(1), "ruby"],
+ ["pl", Gem::Version.new(1), "i386-linux"],
+ ["x", Gem::Version.new(1), "ruby"],
]
assert_equal expected, specs
assert_same specs[0].first, specs[1].first,
- 'identical names not identical'
+ "identical names not identical"
assert_same specs[0][1], specs[-1][1],
- 'identical versions not identical'
+ "identical versions not identical"
assert_same specs[0].last, specs[1].last,
- 'identical platforms not identical'
+ "identical platforms not identical"
refute_same specs[1][1], specs[5][1],
- 'different versions not different'
+ "different versions not different"
end
def test_generate_index_latest_specs
@@ -247,23 +247,23 @@ class TestGemIndexer < Gem::TestCase
latest_specs = Marshal.load latest_specs_dump
expected = [
- ['a', Gem::Version.new(2), 'ruby'],
- ['a_evil', Gem::Version.new(9), 'ruby'],
- ['b', Gem::Version.new(2), 'ruby'],
- ['c', Gem::Version.new('1.2'), 'ruby'],
- ['d', Gem::Version.new('2.0'), 'ruby'],
- ['dep_x', Gem::Version.new(1), 'ruby'],
- ['pl', Gem::Version.new(1), 'i386-linux'],
- ['x', Gem::Version.new(1), 'ruby'],
+ ["a", Gem::Version.new(2), "ruby"],
+ ["a_evil", Gem::Version.new(9), "ruby"],
+ ["b", Gem::Version.new(2), "ruby"],
+ ["c", Gem::Version.new("1.2"), "ruby"],
+ ["d", Gem::Version.new("2.0"), "ruby"],
+ ["dep_x", Gem::Version.new(1), "ruby"],
+ ["pl", Gem::Version.new(1), "i386-linux"],
+ ["x", Gem::Version.new(1), "ruby"],
]
assert_equal expected, latest_specs
assert_same latest_specs[0][1], latest_specs[2][1],
- 'identical versions not identical'
+ "identical versions not identical"
assert_same latest_specs[0].last, latest_specs[1].last,
- 'identical platforms not identical'
+ "identical platforms not identical"
end
def test_generate_index_prerelease_specs
@@ -276,9 +276,9 @@ class TestGemIndexer < Gem::TestCase
prerelease_specs_dump = Gem.read_binary prerelease_specs_path
prerelease_specs = Marshal.load prerelease_specs_dump
- assert_equal [['a', Gem::Version.new('3.a'), 'ruby'],
- ['d', Gem::Version.new('2.0.a'), 'ruby'],
- ['d', Gem::Version.new('2.0.b'), 'ruby']],
+ assert_equal [["a", Gem::Version.new("3.a"), "ruby"],
+ ["d", Gem::Version.new("2.0.a"), "ruby"],
+ ["d", Gem::Version.new("2.0.b"), "ruby"]],
prerelease_specs
end
@@ -288,7 +288,7 @@ class TestGemIndexer < Gem::TestCase
def with_system_gems
Gem::Specification.reset
- sys_gem = util_spec 'systemgem', '1.0'
+ sys_gem = util_spec "systemgem", "1.0"
util_build_gem sys_gem
install_default_gems sys_gem
yield
@@ -300,21 +300,21 @@ class TestGemIndexer < Gem::TestCase
@indexer.generate_index
end
- quickdir = File.join @indexerdir, 'quick'
+ quickdir = File.join @indexerdir, "quick"
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
assert_directory_exists quickdir
assert_directory_exists marshal_quickdir
- @d2_1 = util_spec 'd', '2.1'
+ @d2_1 = util_spec "d", "2.1"
util_build_gem @d2_1
@d2_1_tuple = [@d2_1.name, @d2_1.version, @d2_1.original_platform]
- @d2_1_a = util_spec 'd', '2.2.a'
+ @d2_1_a = util_spec "d", "2.2.a"
util_build_gem @d2_1_a
@d2_1_a_tuple = [@d2_1_a.name, @d2_1_a.version, @d2_1_a.original_platform]
- gems = File.join @indexerdir, 'gems'
+ gems = File.join @indexerdir, "gems"
FileUtils.mv @d2_1.cache_file, gems
FileUtils.mv @d2_1_a.cache_file, gems
diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb
index a499c2be3b..e2225a1eba 100644
--- a/test/rubygems/test_gem_install_update_options.rb
+++ b/test/rubygems/test_gem_install_update_options.rb
@@ -1,14 +1,14 @@
# frozen_string_literal: true
-require_relative 'installer_test_case'
-require 'rubygems/install_update_options'
-require 'rubygems/command'
-require 'rubygems/dependency_installer'
+require_relative "installer_test_case"
+require "rubygems/install_update_options"
+require "rubygems/command"
+require "rubygems/dependency_installer"
class TestGemInstallUpdateOptions < Gem::InstallerTestCase
def setup
super
- @cmd = Gem::Command.new 'dummy', 'dummy',
+ @cmd = Gem::Command.new "dummy", "dummy",
Gem::DependencyInstaller::DEFAULT_OPTIONS
@cmd.extend Gem::InstallUpdateOptions
@cmd.add_install_update_options
@@ -38,7 +38,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
def test_build_root
@cmd.handle_options %w[--build-root build_root]
- assert_equal File.expand_path('build_root'), @cmd.options[:build_root]
+ assert_equal File.expand_path("build_root"), @cmd.options[:build_root]
end
def test_doc
@@ -92,7 +92,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
end
def test_security_policy
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
@cmd.handle_options %w[-P HighSecurity]
@@ -100,7 +100,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
end
def test_security_policy_unknown
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
@cmd.add_install_update_options
@@ -111,7 +111,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
end
def test_user_install_enabled
- @spec = quick_gem 'a' do |spec|
+ @spec = quick_gem "a" do |spec|
util_make_exec spec
end
@@ -124,12 +124,12 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
@installer = Gem::Installer.at @gem, @cmd.options
@installer.install
- assert_path_exist File.join(Gem.user_dir, 'gems')
- assert_path_exist File.join(Gem.user_dir, 'gems', @spec.full_name)
+ assert_path_exist File.join(Gem.user_dir, "gems")
+ assert_path_exist File.join(Gem.user_dir, "gems", @spec.full_name)
end
def test_user_install_disabled_read_only
- @spec = quick_gem 'a' do |spec|
+ @spec = quick_gem "a" do |spec|
util_make_exec spec
end
@@ -137,9 +137,9 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
@gem = @spec.cache_file
if win_platform?
- pend('test_user_install_disabled_read_only test skipped on MS Windows')
+ 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')
+ pend("test_user_install_disabled_read_only test skipped in root privilege")
else
@cmd.handle_options %w[--no-user-install]
@@ -159,7 +159,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
end
def test_vendor
- vendordir(File.join(@tempdir, 'vendor')) do
+ vendordir(File.join(@tempdir, "vendor")) do
@cmd.handle_options %w[--vendor]
assert @cmd.options[:vendor]
@@ -173,7 +173,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
@cmd.handle_options %w[--vendor]
end
- assert_equal 'invalid option: --vendor your platform is not supported',
+ assert_equal "invalid option: --vendor your platform is not supported",
e.message
refute @cmd.options[:vendor]
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 46bb6965c7..4600317578 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'installer_test_case'
+require_relative "installer_test_case"
class TestGemInstaller < Gem::InstallerTestCase
def setup
@@ -21,7 +21,7 @@ class TestGemInstaller < Gem::InstallerTestCase
load_relative "no" do
installer = setup_base_installer
- util_make_exec @spec, ''
+ util_make_exec @spec, ""
expected = <<-EOF
#!#{Gem.ruby}
@@ -55,7 +55,7 @@ load Gem.bin_path("a", "executable", version)
end
EOF
- wrapper = installer.app_script_text 'executable'
+ wrapper = installer.app_script_text "executable"
assert_equal expected, wrapper
end
end
@@ -66,12 +66,12 @@ end
installer.generate_bin
@spec = Gem::Specification.new do |s|
- s.files = ['lib/code.rb']
+ s.files = ["lib/code.rb"]
s.name = "a"
s.version = "3"
s.summary = "summary"
s.description = "desc"
- s.require_path = 'lib'
+ s.require_path = "lib"
end
util_make_exec
@@ -79,7 +79,7 @@ end
installer.wrappers = true
installer.generate_bin
- installed_exec = File.join util_inst_bindir, 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
assert_path_exist installed_exec
wrapper = File.read installed_exec
@@ -98,7 +98,7 @@ end
installer.generate_bin
end
- conflicted = File.join @gemhome, 'bin', 'executable'
+ conflicted = File.join @gemhome, "bin", "executable"
assert_match %r{\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z},
e.message
end
@@ -111,15 +111,15 @@ end
installer.generate_bin
@spec = Gem::Specification.new do |s|
- s.files = ['lib/code.rb']
+ s.files = ["lib/code.rb"]
s.name = "a"
s.version = "3"
s.summary = "summary"
s.description = "desc"
- s.require_path = 'lib'
+ s.require_path = "lib"
end
- File.open File.join(util_inst_bindir, 'executable'), 'w' do |io|
+ File.open File.join(util_inst_bindir, "executable"), "w" do |io|
io.write <<-EXEC
#!/usr/local/bin/ruby
#
@@ -130,14 +130,14 @@ gem 'other', version
end
util_make_exec
- Gem::Installer.exec_format = 'foo-%s-bar'
+ Gem::Installer.exec_format = "foo-%s-bar"
installer.gem_dir = @spec.gem_dir
installer.wrappers = true
installer.format_executable = true
installer.generate_bin # should not raise
- installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
+ installed_exec = File.join util_inst_bindir, "foo-executable-bar"
assert_path_exist installed_exec
wrapper = File.read installed_exec
@@ -172,7 +172,7 @@ gem 'other', version
installer.generate_bin
- installed_exec = File.join util_inst_bindir, 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
assert_path_exist installed_exec
wrapper = File.read installed_exec
@@ -187,7 +187,7 @@ gem 'other', version
installer.generate_bin
- installed_exec = File.join util_inst_bindir, 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
assert_path_exist installed_exec
wrapper = File.read installed_exec
@@ -203,8 +203,8 @@ gem 'other', version
bin_dir = bin_dir.downcase
end
- orig_PATH, ENV['PATH'] =
- ENV['PATH'], [ENV['PATH'], bin_dir].join(File::PATH_SEPARATOR)
+ orig_PATH, ENV["PATH"] =
+ ENV["PATH"], [ENV["PATH"], bin_dir].join(File::PATH_SEPARATOR)
use_ui @ui do
installer.check_that_user_bin_dir_is_in_path
@@ -214,7 +214,7 @@ gem 'other', version
return unless win_platform?
- ENV['PATH'] = [orig_PATH, bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)].join(File::PATH_SEPARATOR)
+ ENV["PATH"] = [orig_PATH, bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)].join(File::PATH_SEPARATOR)
use_ui @ui do
installer.check_that_user_bin_dir_is_in_path
@@ -222,17 +222,17 @@ gem 'other', version
assert_empty @ui.error
ensure
- ENV['PATH'] = orig_PATH
+ ENV["PATH"] = orig_PATH
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?
- orig_PATH, ENV['PATH'] =
- ENV['PATH'], [ENV['PATH'], '~/bin'].join(File::PATH_SEPARATOR)
+ orig_PATH, ENV["PATH"] =
+ ENV["PATH"], [ENV["PATH"], "~/bin"].join(File::PATH_SEPARATOR)
installer = setup_base_installer
- installer.bin_dir.replace File.join @userhome, 'bin'
+ installer.bin_dir.replace File.join @userhome, "bin"
use_ui @ui do
installer.check_that_user_bin_dir_is_in_path
@@ -240,7 +240,7 @@ gem 'other', version
assert_empty @ui.error
ensure
- ENV['PATH'] = orig_PATH unless win_platform?
+ ENV["PATH"] = orig_PATH unless win_platform?
end
def test_check_that_user_bin_dir_is_in_path_not_in_path
@@ -262,22 +262,22 @@ gem 'other', version
def test_ensure_dependency
installer = setup_base_installer
- util_spec 'a'
+ util_spec "a"
- dep = Gem::Dependency.new 'a', '>= 2'
+ dep = Gem::Dependency.new "a", ">= 2"
assert installer.ensure_dependency(@spec, dep)
- dep = Gem::Dependency.new 'b', '> 2'
+ dep = Gem::Dependency.new "b", "> 2"
e = assert_raise Gem::InstallError do
installer.ensure_dependency @spec, dep
end
- assert_equal 'a requires b (> 2)', e.message
+ assert_equal "a requires b (> 2)", e.message
end
def test_ensure_loadable_spec
- a, a_gem = util_gem 'a', 2 do |s|
- s.add_dependency 'garbage ~> 5'
+ a, a_gem = util_gem "a", 2 do |s|
+ s.add_dependency "garbage ~> 5"
end
installer = Gem::Installer.at a_gem
@@ -291,10 +291,10 @@ gem 'other', version
end
def test_ensure_loadable_spec_security_policy
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
- _, a_gem = util_gem 'a', 2 do |s|
- s.add_dependency 'garbage ~> 5'
+ _, a_gem = util_gem "a", 2 do |s|
+ s.add_dependency "garbage ~> 5"
end
policy = Gem::Security::HighSecurity
@@ -310,7 +310,7 @@ gem 'other', version
installer.extract_files
- assert_path_exist File.join @spec.gem_dir, 'bin/executable'
+ assert_path_exist File.join @spec.gem_dir, "bin/executable"
end
def test_generate_bin_bindir
@@ -319,12 +319,12 @@ gem 'other', version
installer.wrappers = true
@spec.executables = %w[executable]
- @spec.bindir = 'bin'
+ @spec.bindir = "bin"
- exec_file = installer.formatted_program_filename 'executable'
+ exec_file = installer.formatted_program_filename "executable"
exec_path = File.join @spec.gem_dir, exec_file
- File.open exec_path, 'w' do |f|
- f.puts '#!/usr/bin/ruby'
+ File.open exec_path, "w" do |f|
+ f.puts "#!/usr/bin/ruby"
end
installer.gem_dir = @spec.gem_dir
@@ -332,7 +332,7 @@ gem 'other', version
installer.generate_bin
assert_directory_exists util_inst_bindir
- installed_exec = File.join(util_inst_bindir, 'executable')
+ installed_exec = File.join(util_inst_bindir, "executable")
assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
@@ -352,7 +352,7 @@ gem 'other', version
:install_dir => "/non/existent",
}
- inst = Gem::Installer.at '', options
+ inst = Gem::Installer.at "", options
Gem::Installer.path_warning = false
@@ -375,7 +375,7 @@ gem 'other', version
installer.generate_bin
assert_directory_exists util_inst_bindir
- installed_exec = File.join util_inst_bindir, 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
@@ -391,10 +391,10 @@ gem 'other', version
util_make_exec
installer.gem_dir = @spec.gem_dir
- Gem::Installer.exec_format = 'foo-%s-bar'
+ Gem::Installer.exec_format = "foo-%s-bar"
installer.generate_bin
assert_directory_exists util_inst_bindir
- installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
+ installed_exec = File.join util_inst_bindir, "foo-executable-bar"
assert_path_exist installed_exec
ensure
Gem::Installer.exec_format = nil
@@ -407,10 +407,10 @@ gem 'other', version
util_make_exec
installer.gem_dir = @spec.gem_dir
- Gem::Installer.exec_format = 'foo-%s-bar'
+ Gem::Installer.exec_format = "foo-%s-bar"
installer.generate_bin
assert_directory_exists util_inst_bindir
- installed_exec = File.join util_inst_bindir, 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
assert_path_exist installed_exec
ensure
Gem::Installer.exec_format = nil
@@ -422,19 +422,19 @@ gem 'other', version
installer.wrappers = true
gem_dir = File.join("#{@gemhome}2", "gems", @spec.full_name)
- gem_bindir = File.join gem_dir, 'bin'
+ gem_bindir = File.join gem_dir, "bin"
FileUtils.mkdir_p gem_bindir
- File.open File.join(gem_bindir, 'executable'), 'w' do |f|
+ File.open File.join(gem_bindir, "executable"), "w" do |f|
f.puts "#!/bin/ruby"
end
installer.gem_home = "#{@gemhome}2"
installer.gem_dir = gem_dir
- installer.bin_dir = File.join "#{@gemhome}2", 'bin'
+ installer.bin_dir = File.join "#{@gemhome}2", "bin"
installer.generate_bin
- installed_exec = File.join("#{@gemhome}2", "bin", 'executable')
+ installed_exec = File.join("#{@gemhome}2", "bin", "executable")
assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
@@ -450,7 +450,7 @@ gem 'other', version
installer.wrappers = true
installer.generate_bin
- assert_path_not_exist util_inst_bindir, 'bin dir was created when not needed'
+ assert_path_not_exist util_inst_bindir, "bin dir was created when not needed"
end
def test_generate_bin_script_no_perms
@@ -462,9 +462,9 @@ gem 'other', version
Dir.mkdir util_inst_bindir
if win_platform?
- pend('test_generate_bin_script_no_perms skipped on MS Windows')
+ 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')
+ pend("test_generate_bin_script_no_perms skipped in root privilege")
else
FileUtils.chmod 0000, util_inst_bindir
@@ -482,16 +482,16 @@ gem 'other', version
installer.wrappers = true
@spec.executables = %w[executable]
- gem_dir = File.join @gemhome, 'gems', @spec.full_name
- gem_bindir = File.join gem_dir, 'bin'
+ gem_dir = File.join @gemhome, "gems", @spec.full_name
+ gem_bindir = File.join gem_dir, "bin"
FileUtils.mkdir_p gem_bindir
- File.open File.join(gem_bindir, 'executable'), 'w' do |f|
+ File.open File.join(gem_bindir, "executable"), "w" do |f|
f.puts "blah blah blah"
end
installer.generate_bin
- installed_exec = File.join @gemhome, 'bin', 'executable'
+ installed_exec = File.join @gemhome, "bin", "executable"
assert_path_exist installed_exec
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
@@ -507,9 +507,9 @@ gem 'other', version
installer.wrappers = true
util_make_exec
installer.gem_dir = @spec.gem_dir
- installed_exec = File.join(util_inst_bindir, 'executable')
+ installed_exec = File.join(util_inst_bindir, "executable")
- real_exec = File.join @spec.gem_dir, 'bin', 'executable'
+ real_exec = File.join @spec.gem_dir, "bin", "executable"
# fake --no-wrappers for previous install
unless Gem.win_platform?
@@ -525,7 +525,7 @@ gem 'other', version
assert_match %r{generated by RubyGems}, File.read(installed_exec)
refute_match %r{generated by RubyGems}, File.read(real_exec),
- 'real executable overwritten'
+ "real executable overwritten"
end
def test_generate_bin_symlink
@@ -539,9 +539,9 @@ gem 'other', version
installer.generate_bin
assert_directory_exists util_inst_bindir
- installed_exec = File.join util_inst_bindir, 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
assert_equal true, File.symlink?(installed_exec)
- assert_equal(File.join(@spec.gem_dir, 'bin', 'executable'),
+ assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
File.readlink(installed_exec))
end
@@ -566,9 +566,9 @@ gem 'other', version
Dir.mkdir util_inst_bindir
if win_platform?
- pend('test_generate_bin_symlink_no_perms skipped on MS Windows')
+ 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')
+ pend("test_user_install_disabled_read_only test skipped in root privilege")
else
FileUtils.chmod 0000, util_inst_bindir
@@ -590,24 +590,24 @@ gem 'other', version
installer.gem_dir = @spec.gem_dir
installer.generate_bin
- installed_exec = File.join(util_inst_bindir, 'executable')
- assert_equal(File.join(@spec.gem_dir, 'bin', 'executable'),
+ installed_exec = File.join(util_inst_bindir, "executable")
+ assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
File.readlink(installed_exec))
@spec = Gem::Specification.new do |s|
- s.files = ['lib/code.rb']
+ s.files = ["lib/code.rb"]
s.name = "a"
s.version = "3"
s.summary = "summary"
s.description = "desc"
- s.require_path = 'lib'
+ s.require_path = "lib"
end
util_make_exec
installer.gem_dir = @spec.gem_dir
installer.generate_bin
- installed_exec = File.join(util_inst_bindir, 'executable')
- assert_equal(@spec.bin_file('executable'),
+ installed_exec = File.join(util_inst_bindir, "executable")
+ assert_equal(@spec.bin_file("executable"),
File.readlink(installed_exec),
"Ensure symlink moved to latest version")
end
@@ -622,17 +622,17 @@ gem 'other', version
installer.gem_dir = @spec.gem_dir
installer.generate_bin
- installed_exec = File.join(util_inst_bindir, 'executable')
- assert_equal(File.join(@spec.gem_dir, 'bin', 'executable'),
+ installed_exec = File.join(util_inst_bindir, "executable")
+ assert_equal(File.join(@spec.gem_dir, "bin", "executable"),
File.readlink(installed_exec))
spec = Gem::Specification.new do |s|
- s.files = ['lib/code.rb']
+ s.files = ["lib/code.rb"]
s.name = "a"
s.version = "1"
s.summary = "summary"
s.description = "desc"
- s.require_path = 'lib'
+ s.require_path = "lib"
end
util_make_exec
@@ -643,8 +643,8 @@ gem 'other', version
installer.generate_bin
- installed_exec = File.join util_inst_bindir, 'executable'
- expected = File.join @spec.gem_dir, 'bin', 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
+ expected = File.join @spec.gem_dir, "bin", "executable"
assert_equal(expected,
File.readlink(installed_exec),
"Ensure symlink not moved")
@@ -661,16 +661,16 @@ gem 'other', version
installer.generate_bin
- installed_exec = File.join util_inst_bindir, 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
assert_path_exist installed_exec
@spec = Gem::Specification.new do |s|
- s.files = ['lib/code.rb']
+ s.files = ["lib/code.rb"]
s.name = "a"
s.version = "3"
s.summary = "summary"
s.description = "desc"
- s.require_path = 'lib'
+ s.require_path = "lib"
end
util_make_exec
@@ -680,8 +680,8 @@ gem 'other', version
installer.generate_bin
- installed_exec = File.join util_inst_bindir, 'executable'
- assert_equal(@spec.bin_file('executable'),
+ installed_exec = File.join util_inst_bindir, "executable"
+ assert_equal(@spec.bin_file("executable"),
File.readlink(installed_exec),
"Ensure symlink moved to latest version")
end
@@ -691,7 +691,7 @@ gem 'other', version
Gem.win_platform = true
old_alt_separator = File::ALT_SEPARATOR
File.__send__(:remove_const, :ALT_SEPARATOR)
- File.const_set(:ALT_SEPARATOR, '\\')
+ File.const_set(:ALT_SEPARATOR, "\\")
installer = setup_base_installer
@@ -704,7 +704,7 @@ gem 'other', version
end
assert_directory_exists util_inst_bindir
- installed_exec = File.join(util_inst_bindir, 'executable')
+ installed_exec = File.join(util_inst_bindir, "executable")
assert_path_exist installed_exec
if symlink_supported?
@@ -726,7 +726,7 @@ gem 'other', version
def test_generate_bin_uses_default_shebang
pend "Symlinks not supported or not enabled" unless symlink_supported?
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
installer.wrappers = true
@@ -762,7 +762,7 @@ gem 'other', version
def test_generate_plugins
installer = util_setup_installer do |spec|
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "puts __FILE__"
end
@@ -773,18 +773,18 @@ gem 'other', version
installer.install
end
- plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
FileUtils.rm plugin_path
installer.generate_plugins
- assert File.exist?(plugin_path), 'plugin not written'
+ assert File.exist?(plugin_path), "plugin not written"
end
def test_generate_plugins_with_install_dir
- spec = quick_gem 'a' do |s|
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ spec = quick_gem "a" do |s|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "puts __FILE__"
end
@@ -793,17 +793,17 @@ gem 'other', version
util_build_gem spec
- plugin_path = File.join "#{@gemhome}2", 'plugins', 'a_plugin.rb'
+ plugin_path = File.join "#{@gemhome}2", "plugins", "a_plugin.rb"
installer = util_installer spec, "#{@gemhome}2"
assert_equal spec, installer.install
- assert File.exist?(plugin_path), 'plugin not written to install_dir'
+ assert File.exist?(plugin_path), "plugin not written to install_dir"
end
def test_generate_plugins_with_user_install
- spec = quick_gem 'a' do |s|
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ spec = quick_gem "a" do |s|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "puts __FILE__"
end
@@ -813,19 +813,19 @@ gem 'other', version
util_build_gem spec
File.chmod(0555, Gem.plugindir)
- system_path = File.join(Gem.plugindir, 'a_plugin.rb')
- user_path = File.join(Gem.plugindir(Gem.user_dir), 'a_plugin.rb')
+ system_path = File.join(Gem.plugindir, "a_plugin.rb")
+ user_path = File.join(Gem.plugindir(Gem.user_dir), "a_plugin.rb")
installer = util_installer spec, Gem.dir, :user
assert_equal spec, installer.install
- assert !File.exist?(system_path), 'plugin incorrectly written to system plugins_dir'
- assert File.exist?(user_path), 'plugin not written to user plugins_dir'
+ assert !File.exist?(system_path), "plugin incorrectly written to system plugins_dir"
+ assert File.exist?(user_path), "plugin not written to user plugins_dir"
end
def test_generate_plugins_with_build_root
- spec = quick_gem 'a' do |s|
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ spec = quick_gem "a" do |s|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "puts __FILE__"
end
@@ -835,17 +835,17 @@ gem 'other', version
util_build_gem spec
File.chmod(0555, Gem.plugindir)
- system_path = File.join(Gem.plugindir, 'a_plugin.rb')
+ system_path = File.join(Gem.plugindir, "a_plugin.rb")
- build_root = File.join(@tempdir, 'build_root')
- build_root_path = File.join(build_root, Gem.plugindir.gsub(/^[a-zA-Z]:/, ''), 'a_plugin.rb')
+ build_root = File.join(@tempdir, "build_root")
+ build_root_path = File.join(build_root, Gem.plugindir.gsub(/^[a-zA-Z]:/, ""), "a_plugin.rb")
installer = Gem::Installer.at spec.cache_file, :build_root => build_root
assert_equal spec, installer.install
- assert !File.exist?(system_path), 'plugin written incorrect written to system plugins_dir'
- assert File.exist?(build_root_path), 'plugin not written to build_root'
+ assert !File.exist?(system_path), "plugin written incorrect written to system plugins_dir"
+ assert File.exist?(build_root_path), "plugin not written to build_root"
refute_includes File.read(build_root_path), build_root
end
@@ -853,49 +853,49 @@ gem 'other', version
def test_keeps_plugins_up_to_date
# NOTE: version a-2 is already installed by setup hooks
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "puts __FILE__"
end
build_rake_in do
util_setup_installer do |spec|
- spec.version = '1'
+ spec.version = "1"
spec.files += %w[lib/rubygems_plugin.rb]
end.install
- plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
- refute File.exist?(plugin_path), 'old version installed while newer version without plugin also installed, but plugin written'
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
+ refute File.exist?(plugin_path), "old version installed while newer version without plugin also installed, but plugin written"
util_setup_installer do |spec|
- spec.version = '2'
+ spec.version = "2"
spec.files += %w[lib/rubygems_plugin.rb]
end.install
- plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
- assert File.exist?(plugin_path), 'latest version reinstalled, but plugin not written'
- assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), 'written plugin has incorrect content'
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
+ assert File.exist?(plugin_path), "latest version reinstalled, but plugin not written"
+ assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content"
util_setup_installer do |spec|
- spec.version = '3'
+ spec.version = "3"
spec.files += %w[lib/rubygems_plugin.rb]
end.install
- plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
- assert File.exist?(plugin_path), 'latest version installed, but plugin removed'
- assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), 'written plugin has incorrect content'
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
+ assert File.exist?(plugin_path), "latest version installed, but plugin removed"
+ assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content"
util_setup_installer do |spec|
- spec.version = '4'
+ spec.version = "4"
end.install
- refute File.exist?(plugin_path), 'new version installed without a plugin while older version with a plugin installed, but plugin not removed'
+ refute File.exist?(plugin_path), "new version installed without a plugin while older version with a plugin installed, but plugin not removed"
end
end
def test_generates_plugins_dir_under_install_dir_if_not_there
Gem.use_paths "#{@gemhome}2" # Set GEM_HOME to an uninitialized repo
- @spec = util_spec 'a'
+ @spec = util_spec "a"
path = Gem::Package.build @spec
@@ -904,8 +904,8 @@ gem 'other', version
end
def test_initialize
- spec = util_spec 'a' do |s|
- s.platform = Gem::Platform.new 'mswin32'
+ spec = util_spec "a" do |s|
+ s.platform = Gem::Platform.new "mswin32"
end
gem = File.join @tempdir, spec.file_name
@@ -916,8 +916,8 @@ gem 'other', version
installer = Gem::Installer.at gem
- assert_equal File.join(@gemhome, 'gems', spec.full_name), installer.gem_dir
- assert_equal File.join(@gemhome, 'bin'), installer.bin_dir
+ assert_equal File.join(@gemhome, "gems", spec.full_name), installer.gem_dir
+ assert_equal File.join(@gemhome, "bin"), installer.bin_dir
end
def test_initialize_user_install
@@ -925,7 +925,7 @@ gem 'other', version
installer = Gem::Installer.at @gem, :user_install => true
- assert_equal File.join(Gem.user_dir, 'gems', @spec.full_name),
+ assert_equal File.join(Gem.user_dir, "gems", @spec.full_name),
installer.gem_dir
assert_equal Gem.bindir(Gem.user_dir), installer.bin_dir
end
@@ -936,7 +936,7 @@ gem 'other', version
installer =
Gem::Installer.at @gem, :user_install => true, :bin_dir => @tempdir
- assert_equal File.join(Gem.user_dir, 'gems', @spec.full_name),
+ assert_equal File.join(Gem.user_dir, "gems", @spec.full_name),
installer.gem_dir
assert_equal @tempdir, installer.bin_dir
end
@@ -944,26 +944,26 @@ gem 'other', version
def test_install
installer = util_setup_installer
- gemdir = File.join @gemhome, 'gems', @spec.full_name
- cache_file = File.join @gemhome, 'cache', @spec.file_name
- stub_exe = File.join @gemhome, 'bin', 'executable'
- rakefile = File.join gemdir, 'ext', 'a', 'Rakefile'
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
+ gemdir = File.join @gemhome, "gems", @spec.full_name
+ cache_file = File.join @gemhome, "cache", @spec.file_name
+ stub_exe = File.join @gemhome, "bin", "executable"
+ rakefile = File.join gemdir, "ext", "a", "Rakefile"
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
Gem.pre_install do
- assert_path_not_exist cache_file, 'cache file must not exist yet'
+ assert_path_not_exist cache_file, "cache file must not exist yet"
true
end
Gem.post_build do
- assert_path_exist gemdir, 'gem install dir must exist'
- assert_path_exist rakefile, 'gem executable must exist'
- assert_path_not_exist stub_exe, 'gem executable must not exist'
+ assert_path_exist gemdir, "gem install dir must exist"
+ assert_path_exist rakefile, "gem executable must exist"
+ assert_path_not_exist stub_exe, "gem executable must not exist"
true
end
Gem.post_install do
- assert_path_exist cache_file, 'cache file must exist'
+ assert_path_exist cache_file, "cache file must exist"
end
@newspec = nil
@@ -975,15 +975,15 @@ gem 'other', version
assert_equal @spec, @newspec
assert_path_exist gemdir
- assert_path_exist stub_exe, 'gem executable must exist'
+ assert_path_exist stub_exe, "gem executable must exist"
- exe = File.join gemdir, 'bin', 'executable'
+ exe = File.join gemdir, "bin", "executable"
assert_path_exist exe
exe_mode = File.stat(exe).mode & 0111
assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
- assert_path_exist File.join gemdir, 'lib', 'code.rb'
+ assert_path_exist File.join gemdir, "lib", "code.rb"
assert_path_exist rakefile
@@ -1000,7 +1000,7 @@ gem 'other', version
installer.wrappers = true
- gemdir = File.join @gemhome, 'gems', @spec.full_name
+ gemdir = File.join @gemhome, "gems", @spec.full_name
@newspec = nil
build_rake_in do
@@ -1009,7 +1009,7 @@ gem 'other', version
end
end
- exe = File.join gemdir, 'bin', 'executable'
+ exe = File.join gemdir, "bin", "executable"
e = assert_raise RuntimeError do
instance_eval File.read(exe)
@@ -1023,10 +1023,10 @@ gem 'other', version
# build old version that has a bin file
installer = util_setup_gem do |spec|
- File.open File.join('bin', 'executable'), 'w' do |f|
+ File.open File.join("bin", "executable"), "w" do |f|
f.puts "require 'code'"
end
- File.open File.join('lib', 'code.rb'), 'w' do |f|
+ File.open File.join("lib", "code.rb"), "w" do |f|
f.puts 'raise "I have an executable"'
end
end
@@ -1038,15 +1038,15 @@ gem 'other', version
end
end
- old_bin_file = File.join installer.bin_dir, 'executable'
+ old_bin_file = File.join installer.bin_dir, "executable"
# build new version that doesn't have a bin file
installer = util_setup_gem do |spec|
- FileUtils.rm File.join('bin', 'executable')
- spec.files.delete File.join('bin', 'executable')
- spec.executables.delete 'executable'
+ FileUtils.rm File.join("bin", "executable")
+ spec.files.delete File.join("bin", "executable")
+ spec.executables.delete "executable"
spec.version = @spec.version.bump
- File.open File.join('lib', 'code.rb'), 'w' do |f|
+ File.open File.join("lib", "code.rb"), "w" do |f|
f.puts 'raise "I do not have an executable"'
end
end
@@ -1063,7 +1063,7 @@ gem 'other', version
# We expect the bin stub to activate the version that actually contains
# the binstub.
- assert_match('I have an executable', e.message)
+ assert_match("I have an executable", e.message)
end
def test_install_creates_binstub_that_understand_version
@@ -1078,7 +1078,7 @@ gem 'other', version
end
end
- exe = File.join @gemhome, 'bin', 'executable'
+ exe = File.join @gemhome, "bin", "executable"
ARGV.unshift "_3.0_"
@@ -1096,17 +1096,17 @@ gem 'other', version
end
def test_install_creates_binstub_that_prefers_user_installed_gem_to_default
- default_spec = new_default_spec('default', '2', nil, 'exe/executable')
- default_spec.executables = 'executable'
+ default_spec = new_default_spec("default", "2", nil, "exe/executable")
+ default_spec.executables = "executable"
install_default_gems default_spec
- exe = File.join @gemhome, 'bin', 'executable'
+ exe = File.join @gemhome, "bin", "executable"
assert_path_exist exe, "default gem's executable not installed"
installer = util_setup_installer do |spec|
- spec.name = 'default'
- spec.version = '2'
+ spec.name = "default"
+ spec.version = "2"
end
util_clear_gems
@@ -1139,7 +1139,7 @@ gem 'other', version
end
end
- exe = File.join @gemhome, 'bin', 'executable'
+ exe = File.join @gemhome, "bin", "executable"
extra_arg = "\xE4pfel".dup.force_encoding("UTF-8")
ARGV.unshift extra_arg
@@ -1166,16 +1166,16 @@ gem 'other', version
end
end
- gemdir = File.join(@gemhome, 'gems', @spec.full_name)
- assert_path_exist File.join gemdir, 'lib', 'code.rb'
+ gemdir = File.join(@gemhome, "gems", @spec.full_name)
+ assert_path_exist File.join gemdir, "lib", "code.rb"
installer = util_setup_installer
# Morph spec to have lib/other.rb instead of code.rb and recreate
- @spec.files = File.join('lib', 'other.rb')
+ @spec.files = File.join("lib", "other.rb")
Dir.chdir @tempdir do
- File.open File.join('lib', 'other.rb'), 'w' do |f|
- f.puts '1'
+ File.open File.join("lib", "other.rb"), "w" do |f|
+ f.puts "1"
end
use_ui ui do
@@ -1190,14 +1190,14 @@ gem 'other', version
end
end
- assert_path_exist File.join gemdir, 'lib', 'other.rb'
- assert_path_not_exist File.join gemdir, 'lib', 'code.rb',
+ assert_path_exist File.join gemdir, "lib", "other.rb"
+ assert_path_not_exist File.join gemdir, "lib", "code.rb",
"code.rb from prior install of same gem shouldn't remain here"
end
def test_install_force
- _, missing_dep_gem = util_gem 'missing_dep', '1' do |s|
- s.add_dependency 'doesnt_exist', '1'
+ _, missing_dep_gem = util_gem "missing_dep", "1" do |s|
+ s.add_dependency "doesnt_exist", "1"
end
use_ui @ui do
@@ -1205,12 +1205,12 @@ gem 'other', version
installer.install
end
- gem_dir = File.join(@gemhome, 'gems', 'missing_dep-1')
+ gem_dir = File.join(@gemhome, "gems", "missing_dep-1")
assert_path_exist gem_dir
end
def test_install_build_root
- build_root = File.join(@tempdir, 'build_root')
+ build_root = File.join(@tempdir, "build_root")
@gem = setup_base_gem
installer = Gem::Installer.at @gem, :build_root => build_root
@@ -1221,22 +1221,22 @@ gem 'other', version
def test_install_missing_dirs
installer = setup_base_installer
- FileUtils.rm_rf File.join(Gem.dir, 'doc')
- FileUtils.rm_rf File.join(Gem.dir, 'specifications')
+ FileUtils.rm_rf File.join(Gem.dir, "doc")
+ FileUtils.rm_rf File.join(Gem.dir, "specifications")
use_ui @ui do
installer.install
end
- assert_directory_exists File.join(Gem.dir, 'doc')
- assert_directory_exists File.join(Gem.dir, 'specifications')
+ assert_directory_exists File.join(Gem.dir, "doc")
+ assert_directory_exists File.join(Gem.dir, "specifications")
- assert_path_exist File.join @gemhome, 'cache', @spec.file_name
- assert_path_exist File.join @gemhome, 'specifications', @spec.spec_name
+ assert_path_exist File.join @gemhome, "cache", @spec.file_name
+ assert_path_exist File.join @gemhome, "specifications", @spec.spec_name
end
def test_install_post_build_false
- @spec = util_spec 'a'
+ @spec = util_spec "a"
util_build_gem @spec
@@ -1256,10 +1256,10 @@ gem 'other', version
assert_equal "post-build hook at #{location} failed for a-2", e.message
end
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
assert_path_not_exist spec_file
- gem_dir = File.join @gemhome, 'gems', @spec.full_name
+ gem_dir = File.join @gemhome, "gems", @spec.full_name
assert_path_not_exist gem_dir
end
@@ -1274,15 +1274,15 @@ gem 'other', version
installer.install
end
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
assert_path_exist spec_file
- gem_dir = File.join @gemhome, 'gems', @spec.full_name
+ gem_dir = File.join @gemhome, "gems", @spec.full_name
assert_path_exist gem_dir
end
def test_install_pre_install_false
- @spec = util_spec 'a'
+ @spec = util_spec "a"
util_build_gem @spec
@@ -1302,7 +1302,7 @@ gem 'other', version
assert_equal "pre-install hook at #{location} failed for a-2", e.message
end
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
assert_path_not_exist spec_file
end
@@ -1317,13 +1317,13 @@ gem 'other', version
installer.install
end
- spec_file = File.join @gemhome, 'specifications', @spec.spec_name
+ spec_file = File.join @gemhome, "specifications", @spec.spec_name
assert_path_exist spec_file
end
def test_install_with_message
@spec = setup_base_spec
- @spec.post_install_message = 'I am a shiny gem!'
+ @spec.post_install_message = "I am a shiny gem!"
use_ui @ui do
path = Gem::Package.build @spec
@@ -1337,7 +1337,7 @@ gem 'other', version
def test_install_with_skipped_message
@spec = setup_base_spec
- @spec.post_install_message = 'I am a shiny gem!'
+ @spec.post_install_message = "I am a shiny gem!"
use_ui @ui do
path = Gem::Package.build @spec
@@ -1370,7 +1370,7 @@ gem 'other', version
installer.install
end
- expected_makefile = File.join gemhome2, 'gems', @spec.full_name, 'Makefile'
+ expected_makefile = File.join gemhome2, "gems", @spec.full_name, "Makefile"
assert_path_exist expected_makefile
end
@@ -1435,11 +1435,11 @@ gem 'other', version
installer.install
end
- expected_makefile = File.join Gem.user_dir, 'gems', @spec.full_name, 'Makefile'
+ expected_makefile = File.join Gem.user_dir, "gems", @spec.full_name, "Makefile"
assert_path_exist expected_makefile
assert_path_exist expected_extension_dir
- assert_path_not_exist File.join expected_extension_dir, 'gem_make.out'
+ assert_path_not_exist File.join expected_extension_dir, "gem_make.out"
end
def test_find_lib_file_after_install
@@ -1469,7 +1469,7 @@ gem 'other', version
end
Dir.mkdir File.join(@tempdir, "lib")
- write_file File.join(@tempdir, 'lib', "b.rb") do |io|
+ write_file File.join(@tempdir, "lib", "b.rb") do |io|
io.write "# b.rb"
end
@@ -1483,14 +1483,14 @@ gem 'other', version
end
expected = File.join @spec.full_require_paths.find {|path|
- File.exist? File.join path, 'b.rb'
- }, 'b.rb'
- assert_equal expected, @spec.matches_for_glob('b.rb').first
+ File.exist? File.join path, "b.rb"
+ }, "b.rb"
+ assert_equal expected, @spec.matches_for_glob("b.rb").first
end
def test_install_extension_and_script
pend "Makefile creation crashes on jruby" if Gem.java_platform?
- pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
@spec = setup_base_spec
@spec.extensions << "extconf.rb"
@@ -1566,15 +1566,15 @@ gem 'other', version
end
assert_path_exist so
rescue
- puts '-' * 78
- puts File.read File.join(@gemhome, 'gems', 'a-2', 'Makefile')
- puts '-' * 78
+ puts "-" * 78
+ puts File.read File.join(@gemhome, "gems", "a-2", "Makefile")
+ puts "-" * 78
- path = File.join(@gemhome, 'gems', 'a-2', 'gem_make.out')
+ path = File.join(@gemhome, "gems", "a-2", "gem_make.out")
if File.exist?(path)
puts File.read(path)
- puts '-' * 78
+ puts "-" * 78
end
raise
@@ -1584,12 +1584,12 @@ gem 'other', version
def test_installation_satisfies_dependency_eh
installer = setup_base_installer
- util_spec 'a'
+ util_spec "a"
- dep = Gem::Dependency.new 'a', '>= 2'
+ dep = Gem::Dependency.new "a", ">= 2"
assert installer.installation_satisfies_dependency?(dep)
- dep = Gem::Dependency.new 'a', '> 2'
+ dep = Gem::Dependency.new "a", "> 2"
refute installer.installation_satisfies_dependency?(dep)
end
@@ -1598,15 +1598,15 @@ gem 'other', version
installer.options[:development] = true
installer.options[:dev_shallow] = true
- util_spec 'a'
+ util_spec "a"
- dep = Gem::Dependency.new 'a', :development
+ dep = Gem::Dependency.new "a", :development
assert installer.installation_satisfies_dependency?(dep)
end
def test_pre_install_checks_dependencies
installer = setup_base_installer
- @spec.add_dependency 'b', '> 5'
+ @spec.add_dependency "b", "> 5"
installer = util_setup_gem
installer.force = false
@@ -1619,7 +1619,7 @@ gem 'other', version
def test_pre_install_checks_dependencies_ignore
installer = util_setup_installer
- @spec.add_dependency 'b', '> 5'
+ @spec.add_dependency "b", "> 5"
installer.ignore_dependencies = true
build_rake_in do
@@ -1633,16 +1633,16 @@ gem 'other', version
gemhome2 = "#{@gemhome}2"
@gem = setup_base_gem
- @spec.add_dependency 'd'
+ @spec.add_dependency "d"
- quick_gem 'd', 2
+ quick_gem "d", 2
gem = File.join @gemhome, @spec.file_name
FileUtils.mv @gemhome, gemhome2
FileUtils.mkdir @gemhome
- FileUtils.mv File.join(gemhome2, 'cache', @spec.file_name), gem
+ FileUtils.mv File.join(gemhome2, "cache", @spec.file_name), gem
# Don't leak any already activated gems into the installer, require
# that it work everything out on it's own.
@@ -1658,7 +1658,7 @@ gem 'other', version
end
def test_pre_install_checks_malicious_name
- spec = util_spec '../malicious', '1'
+ spec = util_spec "../malicious", "1"
def spec.full_name # so the spec is buildable
"malicious-1"
end
@@ -1666,19 +1666,19 @@ gem 'other', version
util_build_gem spec
- gem = File.join(@gemhome, 'cache', spec.file_name)
+ gem = File.join(@gemhome, "cache", spec.file_name)
use_ui @ui do
installer = Gem::Installer.at gem
e = assert_raise Gem::InstallError do
installer.pre_install_checks
end
- assert_equal '#<Gem::Specification name=../malicious version=1> has an invalid name', e.message
+ assert_equal "#<Gem::Specification name=../malicious version=1> has an invalid name", e.message
end
end
def test_pre_install_checks_malicious_name_before_eval
- spec = util_spec "malicious\n::Object.const_set(:FROM_EVAL, true)#", '1'
+ spec = util_spec "malicious\n::Object.const_set(:FROM_EVAL, true)#", "1"
def spec.full_name # so the spec is buildable
"malicious-1"
end
@@ -1686,7 +1686,7 @@ gem 'other', version
util_build_gem spec
- gem = File.join(@gemhome, 'cache', spec.file_name)
+ gem = File.join(@gemhome, "cache", spec.file_name)
use_ui @ui do
installer = Gem::Installer.at gem
@@ -1699,7 +1699,7 @@ gem 'other', version
end
def test_pre_install_checks_malicious_require_paths_before_eval
- spec = util_spec "malicious", '1'
+ spec = util_spec "malicious", "1"
def spec.full_name # so the spec is buildable
"malicious-1"
end
@@ -1708,7 +1708,7 @@ gem 'other', version
util_build_gem spec
- gem = File.join(@gemhome, 'cache', spec.file_name)
+ gem = File.join(@gemhome, "cache", spec.file_name)
use_ui @ui do
installer = Gem::Installer.at gem
@@ -1722,7 +1722,7 @@ gem 'other', version
def test_pre_install_checks_malicious_extensions_before_eval
pend "mswin environment disallow to create file contained the carriage return code." if Gem.win_platform?
- spec = util_spec "malicious", '1'
+ spec = util_spec "malicious", "1"
def spec.full_name # so the spec is buildable
"malicious-1"
end
@@ -1731,7 +1731,7 @@ gem 'other', version
util_build_gem spec
- gem = File.join(@gemhome, 'cache', spec.file_name)
+ gem = File.join(@gemhome, "cache", spec.file_name)
use_ui @ui do
installer = Gem::Installer.at gem
@@ -1743,7 +1743,7 @@ gem 'other', version
end
def test_pre_install_checks_malicious_specification_version_before_eval
- spec = util_spec "malicious", '1'
+ spec = util_spec "malicious", "1"
def spec.full_name # so the spec is buildable
"malicious-1"
end
@@ -1752,7 +1752,7 @@ gem 'other', version
util_build_gem spec
- gem = File.join(@gemhome, 'cache', spec.file_name)
+ gem = File.join(@gemhome, "cache", spec.file_name)
use_ui @ui do
installer = Gem::Installer.at gem
@@ -1764,16 +1764,16 @@ gem 'other', version
end
def test_pre_install_checks_malicious_dependencies_before_eval
- spec = util_spec "malicious", '1'
+ spec = util_spec "malicious", "1"
def spec.full_name # so the spec is buildable
"malicious-1"
end
def spec.validate(*args); end
- spec.add_dependency "b\nfoo", '> 5'
+ spec.add_dependency "b\nfoo", "> 5"
util_build_gem spec
- gem = File.join(@gemhome, 'cache', spec.file_name)
+ gem = File.join(@gemhome, "cache", spec.file_name)
use_ui @ui do
installer = Gem::Installer.at gem
@@ -1811,7 +1811,7 @@ gem 'other', version
util_make_exec @spec, "#!/usr/bin/ruby"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby}", shebang
end
@@ -1821,15 +1821,15 @@ gem 'other', version
installer = setup_base_installer
assert_nil installer.build_root
- assert_equal File.join(@gemhome, 'bin'), installer.bin_dir
+ assert_equal File.join(@gemhome, "bin"), installer.bin_dir
assert_equal @gemhome, installer.gem_home
end
def test_process_options_build_root
- build_root = File.join @tempdir, 'build_root'
- bin_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'bin')
- gem_home = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ''))
- plugins_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'plugins')
+ build_root = File.join @tempdir, "build_root"
+ bin_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""), "bin")
+ gem_home = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""))
+ plugins_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ""), "plugins")
@gem = setup_base_gem
installer = use_ui(@ui) { Gem::Installer.at @gem, :build_root => build_root }
@@ -1848,24 +1848,24 @@ gem 'other', version
end
def test_shebang_arguments
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/ruby -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby} -ws", shebang
end
end
def test_shebang_arguments_with_load_relative
- load_relative 'yes' do
+ load_relative "yes" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/ruby -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
shebang_lines = shebang.split "\n"
@@ -1875,47 +1875,47 @@ gem 'other', version
end
def test_shebang_empty
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
- util_make_exec @spec, ''
+ util_make_exec @spec, ""
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby}", shebang
end
end
def test_shebang_env
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/env ruby"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby}", shebang
end
end
def test_shebang_env_arguments
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/env ruby -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby} -ws", shebang
end
end
def test_shebang_env_arguments_with_load_relative
- load_relative 'yes' do
+ load_relative "yes" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/env ruby -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
shebang_lines = shebang.split "\n"
@@ -1927,10 +1927,10 @@ gem 'other', version
def test_shebang_env_shebang
installer = setup_base_installer
- util_make_exec @spec, ''
+ util_make_exec @spec, ""
installer.env_shebang = true
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
bin_env = get_bin_env
@@ -1939,36 +1939,36 @@ gem 'other', version
end
def test_shebang_nested
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby}", shebang
end
end
def test_shebang_nested_arguments
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby} -ws", shebang
end
end
def test_shebang_nested_arguments_with_load_relative
- load_relative 'yes' do
+ load_relative "yes" do
installer = setup_base_installer
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
shebang_lines = shebang.split "\n"
@@ -1978,36 +1978,36 @@ gem 'other', version
end
def test_shebang_version
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/ruby18"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby}", shebang
end
end
def test_shebang_version_arguments
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby} -ws", shebang
end
end
def test_shebang_version_arguments_with_load_relative
- load_relative 'yes' do
+ load_relative "yes" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
shebang_lines = shebang.split "\n"
@@ -2017,36 +2017,36 @@ gem 'other', version
end
def test_shebang_version_env
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/env ruby18"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby}", shebang
end
end
def test_shebang_version_env_arguments
- load_relative 'no' do
+ load_relative "no" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!#{Gem.ruby} -ws", shebang
end
end
def test_shebang_version_env_arguments_with_load_relative
- load_relative 'yes' do
+ load_relative "yes" do
installer = setup_base_installer
util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
shebang_lines = shebang.split "\n"
@@ -2059,13 +2059,13 @@ gem 'other', version
installer = setup_base_installer
conf = Gem::ConfigFile.new []
- conf[:custom_shebang] = 'test'
+ conf[:custom_shebang] = "test"
Gem.configuration = conf
util_make_exec @spec, "#!/usr/bin/ruby"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!test", shebang
end
@@ -2083,13 +2083,13 @@ gem 'other', version
bin_env = get_bin_env
conf = Gem::ConfigFile.new []
- conf[:custom_shebang] = '1 $env 2 $ruby 3 $exec 4 $name'
+ conf[:custom_shebang] = "1 $env 2 $ruby 3 $exec 4 $name"
Gem.configuration = conf
util_make_exec @spec, "#!/usr/bin/ruby"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} 3 executable 4 a", shebang
end
@@ -2099,13 +2099,13 @@ gem 'other', version
bin_env = get_bin_env
conf = Gem::ConfigFile.new []
- conf[:custom_shebang] = '1 $env 2 $ruby 3 $exec'
+ conf[:custom_shebang] = "1 $env 2 $ruby 3 $exec"
Gem.configuration = conf
util_make_exec @spec, "#!/usr/bin/ruby -ws"
- shebang = installer.shebang 'executable'
+ shebang = installer.shebang "executable"
assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} -ws 3 executable", shebang
end
@@ -2113,14 +2113,14 @@ gem 'other', version
def test_unpack
installer = util_setup_installer
- dest = File.join @gemhome, 'gems', @spec.full_name
+ dest = File.join @gemhome, "gems", @spec.full_name
Gem::Deprecate.skip_during do
installer.unpack dest
end
- assert_path_exist File.join dest, 'lib', 'code.rb'
- assert_path_exist File.join dest, 'bin', 'executable'
+ assert_path_exist File.join dest, "lib", "code.rb"
+ assert_path_exist File.join dest, "bin", "executable"
end
def test_write_build_info_file
@@ -2163,12 +2163,12 @@ gem 'other', version
assert_path_not_exist @spec.build_info_file
assert_path_exist \
- File.join("#{@gemhome}2", 'build_info', "#{@spec.full_name}.info")
+ File.join("#{@gemhome}2", "build_info", "#{@spec.full_name}.info")
end
def test_write_cache_file
@gem = setup_base_gem
- cache_file = File.join @gemhome, 'cache', @spec.file_name
+ cache_file = File.join @gemhome, "cache", @spec.file_name
gem = File.join @gemhome, @spec.file_name
FileUtils.mv cache_file, gem
@@ -2226,7 +2226,7 @@ gem 'other', version
end
def test_default_gem_loaded_from
- spec = util_spec 'a'
+ spec = util_spec "a"
installer = Gem::Installer.for_spec spec, :install_as_default => true
installer.install
assert_predicate spec, :default_gem?
@@ -2235,7 +2235,7 @@ gem 'other', version
def test_default_gem_without_wrappers
installer = setup_base_installer
- FileUtils.rm_rf File.join(Gem.default_dir, 'specifications')
+ FileUtils.rm_rf File.join(Gem.default_dir, "specifications")
installer.wrappers = false
installer.options[:install_as_default] = true
@@ -2245,20 +2245,20 @@ gem 'other', version
installer.install
end
- assert_directory_exists File.join(@spec.gem_dir, 'bin')
- installed_exec = File.join @spec.gem_dir, 'bin', 'executable'
+ assert_directory_exists File.join(@spec.gem_dir, "bin")
+ installed_exec = File.join @spec.gem_dir, "bin", "executable"
assert_path_exist installed_exec
- assert_directory_exists File.join(Gem.default_dir, 'specifications')
- assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')
+ assert_directory_exists File.join(Gem.default_dir, "specifications")
+ assert_directory_exists File.join(Gem.default_dir, "specifications", "default")
- default_spec = eval File.read File.join(Gem.default_dir, 'specifications', 'default', 'a-2.gemspec')
+ default_spec = eval File.read File.join(Gem.default_dir, "specifications", "default", "a-2.gemspec")
assert_equal Gem::Version.new("2"), default_spec.version
- assert_equal ['bin/executable'], default_spec.files
+ assert_equal ["bin/executable"], default_spec.files
assert_directory_exists util_inst_bindir
- installed_exec = File.join util_inst_bindir, 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
assert_path_exist installed_exec
wrapper = File.read installed_exec
@@ -2284,7 +2284,7 @@ gem 'other', version
assert_directory_exists util_inst_bindir
- installed_exec = File.join util_inst_bindir, 'executable'
+ installed_exec = File.join util_inst_bindir, "executable"
assert_path_exist installed_exec
wrapper = File.read installed_exec
@@ -2292,8 +2292,8 @@ gem 'other', version
end
def test_default_gem_with_exe_as_bindir
- @spec = quick_gem 'c' do |spec|
- util_make_exec spec, '#!/usr/bin/ruby', 'exe'
+ @spec = quick_gem "c" do |spec|
+ util_make_exec spec, "#!/usr/bin/ruby", "exe"
end
util_build_gem @spec
@@ -2309,16 +2309,16 @@ gem 'other', version
installer.install
end
- assert_directory_exists File.join(@spec.gem_dir, 'exe')
- installed_exec = File.join @spec.gem_dir, 'exe', 'executable'
+ assert_directory_exists File.join(@spec.gem_dir, "exe")
+ installed_exec = File.join @spec.gem_dir, "exe", "executable"
assert_path_exist installed_exec
- assert_directory_exists File.join(Gem.default_dir, 'specifications')
- assert_directory_exists File.join(Gem.default_dir, 'specifications', 'default')
+ assert_directory_exists File.join(Gem.default_dir, "specifications")
+ assert_directory_exists File.join(Gem.default_dir, "specifications", "default")
- default_spec = eval File.read File.join(Gem.default_dir, 'specifications', 'default', 'c-2.gemspec')
+ default_spec = eval File.read File.join(Gem.default_dir, "specifications", "default", "c-2.gemspec")
assert_equal Gem::Version.new("2"), default_spec.version
- assert_equal ['exe/executable'], default_spec.files
+ assert_equal ["exe/executable"], default_spec.files
end
def test_default_gem_to_specific_install_dir
@@ -2330,17 +2330,17 @@ gem 'other', version
installer.install
end
- assert_directory_exists File.join("#{@gemhome}2", 'specifications')
- assert_directory_exists File.join("#{@gemhome}2", 'specifications', 'default')
+ assert_directory_exists File.join("#{@gemhome}2", "specifications")
+ assert_directory_exists File.join("#{@gemhome}2", "specifications", "default")
- default_spec = eval File.read File.join("#{@gemhome}2", 'specifications', 'default', 'a-2.gemspec')
+ default_spec = eval File.read File.join("#{@gemhome}2", "specifications", "default", "a-2.gemspec")
assert_equal Gem::Version.new("2"), default_spec.version
- assert_equal ['bin/executable'], default_spec.files
+ assert_equal ["bin/executable"], default_spec.files
end
def test_package_attribute
- gem = quick_gem 'c' do |spec|
- util_make_exec spec, '#!/usr/bin/ruby', 'exe'
+ gem = quick_gem "c" do |spec|
+ util_make_exec spec, "#!/usr/bin/ruby", "exe"
end
installer = util_installer(gem, @gemhome)
@@ -2349,8 +2349,8 @@ gem 'other', version
end
def test_gem_attribute
- gem = quick_gem 'c' do |spec|
- util_make_exec spec, '#!/usr/bin/ruby', 'exe'
+ gem = quick_gem "c" do |spec|
+ util_make_exec spec, "#!/usr/bin/ruby", "exe"
end
installer = util_installer(gem, @gemhome)
@@ -2361,14 +2361,14 @@ gem 'other', version
private
def util_execless
- @spec = util_spec 'z'
+ @spec = util_spec "z"
util_build_gem @spec
util_installer @spec, @gemhome
end
def util_conflict_executable(wrappers)
- conflict = quick_gem 'conflict' do |spec|
+ conflict = quick_gem "conflict" do |spec|
util_make_exec spec
end
@@ -2384,11 +2384,11 @@ gem 'other', version
end
def load_relative(value)
- orig_LIBRUBY_RELATIVE = RbConfig::CONFIG['LIBRUBY_RELATIVE']
- RbConfig::CONFIG['LIBRUBY_RELATIVE'] = value
+ orig_LIBRUBY_RELATIVE = RbConfig::CONFIG["LIBRUBY_RELATIVE"]
+ RbConfig::CONFIG["LIBRUBY_RELATIVE"] = value
yield
ensure
- RbConfig::CONFIG['LIBRUBY_RELATIVE'] = orig_LIBRUBY_RELATIVE
+ RbConfig::CONFIG["LIBRUBY_RELATIVE"] = orig_LIBRUBY_RELATIVE
end
end
diff --git a/test/rubygems/test_gem_local_remote_options.rb b/test/rubygems/test_gem_local_remote_options.rb
index 948d1e3981..0c662a3f50 100644
--- a/test/rubygems/test_gem_local_remote_options.rb
+++ b/test/rubygems/test_gem_local_remote_options.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/local_remote_options'
-require 'rubygems/command'
+require_relative "helper"
+require "rubygems/local_remote_options"
+require "rubygems/command"
class TestGemLocalRemoteOptions < Gem::TestCase
def setup
super
- @cmd = Gem::Command.new 'dummy', 'dummy'
+ @cmd = Gem::Command.new "dummy", "dummy"
@cmd.extend Gem::LocalRemoteOptions
end
@@ -75,10 +75,10 @@ class TestGemLocalRemoteOptions < Gem::TestCase
def test_source_option
@cmd.add_source_option
- s1 = URI.parse 'http://more-gems.example.com/'
- s2 = URI.parse 'http://even-more-gems.example.com/'
- s3 = URI.parse 'http://other-gems.example.com/some_subdir'
- s4 = URI.parse 'http://more-gems.example.com/' # Intentional duplicate
+ s1 = URI.parse "http://more-gems.example.com/"
+ s2 = URI.parse "http://even-more-gems.example.com/"
+ s3 = URI.parse "http://other-gems.example.com/some_subdir"
+ s4 = URI.parse "http://more-gems.example.com/" # Intentional duplicate
original_sources = Gem.sources.dup
@@ -96,7 +96,7 @@ class TestGemLocalRemoteOptions < Gem::TestCase
original_sources = Gem.sources.dup
- source = URI.parse 'http://more-gems.example.com/'
+ source = URI.parse "http://more-gems.example.com/"
@cmd.handle_options %W[-s #{source}]
original_sources << source
@@ -121,7 +121,7 @@ class TestGemLocalRemoteOptions < Gem::TestCase
def test_source_option_bad
@cmd.add_source_option
- s1 = 'htp://more-gems.example.com'
+ s1 = "htp://more-gems.example.com"
assert_raise ArgumentError do
@cmd.handle_options %W[--source #{s1}]
diff --git a/test/rubygems/test_gem_name_tuple.rb b/test/rubygems/test_gem_name_tuple.rb
index d87db9bc45..6eca69084c 100644
--- a/test/rubygems/test_gem_name_tuple.rb
+++ b/test/rubygems/test_gem_name_tuple.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/name_tuple'
+require_relative "helper"
+require "rubygems/name_tuple"
class TestGemNameTuple < Gem::TestCase
def test_full_name
@@ -34,8 +34,8 @@ class TestGemNameTuple < Gem::TestCase
end
def test_spaceship
- a = Gem::NameTuple.new 'a', Gem::Version.new(0), Gem::Platform::RUBY
- a_p = Gem::NameTuple.new 'a', Gem::Version.new(0), Gem::Platform.local
+ a = Gem::NameTuple.new "a", Gem::Version.new(0), Gem::Platform::RUBY
+ a_p = Gem::NameTuple.new "a", Gem::Version.new(0), Gem::Platform.local
assert_equal 1, a_p.<=>(a)
end
diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb
index e3dce87c95..9e18dacba1 100644
--- a/test/rubygems/test_gem_package.rb
+++ b/test/rubygems/test_gem_package.rb
@@ -1,14 +1,14 @@
# frozen_string_literal: true
-require_relative 'package/tar_test_case'
-require 'rubygems/openssl'
+require_relative "package/tar_test_case"
+require "rubygems/openssl"
class TestGemPackage < Gem::Package::TarTestCase
def setup
super
- @spec = quick_gem 'a' do |s|
- s.description = 'Ï€'
+ @spec = quick_gem "a" do |s|
+ s.description = "Ï€"
s.files = %w[lib/code.rb]
end
@@ -16,7 +16,7 @@ class TestGemPackage < Gem::Package::TarTestCase
@gem = @spec.cache_file
- @destination = File.join @tempdir, 'extract'
+ @destination = File.join @tempdir, "extract"
FileUtils.mkdir_p @destination
end
@@ -24,11 +24,11 @@ class TestGemPackage < Gem::Package::TarTestCase
def test_class_new_old_format
pend "jruby can't require the simple_gem file" if Gem.java_platform?
require_relative "simple_gem"
- File.open 'old_format.gem', 'wb' do |io|
+ File.open "old_format.gem", "wb" do |io|
io.write SIMPLE_GEM
end
- package = Gem::Package.new 'old_format.gem'
+ package = Gem::Package.new "old_format.gem"
assert package.spec
end
@@ -36,17 +36,17 @@ class TestGemPackage < Gem::Package::TarTestCase
def test_add_checksums
gem_io = StringIO.new
- spec = Gem::Specification.new 'build', '1'
- spec.summary = 'build'
- spec.authors = 'build'
- spec.files = ['lib/code.rb']
+ spec = Gem::Specification.new "build", "1"
+ spec.summary = "build"
+ spec.authors = "build"
+ spec.files = ["lib/code.rb"]
spec.date = Time.at 0
- spec.rubygems_version = Gem::Version.new '0'
+ spec.rubygems_version = Gem::Version.new "0"
- FileUtils.mkdir 'lib'
+ FileUtils.mkdir "lib"
- File.open 'lib/code.rb', 'w' do |io|
- io.write '# lib/code.rb'
+ File.open "lib/code.rb", "w" do |io|
+ io.write "# lib/code.rb"
end
package = Gem::Package.new spec.file_name
@@ -69,11 +69,11 @@ class TestGemPackage < Gem::Package::TarTestCase
reader.each_entry do |entry|
case entry.full_name
- when 'checksums.yaml.gz' then
+ when "checksums.yaml.gz" then
Zlib::GzipReader.wrap entry do |io|
checksums = io.read
end
- when 'data.tar.gz' then
+ when "data.tar.gz" then
tar = entry.read
end
end
@@ -88,13 +88,13 @@ class TestGemPackage < Gem::Package::TarTestCase
metadata_sha512 = OpenSSL::Digest::SHA512.hexdigest s.string
expected = {
- 'SHA512' => {
- 'metadata.gz' => metadata_sha512,
- 'data.tar.gz' => OpenSSL::Digest::SHA512.hexdigest(tar),
+ "SHA512" => {
+ "metadata.gz" => metadata_sha512,
+ "data.tar.gz" => OpenSSL::Digest::SHA512.hexdigest(tar),
},
- 'SHA256' => {
- 'metadata.gz' => metadata_sha256,
- 'data.tar.gz' => OpenSSL::Digest::SHA256.hexdigest(tar),
+ "SHA256" => {
+ "metadata.gz" => metadata_sha256,
+ "data.tar.gz" => OpenSSL::Digest::SHA256.hexdigest(tar),
},
}
@@ -105,12 +105,12 @@ class TestGemPackage < Gem::Package::TarTestCase
epoch = ENV["SOURCE_DATE_EPOCH"]
ENV["SOURCE_DATE_EPOCH"] = "123456789"
- spec = Gem::Specification.new 'build', '1'
- spec.summary = 'build'
- spec.authors = 'build'
- spec.files = ['lib/code.rb']
+ spec = Gem::Specification.new "build", "1"
+ spec.summary = "build"
+ spec.authors = "build"
+ spec.files = ["lib/code.rb"]
spec.date = Time.at 0
- spec.rubygems_version = Gem::Version.new '0'
+ spec.rubygems_version = Gem::Version.new "0"
package = Gem::Package.new spec.file_name
@@ -123,11 +123,11 @@ class TestGemPackage < Gem::Package::TarTestCase
epoch = ENV["SOURCE_DATE_EPOCH"]
ENV["SOURCE_DATE_EPOCH"] = nil
- spec = Gem::Specification.new 'build', '1'
- spec.summary = 'build'
- spec.authors = 'build'
- spec.files = ['lib/code.rb']
- spec.rubygems_version = Gem::Version.new '0'
+ spec = Gem::Specification.new "build", "1"
+ spec.summary = "build"
+ spec.authors = "build"
+ spec.files = ["lib/code.rb"]
+ spec.rubygems_version = Gem::Version.new "0"
package = Gem::Package.new spec.file_name
@@ -144,17 +144,17 @@ class TestGemPackage < Gem::Package::TarTestCase
spec = Gem::Specification.new
spec.files = %w[lib/code.rb lib/empty]
- FileUtils.mkdir_p 'lib/empty'
+ FileUtils.mkdir_p "lib/empty"
- File.open 'lib/code.rb', 'w' do |io|
- io.write '# lib/code.rb'
+ File.open "lib/code.rb", "w" do |io|
+ io.write "# lib/code.rb"
end
- File.open 'lib/extra.rb', 'w' do |io|
- io.write '# lib/extra.rb'
+ File.open "lib/extra.rb", "w" do |io|
+ io.write "# lib/extra.rb"
end
- package = Gem::Package.new 'bogus.gem'
+ package = Gem::Package.new "bogus.gem"
package.spec = spec
tar = util_tar do |tar_io|
@@ -178,16 +178,16 @@ class TestGemPackage < Gem::Package::TarTestCase
spec = Gem::Specification.new
spec.files = %w[lib/code.rb lib/code_sym.rb lib/code_sym2.rb]
- FileUtils.mkdir_p 'lib'
+ FileUtils.mkdir_p "lib"
- File.open 'lib/code.rb', 'w' do |io|
- io.write '# lib/code.rb'
+ File.open "lib/code.rb", "w" do |io|
+ io.write "# lib/code.rb"
end
# NOTE: 'code.rb' is correct, because it's relative to lib/code_sym.rb
begin
- File.symlink('code.rb', 'lib/code_sym.rb')
- File.symlink('../lib/code.rb', 'lib/code_sym2.rb')
+ File.symlink("code.rb", "lib/code_sym.rb")
+ File.symlink("../lib/code.rb", "lib/code_sym2.rb")
rescue Errno::EACCES => e
if win_platform?
pend "symlink - must be admin with no UAC on Windows"
@@ -196,7 +196,7 @@ class TestGemPackage < Gem::Package::TarTestCase
end
end
- package = Gem::Package.new 'bogus.gem'
+ package = Gem::Package.new "bogus.gem"
package.spec = spec
tar = util_tar do |tar_io|
@@ -218,20 +218,20 @@ class TestGemPackage < Gem::Package::TarTestCase
end
assert_equal %w[lib/code.rb], files
- assert_equal [{ 'lib/code_sym.rb' => 'code.rb' }, { 'lib/code_sym2.rb' => '../lib/code.rb' }], symlinks
+ assert_equal [{ "lib/code_sym.rb" => "code.rb" }, { "lib/code_sym2.rb" => "../lib/code.rb" }], symlinks
end
def test_build
- spec = Gem::Specification.new 'build', '1'
- spec.summary = 'build'
- spec.authors = 'build'
- spec.files = ['lib/code.rb']
+ spec = Gem::Specification.new "build", "1"
+ spec.summary = "build"
+ spec.authors = "build"
+ spec.files = ["lib/code.rb"]
spec.rubygems_version = :junk
- FileUtils.mkdir 'lib'
+ FileUtils.mkdir "lib"
- File.open 'lib/code.rb', 'w' do |io|
- io.write '# lib/code.rb'
+ File.open "lib/code.rb", "w" do |io|
+ io.write "# lib/code.rb"
end
package = Gem::Package.new spec.file_name
@@ -252,25 +252,25 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_build_auto_signed
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
- FileUtils.mkdir_p File.join(Gem.user_home, '.gem')
+ FileUtils.mkdir_p File.join(Gem.user_home, ".gem")
- private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ private_key_path = File.join Gem.user_home, ".gem", "gem-private_key.pem"
Gem::Security.write PRIVATE_KEY, private_key_path
- public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ public_cert_path = File.join Gem.user_home, ".gem", "gem-public_cert.pem"
FileUtils.cp PUBLIC_CERT_PATH, public_cert_path
- spec = Gem::Specification.new 'build', '1'
- spec.summary = 'build'
- spec.authors = 'build'
- spec.files = ['lib/code.rb']
+ spec = Gem::Specification.new "build", "1"
+ spec.summary = "build"
+ spec.authors = "build"
+ spec.files = ["lib/code.rb"]
- FileUtils.mkdir 'lib'
+ FileUtils.mkdir "lib"
- File.open 'lib/code.rb', 'w' do |io|
- io.write '# lib/code.rb'
+ File.open "lib/code.rb", "w" do |io|
+ io.write "# lib/code.rb"
end
package = Gem::Package.new spec.file_name
@@ -295,25 +295,25 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_build_auto_signed_encrypted_key
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
- FileUtils.mkdir_p File.join(Gem.user_home, '.gem')
+ FileUtils.mkdir_p File.join(Gem.user_home, ".gem")
- private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ private_key_path = File.join Gem.user_home, ".gem", "gem-private_key.pem"
FileUtils.cp ENCRYPTED_PRIVATE_KEY_PATH, private_key_path
- public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ public_cert_path = File.join Gem.user_home, ".gem", "gem-public_cert.pem"
Gem::Security.write PUBLIC_CERT, public_cert_path
- spec = Gem::Specification.new 'build', '1'
- spec.summary = 'build'
- spec.authors = 'build'
- spec.files = ['lib/code.rb']
+ spec = Gem::Specification.new "build", "1"
+ spec.summary = "build"
+ spec.authors = "build"
+ spec.files = ["lib/code.rb"]
- FileUtils.mkdir 'lib'
+ FileUtils.mkdir "lib"
- File.open 'lib/code.rb', 'w' do |io|
- io.write '# lib/code.rb'
+ File.open "lib/code.rb", "w" do |io|
+ io.write "# lib/code.rb"
end
package = Gem::Package.new spec.file_name
@@ -338,7 +338,7 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_build_invalid
- spec = Gem::Specification.new 'build', '1'
+ spec = Gem::Specification.new "build", "1"
package = Gem::Package.new spec.file_name
package.spec = spec
@@ -347,11 +347,11 @@ class TestGemPackage < Gem::Package::TarTestCase
package.build
end
- assert_equal 'missing value for attribute summary', e.message
+ assert_equal "missing value for attribute summary", e.message
end
def test_build_invalid_arguments
- spec = Gem::Specification.new 'build', '1'
+ spec = Gem::Specification.new "build", "1"
package = Gem::Package.new spec.file_name
package.spec = spec
@@ -364,19 +364,19 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_build_signed
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
- spec = Gem::Specification.new 'build', '1'
- spec.summary = 'build'
- spec.authors = 'build'
- spec.files = ['lib/code.rb']
+ spec = Gem::Specification.new "build", "1"
+ spec.summary = "build"
+ spec.authors = "build"
+ spec.files = ["lib/code.rb"]
spec.cert_chain = [PUBLIC_CERT.to_pem]
spec.signing_key = PRIVATE_KEY
- FileUtils.mkdir 'lib'
+ FileUtils.mkdir "lib"
- File.open 'lib/code.rb', 'w' do |io|
- io.write '# lib/code.rb'
+ File.open "lib/code.rb", "w" do |io|
+ io.write "# lib/code.rb"
end
package = Gem::Package.new spec.file_name
@@ -401,19 +401,19 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_build_signed_encrypted_key
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
- spec = Gem::Specification.new 'build', '1'
- spec.summary = 'build'
- spec.authors = 'build'
- spec.files = ['lib/code.rb']
+ spec = Gem::Specification.new "build", "1"
+ spec.summary = "build"
+ spec.authors = "build"
+ spec.files = ["lib/code.rb"]
spec.cert_chain = [PUBLIC_CERT.to_pem]
spec.signing_key = ENCRYPTED_PRIVATE_KEY
- FileUtils.mkdir 'lib'
+ FileUtils.mkdir "lib"
- File.open 'lib/code.rb', 'w' do |io|
- io.write '# lib/code.rb'
+ File.open "lib/code.rb", "w" do |io|
+ io.write "# lib/code.rb"
end
package = Gem::Package.new spec.file_name
@@ -441,11 +441,11 @@ class TestGemPackage < Gem::Package::TarTestCase
data_tgz = util_tar_gz {}
gem = util_tar do |tar|
- tar.add_file 'data.tar.gz', 0644 do |io|
+ tar.add_file "data.tar.gz", 0644 do |io|
io.write data_tgz.string
end
- tar.add_file 'metadata.gz', 0644 do |io|
+ tar.add_file "metadata.gz", 0644 do |io|
Zlib::GzipWriter.wrap io do |gzio|
gzio.write @spec.to_yaml
end
@@ -475,7 +475,7 @@ class TestGemPackage < Gem::Package::TarTestCase
package.extract_files @destination
- extracted = File.join @destination, 'lib/code.rb'
+ extracted = File.join @destination, "lib/code.rb"
assert_path_exist extracted
mask = 0100666 & (~File.umask)
@@ -488,22 +488,22 @@ class TestGemPackage < Gem::Package::TarTestCase
data_tgz = util_tar_gz {}
gem = util_tar do |tar|
- tar.add_file 'data.tar.gz', 0644 do |io|
+ tar.add_file "data.tar.gz", 0644 do |io|
io.write data_tgz.string
end
- tar.add_file 'metadata.gz', 0644 do |io|
+ tar.add_file "metadata.gz", 0644 do |io|
Zlib::GzipWriter.wrap io do |gzio|
gzio.write @spec.to_yaml
end
end
end
- File.open 'empty.gem', 'wb' do |io|
+ File.open "empty.gem", "wb" do |io|
io.write gem.string
end
- package = Gem::Package.new 'empty.gem'
+ package = Gem::Package.new "empty.gem"
package.extract_files @destination
@@ -514,8 +514,8 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.add_file '/absolute.rb', 0644 do |io|
- io.write 'hi'
+ tar.add_file "/absolute.rb", 0644 do |io|
+ io.write "hi"
end
end
@@ -531,12 +531,12 @@ 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|
- io.write 'hi'
+ tar.add_file "relative.rb", 0644 do |io|
+ io.write "hi"
end
- tar.mkdir 'lib', 0755
- tar.add_symlink 'lib/foo.rb', '../relative.rb', 0644
+ tar.mkdir "lib", 0755
+ tar.add_symlink "lib/foo.rb", "../relative.rb", 0644
end
begin
@@ -549,11 +549,11 @@ class TestGemPackage < Gem::Package::TarTestCase
end
end
- extracted = File.join @destination, 'lib/foo.rb'
+ extracted = File.join @destination, "lib/foo.rb"
assert_path_exist extracted
- assert_equal '../relative.rb',
+ assert_equal "../relative.rb",
File.readlink(extracted)
- assert_equal 'hi',
+ assert_equal "hi",
File.read(extracted)
end
@@ -561,17 +561,17 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.mkdir 'lib', 0755
- tar.add_symlink 'lib/link', '../..', 0644
- tar.add_file 'lib/link/outside.txt', 0644 do |io|
- io.write 'hi'
+ tar.mkdir "lib", 0755
+ tar.add_symlink "lib/link", "../..", 0644
+ tar.add_file "lib/link/outside.txt", 0644 do |io|
+ io.write "hi"
end
end
# Extract into a subdirectory of @destination; if this test fails it writes
# a file outside destination_subdir, but we want the file to remain inside
# @destination so it will be cleaned up.
- destination_subdir = File.join @destination, 'subdir'
+ destination_subdir = File.join @destination, "subdir"
FileUtils.mkdir_p destination_subdir
expected_exceptions = win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError]
@@ -595,18 +595,18 @@ class TestGemPackage < Gem::Package::TarTestCase
# Extract into a subdirectory of @destination; if this test fails it writes
# a file outside destination_subdir, but we want the file to remain inside
# @destination so it will be cleaned up.
- destination_subdir = File.join @destination, 'subdir'
+ destination_subdir = File.join @destination, "subdir"
FileUtils.mkdir_p destination_subdir
- destination_user_dir = File.join @destination, 'user'
- destination_user_subdir = File.join destination_user_dir, 'dir'
+ destination_user_dir = File.join @destination, "user"
+ destination_user_subdir = File.join destination_user_dir, "dir"
FileUtils.mkdir_p destination_user_subdir
pend "TMPDIR seems too long to add it as symlink into tar" if destination_user_dir.size > 90
tgz_io = util_tar_gz do |tar|
- tar.add_symlink 'link', destination_user_dir, 16877
- tar.add_symlink 'link/dir', '.', 16877
+ tar.add_symlink "link", destination_user_dir, 16877
+ tar.add_symlink "link/dir", ".", 16877
end
expected_exceptions = win_platform? ? [Gem::Package::SymlinkError, Errno::EACCES] : [Gem::Package::SymlinkError]
@@ -629,19 +629,19 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.mkdir 'lib', 0755
- tar.add_file 'lib/foo.rb', 0644 do |io|
- io.write 'hi'
+ tar.mkdir "lib", 0755
+ 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
- extracted = File.join @destination, 'lib/foo.rb'
+ extracted = File.join @destination, "lib/foo.rb"
assert_path_exist extracted
- extracted = File.join @destination, 'lib/foo'
+ extracted = File.join @destination, "lib/foo"
assert_path_exist extracted
end
@@ -649,14 +649,14 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.add_file './dot_slash.rb', 0644 do |io|
- io.write 'hi'
+ tar.add_file "./dot_slash.rb", 0644 do |io|
+ io.write "hi"
end
end
package.extract_tar_gz tgz_io, @destination
- extracted = File.join @destination, 'dot_slash.rb'
+ extracted = File.join @destination, "dot_slash.rb"
assert_path_exist extracted
end
@@ -664,14 +664,14 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.add_file '.dot_file.rb', 0644 do |io|
- io.write 'hi'
+ tar.add_file ".dot_file.rb", 0644 do |io|
+ io.write "hi"
end
end
package.extract_tar_gz tgz_io, @destination
- extracted = File.join @destination, '.dot_file.rb'
+ extracted = File.join @destination, ".dot_file.rb"
assert_path_exist extracted
end
@@ -680,14 +680,14 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.add_file 'foo/file.rb', 0644 do |io|
- io.write 'hi'
+ tar.add_file "foo/file.rb", 0644 do |io|
+ io.write "hi"
end
end
package.extract_tar_gz tgz_io, @destination.upcase
- extracted = File.join @destination, 'foo/file.rb'
+ extracted = File.join @destination, "foo/file.rb"
assert_path_exist extracted
end
end
@@ -695,20 +695,20 @@ class TestGemPackage < Gem::Package::TarTestCase
def test_install_location
package = Gem::Package.new @gem
- file = 'file.rb'.dup
- file.taint if RUBY_VERSION < '2.7'
+ file = "file.rb".dup
+ file.taint if RUBY_VERSION < "2.7"
destination = package.install_location file, @destination
- assert_equal File.join(@destination, 'file.rb'), destination
- refute destination.tainted? if RUBY_VERSION < '2.7'
+ assert_equal File.join(@destination, "file.rb"), destination
+ refute destination.tainted? if RUBY_VERSION < "2.7"
end
def test_install_location_absolute
package = Gem::Package.new @gem
e = assert_raise Gem::Package::PathError do
- package.install_location '/absolute.rb', @destination
+ package.install_location "/absolute.rb", @destination
end
assert_equal("installing into parent path /absolute.rb of " +
@@ -718,36 +718,36 @@ class TestGemPackage < Gem::Package::TarTestCase
def test_install_location_dots
package = Gem::Package.new @gem
- file = 'file.rb'
+ file = "file.rb"
- destination = File.join @destination, 'foo', '..', 'bar'
+ destination = File.join @destination, "foo", "..", "bar"
- FileUtils.mkdir_p File.join @destination, 'foo'
+ FileUtils.mkdir_p File.join @destination, "foo"
FileUtils.mkdir_p File.expand_path destination
destination = package.install_location file, destination
# this test only fails on ruby missing File.realpath
- assert_equal File.join(@destination, 'bar', 'file.rb'), destination
+ assert_equal File.join(@destination, "bar", "file.rb"), destination
end
def test_install_location_extra_slash
package = Gem::Package.new @gem
- file = 'foo//file.rb'.dup
- file.taint if RUBY_VERSION < '2.7'
+ file = "foo//file.rb".dup
+ file.taint if RUBY_VERSION < "2.7"
destination = package.install_location file, @destination
- assert_equal File.join(@destination, 'foo', 'file.rb'), destination
- refute destination.tainted? if RUBY_VERSION < '2.7'
+ assert_equal File.join(@destination, "foo", "file.rb"), destination
+ refute destination.tainted? if RUBY_VERSION < "2.7"
end
def test_install_location_relative
package = Gem::Package.new @gem
e = assert_raise Gem::Package::PathError do
- package.install_location '../relative.rb', @destination
+ package.install_location "../relative.rb", @destination
end
parent = File.expand_path File.join @destination, "../relative.rb"
@@ -773,9 +773,9 @@ class TestGemPackage < Gem::Package::TarTestCase
def test_load_spec
entry = StringIO.new Gem::Util.gzip @spec.to_yaml
- def entry.full_name() 'metadata.gz' end
+ def entry.full_name() "metadata.gz" end
- package = Gem::Package.new 'nonexistent.gem'
+ package = Gem::Package.new "nonexistent.gem"
spec = package.load_spec entry
@@ -794,8 +794,8 @@ class TestGemPackage < Gem::Package::TarTestCase
def test_verify_checksum_bad
data_tgz = util_tar_gz do |tar|
- tar.add_file 'lib/code.rb', 0444 do |io|
- io.write '# lib/code.rb'
+ tar.add_file "lib/code.rb", 0444 do |io|
+ io.write "# lib/code.rb"
end
end
@@ -804,45 +804,45 @@ class TestGemPackage < Gem::Package::TarTestCase
gem = util_tar do |tar|
metadata_gz = Gem::Util.gzip @spec.to_yaml
- tar.add_file 'metadata.gz', 0444 do |io|
+ tar.add_file "metadata.gz", 0444 do |io|
io.write metadata_gz
end
- tar.add_file 'data.tar.gz', 0444 do |io|
+ tar.add_file "data.tar.gz", 0444 do |io|
io.write data_tgz
end
bogus_checksums = {
- 'SHA1' => {
- 'data.tar.gz' => 'bogus',
- 'metadata.gz' => 'bogus',
+ "SHA1" => {
+ "data.tar.gz" => "bogus",
+ "metadata.gz" => "bogus",
},
}
- tar.add_file 'checksums.yaml.gz', 0444 do |io|
+ tar.add_file "checksums.yaml.gz", 0444 do |io|
Zlib::GzipWriter.wrap io do |gz_io|
gz_io.write Psych.dump bogus_checksums
end
end
end
- File.open 'mismatch.gem', 'wb' do |io|
+ File.open "mismatch.gem", "wb" do |io|
io.write gem.string
end
- package = Gem::Package.new 'mismatch.gem'
+ package = Gem::Package.new "mismatch.gem"
e = assert_raise Gem::Package::FormatError do
package.verify
end
- assert_equal 'SHA1 checksum mismatch for data.tar.gz in mismatch.gem',
+ assert_equal "SHA1 checksum mismatch for data.tar.gz in mismatch.gem",
e.message
end
def test_verify_checksum_missing
data_tgz = util_tar_gz do |tar|
- tar.add_file 'lib/code.rb', 0444 do |io|
- io.write '# lib/code.rb'
+ tar.add_file "lib/code.rb", 0444 do |io|
+ io.write "# lib/code.rb"
end
end
@@ -851,7 +851,7 @@ class TestGemPackage < Gem::Package::TarTestCase
gem = util_tar do |tar|
metadata_gz = Gem::Util.gzip @spec.to_yaml
- tar.add_file 'metadata.gz', 0444 do |io|
+ tar.add_file "metadata.gz", 0444 do |io|
io.write metadata_gz
end
@@ -859,37 +859,37 @@ class TestGemPackage < Gem::Package::TarTestCase
digest << metadata_gz
checksums = {
- 'SHA1' => {
- 'metadata.gz' => digest.hexdigest,
+ "SHA1" => {
+ "metadata.gz" => digest.hexdigest,
},
}
- tar.add_file 'checksums.yaml.gz', 0444 do |io|
+ tar.add_file "checksums.yaml.gz", 0444 do |io|
Zlib::GzipWriter.wrap io do |gz_io|
gz_io.write Psych.dump checksums
end
end
- tar.add_file 'data.tar.gz', 0444 do |io|
+ tar.add_file "data.tar.gz", 0444 do |io|
io.write data_tgz
end
end
- File.open 'data_checksum_missing.gem', 'wb' do |io|
+ File.open "data_checksum_missing.gem", "wb" do |io|
io.write gem.string
end
- package = Gem::Package.new 'data_checksum_missing.gem'
+ package = Gem::Package.new "data_checksum_missing.gem"
assert package.verify
end
def test_verify_corrupt
pend "jruby strips the null byte and does not think it's corrupt" if Gem.java_platform?
- tf = Tempfile.open 'corrupt' do |io|
- data = Gem::Util.gzip 'a' * 10
+ tf = Tempfile.open "corrupt" do |io|
+ data = Gem::Util.gzip "a" * 10
io.write \
- tar_file_header('metadata.gz', "\000x", 0644, data.length, Time.now)
+ tar_file_header("metadata.gz", "\000x", 0644, data.length, Time.now)
io.write data
io.rewind
@@ -907,19 +907,19 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_verify_empty
- FileUtils.touch 'empty.gem'
+ FileUtils.touch "empty.gem"
- package = Gem::Package.new 'empty.gem'
+ package = Gem::Package.new "empty.gem"
e = assert_raise Gem::Package::FormatError do
package.verify
end
- assert_equal 'package metadata is missing in empty.gem', e.message
+ assert_equal "package metadata is missing in empty.gem", e.message
end
def test_verify_nonexistent
- package = Gem::Package.new 'nonexistent.gem'
+ package = Gem::Package.new "nonexistent.gem"
e = assert_raise Gem::Package::FormatError do
package.verify
@@ -930,19 +930,19 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_verify_duplicate_file
- FileUtils.mkdir_p 'lib'
- FileUtils.touch 'lib/code.rb'
+ FileUtils.mkdir_p "lib"
+ FileUtils.touch "lib/code.rb"
build = Gem::Package.new @gem
build.spec = @spec
build.setup_signer
- File.open @gem, 'wb' do |gem_io|
+ File.open @gem, "wb" do |gem_io|
Gem::Package::TarWriter.new gem_io do |gem|
build.add_metadata gem
build.add_contents gem
- gem.add_file_simple 'a.sig', 0444, 0
- gem.add_file_simple 'a.sig', 0444, 0
+ gem.add_file_simple "a.sig", 0444, 0
+ gem.add_file_simple "a.sig", 0444, 0
end
end
@@ -956,7 +956,7 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_verify_security_policy
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
package = Gem::Package.new @gem
package.security_policy = Gem::Security::HighSecurity
@@ -965,21 +965,21 @@ class TestGemPackage < Gem::Package::TarTestCase
package.verify
end
- assert_equal 'unsigned gems are not allowed by the High Security policy',
+ assert_equal "unsigned gems are not allowed by the High Security policy",
e.message
- refute package.instance_variable_get(:@spec), '@spec must not be loaded'
- assert_empty package.instance_variable_get(:@files), '@files must empty'
+ refute package.instance_variable_get(:@spec), "@spec must not be loaded"
+ assert_empty package.instance_variable_get(:@files), "@files must empty"
end
def test_verify_security_policy_low_security
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
@spec.cert_chain = [PUBLIC_CERT.to_pem]
@spec.signing_key = PRIVATE_KEY
- FileUtils.mkdir_p 'lib'
- FileUtils.touch 'lib/code.rb'
+ FileUtils.mkdir_p "lib"
+ FileUtils.touch "lib/code.rb"
build = Gem::Package.new @gem
build.spec = @spec
@@ -993,7 +993,7 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_verify_security_policy_checksum_missing
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
@spec.cert_chain = [PUBLIC_CERT.to_pem]
@spec.signing_key = PRIVATE_KEY
@@ -1002,23 +1002,23 @@ class TestGemPackage < Gem::Package::TarTestCase
build.spec = @spec
build.setup_signer
- FileUtils.mkdir 'lib'
- FileUtils.touch 'lib/code.rb'
+ FileUtils.mkdir "lib"
+ FileUtils.touch "lib/code.rb"
- File.open @gem, 'wb' do |gem_io|
+ File.open @gem, "wb" do |gem_io|
Gem::Package::TarWriter.new gem_io do |gem|
build.add_metadata gem
build.add_contents gem
# write bogus data.tar.gz to foil signature
- bogus_data = Gem::Util.gzip 'hello'
+ bogus_data = Gem::Util.gzip "hello"
fake_signer = Class.new do
- def digest_name; 'SHA512'; end
+ def digest_name; "SHA512"; end
def digest_algorithm; OpenSSL::Digest(:SHA512).new; end
- def key; 'key'; end
- def sign(*); 'fake_sig'; end
+ def key; "key"; end
+ def sign(*); "fake_sig"; end
end
- gem.add_file_signed 'data2.tar.gz', 0444, fake_signer.new do |io|
+ gem.add_file_signed "data2.tar.gz", 0444, fake_signer.new do |io|
io.write bogus_data
end
@@ -1035,24 +1035,24 @@ class TestGemPackage < Gem::Package::TarTestCase
package.verify
end
- assert_equal 'invalid signature', e.message
+ assert_equal "invalid signature", e.message
- refute package.instance_variable_get(:@spec), '@spec must not be loaded'
- assert_empty package.instance_variable_get(:@files), '@files must empty'
+ refute package.instance_variable_get(:@spec), "@spec must not be loaded"
+ assert_empty package.instance_variable_get(:@files), "@files must empty"
end
def test_verify_truncate
- File.open 'bad.gem', 'wb' do |io|
+ File.open "bad.gem", "wb" do |io|
io.write File.read(@gem, 1024) # don't care about newlines
end
- package = Gem::Package.new 'bad.gem'
+ package = Gem::Package.new "bad.gem"
e = assert_raise Gem::Package::FormatError do
package.verify
end
- assert_equal 'package content (data.tar.gz) is missing in bad.gem',
+ assert_equal "package content (data.tar.gz) is missing in bad.gem",
e.message
end
@@ -1060,7 +1060,7 @@ class TestGemPackage < Gem::Package::TarTestCase
def test_verify_entry
entry = Object.new
- def entry.full_name() raise ArgumentError, 'whatever' end
+ def entry.full_name() raise ArgumentError, "whatever" end
package = Gem::Package.new @gem
diff --git a/test/rubygems/test_gem_package_old.rb b/test/rubygems/test_gem_package_old.rb
index 945340a96a..d65d1edad6 100644
--- a/test/rubygems/test_gem_package_old.rb
+++ b/test/rubygems/test_gem_package_old.rb
@@ -1,19 +1,19 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
unless Gem.java_platform? # jruby can't require the simple_gem file
- require 'rubygems/simple_gem'
+ require "rubygems/simple_gem"
class TestGemPackageOld < Gem::TestCase
def setup
super
- File.open 'old_format.gem', 'wb' do |io|
+ File.open "old_format.gem", "wb" do |io|
io.write SIMPLE_GEM
end
- @package = Gem::Package::Old.new 'old_format.gem'
- @destination = File.join @tempdir, 'extract'
+ @package = Gem::Package::Old.new "old_format.gem"
+ @destination = File.join @tempdir, "extract"
FileUtils.mkdir_p @destination
end
@@ -23,7 +23,7 @@ unless Gem.java_platform? # jruby can't require the simple_gem file
end
def test_contents_security_policy
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
@package.security_policy = Gem::Security::AlmostNoSecurity
@@ -35,7 +35,7 @@ unless Gem.java_platform? # jruby can't require the simple_gem file
def test_extract_files
@package.extract_files @destination
- extracted = File.join @destination, 'lib/foo.rb'
+ extracted = File.join @destination, "lib/foo.rb"
assert_path_exist extracted
mask = 0100644 & (~File.umask)
@@ -44,7 +44,7 @@ unless Gem.java_platform? # jruby can't require the simple_gem file
end
def test_extract_files_security_policy
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
@package.security_policy = Gem::Security::AlmostNoSecurity
@@ -54,11 +54,11 @@ unless Gem.java_platform? # jruby can't require the simple_gem file
end
def test_spec
- assert_equal 'testing', @package.spec.name
+ assert_equal "testing", @package.spec.name
end
def test_spec_security_policy
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
@package.security_policy = Gem::Security::AlmostNoSecurity
@@ -68,7 +68,7 @@ unless Gem.java_platform? # jruby can't require the simple_gem file
end
def test_verify
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
assert @package.verify
@@ -82,8 +82,8 @@ unless Gem.java_platform? # jruby can't require the simple_gem file
@package.verify
end
- assert_equal 'old format gems do not contain signatures ' +
- 'and cannot be verified',
+ assert_equal "old format gems do not contain signatures " +
+ "and cannot be verified",
e.message
end
end
diff --git a/test/rubygems/test_gem_package_tar_header.rb b/test/rubygems/test_gem_package_tar_header.rb
index 0e72a72d6a..3ff4f0b30b 100644
--- a/test/rubygems/test_gem_package_tar_header.rb
+++ b/test/rubygems/test_gem_package_tar_header.rb
@@ -1,25 +1,25 @@
# frozen_string_literal: true
-require_relative 'package/tar_test_case'
-require 'rubygems/package'
+require_relative "package/tar_test_case"
+require "rubygems/package"
class TestGemPackageTarHeader < Gem::Package::TarTestCase
def setup
super
header = {
- :name => 'x',
+ :name => "x",
:mode => 0644,
:uid => 1000,
:gid => 10000,
:size => 100,
:mtime => 12345,
- :typeflag => '0',
- :linkname => 'link',
- :uname => 'user',
- :gname => 'group',
+ :typeflag => "0",
+ :linkname => "link",
+ :uname => "user",
+ :gname => "group",
:devmajor => 1,
:devminor => 2,
- :prefix => 'y',
+ :prefix => "y",
}
@tar_header = Gem::Package::TarHeader.new header
@@ -36,62 +36,62 @@ class TestGemPackageTarHeader < Gem::Package::TarTestCase
end
def test_initialize
- assert_equal '', @tar_header.checksum, 'checksum'
- assert_equal 1, @tar_header.devmajor, 'devmajor'
- assert_equal 2, @tar_header.devminor, 'devminor'
- assert_equal 10000, @tar_header.gid, 'gid'
- assert_equal 'group', @tar_header.gname, 'gname'
- assert_equal 'link', @tar_header.linkname, 'linkname'
- assert_equal 'ustar', @tar_header.magic, 'magic'
- assert_equal 0644, @tar_header.mode, 'mode'
- assert_equal 12345, @tar_header.mtime, 'mtime'
- assert_equal 'x', @tar_header.name, 'name'
- assert_equal 'y', @tar_header.prefix, 'prefix'
- assert_equal 100, @tar_header.size, 'size'
- assert_equal '0', @tar_header.typeflag, 'typeflag'
- assert_equal 1000, @tar_header.uid, 'uid'
- assert_equal 'user', @tar_header.uname, 'uname'
- assert_equal '00', @tar_header.version, 'version'
-
- refute_empty @tar_header, 'empty'
+ assert_equal "", @tar_header.checksum, "checksum"
+ assert_equal 1, @tar_header.devmajor, "devmajor"
+ assert_equal 2, @tar_header.devminor, "devminor"
+ assert_equal 10000, @tar_header.gid, "gid"
+ assert_equal "group", @tar_header.gname, "gname"
+ assert_equal "link", @tar_header.linkname, "linkname"
+ assert_equal "ustar", @tar_header.magic, "magic"
+ assert_equal 0644, @tar_header.mode, "mode"
+ assert_equal 12345, @tar_header.mtime, "mtime"
+ assert_equal "x", @tar_header.name, "name"
+ assert_equal "y", @tar_header.prefix, "prefix"
+ assert_equal 100, @tar_header.size, "size"
+ assert_equal "0", @tar_header.typeflag, "typeflag"
+ assert_equal 1000, @tar_header.uid, "uid"
+ assert_equal "user", @tar_header.uname, "uname"
+ assert_equal "00", @tar_header.version, "version"
+
+ refute_empty @tar_header, "empty"
end
def test_initialize_bad
assert_raise ArgumentError do
- Gem::Package::TarHeader.new :name => '', :size => '', :mode => ''
+ Gem::Package::TarHeader.new :name => "", :size => "", :mode => ""
end
assert_raise ArgumentError do
- Gem::Package::TarHeader.new :name => '', :size => '', :prefix => ''
+ Gem::Package::TarHeader.new :name => "", :size => "", :prefix => ""
end
assert_raise ArgumentError do
- Gem::Package::TarHeader.new :name => '', :prefix => '', :mode => ''
+ Gem::Package::TarHeader.new :name => "", :prefix => "", :mode => ""
end
assert_raise ArgumentError do
- Gem::Package::TarHeader.new :prefix => '', :size => '', :mode => ''
+ Gem::Package::TarHeader.new :prefix => "", :size => "", :mode => ""
end
end
def test_initialize_typeflag
header = {
- :mode => '',
- :name => '',
- :prefix => '',
- :size => '',
- :typeflag => '',
+ :mode => "",
+ :name => "",
+ :prefix => "",
+ :size => "",
+ :typeflag => "",
}
tar_header = Gem::Package::TarHeader.new header
- assert_equal '0', tar_header.typeflag
+ assert_equal "0", tar_header.typeflag
end
def test_empty_eh
refute_empty @tar_header
- @tar_header = Gem::Package::TarHeader.new :name => 'x', :prefix => '',
+ @tar_header = Gem::Package::TarHeader.new :name => "x", :prefix => "",
:mode => 0, :size => 0,
:empty => true
@@ -135,11 +135,11 @@ group\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000
end
def test_update_checksum
- assert_equal '', @tar_header.checksum
+ assert_equal "", @tar_header.checksum
@tar_header.update_checksum
- assert_equal '012467', @tar_header.checksum
+ assert_equal "012467", @tar_header.checksum
end
def test_from_bad_octal
@@ -165,7 +165,7 @@ group\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000
def test_big_uid_gid
stream = StringIO.new(
- <<-EOF.dup.force_encoding('binary').split("\n").join
+ <<-EOF.dup.force_encoding("binary").split("\n").join
GeoIP2-City_20190528/
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
@@ -197,7 +197,7 @@ tjmather\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
assert_equal 1991400094, tar_header.uid
assert_equal 1991400094, tar_header.gid
- assert_equal 'GeoIP2-City_20190528/', tar_header.name
+ assert_equal "GeoIP2-City_20190528/", tar_header.name
assert_equal 0755, tar_header.mode
assert_equal 0, tar_header.size
assert_equal 1559064640, tar_header.mtime
@@ -206,7 +206,7 @@ tjmather\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
def test_spaces_in_headers
stream = StringIO.new(
- <<-EOF.dup.force_encoding('binary').split("\n").join
+ <<-EOF.dup.force_encoding("binary").split("\n").join
Access_Points_09202018.csv
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
diff --git a/test/rubygems/test_gem_package_tar_reader.rb b/test/rubygems/test_gem_package_tar_reader.rb
index 277b552f1b..86ffff4fe5 100644
--- a/test/rubygems/test_gem_package_tar_reader.rb
+++ b/test/rubygems/test_gem_package_tar_reader.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'package/tar_test_case'
-require 'rubygems/package'
+require_relative "package/tar_test_case"
+require "rubygems/package"
class TestGemPackageTarReader < Gem::Package::TarTestCase
def test_each_entry
@@ -25,7 +25,7 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
end
def test_rewind
- content = ('a'..'z').to_a.join(" ")
+ content = ("a".."z").to_a.join(" ")
str =
tar_file_header("lib/foo", "", 010644, content.size, Time.now) +
@@ -56,10 +56,10 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
io = TempIO.new tar
Gem::Package::TarReader.new io do |tar_reader|
- tar_reader.seek 'baz/bar' do |entry|
+ tar_reader.seek "baz/bar" do |entry|
assert_kind_of Gem::Package::TarReader::Entry, entry
- assert_equal 'baz/bar', entry.full_name
+ assert_equal "baz/bar", entry.full_name
end
assert_equal 0, io.pos
@@ -75,8 +75,8 @@ class TestGemPackageTarReader < Gem::Package::TarTestCase
io = TempIO.new tar
Gem::Package::TarReader.new io do |tar_reader|
- tar_reader.seek 'nonexistent' do |entry|
- flunk 'entry missing but entry-found block was run'
+ tar_reader.seek "nonexistent" do |entry|
+ flunk "entry missing but entry-found block was run"
end
assert_equal 0, io.pos
diff --git a/test/rubygems/test_gem_package_tar_reader_entry.rb b/test/rubygems/test_gem_package_tar_reader_entry.rb
index 1be5870146..ffb4542178 100644
--- a/test/rubygems/test_gem_package_tar_reader_entry.rb
+++ b/test/rubygems/test_gem_package_tar_reader_entry.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require_relative 'package/tar_test_case'
-require 'rubygems/package'
+require_relative "package/tar_test_case"
+require "rubygems/package"
class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
def setup
super
- @contents = ('a'..'z').to_a.join * 100
+ @contents = ("a".."z").to_a.join * 100
@tar = String.new
@tar << tar_file_header("lib/foo", "", 0, @contents.size, Time.now)
@@ -43,19 +43,19 @@ class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
assert @entry.bytes_read
e = assert_raise(IOError) { @entry.eof? }
- assert_equal 'closed Gem::Package::TarReader::Entry', e.message
+ assert_equal "closed Gem::Package::TarReader::Entry", e.message
e = assert_raise(IOError) { @entry.getc }
- assert_equal 'closed Gem::Package::TarReader::Entry', e.message
+ assert_equal "closed Gem::Package::TarReader::Entry", e.message
e = assert_raise(IOError) { @entry.pos }
- assert_equal 'closed Gem::Package::TarReader::Entry', e.message
+ assert_equal "closed Gem::Package::TarReader::Entry", e.message
e = assert_raise(IOError) { @entry.read }
- assert_equal 'closed Gem::Package::TarReader::Entry', e.message
+ assert_equal "closed Gem::Package::TarReader::Entry", e.message
e = assert_raise(IOError) { @entry.rewind }
- assert_equal 'closed Gem::Package::TarReader::Entry', e.message
+ assert_equal "closed Gem::Package::TarReader::Entry", e.message
end
def test_closed_eh
@@ -71,7 +71,7 @@ class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
end
def test_full_name
- assert_equal 'lib/foo', @entry.full_name
+ assert_equal "lib/foo", @entry.full_name
end
def test_full_name_null
@@ -82,7 +82,7 @@ class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
@entry.full_name
end
- assert_equal 'tar is corrupt, name contains null byte', e.message
+ assert_equal "tar is corrupt, name contains null byte", e.message
end
def test_getc
diff --git a/test/rubygems/test_gem_package_tar_writer.rb b/test/rubygems/test_gem_package_tar_writer.rb
index 31a91fa21a..5dcb90c14e 100644
--- a/test/rubygems/test_gem_package_tar_writer.rb
+++ b/test/rubygems/test_gem_package_tar_writer.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'package/tar_test_case'
-require 'rubygems/package/tar_writer'
+require_relative "package/tar_test_case"
+require "rubygems/package/tar_writer"
class TestGemPackageTarWriter < Gem::Package::TarTestCase
def setup
@@ -11,7 +11,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
# is not set.
Gem.instance_variable_set(:'@default_source_date_epoch', nil)
- @data = 'abcde12345'
+ @data = "abcde12345"
@io = TempIO.new
@tar_writer = Gem::Package::TarWriter.new @io
@epoch = ENV["SOURCE_DATE_EPOCH"]
@@ -28,11 +28,11 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_file 'x', 0644 do |f|
- f.write 'a' * 10
+ @tar_writer.add_file "x", 0644 do |f|
+ f.write "a" * 10
end
- assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ assert_headers_equal(tar_file_header("x", "", 0644, 10, Time.now),
@io.string[0, 512])
end
assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
@@ -42,18 +42,18 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_source_date_epoch
ENV["SOURCE_DATE_EPOCH"] = "123456789"
Time.stub :now, Time.at(1458518157) do
- @tar_writer.mkdir 'foo', 0644
+ @tar_writer.mkdir "foo", 0644
- assert_headers_equal tar_dir_header('foo', '', 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc),
+ assert_headers_equal tar_dir_header("foo", "", 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc),
@io.string[0, 512]
end
end
def test_add_symlink
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_symlink 'x', 'y', 0644
+ @tar_writer.add_symlink "x", "y", 0644
- assert_headers_equal(tar_symlink_header('x', '', 0644, Time.now, 'y'),
+ assert_headers_equal(tar_symlink_header("x", "", 0644, Time.now, "y"),
@io.string[0, 512])
end
assert_equal 512, @io.pos
@@ -62,9 +62,9 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_symlink_source_date_epoch
ENV["SOURCE_DATE_EPOCH"] = "123456789"
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_symlink 'x', 'y', 0644
+ @tar_writer.add_symlink "x", "y", 0644
- assert_headers_equal(tar_symlink_header('x', '', 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc, 'y'),
+ assert_headers_equal(tar_symlink_header("x", "", 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc, "y"),
@io.string[0, 512])
end
end
@@ -73,19 +73,19 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
digest_algorithms = Digest::SHA1.new, Digest::SHA512.new
Time.stub :now, Time.at(1458518157) do
- digests = @tar_writer.add_file_digest 'x', 0644, digest_algorithms do |io|
- io.write 'a' * 10
+ digests = @tar_writer.add_file_digest "x", 0644, digest_algorithms do |io|
+ io.write "a" * 10
end
- assert_equal '3495ff69d34671d1e15b33a63c1379fdedd3a32a',
- digests['SHA1'].hexdigest
- assert_equal '4714870aff6c97ca09d135834fdb58a6389a50c1' \
- '1fef8ec4afef466fb60a23ac6b7a9c92658f14df' \
- '4993d6b40a4e4d8424196afc347e97640d68de61' \
- 'e1cf14b0',
- digests['SHA512'].hexdigest
+ assert_equal "3495ff69d34671d1e15b33a63c1379fdedd3a32a",
+ digests["SHA1"].hexdigest
+ assert_equal "4714870aff6c97ca09d135834fdb58a6389a50c1" \
+ "1fef8ec4afef466fb60a23ac6b7a9c92658f14df" \
+ "4993d6b40a4e4d8424196afc347e97640d68de61" \
+ "e1cf14b0",
+ digests["SHA512"].hexdigest
- assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ assert_headers_equal(tar_file_header("x", "", 0644, 10, Time.now),
@io.string[0, 512])
end
assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
@@ -96,19 +96,19 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
digest_algorithms = [Digest::SHA1.new, Digest::SHA512.new]
Time.stub :now, Time.at(1458518157) do
- digests = @tar_writer.add_file_digest 'x', 0644, digest_algorithms do |io|
- io.write 'a' * 10
+ digests = @tar_writer.add_file_digest "x", 0644, digest_algorithms do |io|
+ io.write "a" * 10
end
- assert_equal '3495ff69d34671d1e15b33a63c1379fdedd3a32a',
- digests['SHA1'].hexdigest
- assert_equal '4714870aff6c97ca09d135834fdb58a6389a50c1' \
- '1fef8ec4afef466fb60a23ac6b7a9c92658f14df' \
- '4993d6b40a4e4d8424196afc347e97640d68de61' \
- 'e1cf14b0',
- digests['SHA512'].hexdigest
+ assert_equal "3495ff69d34671d1e15b33a63c1379fdedd3a32a",
+ digests["SHA1"].hexdigest
+ assert_equal "4714870aff6c97ca09d135834fdb58a6389a50c1" \
+ "1fef8ec4afef466fb60a23ac6b7a9c92658f14df" \
+ "4993d6b40a4e4d8424196afc347e97640d68de61" \
+ "e1cf14b0",
+ digests["SHA512"].hexdigest
- assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ assert_headers_equal(tar_file_header("x", "", 0644, 10, Time.now),
@io.string[0, 512])
end
assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
@@ -116,26 +116,26 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
end
def test_add_file_signer
- pend 'openssl is missing' unless Gem::HAVE_OPENSSL
+ pend "openssl is missing" unless Gem::HAVE_OPENSSL
signer = Gem::Security::Signer.new PRIVATE_KEY, [PUBLIC_CERT]
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_file_signed 'x', 0644, signer do |io|
- io.write 'a' * 10
+ @tar_writer.add_file_signed "x", 0644, signer do |io|
+ io.write "a" * 10
end
- assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ assert_headers_equal(tar_file_header("x", "", 0644, 10, Time.now),
@io.string[0, 512])
assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
digest = signer.digest_algorithm.new
- digest.update 'a' * 10
+ digest.update "a" * 10
signature = signer.sign digest.digest
- assert_headers_equal(tar_file_header('x.sig', '', 0444, signature.length,
+ assert_headers_equal(tar_file_header("x.sig", "", 0444, signature.length,
Time.now),
@io.string[1024, 512])
assert_equal "#{signature}#{"\0" * (512 - signature.length)}",
@@ -149,11 +149,11 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
signer = Gem::Security::Signer.new nil, nil
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_file_signed 'x', 0644, signer do |io|
- io.write 'a' * 10
+ @tar_writer.add_file_signed "x", 0644, signer do |io|
+ io.write "a" * 10
end
- assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ assert_headers_equal(tar_file_header("x", "", 0644, 10, Time.now),
@io.string[0, 512])
end
assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
@@ -163,11 +163,11 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_simple
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_file_simple 'x', 0644, 10 do |io|
+ @tar_writer.add_file_simple "x", 0644, 10 do |io|
io.write "a" * 10
end
- assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
+ assert_headers_equal(tar_file_header("x", "", 0644, 10, Time.now),
@io.string[0, 512])
assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
@@ -178,20 +178,20 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_simple_source_date_epoch
ENV["SOURCE_DATE_EPOCH"] = "123456789"
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_file_simple 'x', 0644, 10 do |io|
+ @tar_writer.add_file_simple "x", 0644, 10 do |io|
io.write "a" * 10
end
- assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc),
+ assert_headers_equal(tar_file_header("x", "", 0644, 10, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc),
@io.string[0, 512])
end
end
def test_add_file_simple_padding
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_file_simple 'x', 0, 100
+ @tar_writer.add_file_simple "x", 0, 100
- assert_headers_equal tar_file_header('x', '', 0, 100, Time.now),
+ assert_headers_equal tar_file_header("x", "", 0, 100, Time.now),
@io.string[0, 512]
end
@@ -222,34 +222,34 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
e = assert_raise IOError do
@tar_writer.close
end
- assert_equal 'closed Gem::Package::TarWriter', e.message
+ assert_equal "closed Gem::Package::TarWriter", e.message
e = assert_raise IOError do
@tar_writer.flush
end
- assert_equal 'closed Gem::Package::TarWriter', e.message
+ assert_equal "closed Gem::Package::TarWriter", e.message
e = assert_raise IOError do
- @tar_writer.add_file 'x', 0
+ @tar_writer.add_file "x", 0
end
- assert_equal 'closed Gem::Package::TarWriter', e.message
+ assert_equal "closed Gem::Package::TarWriter", e.message
e = assert_raise IOError do
- @tar_writer.add_file_simple 'x', 0, 0
+ @tar_writer.add_file_simple "x", 0, 0
end
- assert_equal 'closed Gem::Package::TarWriter', e.message
+ assert_equal "closed Gem::Package::TarWriter", e.message
e = assert_raise IOError do
- @tar_writer.mkdir 'x', 0
+ @tar_writer.mkdir "x", 0
end
- assert_equal 'closed Gem::Package::TarWriter', e.message
+ assert_equal "closed Gem::Package::TarWriter", e.message
end
def test_mkdir
Time.stub :now, Time.at(1458518157) do
- @tar_writer.mkdir 'foo', 0644
+ @tar_writer.mkdir "foo", 0644
- assert_headers_equal tar_dir_header('foo', '', 0644, Time.now),
+ assert_headers_equal tar_dir_header("foo", "", 0644, Time.now),
@io.string[0, 512]
assert_equal 512, @io.pos
@@ -259,42 +259,42 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_mkdir_source_date_epoch
ENV["SOURCE_DATE_EPOCH"] = "123456789"
Time.stub :now, Time.at(1458518157) do
- @tar_writer.mkdir 'foo', 0644
+ @tar_writer.mkdir "foo", 0644
- assert_headers_equal tar_dir_header('foo', '', 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc),
+ assert_headers_equal tar_dir_header("foo", "", 0644, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc),
@io.string[0, 512]
end
end
def test_split_name
- assert_equal ['b' * 100, 'a' * 155],
+ assert_equal ["b" * 100, "a" * 155],
@tar_writer.split_name("#{'a' * 155}/#{'b' * 100}")
- assert_equal ["#{'qwer/' * 19}bla", 'a' * 151],
+ assert_equal ["#{'qwer/' * 19}bla", "a" * 151],
@tar_writer.split_name("#{'a' * 151}/#{'qwer/' * 19}bla")
names = [
- ([''] + ['123456789'] * 9 + ['1234567890']).join('/'), # 101 bytes (several pieces)
- (['123456789'] * 9 + ['1234567890'] + ['']).join('/'), # 101 bytes (several pieces)
- '/' * 99,
- '/' * 100,
- '/' * 101,
- '/' * 102,
+ ([""] + ["123456789"] * 9 + ["1234567890"]).join("/"), # 101 bytes (several pieces)
+ (["123456789"] * 9 + ["1234567890"] + [""]).join("/"), # 101 bytes (several pieces)
+ "/" * 99,
+ "/" * 100,
+ "/" * 101,
+ "/" * 102,
]
names.each do |name|
newname, prefix = @tar_writer.split_name(name)
assert(!(newname.empty?), "split_name() returned empty name")
assert(newname.bytesize <= 100, "split_name() returned name longer than 100 bytes: '#{newname}' for '#{name}'")
assert(prefix.bytesize <= 155, "split_name() returned prefix longer than 155 bytes: '#{prefix}' for '#{name}'")
- newname = [prefix, newname].join('/') unless prefix.empty?
+ newname = [prefix, newname].join("/") unless prefix.empty?
assert_equal name, newname
end
end
def test_split_name_too_long_name
- name = File.join 'a', 'b' * 100
- assert_equal ['b' * 100, 'a'], @tar_writer.split_name(name)
+ name = File.join "a", "b" * 100
+ assert_equal ["b" * 100, "a"], @tar_writer.split_name(name)
- name = File.join 'a', 'b' * 101
+ name = File.join "a", "b" * 101
exception = assert_raise Gem::Package::TooLongFileName do
@tar_writer.split_name name
end
@@ -302,7 +302,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
# note, GNU tar 1.28 is unable to handle this case too,
# tested with "tar --format=ustar -cPf /tmp/foo.tartar -- /aaaaaa....a"
- name = '/' + 'a' * 100
+ name = "/" + "a" * 100
exception = assert_raise Gem::Package::TooLongFileName do
@tar_writer.split_name name
end
@@ -310,10 +310,10 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
end
def test_split_name_too_long_prefix
- name = File.join 'a' * 155, 'b'
- assert_equal ['b', 'a' * 155], @tar_writer.split_name(name)
+ name = File.join "a" * 155, "b"
+ assert_equal ["b", "a" * 155], @tar_writer.split_name(name)
- name = File.join 'a' * 156, 'b'
+ name = File.join "a" * 156, "b"
exception = assert_raise Gem::Package::TooLongFileName do
@tar_writer.split_name name
end
@@ -321,7 +321,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
end
def test_split_name_too_long_total
- name = 'a' * 257
+ name = "a" * 257
exception = assert_raise Gem::Package::TooLongFileName do
@tar_writer.split_name name
end
diff --git a/test/rubygems/test_gem_package_task.rb b/test/rubygems/test_gem_package_task.rb
index 0cedfe56eb..65fb818d7a 100644
--- a/test/rubygems/test_gem_package_task.rb
+++ b/test/rubygems/test_gem_package_task.rb
@@ -1,15 +1,15 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems'
+require_relative "helper"
+require "rubygems"
begin
- require 'rubygems/package_task'
+ require "rubygems/package_task"
rescue LoadError => e
- raise unless e.path == 'rake/packagetask'
+ raise unless e.path == "rake/packagetask"
end
unless defined?(Rake::PackageTask)
- warn 'Skipping Gem::PackageTask tests. rake not found.'
+ warn "Skipping Gem::PackageTask tests. rake not found."
end
class TestGemPackageTask < Gem::TestCase
@@ -23,7 +23,7 @@ class TestGemPackageTask < Gem::TestCase
g.authors = %w[author]
g.files = %w[x]
- g.summary = 'summary'
+ g.summary = "summary"
end
Rake.application = Rake::Application.new
@@ -35,12 +35,12 @@ class TestGemPackageTask < Gem::TestCase
assert_equal %w[x y], pkg.package_files
Dir.chdir @tempdir do
- FileUtils.touch 'x'
- FileUtils.touch 'y'
+ FileUtils.touch "x"
+ FileUtils.touch "y"
- Rake.application['package'].invoke
+ Rake.application["package"].invoke
- assert_path_exist 'pkg/pkgr-1.2.3.gem'
+ assert_path_exist "pkg/pkgr-1.2.3.gem"
end
ensure
RakeFileUtils.verbose_flag = original_rake_fileutils_verbosity
@@ -53,7 +53,7 @@ class TestGemPackageTask < Gem::TestCase
g.authors = %w[author]
g.files = %w[x]
- g.summary = 'summary'
+ g.summary = "summary"
end
_, err = capture_output do
@@ -66,10 +66,10 @@ class TestGemPackageTask < Gem::TestCase
assert_equal %w[x y], pkg.package_files
Dir.chdir @tempdir do
- FileUtils.touch 'x'
- FileUtils.touch 'y'
+ FileUtils.touch "x"
+ FileUtils.touch "y"
- Rake.application['package'].invoke
+ Rake.application["package"].invoke
end
end
@@ -104,14 +104,14 @@ class TestGemPackageTask < Gem::TestCase
def test_package_dir_path
gem = Gem::Specification.new do |g|
- g.name = 'nokogiri'
- g.version = '1.5.0'
- g.platform = 'java'
+ g.name = "nokogiri"
+ g.version = "1.5.0"
+ g.platform = "java"
end
pkg = Gem::PackageTask.new gem
pkg.define
- assert_equal 'pkg/nokogiri-1.5.0-java', pkg.package_dir_path
+ assert_equal "pkg/nokogiri-1.5.0-java", pkg.package_dir_path
end
end if defined?(Rake::PackageTask)
diff --git a/test/rubygems/test_gem_path_support.rb b/test/rubygems/test_gem_path_support.rb
index 394cba2b7f..fa0e3990be 100644
--- a/test/rubygems/test_gem_path_support.rb
+++ b/test/rubygems/test_gem_path_support.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems'
-require 'fileutils'
+require_relative "helper"
+require "rubygems"
+require "fileutils"
class TestGemPathSupport < Gem::TestCase
def setup
@@ -25,7 +25,7 @@ class TestGemPathSupport < Gem::TestCase
assert_equal File.join(@tempdir, "foo"), ps.home
- expected = ENV["GEM_PATH"].split(File::PATH_SEPARATOR) + [File.join(@tempdir, 'foo')]
+ expected = ENV["GEM_PATH"].split(File::PATH_SEPARATOR) + [File.join(@tempdir, "foo")]
assert_equal expected, ps.path
end
@@ -45,8 +45,8 @@ class TestGemPathSupport < Gem::TestCase
assert_equal ENV["GEM_HOME"], ps.home
expected = [
- File.join(@tempdir, 'foo'),
- File.join(@tempdir, 'bar'),
+ File.join(@tempdir, "foo"),
+ File.join(@tempdir, "bar"),
ENV["GEM_HOME"],
]
@@ -65,8 +65,8 @@ class TestGemPathSupport < Gem::TestCase
assert_equal ENV["GEM_HOME"], ps.home
expected = [
- File.join(@tempdir, 'foo'),
- File.join(@tempdir, 'bar'),
+ File.join(@tempdir, "foo"),
+ File.join(@tempdir, "bar"),
] + Gem.default_path << ENV["GEM_HOME"]
assert_equal expected, ps.path
@@ -83,8 +83,8 @@ class TestGemPathSupport < Gem::TestCase
assert_equal ENV["GEM_HOME"], ps.home
expected = [
- File.join(@tempdir, 'foo'),
- File.join(@tempdir, 'bar'),
+ File.join(@tempdir, "foo"),
+ File.join(@tempdir, "bar"),
] + Gem.default_path << ENV["GEM_HOME"]
assert_equal expected, ps.path
@@ -97,7 +97,7 @@ class TestGemPathSupport < Gem::TestCase
assert_equal File.join(@tempdir, "foo"), ps.home
- expected = [File.join(@tempdir, 'foo'), File.join(@tempdir, 'bar')]
+ expected = [File.join(@tempdir, "foo"), File.join(@tempdir, "bar")]
assert_equal expected, ps.path
end
end
@@ -108,12 +108,12 @@ class TestGemPathSupport < Gem::TestCase
ps = Gem::PathSupport.new ENV
assert_equal Gem.default_spec_cache_dir, ps.spec_cache_dir
- ENV["GEM_SPEC_CACHE"] = 'bar'
+ ENV["GEM_SPEC_CACHE"] = "bar"
ps = Gem::PathSupport.new ENV
assert_equal ENV["GEM_SPEC_CACHE"], ps.spec_cache_dir
- ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
+ ENV["GEM_SPEC_CACHE"] = File.join @tempdir, "spec_cache"
ps = Gem::PathSupport.new "GEM_SPEC_CACHE" => "foo"
assert_equal "foo", ps.spec_cache_dir
@@ -126,7 +126,7 @@ class TestGemPathSupport < Gem::TestCase
begin
File.symlink(dir, symlink)
rescue NotImplementedError, SystemCallError
- pend 'symlinks not supported'
+ pend "symlinks not supported"
end
not_existing = "#{@tempdir}/does_not_exist"
path = "#{symlink}#{File::PATH_SEPARATOR}#{not_existing}"
diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb
index b9202ab7be..0fb5bf59a5 100644
--- a/test/rubygems/test_gem_platform.rb
+++ b/test/rubygems/test_gem_platform.rb
@@ -1,47 +1,47 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/platform'
-require 'rbconfig'
+require_relative "helper"
+require "rubygems/platform"
+require "rbconfig"
class TestGemPlatform < Gem::TestCase
def test_self_local
- util_set_arch 'i686-darwin8.10.1'
+ util_set_arch "i686-darwin8.10.1"
assert_equal Gem::Platform.new(%w[x86 darwin 8]), Gem::Platform.local
end
def test_self_match
Gem::Deprecate.skip_during do
- assert Gem::Platform.match(nil), 'nil == ruby'
- assert Gem::Platform.match(Gem::Platform.local), 'exact match'
- assert Gem::Platform.match(Gem::Platform.local.to_s), '=~ match'
- assert Gem::Platform.match(Gem::Platform::RUBY), 'ruby'
+ assert Gem::Platform.match(nil), "nil == ruby"
+ assert Gem::Platform.match(Gem::Platform.local), "exact match"
+ assert Gem::Platform.match(Gem::Platform.local.to_s), "=~ match"
+ assert Gem::Platform.match(Gem::Platform::RUBY), "ruby"
end
end
def test_self_match_gem?
- assert Gem::Platform.match_gem?(nil, 'json'), 'nil == ruby'
- assert Gem::Platform.match_gem?(Gem::Platform.local, 'json'), 'exact match'
- assert Gem::Platform.match_gem?(Gem::Platform.local.to_s, 'json'), '=~ match'
- assert Gem::Platform.match_gem?(Gem::Platform::RUBY, 'json'), 'ruby'
+ assert Gem::Platform.match_gem?(nil, "json"), "nil == ruby"
+ assert Gem::Platform.match_gem?(Gem::Platform.local, "json"), "exact match"
+ assert Gem::Platform.match_gem?(Gem::Platform.local.to_s, "json"), "=~ match"
+ assert Gem::Platform.match_gem?(Gem::Platform::RUBY, "json"), "ruby"
end
def test_self_match_spec?
make_spec = -> platform do
- util_spec 'mygem-for-platform-match_spec', '1' do |s|
+ util_spec "mygem-for-platform-match_spec", "1" do |s|
s.platform = platform
end
end
- assert Gem::Platform.match_spec?(make_spec.call(nil)), 'nil == ruby'
- assert Gem::Platform.match_spec?(make_spec.call(Gem::Platform.local)), 'exact match'
- assert Gem::Platform.match_spec?(make_spec.call(Gem::Platform.local.to_s)), '=~ match'
- assert Gem::Platform.match_spec?(make_spec.call(Gem::Platform::RUBY)), 'ruby'
+ assert Gem::Platform.match_spec?(make_spec.call(nil)), "nil == ruby"
+ assert Gem::Platform.match_spec?(make_spec.call(Gem::Platform.local)), "exact match"
+ assert Gem::Platform.match_spec?(make_spec.call(Gem::Platform.local.to_s)), "=~ match"
+ assert Gem::Platform.match_spec?(make_spec.call(Gem::Platform::RUBY)), "ruby"
end
def test_self_match_spec_with_match_gem_override
make_spec = -> name, platform do
- util_spec name, '1' do |s|
+ util_spec name, "1" do |s|
s.platform = platform
end
end
@@ -50,7 +50,7 @@ class TestGemPlatform < Gem::TestCase
alias_method :original_match_gem?, :match_gem?
def match_gem?(platform, gem_name)
# e.g., sassc and libv8 are such gems, their native extensions do not use the Ruby C API
- if gem_name == 'gem-with-ruby-impl-independent-precompiled-ext'
+ if gem_name == "gem-with-ruby-impl-independent-precompiled-ext"
match_platforms?(platform, [Gem::Platform::RUBY, Gem::Platform.local])
else
match_platforms?(platform, Gem.platforms)
@@ -61,10 +61,10 @@ class TestGemPlatform < Gem::TestCase
platforms = Gem.platforms
Gem.platforms = [Gem::Platform::RUBY]
begin
- assert_equal true, Gem::Platform.match_spec?(make_spec.call('mygem', Gem::Platform::RUBY))
- assert_equal false, Gem::Platform.match_spec?(make_spec.call('mygem', Gem::Platform.local))
+ assert_equal true, Gem::Platform.match_spec?(make_spec.call("mygem", Gem::Platform::RUBY))
+ assert_equal false, Gem::Platform.match_spec?(make_spec.call("mygem", Gem::Platform.local))
- name = 'gem-with-ruby-impl-independent-precompiled-ext'
+ name = "gem-with-ruby-impl-independent-precompiled-ext"
assert_equal true, Gem::Platform.match_spec?(make_spec.call(name, Gem::Platform.local))
ensure
Gem.platforms = platforms
@@ -80,65 +80,65 @@ class TestGemPlatform < Gem::TestCase
assert_equal Gem::Platform.local, Gem::Platform.new(Gem::Platform::CURRENT)
assert_equal Gem::Platform::RUBY, Gem::Platform.new(Gem::Platform::RUBY)
assert_equal Gem::Platform::RUBY, Gem::Platform.new(nil)
- assert_equal Gem::Platform::RUBY, Gem::Platform.new('')
+ assert_equal Gem::Platform::RUBY, Gem::Platform.new("")
end
def test_initialize
test_cases = {
- 'amd64-freebsd6' => ['amd64', 'freebsd', '6'],
- 'hppa2.0w-hpux11.31' => ['hppa2.0w', 'hpux', '11'],
- 'java' => [nil, 'java', nil],
- 'jruby' => [nil, 'java', nil],
- 'universal-dotnet' => ['universal', 'dotnet', nil],
- 'universal-dotnet2.0' => ['universal', 'dotnet', '2.0'],
- 'universal-dotnet4.0' => ['universal', 'dotnet', '4.0'],
- 'powerpc-aix5.3.0.0' => ['powerpc', 'aix', '5'],
- 'powerpc-darwin7' => ['powerpc', 'darwin', '7'],
- 'powerpc-darwin8' => ['powerpc', 'darwin', '8'],
- 'powerpc-linux' => ['powerpc', 'linux', nil],
- 'powerpc64-linux' => ['powerpc64', 'linux', nil],
- 'sparc-solaris2.10' => ['sparc', 'solaris', '2.10'],
- 'sparc-solaris2.8' => ['sparc', 'solaris', '2.8'],
- 'sparc-solaris2.9' => ['sparc', 'solaris', '2.9'],
- 'universal-darwin8' => ['universal', 'darwin', '8'],
- 'universal-darwin9' => ['universal', 'darwin', '9'],
- 'universal-macruby' => ['universal', 'macruby', nil],
- 'i386-cygwin' => ['x86', 'cygwin', nil],
- 'i686-darwin' => ['x86', 'darwin', nil],
- 'i686-darwin8.4.1' => ['x86', 'darwin', '8'],
- 'i386-freebsd4.11' => ['x86', 'freebsd', '4'],
- 'i386-freebsd5' => ['x86', 'freebsd', '5'],
- 'i386-freebsd6' => ['x86', 'freebsd', '6'],
- 'i386-freebsd7' => ['x86', 'freebsd', '7'],
- 'i386-freebsd' => ['x86', 'freebsd', nil],
- 'universal-freebsd' => ['universal', 'freebsd', nil],
- 'i386-java1.5' => ['x86', 'java', '1.5'],
- 'x86-java1.6' => ['x86', 'java', '1.6'],
- 'i386-java1.6' => ['x86', 'java', '1.6'],
- 'i686-linux' => ['x86', 'linux', nil],
- 'i586-linux' => ['x86', 'linux', nil],
- 'i486-linux' => ['x86', 'linux', nil],
- 'i386-linux' => ['x86', 'linux', nil],
- 'i586-linux-gnu' => ['x86', 'linux', nil],
- 'i386-linux-gnu' => ['x86', 'linux', nil],
- 'i386-mingw32' => ['x86', 'mingw32', nil],
- 'x64-mingw-ucrt' => ['x64', 'mingw', 'ucrt'],
- 'i386-mswin32' => ['x86', 'mswin32', nil],
- 'i386-mswin32_80' => ['x86', 'mswin32', '80'],
- 'i386-mswin32-80' => ['x86', 'mswin32', '80'],
- 'x86-mswin32' => ['x86', 'mswin32', nil],
- 'x86-mswin32_60' => ['x86', 'mswin32', '60'],
- 'x86-mswin32-60' => ['x86', 'mswin32', '60'],
- 'i386-netbsdelf' => ['x86', 'netbsdelf', nil],
- 'i386-openbsd4.0' => ['x86', 'openbsd', '4.0'],
- 'i386-solaris2.10' => ['x86', 'solaris', '2.10'],
- 'i386-solaris2.8' => ['x86', 'solaris', '2.8'],
- 'mswin32' => ['x86', 'mswin32', nil],
- 'x86_64-linux' => ['x86_64', 'linux', nil],
- 'x86_64-linux-musl' => ['x86_64', 'linux', 'musl'],
- 'x86_64-openbsd3.9' => ['x86_64', 'openbsd', '3.9'],
- 'x86_64-openbsd4.0' => ['x86_64', 'openbsd', '4.0'],
- 'x86_64-openbsd' => ['x86_64', 'openbsd', nil],
+ "amd64-freebsd6" => ["amd64", "freebsd", "6"],
+ "hppa2.0w-hpux11.31" => ["hppa2.0w", "hpux", "11"],
+ "java" => [nil, "java", nil],
+ "jruby" => [nil, "java", nil],
+ "universal-dotnet" => ["universal", "dotnet", nil],
+ "universal-dotnet2.0" => ["universal", "dotnet", "2.0"],
+ "universal-dotnet4.0" => ["universal", "dotnet", "4.0"],
+ "powerpc-aix5.3.0.0" => ["powerpc", "aix", "5"],
+ "powerpc-darwin7" => ["powerpc", "darwin", "7"],
+ "powerpc-darwin8" => ["powerpc", "darwin", "8"],
+ "powerpc-linux" => ["powerpc", "linux", nil],
+ "powerpc64-linux" => ["powerpc64", "linux", nil],
+ "sparc-solaris2.10" => ["sparc", "solaris", "2.10"],
+ "sparc-solaris2.8" => ["sparc", "solaris", "2.8"],
+ "sparc-solaris2.9" => ["sparc", "solaris", "2.9"],
+ "universal-darwin8" => ["universal", "darwin", "8"],
+ "universal-darwin9" => ["universal", "darwin", "9"],
+ "universal-macruby" => ["universal", "macruby", nil],
+ "i386-cygwin" => ["x86", "cygwin", nil],
+ "i686-darwin" => ["x86", "darwin", nil],
+ "i686-darwin8.4.1" => ["x86", "darwin", "8"],
+ "i386-freebsd4.11" => ["x86", "freebsd", "4"],
+ "i386-freebsd5" => ["x86", "freebsd", "5"],
+ "i386-freebsd6" => ["x86", "freebsd", "6"],
+ "i386-freebsd7" => ["x86", "freebsd", "7"],
+ "i386-freebsd" => ["x86", "freebsd", nil],
+ "universal-freebsd" => ["universal", "freebsd", nil],
+ "i386-java1.5" => ["x86", "java", "1.5"],
+ "x86-java1.6" => ["x86", "java", "1.6"],
+ "i386-java1.6" => ["x86", "java", "1.6"],
+ "i686-linux" => ["x86", "linux", nil],
+ "i586-linux" => ["x86", "linux", nil],
+ "i486-linux" => ["x86", "linux", nil],
+ "i386-linux" => ["x86", "linux", nil],
+ "i586-linux-gnu" => ["x86", "linux", nil],
+ "i386-linux-gnu" => ["x86", "linux", nil],
+ "i386-mingw32" => ["x86", "mingw32", nil],
+ "x64-mingw-ucrt" => ["x64", "mingw", "ucrt"],
+ "i386-mswin32" => ["x86", "mswin32", nil],
+ "i386-mswin32_80" => ["x86", "mswin32", "80"],
+ "i386-mswin32-80" => ["x86", "mswin32", "80"],
+ "x86-mswin32" => ["x86", "mswin32", nil],
+ "x86-mswin32_60" => ["x86", "mswin32", "60"],
+ "x86-mswin32-60" => ["x86", "mswin32", "60"],
+ "i386-netbsdelf" => ["x86", "netbsdelf", nil],
+ "i386-openbsd4.0" => ["x86", "openbsd", "4.0"],
+ "i386-solaris2.10" => ["x86", "solaris", "2.10"],
+ "i386-solaris2.8" => ["x86", "solaris", "2.8"],
+ "mswin32" => ["x86", "mswin32", nil],
+ "x86_64-linux" => ["x86_64", "linux", nil],
+ "x86_64-linux-musl" => ["x86_64", "linux", "musl"],
+ "x86_64-openbsd3.9" => ["x86_64", "openbsd", "3.9"],
+ "x86_64-openbsd4.0" => ["x86_64", "openbsd", "4.0"],
+ "x86_64-openbsd" => ["x86_64", "openbsd", nil],
}
test_cases.each do |arch, expected|
@@ -148,67 +148,67 @@ class TestGemPlatform < Gem::TestCase
end
def test_initialize_command_line
- expected = ['x86', 'mswin32', nil]
+ expected = ["x86", "mswin32", nil]
- platform = Gem::Platform.new 'i386-mswin32'
+ platform = Gem::Platform.new "i386-mswin32"
- assert_equal expected, platform.to_a, 'i386-mswin32'
+ assert_equal expected, platform.to_a, "i386-mswin32"
- expected = ['x86', 'mswin32', '80']
+ expected = ["x86", "mswin32", "80"]
- platform = Gem::Platform.new 'i386-mswin32-80'
+ platform = Gem::Platform.new "i386-mswin32-80"
- assert_equal expected, platform.to_a, 'i386-mswin32-80'
+ assert_equal expected, platform.to_a, "i386-mswin32-80"
- expected = ['x86', 'solaris', '2.10']
+ expected = ["x86", "solaris", "2.10"]
- platform = Gem::Platform.new 'i386-solaris-2.10'
+ platform = Gem::Platform.new "i386-solaris-2.10"
- assert_equal expected, platform.to_a, 'i386-solaris-2.10'
+ assert_equal expected, platform.to_a, "i386-solaris-2.10"
end
def test_initialize_mswin32_vc6
- orig_RUBY_SO_NAME = RbConfig::CONFIG['RUBY_SO_NAME']
- RbConfig::CONFIG['RUBY_SO_NAME'] = 'msvcrt-ruby18'
+ orig_RUBY_SO_NAME = RbConfig::CONFIG["RUBY_SO_NAME"]
+ RbConfig::CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby18"
- expected = ['x86', 'mswin32', nil]
+ expected = ["x86", "mswin32", nil]
- platform = Gem::Platform.new 'i386-mswin32'
+ platform = Gem::Platform.new "i386-mswin32"
- assert_equal expected, platform.to_a, 'i386-mswin32 VC6'
+ assert_equal expected, platform.to_a, "i386-mswin32 VC6"
ensure
if orig_RUBY_SO_NAME
- RbConfig::CONFIG['RUBY_SO_NAME'] = orig_RUBY_SO_NAME
+ RbConfig::CONFIG["RUBY_SO_NAME"] = orig_RUBY_SO_NAME
else
- RbConfig::CONFIG.delete 'RUBY_SO_NAME'
+ RbConfig::CONFIG.delete "RUBY_SO_NAME"
end
end
def test_initialize_platform
- platform = Gem::Platform.new 'cpu-my_platform1'
+ platform = Gem::Platform.new "cpu-my_platform1"
- assert_equal 'cpu', platform.cpu
- assert_equal 'my_platform', platform.os
- assert_equal '1', platform.version
+ assert_equal "cpu", platform.cpu
+ assert_equal "my_platform", platform.os
+ assert_equal "1", platform.version
end
def test_initialize_test
- platform = Gem::Platform.new 'cpu-my_platform1'
- assert_equal 'cpu', platform.cpu
- assert_equal 'my_platform', platform.os
- assert_equal '1', platform.version
-
- platform = Gem::Platform.new 'cpu-other_platform1'
- assert_equal 'cpu', platform.cpu
- assert_equal 'other_platform', platform.os
- assert_equal '1', platform.version
+ platform = Gem::Platform.new "cpu-my_platform1"
+ assert_equal "cpu", platform.cpu
+ assert_equal "my_platform", platform.os
+ assert_equal "1", platform.version
+
+ platform = Gem::Platform.new "cpu-other_platform1"
+ assert_equal "cpu", platform.cpu
+ assert_equal "other_platform", platform.os
+ assert_equal "1", platform.version
end
def test_to_s
if win_platform?
- assert_equal 'x86-mswin32-60', Gem::Platform.local.to_s
+ assert_equal "x86-mswin32-60", Gem::Platform.local.to_s
else
- assert_equal 'x86-darwin-8', Gem::Platform.local.to_s
+ assert_equal "x86-darwin-8", Gem::Platform.local.to_s
end
end
@@ -231,146 +231,146 @@ class TestGemPlatform < Gem::TestCase
end
def test_equals3_cpu
- ppc_darwin8 = Gem::Platform.new 'powerpc-darwin8.0'
- uni_darwin8 = Gem::Platform.new 'universal-darwin8.0'
- x86_darwin8 = Gem::Platform.new 'i686-darwin8.0'
-
- util_set_arch 'powerpc-darwin8'
- assert((ppc_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
- assert((uni_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
- refute((x86_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
-
- util_set_arch 'i686-darwin8'
- refute((ppc_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
- assert((uni_darwin8 === Gem::Platform.local), 'x86 =~ universal')
- assert((x86_darwin8 === Gem::Platform.local), 'powerpc =~ universal')
-
- util_set_arch 'universal-darwin8'
- assert((ppc_darwin8 === Gem::Platform.local), 'universal =~ ppc')
- assert((uni_darwin8 === Gem::Platform.local), 'universal =~ universal')
- assert((x86_darwin8 === Gem::Platform.local), 'universal =~ x86')
+ ppc_darwin8 = Gem::Platform.new "powerpc-darwin8.0"
+ uni_darwin8 = Gem::Platform.new "universal-darwin8.0"
+ x86_darwin8 = Gem::Platform.new "i686-darwin8.0"
+
+ util_set_arch "powerpc-darwin8"
+ assert((ppc_darwin8 === Gem::Platform.local), "powerpc =~ universal")
+ assert((uni_darwin8 === Gem::Platform.local), "powerpc =~ universal")
+ refute((x86_darwin8 === Gem::Platform.local), "powerpc =~ universal")
+
+ util_set_arch "i686-darwin8"
+ refute((ppc_darwin8 === Gem::Platform.local), "powerpc =~ universal")
+ assert((uni_darwin8 === Gem::Platform.local), "x86 =~ universal")
+ assert((x86_darwin8 === Gem::Platform.local), "powerpc =~ universal")
+
+ util_set_arch "universal-darwin8"
+ assert((ppc_darwin8 === Gem::Platform.local), "universal =~ ppc")
+ assert((uni_darwin8 === Gem::Platform.local), "universal =~ universal")
+ assert((x86_darwin8 === Gem::Platform.local), "universal =~ x86")
end
def test_nil_cpu_arch_is_treated_as_universal
- with_nil_arch = Gem::Platform.new [nil, 'mingw32']
- with_uni_arch = Gem::Platform.new ['universal', 'mingw32']
- with_x86_arch = Gem::Platform.new ['x86', 'mingw32']
-
- assert((with_nil_arch === with_uni_arch), 'nil =~ universal')
- assert((with_uni_arch === with_nil_arch), 'universal =~ nil')
- assert((with_nil_arch === with_x86_arch), 'nil =~ x86')
- assert((with_x86_arch === with_nil_arch), 'x86 =~ nil')
+ with_nil_arch = Gem::Platform.new [nil, "mingw32"]
+ with_uni_arch = Gem::Platform.new ["universal", "mingw32"]
+ with_x86_arch = Gem::Platform.new ["x86", "mingw32"]
+
+ assert((with_nil_arch === with_uni_arch), "nil =~ universal")
+ assert((with_uni_arch === with_nil_arch), "universal =~ nil")
+ assert((with_nil_arch === with_x86_arch), "nil =~ x86")
+ assert((with_x86_arch === with_nil_arch), "x86 =~ nil")
end
def test_equals3_cpu_arm
- arm = Gem::Platform.new 'arm-linux'
- armv5 = Gem::Platform.new 'armv5-linux'
- armv7 = Gem::Platform.new 'armv7-linux'
-
- util_set_arch 'armv5-linux'
- assert((arm === Gem::Platform.local), 'arm === armv5')
- assert((armv5 === Gem::Platform.local), 'armv5 === armv5')
- refute((armv7 === Gem::Platform.local), 'armv7 === armv5')
- refute((Gem::Platform.local === arm), 'armv5 === arm')
-
- util_set_arch 'armv7-linux'
- assert((arm === Gem::Platform.local), 'arm === armv7')
- refute((armv5 === Gem::Platform.local), 'armv5 === armv7')
- assert((armv7 === Gem::Platform.local), 'armv7 === armv7')
- refute((Gem::Platform.local === arm), 'armv7 === arm')
+ arm = Gem::Platform.new "arm-linux"
+ armv5 = Gem::Platform.new "armv5-linux"
+ armv7 = Gem::Platform.new "armv7-linux"
+
+ util_set_arch "armv5-linux"
+ assert((arm === Gem::Platform.local), "arm === armv5")
+ assert((armv5 === Gem::Platform.local), "armv5 === armv5")
+ refute((armv7 === Gem::Platform.local), "armv7 === armv5")
+ refute((Gem::Platform.local === arm), "armv5 === arm")
+
+ util_set_arch "armv7-linux"
+ assert((arm === Gem::Platform.local), "arm === armv7")
+ refute((armv5 === Gem::Platform.local), "armv5 === armv7")
+ assert((armv7 === Gem::Platform.local), "armv7 === armv7")
+ refute((Gem::Platform.local === arm), "armv7 === arm")
end
def test_equals3_universal_mingw
- uni_mingw = Gem::Platform.new 'universal-mingw'
- mingw32 = Gem::Platform.new 'x64-mingw32'
- mingw_ucrt = Gem::Platform.new 'x64-mingw-ucrt'
-
- util_set_arch 'x64-mingw32'
- assert((uni_mingw === Gem::Platform.local), 'uni_mingw === mingw32')
- assert((mingw32 === Gem::Platform.local), 'mingw32 === mingw32')
- refute((mingw_ucrt === Gem::Platform.local), 'mingw32 === mingw_ucrt')
-
- util_set_arch 'x64-mingw-ucrt'
- assert((uni_mingw === Gem::Platform.local), 'uni_mingw === mingw32')
- assert((mingw_ucrt === Gem::Platform.local), 'mingw_ucrt === mingw_ucrt')
- refute((mingw32 === Gem::Platform.local), 'mingw32 === mingw_ucrt')
+ uni_mingw = Gem::Platform.new "universal-mingw"
+ mingw32 = Gem::Platform.new "x64-mingw32"
+ mingw_ucrt = Gem::Platform.new "x64-mingw-ucrt"
+
+ util_set_arch "x64-mingw32"
+ assert((uni_mingw === Gem::Platform.local), "uni_mingw === mingw32")
+ assert((mingw32 === Gem::Platform.local), "mingw32 === mingw32")
+ refute((mingw_ucrt === Gem::Platform.local), "mingw32 === mingw_ucrt")
+
+ util_set_arch "x64-mingw-ucrt"
+ assert((uni_mingw === Gem::Platform.local), "uni_mingw === mingw32")
+ assert((mingw_ucrt === Gem::Platform.local), "mingw_ucrt === mingw_ucrt")
+ refute((mingw32 === Gem::Platform.local), "mingw32 === mingw_ucrt")
end
def test_equals3_version
- util_set_arch 'i686-darwin8'
+ util_set_arch "i686-darwin8"
- x86_darwin = Gem::Platform.new ['x86', 'darwin', nil]
- x86_darwin7 = Gem::Platform.new ['x86', 'darwin', '7']
- x86_darwin8 = Gem::Platform.new ['x86', 'darwin', '8']
- x86_darwin9 = Gem::Platform.new ['x86', 'darwin', '9']
+ x86_darwin = Gem::Platform.new ["x86", "darwin", nil]
+ x86_darwin7 = Gem::Platform.new ["x86", "darwin", "7"]
+ x86_darwin8 = Gem::Platform.new ["x86", "darwin", "8"]
+ x86_darwin9 = Gem::Platform.new ["x86", "darwin", "9"]
- assert((x86_darwin === Gem::Platform.local), 'x86_darwin === x86_darwin8')
- assert((x86_darwin8 === Gem::Platform.local), 'x86_darwin8 === x86_darwin8')
+ assert((x86_darwin === Gem::Platform.local), "x86_darwin === x86_darwin8")
+ assert((x86_darwin8 === Gem::Platform.local), "x86_darwin8 === x86_darwin8")
- refute((x86_darwin7 === Gem::Platform.local), 'x86_darwin7 === x86_darwin8')
- refute((x86_darwin9 === Gem::Platform.local), 'x86_darwin9 === x86_darwin8')
+ refute((x86_darwin7 === Gem::Platform.local), "x86_darwin7 === x86_darwin8")
+ refute((x86_darwin9 === Gem::Platform.local), "x86_darwin9 === x86_darwin8")
end
def test_equals_tilde
- util_set_arch 'i386-mswin32'
+ util_set_arch "i386-mswin32"
- assert_local_match 'mswin32'
- assert_local_match 'i386-mswin32'
+ assert_local_match "mswin32"
+ assert_local_match "i386-mswin32"
# oddballs
- assert_local_match 'i386-mswin32-mq5.3'
- assert_local_match 'i386-mswin32-mq6'
- refute_local_match 'win32-1.8.2-VC7'
- refute_local_match 'win32-1.8.4-VC6'
- refute_local_match 'win32-source'
- refute_local_match 'windows'
-
- util_set_arch 'i686-linux'
- assert_local_match 'i486-linux'
- assert_local_match 'i586-linux'
- assert_local_match 'i686-linux'
-
- util_set_arch 'i686-darwin8'
- assert_local_match 'i686-darwin8.4.1'
- assert_local_match 'i686-darwin8.8.2'
-
- util_set_arch 'java'
- assert_local_match 'java'
- assert_local_match 'jruby'
-
- util_set_arch 'universal-dotnet2.0'
- assert_local_match 'universal-dotnet'
- assert_local_match 'universal-dotnet-2.0'
- refute_local_match 'universal-dotnet-4.0'
- assert_local_match 'dotnet'
- assert_local_match 'dotnet-2.0'
- refute_local_match 'dotnet-4.0'
-
- util_set_arch 'universal-dotnet4.0'
- assert_local_match 'universal-dotnet'
- refute_local_match 'universal-dotnet-2.0'
- assert_local_match 'universal-dotnet-4.0'
- assert_local_match 'dotnet'
- refute_local_match 'dotnet-2.0'
- assert_local_match 'dotnet-4.0'
-
- util_set_arch 'universal-macruby-1.0'
- assert_local_match 'universal-macruby'
- assert_local_match 'macruby'
- refute_local_match 'universal-macruby-0.10'
- assert_local_match 'universal-macruby-1.0'
-
- util_set_arch 'powerpc-darwin'
- assert_local_match 'powerpc-darwin'
-
- util_set_arch 'powerpc-darwin7'
- assert_local_match 'powerpc-darwin7.9.0'
-
- util_set_arch 'powerpc-darwin8'
- assert_local_match 'powerpc-darwin8.10.0'
-
- util_set_arch 'sparc-solaris2.8'
- assert_local_match 'sparc-solaris2.8-mq5.3'
+ assert_local_match "i386-mswin32-mq5.3"
+ assert_local_match "i386-mswin32-mq6"
+ refute_local_match "win32-1.8.2-VC7"
+ refute_local_match "win32-1.8.4-VC6"
+ refute_local_match "win32-source"
+ refute_local_match "windows"
+
+ util_set_arch "i686-linux"
+ assert_local_match "i486-linux"
+ assert_local_match "i586-linux"
+ assert_local_match "i686-linux"
+
+ util_set_arch "i686-darwin8"
+ assert_local_match "i686-darwin8.4.1"
+ assert_local_match "i686-darwin8.8.2"
+
+ util_set_arch "java"
+ assert_local_match "java"
+ assert_local_match "jruby"
+
+ util_set_arch "universal-dotnet2.0"
+ assert_local_match "universal-dotnet"
+ assert_local_match "universal-dotnet-2.0"
+ refute_local_match "universal-dotnet-4.0"
+ assert_local_match "dotnet"
+ assert_local_match "dotnet-2.0"
+ refute_local_match "dotnet-4.0"
+
+ util_set_arch "universal-dotnet4.0"
+ assert_local_match "universal-dotnet"
+ refute_local_match "universal-dotnet-2.0"
+ assert_local_match "universal-dotnet-4.0"
+ assert_local_match "dotnet"
+ refute_local_match "dotnet-2.0"
+ assert_local_match "dotnet-4.0"
+
+ util_set_arch "universal-macruby-1.0"
+ assert_local_match "universal-macruby"
+ assert_local_match "macruby"
+ refute_local_match "universal-macruby-0.10"
+ assert_local_match "universal-macruby-1.0"
+
+ util_set_arch "powerpc-darwin"
+ assert_local_match "powerpc-darwin"
+
+ util_set_arch "powerpc-darwin7"
+ assert_local_match "powerpc-darwin7.9.0"
+
+ util_set_arch "powerpc-darwin8"
+ assert_local_match "powerpc-darwin8.10.0"
+
+ util_set_arch "sparc-solaris2.8"
+ assert_local_match "sparc-solaris2.8-mq5.3"
end
def test_inspect
diff --git a/test/rubygems/test_gem_rdoc.rb b/test/rubygems/test_gem_rdoc.rb
index 7b8ad07b27..7a34542360 100644
--- a/test/rubygems/test_gem_rdoc.rb
+++ b/test/rubygems/test_gem_rdoc.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require 'rubygems'
-require_relative 'helper'
-require 'rubygems/rdoc'
+require "rubygems"
+require_relative "helper"
+require "rubygems/rdoc"
class TestGemRDoc < Gem::TestCase
Gem::RDoc.load_rdoc
@@ -9,13 +9,13 @@ class TestGemRDoc < Gem::TestCase
def setup
super
- @a = util_spec 'a' do |s|
+ @a = util_spec "a" do |s|
s.rdoc_options = %w[--main MyTitle]
s.extra_rdoc_files = %w[README]
end
- write_file File.join(@tempdir, 'lib', 'a.rb')
- write_file File.join(@tempdir, 'README')
+ write_file File.join(@tempdir, "lib", "a.rb")
+ write_file File.join(@tempdir, "README")
install_gem @a
@@ -70,14 +70,14 @@ class TestGemRDoc < Gem::TestCase
def test_rdoc_installed?
refute @hook.rdoc_installed?
- FileUtils.mkdir_p @a.doc_dir 'rdoc'
+ FileUtils.mkdir_p @a.doc_dir "rdoc"
assert @hook.rdoc_installed?
end
def test_remove
- FileUtils.mkdir_p @a.doc_dir 'rdoc'
- FileUtils.mkdir_p @a.doc_dir 'ri'
+ FileUtils.mkdir_p @a.doc_dir "rdoc"
+ FileUtils.mkdir_p @a.doc_dir "ri"
@hook.remove
@@ -88,8 +88,8 @@ class TestGemRDoc < Gem::TestCase
end
def test_remove_unwritable
- pend 'chmod not supported' if Gem.win_platform?
- pend 'skipped in root privilege' if Process.uid.zero?
+ pend "chmod not supported" if Gem.win_platform?
+ pend "skipped in root privilege" if Process.uid.zero?
FileUtils.mkdir_p @a.base_dir
FileUtils.chmod 0, @a.base_dir
@@ -105,7 +105,7 @@ class TestGemRDoc < Gem::TestCase
def test_ri_installed?
refute @hook.ri_installed?
- FileUtils.mkdir_p @a.doc_dir 'ri'
+ FileUtils.mkdir_p @a.doc_dir "ri"
assert @hook.ri_installed?
end
@@ -117,8 +117,8 @@ class TestGemRDoc < Gem::TestCase
end
def test_setup_unwritable
- pend 'chmod not supported' if Gem.win_platform?
- pend 'skipped in root privilege' if Process.uid.zero?
+ pend "chmod not supported" if Gem.win_platform?
+ pend "skipped in root privilege" if Process.uid.zero?
FileUtils.mkdir_p @a.doc_dir
FileUtils.chmod 0, @a.doc_dir
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index fa82a117a1..d8b55a5f7a 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -1,15 +1,15 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
-require 'webrick'
-require 'webrick/https' if Gem::HAVE_OPENSSL
+require "webrick"
+require "webrick/https" if Gem::HAVE_OPENSSL
unless Gem::HAVE_OPENSSL
- warn 'Skipping Gem::RemoteFetcher tests. openssl not found.'
+ warn "Skipping Gem::RemoteFetcher tests. openssl not found."
end
-require 'rubygems/remote_fetcher'
-require 'rubygems/package'
+require "rubygems/remote_fetcher"
+require "rubygems/package"
# = Testing Proxy Settings
#
@@ -69,7 +69,7 @@ gems:
dependencies: []
EOY
- PROXY_DATA = SERVER_DATA.gsub(/0.4.11/, '0.4.2')
+ PROXY_DATA = SERVER_DATA.gsub(/0.4.11/, "0.4.2")
# Generated via:
# x = OpenSSL::PKey::DH.new(2048) # wait a while...
@@ -104,11 +104,11 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@cache_dir = File.join @gemhome, "cache"
# TODO: why does the remote fetcher need it written to disk?
- @a1, @a1_gem = util_gem 'a', '1' do |s|
- s.executables << 'a_bin'
+ @a1, @a1_gem = util_gem "a", "1" do |s|
+ s.executables << "a_bin"
end
- @a1.loaded_from = File.join(@gemhome, 'specifications', @a1.full_name)
+ @a1.loaded_from = File.join(@gemhome, "specifications", @a1.full_name)
Gem::RemoteFetcher.fetcher = nil
@stub_ui = Gem::MockGemUi.new
@@ -130,7 +130,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_self_fetcher_with_proxy
- proxy_uri = 'http://proxy.example.com'
+ proxy_uri = "http://proxy.example.com"
Gem.configuration[:http_proxy] = proxy_uri
Gem::RemoteFetcher.fetcher = nil
@@ -149,34 +149,34 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@fetcher.fetch_path("gems.example.com/yaml", nil, true)
end
- assert_equal 'uri scheme is invalid: nil', e.message
+ assert_equal "uri scheme is invalid: nil", e.message
end
def test_no_proxy
use_ui @stub_ui do
assert_data_from_server @fetcher.fetch_path(@server_uri)
response = @fetcher.fetch_path(@server_uri, nil, true)
- assert_equal SERVER_DATA.size, response['content-length'].to_i
+ assert_equal SERVER_DATA.size, response["content-length"].to_i
end
end
def test_cache_update_path
- uri = URI 'http://example/file'
- path = File.join @tempdir, 'file'
+ uri = URI "http://example/file"
+ path = File.join @tempdir, "file"
- fetcher = util_fuck_with_fetcher 'hello'
+ fetcher = util_fuck_with_fetcher "hello"
data = fetcher.cache_update_path uri, path
- assert_equal 'hello', data
+ assert_equal "hello", data
- assert_equal 'hello', File.read(path)
+ assert_equal "hello", File.read(path)
end
def test_cache_update_path_with_utf8_internal_encoding
- with_internal_encoding('UTF-8') do
- uri = URI 'http://example/file'
- path = File.join @tempdir, 'file'
+ with_internal_encoding("UTF-8") do
+ uri = URI "http://example/file"
+ path = File.join @tempdir, "file"
data = String.new("\xC8").force_encoding(Encoding::BINARY)
fetcher = util_fuck_with_fetcher data
@@ -189,14 +189,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_cache_update_path_no_update
- uri = URI 'http://example/file'
- path = File.join @tempdir, 'file'
+ uri = URI "http://example/file"
+ path = File.join @tempdir, "file"
- fetcher = util_fuck_with_fetcher 'hello'
+ fetcher = util_fuck_with_fetcher "hello"
data = fetcher.cache_update_path uri, path, false
- assert_equal 'hello', data
+ assert_equal "hello", data
assert_path_not_exist path
end
@@ -219,7 +219,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@test_data
end
- raise Gem::RemoteFetcher::FetchError.new("haha!", '')
+ raise Gem::RemoteFetcher::FetchError.new("haha!", "")
end
end
@@ -228,14 +228,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_download
a1_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
fetcher = util_fuck_with_fetcher a1_data
a1_cache_gem = @a1.cache_file
- assert_equal a1_cache_gem, fetcher.download(@a1, 'http://gems.example.com')
+ assert_equal a1_cache_gem, fetcher.download(@a1, "http://gems.example.com")
assert_equal("http://gems.example.com/gems/a-1.gem",
fetcher.instance_variable_get(:@test_arg).to_s)
assert File.exist?(a1_cache_gem)
@@ -243,14 +243,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_download_with_auth
a1_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
fetcher = util_fuck_with_fetcher a1_data
a1_cache_gem = @a1.cache_file
- assert_equal a1_cache_gem, fetcher.download(@a1, 'http://user:password@gems.example.com')
+ assert_equal a1_cache_gem, fetcher.download(@a1, "http://user:password@gems.example.com")
assert_equal("http://user:password@gems.example.com/gems/a-1.gem",
fetcher.instance_variable_get(:@test_arg).to_s)
assert File.exist?(a1_cache_gem)
@@ -258,14 +258,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_download_with_token
a1_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
fetcher = util_fuck_with_fetcher a1_data
a1_cache_gem = @a1.cache_file
- assert_equal a1_cache_gem, fetcher.download(@a1, 'http://token@gems.example.com')
+ assert_equal a1_cache_gem, fetcher.download(@a1, "http://token@gems.example.com")
assert_equal("http://token@gems.example.com/gems/a-1.gem",
fetcher.instance_variable_get(:@test_arg).to_s)
assert File.exist?(a1_cache_gem)
@@ -273,14 +273,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_download_with_x_oauth_basic
a1_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
fetcher = util_fuck_with_fetcher a1_data
a1_cache_gem = @a1.cache_file
- assert_equal a1_cache_gem, fetcher.download(@a1, 'http://token:x-oauth-basic@gems.example.com')
+ assert_equal a1_cache_gem, fetcher.download(@a1, "http://token:x-oauth-basic@gems.example.com")
assert_equal("http://token:x-oauth-basic@gems.example.com/gems/a-1.gem",
fetcher.instance_variable_get(:@test_arg).to_s)
assert File.exist?(a1_cache_gem)
@@ -288,14 +288,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_download_with_encoded_auth
a1_data = nil
- File.open @a1_gem, 'rb' do |fp|
+ File.open @a1_gem, "rb" do |fp|
a1_data = fp.read
end
fetcher = util_fuck_with_fetcher a1_data
a1_cache_gem = @a1.cache_file
- assert_equal a1_cache_gem, fetcher.download(@a1, 'http://user:%25pas%25sword@gems.example.com')
+ assert_equal a1_cache_gem, fetcher.download(@a1, "http://user:%25pas%25sword@gems.example.com")
assert_equal("http://user:%25pas%25sword@gems.example.com/gems/a-1.gem",
fetcher.instance_variable_get(:@test_arg).to_s)
assert File.exist?(a1_cache_gem)
@@ -306,7 +306,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
inst = Gem::RemoteFetcher.fetcher
- assert_equal @a1.cache_file, inst.download(@a1, 'http://gems.example.com')
+ assert_equal @a1.cache_file, inst.download(@a1, "http://gems.example.com")
end
def test_download_local
@@ -322,7 +322,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_download_local_space
- space_path = File.join @tempdir, 'space path'
+ space_path = File.join @tempdir, "space path"
FileUtils.mkdir space_path
FileUtils.mv @a1_gem, space_path
local_path = File.join space_path, @a1.file_name
@@ -336,17 +336,17 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_download_install_dir
- a1_data = File.open @a1_gem, 'rb' do |fp|
+ a1_data = File.open @a1_gem, "rb" do |fp|
fp.read
end
fetcher = util_fuck_with_fetcher a1_data
- install_dir = File.join @tempdir, 'more_gems'
+ install_dir = File.join @tempdir, "more_gems"
a1_cache_gem = File.join install_dir, "cache", @a1.file_name
FileUtils.mkdir_p(File.dirname(a1_cache_gem))
- actual = fetcher.download(@a1, 'http://gems.example.com', install_dir)
+ actual = fetcher.download(@a1, "http://gems.example.com", install_dir)
assert_equal a1_cache_gem, actual
assert_equal("http://gems.example.com/gems/a-1.gem",
@@ -380,7 +380,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
FileUtils.chmod 0555, @gemhome
fetcher = util_fuck_with_fetcher File.read(@a1_gem)
- fetcher.download(@a1, 'http://gems.example.com')
+ fetcher.download(@a1, "http://gems.example.com")
a1_cache_gem = File.join Gem.user_dir, "cache", @a1.file_name
assert File.exist? a1_cache_gem
ensure
@@ -390,16 +390,16 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_download_platform_legacy
- original_platform = 'old-platform'
+ original_platform = "old-platform"
- e1, e1_gem = util_gem 'e', '1' do |s|
+ e1, e1_gem = util_gem "e", "1" do |s|
s.platform = Gem::Platform::CURRENT
s.instance_variable_set :@original_platform, original_platform
end
- e1.loaded_from = File.join(@gemhome, 'specifications', e1.full_name)
+ e1.loaded_from = File.join(@gemhome, "specifications", e1.full_name)
e1_data = nil
- File.open e1_gem, 'rb' do |fp|
+ File.open e1_gem, "rb" do |fp|
e1_data = fp.read
end
@@ -407,7 +407,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
e1_cache_gem = e1.cache_file
- assert_equal e1_cache_gem, fetcher.download(e1, 'http://gems.example.com')
+ assert_equal e1_cache_gem, fetcher.download(e1, "http://gems.example.com")
assert_equal("http://gems.example.com/gems/#{e1.original_name}.gem",
fetcher.instance_variable_get(:@test_arg).to_s)
@@ -435,14 +435,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
inst = Gem::RemoteFetcher.fetcher
e = assert_raise ArgumentError do
- inst.download @a1, 'ftp://gems.rubyforge.org'
+ inst.download @a1, "ftp://gems.rubyforge.org"
end
- assert_equal 'unsupported URI scheme ftp', e.message
+ assert_equal "unsupported URI scheme ftp", e.message
end
def test_download_to_cache
- @a2, @a2_gem = util_gem 'a', '2'
+ @a2, @a2_gem = util_gem "a", "2"
util_setup_spec_fetcher @a1, @a2
@fetcher.instance_variable_set :@a1, @a1
@@ -458,7 +458,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
end
- gem = Gem::RemoteFetcher.fetcher.download_to_cache dep 'a'
+ gem = Gem::RemoteFetcher.fetcher.download_to_cache dep "a"
assert_equal @a2.file_name, File.basename(gem)
end
@@ -468,10 +468,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@fetcher = fetcher
def fetcher.fetch_http(uri, mtime, head = nil)
- Gem::Util.gzip 'foo'
+ Gem::Util.gzip "foo"
end
- assert_equal 'foo', fetcher.fetch_path(@uri + 'foo.gz')
+ assert_equal "foo", fetcher.fetch_path(@uri + "foo.gz")
end
def test_fetch_path_gzip_unmodified
@@ -482,7 +482,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
nil
end
- assert_nil fetcher.fetch_path(@uri + 'foo.gz', Time.at(0))
+ assert_nil fetcher.fetch_path(@uri + "foo.gz", Time.at(0))
end
def test_fetch_path_io_error
@@ -493,7 +493,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
raise EOFError
end
- url = 'http://example.com/uri'
+ url = "http://example.com/uri"
e = assert_raise Gem::RemoteFetcher::FetchError do
fetcher.fetch_path url
@@ -511,7 +511,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
raise SocketError
end
- url = 'http://example.com/uri'
+ url = "http://example.com/uri"
e = assert_raise Gem::RemoteFetcher::FetchError do
fetcher.fetch_path url
@@ -526,10 +526,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@fetcher = fetcher
def fetcher.fetch_http(uri, mtime = nil, head = nil)
- raise Errno::ECONNREFUSED, 'connect(2)'
+ raise Errno::ECONNREFUSED, "connect(2)"
end
- url = 'http://example.com/uri'
+ url = "http://example.com/uri"
e = assert_raise Gem::RemoteFetcher::FetchError do
fetcher.fetch_path url
@@ -545,10 +545,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@fetcher = fetcher
def fetcher.fetch_http(uri, mtime = nil, head = nil)
- raise Timeout::Error, 'timed out'
+ raise Timeout::Error, "timed out"
end
- url = 'http://example.com/uri'
+ url = "http://example.com/uri"
e = assert_raise Gem::RemoteFetcher::FetchError do
fetcher.fetch_path url
@@ -564,10 +564,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@fetcher = fetcher
def fetcher.fetch_http(uri, mtime = nil, head = nil)
- raise SocketError, 'getaddrinfo: nodename nor servname provided'
+ raise SocketError, "getaddrinfo: nodename nor servname provided"
end
- url = 'http://example.com/uri'
+ url = "http://example.com/uri"
e = assert_raise Gem::RemoteFetcher::FetchError do
fetcher.fetch_path url
@@ -586,7 +586,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
raise OpenSSL::SSL::SSLError
end
- url = 'http://example.com/uri'
+ url = "http://example.com/uri"
e = assert_raise Gem::RemoteFetcher::FetchError do
fetcher.fetch_path url
@@ -609,7 +609,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_implicit_no_proxy
use_ui @stub_ui do
- ENV['http_proxy'] = 'http://fakeurl:12345'
+ ENV["http_proxy"] = "http://fakeurl:12345"
fetcher = Gem::RemoteFetcher.new :no_proxy
@fetcher = fetcher
assert_data_from_server fetcher.fetch_path(@server_uri)
@@ -618,7 +618,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_implicit_proxy
use_ui @stub_ui do
- ENV['http_proxy'] = @proxy_uri
+ ENV["http_proxy"] = @proxy_uri
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
assert_data_from_proxy fetcher.fetch_path(@server_uri)
@@ -627,7 +627,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_implicit_upper_case_proxy
use_ui @stub_ui do
- ENV['HTTP_PROXY'] = @proxy_uri
+ ENV["HTTP_PROXY"] = @proxy_uri
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
assert_data_from_proxy fetcher.fetch_path(@server_uri)
@@ -645,36 +645,36 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_http
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
- url = 'http://gems.example.com/redirect'
+ url = "http://gems.example.com/redirect"
def fetcher.request(uri, request_class, last_modified = nil)
- url = 'http://gems.example.com/redirect'
+ url = "http://gems.example.com/redirect"
unless defined? @requested
@requested = true
res = Net::HTTPMovedPermanently.new nil, 301, nil
- res.add_field 'Location', url
+ res.add_field "Location", url
res
else
res = Net::HTTPOK.new nil, 200, nil
- def res.body() 'real_path' end
+ def res.body() "real_path" end
res
end
end
data = fetcher.fetch_http URI.parse(url)
- assert_equal 'real_path', data
+ assert_equal "real_path", data
end
def test_fetch_http_redirects
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
- url = 'http://gems.example.com/redirect'
+ url = "http://gems.example.com/redirect"
def fetcher.request(uri, request_class, last_modified = nil)
- url = 'http://gems.example.com/redirect'
+ url = "http://gems.example.com/redirect"
res = Net::HTTPMovedPermanently.new nil, 301, nil
- res.add_field 'Location', url
+ res.add_field "Location", url
res
end
@@ -688,7 +688,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_http_redirects_without_location
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
- url = 'http://gems.example.com/redirect'
+ url = "http://gems.example.com/redirect"
def fetcher.request(uri, request_class, last_modified = nil)
res = Net::HTTPMovedPermanently.new nil, 301, nil
@@ -710,7 +710,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
assert_equal "murphy", fetcher.fetch_path(@server_uri)
end
- def assert_fetch_s3(url, signature, token=nil, region='us-east-1', instance_profile_json=nil)
+ def assert_fetch_s3(url, signature, token=nil, region="us-east-1", instance_profile_json=nil)
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
$fetched_uri = nil
@@ -719,12 +719,12 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def fetcher.request(uri, request_class, last_modified = nil)
$fetched_uri = uri
res = Net::HTTPOK.new nil, 200, nil
- def res.body() 'success' end
+ def res.body() "success" end
res
end
def fetcher.s3_uri_signer(uri)
- require 'json'
+ require "json"
s3_uri_signer = Gem::S3URISigner.new(uri)
def s3_uri_signer.ec2_metadata_credentials_json
JSON.parse($instance_profile)
@@ -738,18 +738,18 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
data = fetcher.fetch_s3 URI.parse(url)
assert_equal "https://my-bucket.s3.#{region}.amazonaws.com/gems/specs.4.8.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=testuser%2F20190624%2F#{region}%2Fs3%2Faws4_request&X-Amz-Date=20190624T050641Z&X-Amz-Expires=86400#{token ? "&X-Amz-Security-Token=" + token : ""}&X-Amz-SignedHeaders=host&X-Amz-Signature=#{signature}", $fetched_uri.to_s
- assert_equal 'success', data
+ assert_equal "success", data
ensure
$fetched_uri = nil
end
def test_fetch_s3_config_creds
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :id => 'testuser', :secret => 'testpass' },
+ "my-bucket" => { :id => "testuser", :secret => "testpass" },
}
- url = 's3://my-bucket/gems/specs.4.8.gz'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b'
+ assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b"
end
ensure
Gem.configuration[:s3_source] = nil
@@ -757,11 +757,11 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_config_creds_with_region
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :id => 'testuser', :secret => 'testpass', :region => 'us-west-2' },
+ "my-bucket" => { :id => "testuser", :secret => "testpass", :region => "us-west-2" },
}
- url = 's3://my-bucket/gems/specs.4.8.gz'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9', nil, 'us-west-2'
+ assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2"
end
ensure
Gem.configuration[:s3_source] = nil
@@ -769,79 +769,79 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_config_creds_with_token
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :id => 'testuser', :secret => 'testpass', :security_token => 'testtoken' },
+ "my-bucket" => { :id => "testuser", :secret => "testpass", :security_token => "testtoken" },
}
- url = 's3://my-bucket/gems/specs.4.8.gz'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c', 'testtoken'
+ assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken"
end
ensure
Gem.configuration[:s3_source] = nil
end
def test_fetch_s3_env_creds
- ENV['AWS_ACCESS_KEY_ID'] = 'testuser'
- ENV['AWS_SECRET_ACCESS_KEY'] = 'testpass'
- ENV['AWS_SESSION_TOKEN'] = nil
+ ENV["AWS_ACCESS_KEY_ID"] = "testuser"
+ ENV["AWS_SECRET_ACCESS_KEY"] = "testpass"
+ ENV["AWS_SESSION_TOKEN"] = nil
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :provider => 'env' },
+ "my-bucket" => { :provider => "env" },
}
- url = 's3://my-bucket/gems/specs.4.8.gz'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b'
+ assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b"
end
ensure
- ENV.each_key {|key| ENV.delete(key) if key.start_with?('AWS') }
+ ENV.each_key {|key| ENV.delete(key) if key.start_with?("AWS") }
Gem.configuration[:s3_source] = nil
end
def test_fetch_s3_env_creds_with_region
- ENV['AWS_ACCESS_KEY_ID'] = 'testuser'
- ENV['AWS_SECRET_ACCESS_KEY'] = 'testpass'
- ENV['AWS_SESSION_TOKEN'] = nil
+ ENV["AWS_ACCESS_KEY_ID"] = "testuser"
+ ENV["AWS_SECRET_ACCESS_KEY"] = "testpass"
+ ENV["AWS_SESSION_TOKEN"] = nil
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :provider => 'env', :region => 'us-west-2' },
+ "my-bucket" => { :provider => "env", :region => "us-west-2" },
}
- url = 's3://my-bucket/gems/specs.4.8.gz'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9', nil, 'us-west-2'
+ assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2"
end
ensure
- ENV.each_key {|key| ENV.delete(key) if key.start_with?('AWS') }
+ ENV.each_key {|key| ENV.delete(key) if key.start_with?("AWS") }
Gem.configuration[:s3_source] = nil
end
def test_fetch_s3_env_creds_with_token
- ENV['AWS_ACCESS_KEY_ID'] = 'testuser'
- ENV['AWS_SECRET_ACCESS_KEY'] = 'testpass'
- ENV['AWS_SESSION_TOKEN'] = 'testtoken'
+ ENV["AWS_ACCESS_KEY_ID"] = "testuser"
+ ENV["AWS_SECRET_ACCESS_KEY"] = "testpass"
+ ENV["AWS_SESSION_TOKEN"] = "testtoken"
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :provider => 'env' },
+ "my-bucket" => { :provider => "env" },
}
- url = 's3://my-bucket/gems/specs.4.8.gz'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c', 'testtoken'
+ assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken"
end
ensure
- ENV.each_key {|key| ENV.delete(key) if key.start_with?('AWS') }
+ ENV.each_key {|key| ENV.delete(key) if key.start_with?("AWS") }
Gem.configuration[:s3_source] = nil
end
def test_fetch_s3_url_creds
- url = 's3://testuser:testpass@my-bucket/gems/specs.4.8.gz'
+ url = "s3://testuser:testpass@my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b'
+ assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b"
end
end
def test_fetch_s3_instance_profile_creds
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :provider => 'instance_profile' },
+ "my-bucket" => { :provider => "instance_profile" },
}
- url = 's3://my-bucket/gems/specs.4.8.gz'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b', nil, 'us-east-1',
+ assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b", nil, "us-east-1",
'{"AccessKeyId": "testuser", "SecretAccessKey": "testpass"}'
end
ensure
@@ -850,12 +850,12 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_instance_profile_creds_with_region
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :provider => 'instance_profile', :region => 'us-west-2' },
+ "my-bucket" => { :provider => "instance_profile", :region => "us-west-2" },
}
- url = 's3://my-bucket/gems/specs.4.8.gz'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9', nil, 'us-west-2',
+ assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2",
'{"AccessKeyId": "testuser", "SecretAccessKey": "testpass"}'
end
ensure
@@ -864,12 +864,12 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_fetch_s3_instance_profile_creds_with_token
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :provider => 'instance_profile' },
+ "my-bucket" => { :provider => "instance_profile" },
}
- url = 's3://my-bucket/gems/specs.4.8.gz'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
Time.stub :now, Time.at(1561353581) do
- assert_fetch_s3 url, '935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c', 'testtoken', 'us-east-1',
+ assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken", "us-east-1",
'{"AccessKeyId": "testuser", "SecretAccessKey": "testpass", "Token": "testtoken"}'
end
ensure
@@ -888,35 +888,35 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
def test_fetch_s3_no_source_key
- url = 's3://my-bucket/gems/specs.4.8.gz'
- refute_fetch_s3 url, 'no s3_source key exists in .gemrc'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
+ refute_fetch_s3 url, "no s3_source key exists in .gemrc"
end
def test_fetch_s3_no_host
Gem.configuration[:s3_source] = {
- 'my-bucket' => { :id => 'testuser', :secret => 'testpass' },
+ "my-bucket" => { :id => "testuser", :secret => "testpass" },
}
- url = 's3://other-bucket/gems/specs.4.8.gz'
- refute_fetch_s3 url, 'no key for host other-bucket in s3_source in .gemrc'
+ url = "s3://other-bucket/gems/specs.4.8.gz"
+ refute_fetch_s3 url, "no key for host other-bucket in s3_source in .gemrc"
ensure
Gem.configuration[:s3_source] = nil
end
def test_fetch_s3_no_id
- Gem.configuration[:s3_source] = { 'my-bucket' => { :secret => 'testpass' } }
+ Gem.configuration[:s3_source] = { "my-bucket" => { :secret => "testpass" } }
- url = 's3://my-bucket/gems/specs.4.8.gz'
- refute_fetch_s3 url, 's3_source for my-bucket missing id or secret'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
+ refute_fetch_s3 url, "s3_source for my-bucket missing id or secret"
ensure
Gem.configuration[:s3_source] = nil
end
def test_fetch_s3_no_secret
- Gem.configuration[:s3_source] = { 'my-bucket' => { :id => 'testuser' } }
+ Gem.configuration[:s3_source] = { "my-bucket" => { :id => "testuser" } }
- url = 's3://my-bucket/gems/specs.4.8.gz'
- refute_fetch_s3 url, 's3_source for my-bucket missing id or secret'
+ url = "s3://my-bucket/gems/specs.4.8.gz"
+ refute_fetch_s3 url, "s3_source for my-bucket missing id or secret"
ensure
Gem.configuration[:s3_source] = nil
end
@@ -946,7 +946,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
@fetcher = fetcher
assert_throws :block_called do
- fetcher.request URI('http://example'), Net::HTTP::Get do |req|
+ fetcher.request URI("http://example"), Net::HTTP::Get do |req|
assert_kind_of Net::HTTPGenericRequest, req
throw :block_called
end
@@ -964,7 +964,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_ssl_connection
ssl_server = start_ssl_server
- temp_ca_cert = File.join(__dir__, 'ca_cert.pem')
+ temp_ca_cert = File.join(__dir__, "ca_cert.pem")
with_configured_fetcher(":ssl_ca_cert: #{temp_ca_cert}") do |fetcher|
fetcher.fetch_path("https://localhost:#{ssl_server.config[:Port]}/yaml")
end
@@ -975,8 +975,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
:SSLVerifyClient =>
OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT })
- temp_ca_cert = File.join(__dir__, 'ca_cert.pem')
- temp_client_cert = File.join(__dir__, 'client.pem')
+ temp_ca_cert = File.join(__dir__, "ca_cert.pem")
+ temp_client_cert = File.join(__dir__, "client.pem")
with_configured_fetcher(
":ssl_ca_cert: #{temp_ca_cert}\n" +
@@ -990,8 +990,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
:SSLVerifyClient =>
OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT })
- temp_ca_cert = File.join(__dir__, 'ca_cert.pem')
- temp_client_cert = File.join(__dir__, 'invalid_client.pem')
+ temp_ca_cert = File.join(__dir__, "ca_cert.pem")
+ temp_client_cert = File.join(__dir__, "invalid_client.pem")
with_configured_fetcher(
":ssl_ca_cert: #{temp_ca_cert}\n" +
@@ -1020,7 +1020,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def test_do_not_follow_insecure_redirect
ssl_server = start_ssl_server
- temp_ca_cert = File.join(__dir__, 'ca_cert.pem')
+ temp_ca_cert = File.join(__dir__, "ca_cert.pem")
expected_error_message =
"redirecting to non-https resource: #{@server_uri} (https://localhost:#{ssl_server.config[:Port]}/insecure_redirect?to=#{@server_uri})"
@@ -1046,8 +1046,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def with_configured_fetcher(config_str = nil, &block)
if config_str
- temp_conf = File.join @tempdir, '.gemrc'
- File.open temp_conf, 'w' do |fp|
+ temp_conf = File.join @tempdir, ".gemrc"
+ File.open temp_conf, "w" do |fp|
fp.puts config_str
end
Gem.configuration = Gem::ConfigFile.new %W[--config-file #{temp_conf}]
@@ -1136,9 +1136,9 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
:Logger => null_logger,
:AccessLog => [],
:SSLEnable => true,
- :SSLCACertificateFile => File.join(__dir__, 'ca_cert.pem'),
- :SSLCertificate => cert('ssl_cert.pem'),
- :SSLPrivateKey => key('ssl_key.pem'),
+ :SSLCACertificateFile => File.join(__dir__, "ca_cert.pem"),
+ :SSLCertificate => cert("ssl_cert.pem"),
+ :SSLPrivateKey => key("ssl_key.pem"),
:SSLVerifyClient => nil,
:SSLCertName => nil,
}.merge(config))
@@ -1146,7 +1146,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
res.body = "--- true\n"
end
server.mount_proc("/insecure_redirect") do |req, res|
- res.set_redirect(WEBrick::HTTPStatus::MovedPermanently, req.query['to'])
+ res.set_redirect(WEBrick::HTTPStatus::MovedPermanently, req.query["to"])
end
server.ssl_context.tmp_dh_callback = proc { TEST_KEY_DH2048 }
t = Thread.new do
@@ -1185,22 +1185,22 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
res.body = req["X-Captain"]
elsif @enable_yaml
res.body = data
- res['Content-Type'] = 'text/plain'
- res['content-length'] = data.size
+ res["Content-Type"] = "text/plain"
+ res["content-length"] = data.size
else
res.status = "404"
res.body = "<h1>NOT FOUND</h1>"
- res['Content-Type'] = 'text/html'
+ res["Content-Type"] = "text/html"
end
end
s.mount_proc("/yaml.Z") do |req, res|
if @enable_zip
res.body = Zlib::Deflate.deflate(data)
- res['Content-Type'] = 'text/plain'
+ res["Content-Type"] = "text/plain"
else
res.status = "404"
res.body = "<h1>NOT FOUND</h1>"
- res['Content-Type'] = 'text/html'
+ res["Content-Type"] = "text/html"
end
end
th = Thread.new do
diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb
index 47654f6fa4..aba9dc5447 100644
--- a/test/rubygems/test_gem_request.rb
+++ b/test/rubygems/test_gem_request.rb
@@ -1,20 +1,20 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/request'
-require 'ostruct'
-require 'base64'
+require_relative "helper"
+require "rubygems/request"
+require "ostruct"
+require "base64"
unless Gem::HAVE_OPENSSL
- warn 'Skipping Gem::Request tests. openssl not found.'
+ warn "Skipping Gem::Request tests. openssl not found."
end
class TestGemRequest < Gem::TestCase
- CA_CERT_FILE = cert_path 'ca'
- CHILD_CERT = load_cert 'child'
- EXPIRED_CERT = load_cert 'expired'
- PUBLIC_CERT = load_cert 'public'
- PUBLIC_CERT_FILE = cert_path 'public'
- SSL_CERT = load_cert 'ssl'
+ CA_CERT_FILE = cert_path "ca"
+ CHILD_CERT = load_cert "child"
+ EXPIRED_CERT = load_cert "expired"
+ PUBLIC_CERT = load_cert "public"
+ PUBLIC_CERT_FILE = cert_path "public"
+ SSL_CERT = load_cert "ssl"
def make_request(uri, request_class, last_modified, proxy)
Gem::Request.create_with_proxy uri, request_class, last_modified, proxy
@@ -28,7 +28,7 @@ class TestGemRequest < Gem::TestCase
super
@proxy_uri = "http://localhost:1234"
- @uri = URI('http://example')
+ @uri = URI("http://example")
@request = make_request @uri, nil, nil, nil
end
@@ -40,7 +40,7 @@ class TestGemRequest < Gem::TestCase
end
def test_initialize_proxy
- proxy_uri = 'http://proxy.example.com'
+ proxy_uri = "http://proxy.example.com"
request = make_request @uri, nil, nil, proxy_uri
@@ -48,7 +48,7 @@ class TestGemRequest < Gem::TestCase
end
def test_initialize_proxy_URI
- proxy_uri = 'http://proxy.example.com'
+ proxy_uri = "http://proxy.example.com"
request = make_request @uri, nil, nil, URI(proxy_uri)
@@ -56,22 +56,22 @@ class TestGemRequest < Gem::TestCase
end
def test_initialize_proxy_ENV
- ENV['http_proxy'] = @proxy_uri
- ENV['http_proxy_user'] = 'foo'
- ENV['http_proxy_pass'] = 'bar'
+ ENV["http_proxy"] = @proxy_uri
+ ENV["http_proxy_user"] = "foo"
+ ENV["http_proxy_pass"] = "bar"
request = make_request @uri, nil, nil, nil
proxy = request.proxy_uri
- assert_equal 'foo', proxy.user
- assert_equal 'bar', proxy.password
+ assert_equal "foo", proxy.user
+ assert_equal "bar", proxy.password
end
def test_initialize_proxy_ENV_https
- ENV['https_proxy'] = @proxy_uri
+ ENV["https_proxy"] = @proxy_uri
- request = make_request URI('https://example'), nil, nil, nil
+ request = make_request URI("https://example"), nil, nil, nil
proxy = request.proxy_uri
@@ -79,10 +79,10 @@ class TestGemRequest < Gem::TestCase
end
def test_proxy_ENV
- ENV['http_proxy'] = "http://proxy"
- ENV['https_proxy'] = ""
+ ENV["http_proxy"] = "http://proxy"
+ ENV["https_proxy"] = ""
- request = make_request URI('https://example'), nil, nil, nil
+ request = make_request URI("https://example"), nil, nil, nil
proxy = request.proxy_uri
@@ -90,13 +90,13 @@ class TestGemRequest < Gem::TestCase
end
def test_configure_connection_for_https
- connection = Net::HTTP.new 'localhost', 443
+ connection = Net::HTTP.new "localhost", 443
request = Class.new(Gem::Request) do
def self.get_cert_files
[TestGemRequest::PUBLIC_CERT_FILE]
end
- end.create_with_proxy URI('https://example'), nil, nil, nil
+ end.create_with_proxy URI("https://example"), nil, nil, nil
Gem::Request.configure_connection_for_https connection, request.cert_files
@@ -109,13 +109,13 @@ class TestGemRequest < Gem::TestCase
ssl_ca_cert, Gem.configuration.ssl_ca_cert =
Gem.configuration.ssl_ca_cert, CA_CERT_FILE
- connection = Net::HTTP.new 'localhost', 443
+ connection = Net::HTTP.new "localhost", 443
request = Class.new(Gem::Request) do
def self.get_cert_files
[TestGemRequest::PUBLIC_CERT_FILE]
end
- end.create_with_proxy URI('https://example'), nil, nil, nil
+ end.create_with_proxy URI("https://example"), nil, nil, nil
Gem::Request.configure_connection_for_https connection, request.cert_files
@@ -128,7 +128,7 @@ class TestGemRequest < Gem::TestCase
end
def test_get_proxy_from_env_fallback
- ENV['http_proxy'] = @proxy_uri
+ ENV["http_proxy"] = @proxy_uri
request = make_request @uri, nil, nil, nil
proxy = request.proxy_uri
@@ -136,8 +136,8 @@ class TestGemRequest < Gem::TestCase
end
def test_get_proxy_from_env_https
- ENV['https_proxy'] = @proxy_uri
- uri = URI('https://example')
+ ENV["https_proxy"] = @proxy_uri
+ uri = URI("https://example")
request = make_request uri, nil, nil, nil
proxy = request.proxy_uri
@@ -146,39 +146,39 @@ class TestGemRequest < Gem::TestCase
end
def test_get_proxy_from_env_domain
- ENV['http_proxy'] = @proxy_uri
- ENV['http_proxy_user'] = 'foo\user'
- ENV['http_proxy_pass'] = 'my bar'
+ ENV["http_proxy"] = @proxy_uri
+ ENV["http_proxy_user"] = 'foo\user'
+ ENV["http_proxy_pass"] = "my bar"
request = make_request @uri, nil, nil, nil
proxy = request.proxy_uri
assert_equal 'foo\user', Gem::UriFormatter.new(proxy.user).unescape
- assert_equal 'my bar', Gem::UriFormatter.new(proxy.password).unescape
+ assert_equal "my bar", Gem::UriFormatter.new(proxy.password).unescape
end
def test_get_proxy_from_env_escape
- ENV['http_proxy'] = @proxy_uri
- ENV['http_proxy_user'] = 'foo@user'
- ENV['http_proxy_pass'] = 'my@bar'
+ ENV["http_proxy"] = @proxy_uri
+ ENV["http_proxy_user"] = "foo@user"
+ ENV["http_proxy_pass"] = "my@bar"
request = make_request @uri, nil, nil, nil
proxy = request.proxy_uri
- assert_equal 'foo%40user', proxy.user
- assert_equal 'my%40bar', proxy.password
+ assert_equal "foo%40user", proxy.user
+ assert_equal "my%40bar", proxy.password
end
def test_get_proxy_from_env_normalize
- ENV['HTTP_PROXY'] = 'fakeurl:12345'
+ ENV["HTTP_PROXY"] = "fakeurl:12345"
request = make_request @uri, nil, nil, nil
- assert_equal 'http://fakeurl:12345', request.proxy_uri.to_s
+ assert_equal "http://fakeurl:12345", request.proxy_uri.to_s
end
def test_get_proxy_from_env_empty
- ENV['HTTP_PROXY'] = ''
- ENV.delete 'http_proxy'
+ ENV["HTTP_PROXY"] = ""
+ ENV.delete "http_proxy"
request = make_request @uri, nil, nil, nil
assert_nil request.proxy_uri
@@ -207,7 +207,7 @@ class TestGemRequest < Gem::TestCase
c
end
- auth_header = conn.payload['Authorization']
+ auth_header = conn.payload["Authorization"]
assert_equal "Basic #{Base64.encode64('user:pass')}".strip, auth_header
assert_includes @ui.output, "GET https://user:REDACTED@example.rubygems/specs.#{Gem.marshal_version}"
end
@@ -224,7 +224,7 @@ class TestGemRequest < Gem::TestCase
c
end
- auth_header = conn.payload['Authorization']
+ auth_header = conn.payload["Authorization"]
assert_equal "Basic #{Base64.encode64('user:{DEScede}pass')}".strip, auth_header
assert_includes @ui.output, "GET https://user:REDACTED@example.rubygems/specs.#{Gem.marshal_version}"
end
@@ -241,36 +241,36 @@ class TestGemRequest < Gem::TestCase
c
end
- auth_header = conn.payload['Authorization']
+ auth_header = conn.payload["Authorization"]
assert_equal "Basic #{Base64.encode64('{DEScede}pass:x-oauth-basic')}".strip, auth_header
assert_includes @ui.output, "GET https://REDACTED:x-oauth-basic@example.rubygems/specs.#{Gem.marshal_version}"
end
def test_fetch_head
uri = Gem::Uri.new(URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}")
- response = util_stub_net_http(:body => '', :code => 200) do |conn|
+ response = util_stub_net_http(:body => "", :code => 200) do |conn|
@request = make_request(uri, Net::HTTP::Get, nil, nil)
@request.fetch
end
assert_equal 200, response.code
- assert_equal '', response.body
+ assert_equal "", response.body
end
def test_fetch_unmodified
uri = Gem::Uri.new(URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}")
t = Time.utc(2013, 1, 2, 3, 4, 5)
- conn, response = util_stub_net_http(:body => '', :code => 304) do |c|
+ conn, response = util_stub_net_http(:body => "", :code => 304) do |c|
@request = make_request(uri, Net::HTTP::Get, t, nil)
[c, @request.fetch]
end
assert_equal 304, response.code
- assert_equal '', response.body
+ assert_equal "", response.body
- modified_header = conn.payload['if-modified-since']
+ modified_header = conn.payload["if-modified-since"]
- assert_equal 'Wed, 02 Jan 2013 03:04:05 GMT', modified_header
+ assert_equal "Wed, 02 Jan 2013 03:04:05 GMT", modified_header
end
def test_user_agent
@@ -287,7 +287,7 @@ class TestGemRequest < Gem::TestCase
util_save_version
Object.send :remove_const, :RUBY_ENGINE
- Object.send :const_set, :RUBY_ENGINE, 'vroom'
+ Object.send :const_set, :RUBY_ENGINE, "vroom"
ua = make_request(@uri, nil, nil, nil).user_agent
@@ -300,7 +300,7 @@ class TestGemRequest < Gem::TestCase
util_save_version
Object.send :remove_const, :RUBY_ENGINE
- Object.send :const_set, :RUBY_ENGINE, 'ruby'
+ Object.send :const_set, :RUBY_ENGINE, "ruby"
ua = make_request(@uri, nil, nil, nil).user_agent
diff --git a/test/rubygems/test_gem_request_connection_pools.rb b/test/rubygems/test_gem_request_connection_pools.rb
index c5e7cf2ed4..964d5c961f 100644
--- a/test/rubygems/test_gem_request_connection_pools.rb
+++ b/test/rubygems/test_gem_request_connection_pools.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/request'
-require 'timeout'
+require_relative "helper"
+require "rubygems/request"
+require "timeout"
class TestGemRequestConnectionPool < Gem::TestCase
class FakeHttp
@@ -17,7 +17,7 @@ class TestGemRequestConnectionPool < Gem::TestCase
@old_client = Gem::Request::ConnectionPools.client
Gem::Request::ConnectionPools.client = FakeHttp
- @proxy = URI 'http://proxy.example'
+ @proxy = URI "http://proxy.example"
end
def teardown
@@ -32,9 +32,9 @@ class TestGemRequestConnectionPool < Gem::TestCase
ems.example
]
- no_proxy = pools.send :no_proxy?, 'rubygems.example', env_no_proxy
+ no_proxy = pools.send :no_proxy?, "rubygems.example", env_no_proxy
- refute no_proxy, 'mismatch'
+ refute no_proxy, "mismatch"
end
def test_to_proxy_empty_string
@@ -42,13 +42,13 @@ class TestGemRequestConnectionPool < Gem::TestCase
env_no_proxy = [""]
- no_proxy = pools.send :no_proxy?, 'ems.example', env_no_proxy
+ no_proxy = pools.send :no_proxy?, "ems.example", env_no_proxy
- refute no_proxy, 'mismatch'
+ refute no_proxy, "mismatch"
end
def test_checkout_same_connection
- uri = URI.parse('http://example/some_endpoint')
+ uri = URI.parse("http://example/some_endpoint")
pools = Gem::Request::ConnectionPools.new nil, []
pool = pools.pool_for uri
@@ -66,13 +66,13 @@ class TestGemRequestConnectionPool < Gem::TestCase
2.no-proxy.example
]
- no_proxy = pools.send :no_proxy?, '2.no-proxy.example', env_no_proxy
+ no_proxy = pools.send :no_proxy?, "2.no-proxy.example", env_no_proxy
- assert no_proxy, 'match'
+ assert no_proxy, "match"
- no_proxy = pools.send :no_proxy?, 'proxy.example', env_no_proxy
+ no_proxy = pools.send :no_proxy?, "proxy.example", env_no_proxy
- refute no_proxy, 'mismatch'
+ refute no_proxy, "mismatch"
end
def test_to_proxy_eh_wildcard
@@ -82,31 +82,31 @@ class TestGemRequestConnectionPool < Gem::TestCase
.no-proxy.example
]
- no_proxy = pools.send :no_proxy?, '2.no-proxy.example', env_no_proxy
+ no_proxy = pools.send :no_proxy?, "2.no-proxy.example", env_no_proxy
- assert no_proxy, 'wildcard matching subdomain'
+ assert no_proxy, "wildcard matching subdomain"
- no_proxy = pools.send :no_proxy?, 'no-proxy.example', env_no_proxy
+ no_proxy = pools.send :no_proxy?, "no-proxy.example", env_no_proxy
- assert no_proxy, 'wildcard matching dotless domain'
+ assert no_proxy, "wildcard matching dotless domain"
- no_proxy = pools.send :no_proxy?, 'proxy.example', env_no_proxy
+ no_proxy = pools.send :no_proxy?, "proxy.example", env_no_proxy
- refute no_proxy, 'wildcard mismatch'
+ refute no_proxy, "wildcard mismatch"
end
def test_net_http_args
pools = Gem::Request::ConnectionPools.new nil, []
- net_http_args = pools.send :net_http_args, URI('http://example'), nil
+ net_http_args = pools.send :net_http_args, URI("http://example"), nil
- assert_equal ['example', 80], net_http_args
+ assert_equal ["example", 80], net_http_args
end
def test_net_http_args_ipv6
pools = Gem::Request::ConnectionPools.new nil, []
- net_http_args = pools.send :net_http_args, URI('http://[::1]'), nil
+ net_http_args = pools.send :net_http_args, URI("http://[::1]"), nil
assert_equal ["::1", 80], net_http_args
end
@@ -114,26 +114,26 @@ class TestGemRequestConnectionPool < Gem::TestCase
def test_net_http_args_proxy
pools = Gem::Request::ConnectionPools.new nil, []
- net_http_args = pools.send :net_http_args, URI('http://example'), @proxy
+ net_http_args = pools.send :net_http_args, URI("http://example"), @proxy
- assert_equal ['example', 80, 'proxy.example', 80, nil, nil], net_http_args
+ assert_equal ["example", 80, "proxy.example", 80, nil, nil], net_http_args
end
def test_net_http_args_no_proxy
- orig_no_proxy, ENV['no_proxy'] = ENV['no_proxy'], 'example'
+ orig_no_proxy, ENV["no_proxy"] = ENV["no_proxy"], "example"
pools = Gem::Request::ConnectionPools.new nil, []
- net_http_args = pools.send :net_http_args, URI('http://example'), @proxy
+ net_http_args = pools.send :net_http_args, URI("http://example"), @proxy
- assert_equal ['example', 80, nil, nil], net_http_args
+ assert_equal ["example", 80, nil, nil], net_http_args
ensure
- ENV['no_proxy'] = orig_no_proxy
+ ENV["no_proxy"] = orig_no_proxy
end
def test_thread_waits_for_connection
- uri = URI.parse('http://example/some_endpoint')
+ uri = URI.parse("http://example/some_endpoint")
pools = Gem::Request::ConnectionPools.new nil, []
pool = pools.pool_for uri
diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb
index e2fe98b9bf..6d14321126 100644
--- a/test/rubygems/test_gem_request_set.rb
+++ b/test/rubygems/test_gem_request_set.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/request_set'
+require_relative "helper"
+require "rubygems/request_set"
class TestGemRequestSet < Gem::TestCase
def setup
@@ -23,24 +23,24 @@ class TestGemRequestSet < Gem::TestCase
def test_gem_duplicate
rs = Gem::RequestSet.new
- rs.gem 'a', '1'
- rs.gem 'a', '2'
+ rs.gem "a", "1"
+ rs.gem "a", "2"
- assert_equal [dep('a', '= 1', '= 2')], rs.dependencies
+ assert_equal [dep("a", "= 1", "= 2")], rs.dependencies
end
def test_import
rs = Gem::RequestSet.new
- rs.gem 'a'
+ rs.gem "a"
- rs.import [dep('b')]
+ rs.import [dep("b")]
- assert_equal [dep('a'), dep('b')], rs.dependencies
+ assert_equal [dep("a"), dep("b")], rs.dependencies
end
def test_install_from_gemdeps
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
done_installing_ran = false
@@ -52,7 +52,7 @@ class TestGemRequestSet < Gem::TestCase
rs = Gem::RequestSet.new
installed = []
- File.open 'gem.deps.rb', 'w' do |io|
+ File.open "gem.deps.rb", "w" do |io|
io.puts 'gem "a"'
io.flush
@@ -63,9 +63,9 @@ class TestGemRequestSet < Gem::TestCase
assert_kind_of Array, result # what is supposed to be in here?
end
- assert_includes installed, 'a-2'
- assert_path_exist File.join @gemhome, 'gems', 'a-2'
- assert_path_exist 'gem.deps.rb.lock'
+ assert_includes installed, "a-2"
+ assert_path_exist File.join @gemhome, "gems", "a-2"
+ assert_path_exist "gem.deps.rb.lock"
assert rs.remote
refute done_installing_ran
@@ -73,12 +73,12 @@ class TestGemRequestSet < Gem::TestCase
def test_install_from_gemdeps_explain
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
rs = Gem::RequestSet.new
- File.open 'gem.deps.rb', 'w' do |io|
+ File.open "gem.deps.rb", "w" do |io|
io.puts 'gem "a"'
io.flush
@@ -96,21 +96,21 @@ Gems to install:
def test_install_from_gemdeps_install_dir
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
util_clear_gems
- assert_path_not_exist File.join Gem.dir, 'gems', 'a-2'
+ assert_path_not_exist File.join Gem.dir, "gems", "a-2"
rs = Gem::RequestSet.new
installed = []
- File.open 'gem.deps.rb', 'w' do |io|
+ File.open "gem.deps.rb", "w" do |io|
io.puts 'gem "a"'
end
options = {
- :gemdeps => 'gem.deps.rb',
+ :gemdeps => "gem.deps.rb",
:install_dir => "#{@gemhome}2",
}
@@ -118,18 +118,18 @@ Gems to install:
installed << req.full_name
end
- assert_includes installed, 'a-2'
- assert_path_not_exist File.join Gem.dir, 'gems', 'a-2'
+ assert_includes installed, "a-2"
+ assert_path_not_exist File.join Gem.dir, "gems", "a-2"
end
def test_install_from_gemdeps_local
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
rs = Gem::RequestSet.new
- File.open 'gem.deps.rb', 'w' do |io|
+ File.open "gem.deps.rb", "w" do |io|
io.puts 'gem "a"'
io.flush
@@ -143,15 +143,15 @@ Gems to install:
def test_install_from_gemdeps_lockfile
spec_fetcher do |fetcher|
- fetcher.download 'a', 1
- fetcher.download 'a', 2
- fetcher.download 'b', 1, 'a' => '>= 0'
+ fetcher.download "a", 1
+ fetcher.download "a", 2
+ fetcher.download "b", 1, "a" => ">= 0"
end
rs = Gem::RequestSet.new
installed = []
- File.open 'gem.deps.rb.lock', 'w' do |io|
+ File.open "gem.deps.rb.lock", "w" do |io|
io.puts <<-LOCKFILE
GEM
remote: #{@gem_repo}
@@ -168,19 +168,19 @@ DEPENDENCIES
LOCKFILE
end
- File.open 'gem.deps.rb', 'w' do |io|
+ File.open "gem.deps.rb", "w" do |io|
io.puts 'gem "b"'
end
- rs.install_from_gemdeps :gemdeps => 'gem.deps.rb' do |req, installer|
+ rs.install_from_gemdeps :gemdeps => "gem.deps.rb" do |req, installer|
installed << req.full_name
end
- assert_includes installed, 'b-1'
- assert_includes installed, 'a-1'
+ assert_includes installed, "b-1"
+ assert_includes installed, "a-1"
- assert_path_exist File.join @gemhome, 'specifications', 'a-1.gemspec'
- assert_path_exist File.join @gemhome, 'specifications', 'b-1.gemspec'
+ assert_path_exist File.join @gemhome, "specifications", "a-1.gemspec"
+ assert_path_exist File.join @gemhome, "specifications", "b-1.gemspec"
end
def test_install_from_gemdeps_complex_dependencies
@@ -197,7 +197,7 @@ DEPENDENCIES
rs = Gem::RequestSet.new
installed = []
- File.open 'Gemfile.lock', 'w' do |io|
+ File.open "Gemfile.lock", "w" do |io|
io.puts <<-LOCKFILE
GEM
remote: #{@gem_repo}
@@ -212,7 +212,7 @@ DEPENDENCIES
LOCKFILE
end
- File.open 'testo.gemspec', 'w' do |io|
+ File.open "testo.gemspec", "w" do |io|
io.puts <<-LOCKFILE
Gem::Specification.new do |spec|
spec.name = 'testo'
@@ -222,28 +222,28 @@ end
LOCKFILE
end
- File.open 'Gemfile', 'w' do |io|
+ File.open "Gemfile", "w" do |io|
io.puts("gemspec")
end
- rs.install_from_gemdeps :gemdeps => 'Gemfile' do |req, installer|
+ rs.install_from_gemdeps :gemdeps => "Gemfile" do |req, installer|
installed << req.full_name
end
- assert_includes installed, 'z-1.0.3'
+ assert_includes installed, "z-1.0.3"
- assert_path_exist File.join @gemhome, 'specifications', 'z-1.0.3.gemspec'
+ assert_path_exist File.join @gemhome, "specifications", "z-1.0.3.gemspec"
end
def test_install_from_gemdeps_version_mismatch
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
rs = Gem::RequestSet.new
installed = []
- File.open 'gem.deps.rb', 'w' do |io|
+ File.open "gem.deps.rb", "w" do |io|
io.puts <<-GEM_DEPS
gem "a"
ruby "0"
@@ -256,13 +256,13 @@ ruby "0"
end
end
- assert_includes installed, 'a-2'
+ assert_includes installed, "a-2"
end
def test_load_gemdeps
rs = Gem::RequestSet.new
- tf = Tempfile.open 'gem.deps.rb' do |io|
+ tf = Tempfile.open "gem.deps.rb" do |io|
io.puts 'gem "a"'
io.flush
@@ -273,7 +273,7 @@ ruby "0"
end
tf.close!
- assert_equal [dep('a')], rs.dependencies
+ assert_equal [dep("a")], rs.dependencies
assert rs.git_set
assert rs.vendor_set
@@ -282,7 +282,7 @@ ruby "0"
def test_load_gemdeps_installing
rs = Gem::RequestSet.new
- tf = Tempfile.open 'gem.deps.rb' do |io|
+ tf = Tempfile.open "gem.deps.rb" do |io|
io.puts 'ruby "0"'
io.puts 'gem "a"'
io.flush
@@ -294,13 +294,13 @@ ruby "0"
end
tf.close!
- assert_equal [dep('a')], rs.dependencies
+ assert_equal [dep("a")], rs.dependencies
end
def test_load_gemdeps_without_groups
rs = Gem::RequestSet.new
- tf = Tempfile.open 'gem.deps.rb' do |io|
+ tf = Tempfile.open "gem.deps.rb" do |io|
io.puts 'gem "a", :group => :test'
io.flush
@@ -332,12 +332,12 @@ ruby "0"
end
def test_bug_bug_990
- a = util_spec 'a', '1.b', 'b' => '~> 1.a'
- b = util_spec 'b', '1.b', 'c' => '>= 1'
- c = util_spec 'c', '1.1.b'
+ a = util_spec "a", "1.b", "b" => "~> 1.a"
+ b = util_spec "b", "1.b", "c" => ">= 1"
+ c = util_spec "c", "1.1.b"
rs = Gem::RequestSet.new
- rs.gem 'a'
+ rs.gem "a"
rs.prerelease = true
res = rs.resolve StaticSet.new([a, b, c])
@@ -349,11 +349,11 @@ ruby "0"
end
def test_resolve_development
- a = util_spec 'a', 1
+ a = util_spec "a", 1
spec = Gem::Resolver::SpecSpecification.new nil, a
rs = Gem::RequestSet.new
- rs.gem 'a'
+ rs.gem "a"
rs.development = true
res = rs.resolve StaticSet.new [spec]
@@ -364,22 +364,22 @@ ruby "0"
end
def test_resolve_development_shallow
- a = util_spec 'a', 1 do |s|
- s.add_development_dependency 'b'
+ a = util_spec "a", 1 do |s|
+ s.add_development_dependency "b"
end
- b = util_spec 'b', 1 do |s|
- s.add_development_dependency 'c'
+ b = util_spec "b", 1 do |s|
+ s.add_development_dependency "c"
end
- c = util_spec 'c', 1
+ c = util_spec "c", 1
a_spec = Gem::Resolver::SpecSpecification.new nil, a
b_spec = Gem::Resolver::SpecSpecification.new nil, b
c_spec = Gem::Resolver::SpecSpecification.new nil, c
rs = Gem::RequestSet.new
- rs.gem 'a'
+ rs.gem "a"
rs.development = true
rs.development_shallow = true
@@ -395,7 +395,7 @@ ruby "0"
rs = Gem::RequestSet.new
- tf = Tempfile.open 'gem.deps.rb' do |io|
+ tf = Tempfile.open "gem.deps.rb" do |io|
io.puts <<-GEMS_DEPS_RB
gem "#{name}", :git => "#{repository}"
GEMS_DEPS_RB
@@ -435,12 +435,12 @@ ruby "0"
end
def test_resolve_incompatible
- a1 = util_spec 'a', 1
- a2 = util_spec 'a', 2
+ a1 = util_spec "a", 1
+ a2 = util_spec "a", 2
rs = Gem::RequestSet.new
- rs.gem 'a', '= 1'
- rs.gem 'a', '= 2'
+ rs.gem "a", "= 1"
+ rs.gem "a", "= 2"
set = StaticSet.new [a1, a2]
@@ -450,15 +450,15 @@ ruby "0"
end
def test_resolve_vendor
- a_name, _, a_directory = vendor_gem 'a', 1 do |s|
- s.add_dependency 'b', '~> 2.0'
+ a_name, _, a_directory = vendor_gem "a", 1 do |s|
+ s.add_dependency "b", "~> 2.0"
end
- b_name, _, b_directory = vendor_gem 'b', 2
+ b_name, _, b_directory = vendor_gem "b", 2
rs = Gem::RequestSet.new
- tf = Tempfile.open 'gem.deps.rb' do |io|
+ tf = Tempfile.open "gem.deps.rb" do |io|
io.puts <<-GEMS_DEPS_RB
gem "#{a_name}", :path => "#{a_directory}"
gem "#{b_name}", :path => "#{b_directory}"
@@ -509,7 +509,7 @@ ruby "0"
end
rs = Gem::RequestSet.new
- rs.gem 'a'
+ rs.gem "a"
rs.resolve
@@ -525,8 +525,8 @@ ruby "0"
assert_equal %w[b-1 a-1],
installers.map {|installer| installer.spec.full_name }
- assert_path_exist File.join @gemhome, 'specifications', 'a-1.gemspec'
- assert_path_exist File.join @gemhome, 'specifications', 'b-1.gemspec'
+ assert_path_exist File.join @gemhome, "specifications", "a-1.gemspec"
+ assert_path_exist File.join @gemhome, "specifications", "b-1.gemspec"
assert_equal %w[b-1 a-1], installed.map {|s| s.full_name }
@@ -545,32 +545,32 @@ ruby "0"
rs.resolve
installed = rs.install_into @tempdir do
- assert_equal @tempdir, ENV['GEM_HOME']
+ assert_equal @tempdir, ENV["GEM_HOME"]
end
- assert_path_exist File.join @tempdir, 'specifications', 'a-1.gemspec'
- assert_path_exist File.join @tempdir, 'specifications', 'b-1.gemspec'
+ assert_path_exist File.join @tempdir, "specifications", "a-1.gemspec"
+ assert_path_exist File.join @tempdir, "specifications", "b-1.gemspec"
assert_equal %w[b-1 a-1], installed.map {|s| s.full_name }
end
def test_install_into_development_shallow
spec_fetcher do |fetcher|
- fetcher.gem 'a', '1' do |s|
- s.add_development_dependency 'b', '= 1'
+ fetcher.gem "a", "1" do |s|
+ s.add_development_dependency "b", "= 1"
end
- fetcher.gem 'b', '1' do |s|
- s.add_development_dependency 'c', '= 1'
+ fetcher.gem "b", "1" do |s|
+ s.add_development_dependency "c", "= 1"
end
- fetcher.spec 'c', '1'
+ fetcher.spec "c", "1"
end
rs = Gem::RequestSet.new
rs.development = true
rs.development_shallow = true
- rs.gem 'a'
+ rs.gem "a"
rs.resolve
@@ -580,25 +580,25 @@ ruby "0"
}
installed = rs.install_into @tempdir, true, options do
- assert_equal @tempdir, ENV['GEM_HOME']
+ assert_equal @tempdir, ENV["GEM_HOME"]
end
assert_equal %w[a-1 b-1], installed.map {|s| s.full_name }.sort
end
def test_sorted_requests_development_shallow
- a = util_spec 'a', 1 do |s|
- s.add_development_dependency 'b'
+ a = util_spec "a", 1 do |s|
+ s.add_development_dependency "b"
end
- b = util_spec 'b', 1 do |s|
- s.add_development_dependency 'c'
+ b = util_spec "b", 1 do |s|
+ s.add_development_dependency "c"
end
- c = util_spec 'c', 1
+ c = util_spec "c", 1
rs = Gem::RequestSet.new
- rs.gem 'a'
+ rs.gem "a"
rs.development = true
rs.development_shallow = true
@@ -612,18 +612,18 @@ ruby "0"
end
def test_tsort_each_child_development
- a = util_spec 'a', 1 do |s|
- s.add_development_dependency 'b'
+ a = util_spec "a", 1 do |s|
+ s.add_development_dependency "b"
end
- b = util_spec 'b', 1 do |s|
- s.add_development_dependency 'c'
+ b = util_spec "b", 1 do |s|
+ s.add_development_dependency "c"
end
- c = util_spec 'c', 1
+ c = util_spec "c", 1
rs = Gem::RequestSet.new
- rs.gem 'a'
+ rs.gem "a"
rs.development = true
rs.development_shallow = true
@@ -641,18 +641,18 @@ ruby "0"
end
def test_tsort_each_child_development_shallow
- a = util_spec 'a', 1 do |s|
- s.add_development_dependency 'b'
+ a = util_spec "a", 1 do |s|
+ s.add_development_dependency "b"
end
- b = util_spec 'b', 1 do |s|
- s.add_development_dependency 'c'
+ b = util_spec "b", 1 do |s|
+ s.add_development_dependency "c"
end
- c = util_spec 'c', 1
+ c = util_spec "c", 1
rs = Gem::RequestSet.new
- rs.gem 'a'
+ rs.gem "a"
rs.development = true
rs.development_shallow = true
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 cc4f99df91..d1411ddc56 100644
--- a/test/rubygems/test_gem_request_set_gem_dependency_api.rb
+++ b/test/rubygems/test_gem_request_set_gem_dependency_api.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/request_set'
+require_relative "helper"
+require "rubygems/request_set"
class TestGemRequestSetGemDependencyAPI < Gem::TestCase
def setup
@@ -13,7 +13,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
@git_set = Gem::Resolver::GitSet.new
@vendor_set = Gem::Resolver::VendorSet.new
- @gda = @GDA.new @set, 'gem.deps.rb'
+ @gda = @GDA.new @set, "gem.deps.rb"
@gda.instance_variable_set :@git_set, @git_set
@gda.instance_variable_set :@vendor_set, @vendor_set
end
@@ -44,45 +44,45 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
def test_gempspec_with_multiple_runtime_deps
- save_gemspec 'foo', '1.0' do |s|
- s.add_runtime_dependency 'bar', '>= 1.6.0', '< 1.6.4'
+ save_gemspec "foo", "1.0" do |s|
+ s.add_runtime_dependency "bar", ">= 1.6.0", "< 1.6.4"
end
@gda.gemspec
assert_equal %w[ foo bar ].sort, @set.dependencies.map(&:name).sort
- bar = @set.dependencies.find {|d| d.name == 'bar' }
- assert_equal [["<", Gem::Version.create('1.6.4')],
- [">=", Gem::Version.create('1.6.0')]], bar.requirement.requirements.sort
+ bar = @set.dependencies.find {|d| d.name == "bar" }
+ assert_equal [["<", Gem::Version.create("1.6.4")],
+ [">=", Gem::Version.create("1.6.0")]], bar.requirement.requirements.sort
end
def test_gemspec_without_group
- @gda.send :add_dependencies, [:development], [dep('a', '= 1')]
+ @gda.send :add_dependencies, [:development], [dep("a", "= 1")]
- assert_equal [dep('a', '= 1')], @set.dependencies
+ assert_equal [dep("a", "= 1")], @set.dependencies
@gda.without_groups << :development
- @gda.send :add_dependencies, [:development], [dep('b', '= 2')]
+ @gda.send :add_dependencies, [:development], [dep("b", "= 2")]
- assert_equal [dep('a', '= 1')], @set.dependencies
+ assert_equal [dep("a", "= 1")], @set.dependencies
end
def test_gem
- @gda.gem 'a'
+ @gda.gem "a"
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
- assert_equal %w[a], @gda.requires['a']
+ assert_equal %w[a], @gda.requires["a"]
- expected = { 'a' => Gem::Requirement.default }
+ expected = { "a" => Gem::Requirement.default }
assert_equal expected, @gda.dependencies
end
def test_gem_duplicate
- @gda.gem 'a'
+ @gda.gem "a"
_, err = capture_output do
- @gda.gem 'a'
+ @gda.gem "a"
end
expected = "Gem dependencies file gem.deps.rb requires a more than once."
@@ -91,141 +91,141 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
def test_gem_git
- @gda.gem 'a', :git => 'git/a'
+ @gda.gem "a", :git => "git/a"
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
- assert_equal %w[git/a master], @git_set.repositories['a']
+ assert_equal %w[git/a master], @git_set.repositories["a"]
- expected = { 'a' => Gem::Requirement.create('!') }
+ expected = { "a" => Gem::Requirement.create("!") }
assert_equal expected, @gda.dependencies
end
def test_gem_bitbucket
- @gda.gem 'a', :bitbucket => 'example/repository'
+ @gda.gem "a", :bitbucket => "example/repository"
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
assert_equal %w[https://example@bitbucket.org/example/repository.git master],
- @git_set.repositories['a']
+ @git_set.repositories["a"]
- expected = { 'a' => Gem::Requirement.create('!') }
+ expected = { "a" => Gem::Requirement.create("!") }
assert_equal expected, @gda.dependencies
end
def test_gem_bitbucket_expand_path
- @gda.gem 'a', :bitbucket => 'example'
+ @gda.gem "a", :bitbucket => "example"
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
assert_equal %w[https://example@bitbucket.org/example/example.git master],
- @git_set.repositories['a']
+ @git_set.repositories["a"]
- expected = { 'a' => Gem::Requirement.create('!') }
+ expected = { "a" => Gem::Requirement.create("!") }
assert_equal expected, @gda.dependencies
end
def test_gem_git_branch
_, err = capture_output do
- @gda.gem 'a', :git => 'git/a', :branch => 'other', :tag => 'v1'
+ @gda.gem "a", :git => "git/a", :branch => "other", :tag => "v1"
end
expected = "Gem dependencies file gem.deps.rb includes git reference for both ref/branch and tag but only ref/branch is used."
assert_match expected, err
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
- assert_equal %w[git/a other], @git_set.repositories['a']
+ assert_equal %w[git/a other], @git_set.repositories["a"]
end
def test_gem_git_gist
- @gda.gem 'a', :gist => 'a'
+ @gda.gem "a", :gist => "a"
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
assert_equal %w[https://gist.github.com/a.git master],
- @git_set.repositories['a']
+ @git_set.repositories["a"]
end
def test_gem_git_ref
_, err = capture_output do
- @gda.gem 'a', :git => 'git/a', :ref => 'abcd123', :branch => 'other'
+ @gda.gem "a", :git => "git/a", :ref => "abcd123", :branch => "other"
end
expected = "Gem dependencies file gem.deps.rb includes git reference for both ref and branch but only ref is used."
assert_match expected, err
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
- assert_equal %w[git/a abcd123], @git_set.repositories['a']
+ assert_equal %w[git/a abcd123], @git_set.repositories["a"]
end
def test_gem_git_submodules
- @gda.gem 'a', :git => 'git/a', :submodules => true
+ @gda.gem "a", :git => "git/a", :submodules => true
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
- assert_equal %w[git/a master], @git_set.repositories['a']
+ assert_equal %w[git/a master], @git_set.repositories["a"]
assert_equal %w[git/a], @git_set.need_submodules.keys
end
def test_gem_git_tag
- @gda.gem 'a', :git => 'git/a', :tag => 'v1'
+ @gda.gem "a", :git => "git/a", :tag => "v1"
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
- assert_equal %w[git/a v1], @git_set.repositories['a']
+ assert_equal %w[git/a v1], @git_set.repositories["a"]
end
def test_gem_github
- @gda.gem 'a', :github => 'example/repository'
+ @gda.gem "a", :github => "example/repository"
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
assert_equal %w[git://github.com/example/repository.git master],
- @git_set.repositories['a']
+ @git_set.repositories["a"]
- expected = { 'a' => Gem::Requirement.create('!') }
+ expected = { "a" => Gem::Requirement.create("!") }
assert_equal expected, @gda.dependencies
end
def test_gem_github_expand_path
- @gda.gem 'a', :github => 'example'
+ @gda.gem "a", :github => "example"
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
assert_equal %w[git://github.com/example/example.git master],
- @git_set.repositories['a']
+ @git_set.repositories["a"]
- expected = { 'a' => Gem::Requirement.create('!') }
+ expected = { "a" => Gem::Requirement.create("!") }
assert_equal expected, @gda.dependencies
end
def test_gem_group
- @gda.gem 'a', :group => :test
+ @gda.gem "a", :group => :test
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
end
def test_gem_group_without
@gda.without_groups << :test
- @gda.gem 'a', :group => :test
+ @gda.gem "a", :group => :test
assert_empty @set.dependencies
- expected = { 'a' => Gem::Requirement.default }
+ expected = { "a" => Gem::Requirement.default }
assert_equal expected, @gda.dependencies
end
def test_gem_groups
- @gda.gem 'a', :groups => [:test, :development]
+ @gda.gem "a", :groups => [:test, :development]
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
end
def test_gem_path
@@ -239,7 +239,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
assert_equal "#{name}-#{version}", loaded.full_name
- expected = { name => Gem::Requirement.create('!') }
+ expected = { name => Gem::Requirement.create("!") }
assert_equal expected, @gda.dependencies
end
@@ -247,8 +247,8 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
def test_gem_platforms
win_platform, Gem.win_platform = Gem.win_platform?, false
- with_engine_version 'ruby', '2.0.0' do
- @gda.gem 'a', :platforms => :ruby
+ with_engine_version "ruby", "2.0.0" do
+ @gda.gem "a", :platforms => :ruby
refute_empty @set.dependencies
end
@@ -259,44 +259,44 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
def test_gem_platforms_bundler_ruby
win_platform, Gem.win_platform = Gem.win_platform?, false
- with_engine_version 'ruby', '2.0.0' do
+ with_engine_version "ruby", "2.0.0" do
set = Gem::RequestSet.new
- gda = @GDA.new set, 'gem.deps.rb'
- gda.gem 'a', :platforms => :ruby
+ gda = @GDA.new set, "gem.deps.rb"
+ gda.gem "a", :platforms => :ruby
refute_empty set.dependencies
end
- with_engine_version 'rbx', '2.0.0' do
+ with_engine_version "rbx", "2.0.0" do
set = Gem::RequestSet.new
- gda = @GDA.new set, 'gem.deps.rb'
- gda.gem 'a', :platforms => :ruby
+ gda = @GDA.new set, "gem.deps.rb"
+ gda.gem "a", :platforms => :ruby
refute_empty set.dependencies
end
- with_engine_version 'truffleruby', '2.0.0' do
+ with_engine_version "truffleruby", "2.0.0" do
set = Gem::RequestSet.new
- gda = @GDA.new set, 'gem.deps.rb'
- gda.gem 'a', :platforms => :ruby
+ gda = @GDA.new set, "gem.deps.rb"
+ gda.gem "a", :platforms => :ruby
refute_empty set.dependencies
end
- with_engine_version 'jruby', '1.7.6' do
+ with_engine_version "jruby", "1.7.6" do
set = Gem::RequestSet.new
- gda = @GDA.new set, 'gem.deps.rb'
- gda.gem 'a', :platforms => :ruby
+ gda = @GDA.new set, "gem.deps.rb"
+ gda.gem "a", :platforms => :ruby
assert_empty set.dependencies
end
Gem.win_platform = true
- with_engine_version 'ruby', '2.0.0' do
+ with_engine_version "ruby", "2.0.0" do
set = Gem::RequestSet.new
- gda = @GDA.new set, 'gem.deps.rb'
- gda.gem 'a', :platforms => :ruby
+ gda = @GDA.new set, "gem.deps.rb"
+ gda.gem "a", :platforms => :ruby
assert_empty set.dependencies
end
@@ -305,14 +305,14 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
def test_gem_platforms_engine
- with_engine_version 'jruby', '1.7.6' do
- @gda.gem 'a', :platforms => :mri
+ with_engine_version "jruby", "1.7.6" do
+ @gda.gem "a", :platforms => :mri
assert_empty @set.dependencies
end
- with_engine_version 'truffleruby', '1.2.3' do
- @gda.gem 'a', :platforms => :mri
+ with_engine_version "truffleruby", "1.2.3" do
+ @gda.gem "a", :platforms => :mri
assert_empty @set.dependencies
end
@@ -321,16 +321,16 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
def test_gem_platforms_maglev
win_platform, Gem.win_platform = Gem.win_platform?, false
- with_engine_version 'maglev', '1.0.0' do
+ with_engine_version "maglev", "1.0.0" do
set = Gem::RequestSet.new
- gda = @GDA.new set, 'gem.deps.rb'
- gda.gem 'a', :platforms => :ruby
+ gda = @GDA.new set, "gem.deps.rb"
+ gda.gem "a", :platforms => :ruby
refute_empty set.dependencies
set = Gem::RequestSet.new
- gda = @GDA.new set, 'gem.deps.rb'
- gda.gem 'a', :platforms => :maglev
+ gda = @GDA.new set, "gem.deps.rb"
+ gda.gem "a", :platforms => :maglev
refute_empty set.dependencies
end
@@ -339,16 +339,16 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
def test_gem_platforms_truffleruby
- with_engine_version 'truffleruby', '1.0.0' do
+ with_engine_version "truffleruby", "1.0.0" do
set = Gem::RequestSet.new
- gda = @GDA.new set, 'gem.deps.rb'
- gda.gem 'a', :platforms => :truffleruby
+ gda = @GDA.new set, "gem.deps.rb"
+ gda.gem "a", :platforms => :truffleruby
refute_empty set.dependencies
set = Gem::RequestSet.new
- gda = @GDA.new set, 'gem.deps.rb'
- gda.gem 'a', :platforms => :maglev
+ gda = @GDA.new set, "gem.deps.rb"
+ gda.gem "a", :platforms => :maglev
assert_empty set.dependencies
end
@@ -357,8 +357,8 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
def test_gem_platforms_multiple
win_platform, Gem.win_platform = Gem.win_platform?, false
- with_engine_version 'ruby', '2.0.0' do
- @gda.gem 'a', :platforms => [:mswin, :jruby]
+ with_engine_version "ruby", "2.0.0" do
+ @gda.gem "a", :platforms => [:mswin, :jruby]
assert_empty @set.dependencies
end
@@ -370,8 +370,8 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
def test_gem_platforms_platform
win_platform, Gem.win_platform = Gem.win_platform?, false
- with_engine_version 'ruby', '2.0.0' do
- @gda.gem 'a', :platforms => :jruby, :platform => :ruby
+ with_engine_version "ruby", "2.0.0" do
+ @gda.gem "a", :platforms => :jruby, :platform => :ruby
refute_empty @set.dependencies
end
@@ -380,8 +380,8 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
def test_gem_platforms_version
- with_engine_version 'ruby', '2.0.0' do
- @gda.gem 'a', :platforms => :ruby_18
+ with_engine_version "ruby", "2.0.0" do
+ @gda.gem "a", :platforms => :ruby_18
assert_empty @set.dependencies
end
@@ -389,26 +389,26 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
def test_gem_platforms_unknown
e = assert_raise ArgumentError do
- @gda.gem 'a', :platforms => :unknown
+ @gda.gem "a", :platforms => :unknown
end
- assert_equal 'unknown platform :unknown', e.message
+ assert_equal "unknown platform :unknown", e.message
end
def test_gem_requires
- @gda.gem 'a', :require => %w[b c]
- @gda.gem 'd', :require => 'e'
+ @gda.gem "a", :require => %w[b c]
+ @gda.gem "d", :require => "e"
- assert_equal [dep('a'), dep('d')], @set.dependencies
+ assert_equal [dep("a"), dep("d")], @set.dependencies
- assert_equal %w[b c], @gda.requires['a']
- assert_equal %w[e], @gda.requires['d']
+ assert_equal %w[b c], @gda.requires["a"]
+ assert_equal %w[e], @gda.requires["d"]
end
def test_gem_requires_false
- @gda.gem 'a', :require => false
+ @gda.gem "a", :require => false
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
assert_empty @gda.requires
end
@@ -416,37 +416,37 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
def test_gem_requires_without_group
@gda.without_groups << :test
- @gda.gem 'a', :group => :test
+ @gda.gem "a", :group => :test
assert_empty @set.dependencies
- assert_empty @gda.requires['a']
+ assert_empty @gda.requires["a"]
end
def test_gem_requirement
- @gda.gem 'a', '~> 1.0'
+ @gda.gem "a", "~> 1.0"
- assert_equal [dep('a', '~> 1.0')], @set.dependencies
+ assert_equal [dep("a", "~> 1.0")], @set.dependencies
- expected = { 'a' => Gem::Requirement.create(['~> 1.0']) }
+ expected = { "a" => Gem::Requirement.create(["~> 1.0"]) }
assert_equal expected, @gda.dependencies
end
def test_gem_requirements
- @gda.gem 'b', '~> 1.0', '>= 1.0.2'
+ @gda.gem "b", "~> 1.0", ">= 1.0.2"
- assert_equal [dep('b', '~> 1.0', '>= 1.0.2')], @set.dependencies
+ assert_equal [dep("b", "~> 1.0", ">= 1.0.2")], @set.dependencies
- expected = { 'b' => Gem::Requirement.create(['~> 1.0', '>= 1.0.2']) }
+ expected = { "b" => Gem::Requirement.create(["~> 1.0", ">= 1.0.2"]) }
assert_equal expected, @gda.dependencies
end
def test_gem_requirements_options
- @gda.gem 'c', :git => 'https://example/c.git'
+ @gda.gem "c", :git => "https://example/c.git"
- assert_equal [dep('c')], @set.dependencies
+ assert_equal [dep("c")], @set.dependencies
end
def test_gem_source_mismatch
@@ -475,47 +475,47 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
def test_gem_deps_file
- assert_equal 'gem.deps.rb', @gda.gem_deps_file
+ assert_equal "gem.deps.rb", @gda.gem_deps_file
- gda = @GDA.new @set, 'foo/Gemfile'
+ gda = @GDA.new @set, "foo/Gemfile"
- assert_equal 'Gemfile', gda.gem_deps_file
+ assert_equal "Gemfile", gda.gem_deps_file
end
def test_gem_group_method
groups = []
@gda.group :a do
- groups = @gda.send :gem_group, 'a', :group => :b, :groups => [:c, :d]
+ groups = @gda.send :gem_group, "a", :group => :b, :groups => [:c, :d]
end
assert_equal [:a, :b, :c, :d], groups.sort_by {|group| group.to_s }
end
def test_gemspec
- save_gemspec 'a', 1 do |s|
- s.add_dependency 'b', 2
- s.add_development_dependency 'c', 3
+ save_gemspec "a", 1 do |s|
+ s.add_dependency "b", 2
+ s.add_development_dependency "c", 3
end
@gda.gemspec
- assert_equal [dep('a', '= 1'), dep('b', '= 2'), dep('c', '=3')],
+ assert_equal [dep("a", "= 1"), dep("b", "= 2"), dep("c", "=3")],
@set.dependencies
- assert_equal %w[a], @gda.requires['a']
+ assert_equal %w[a], @gda.requires["a"]
expected = {
- 'a' => Gem::Requirement.create('!'),
- 'b' => req('= 2'),
- 'c' => req('= 3'),
+ "a" => Gem::Requirement.create("!"),
+ "b" => req("= 2"),
+ "c" => req("= 3"),
}
assert_equal expected, @gda.dependencies
end
def test_gemspec_bad
- FileUtils.touch 'a.gemspec'
+ FileUtils.touch "a.gemspec"
e = assert_raise ArgumentError do
capture_output do
@@ -523,31 +523,31 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
end
- assert_equal 'invalid gemspec ./a.gemspec', e.message
+ assert_equal "invalid gemspec ./a.gemspec", e.message
end
def test_gemspec_development_group
- save_gemspec 'a', 1 do |s|
- s.add_dependency 'b', 2
- s.add_development_dependency 'c', 3
+ save_gemspec "a", 1 do |s|
+ s.add_dependency "b", 2
+ s.add_development_dependency "c", 3
end
@gda.without_groups << :other
@gda.gemspec :development_group => :other
- assert_equal [dep('a', '= 1'), dep('b', '= 2')], @set.dependencies
+ assert_equal [dep("a", "= 1"), dep("b", "= 2")], @set.dependencies
- assert_equal %w[a], @gda.requires['a']
+ assert_equal %w[a], @gda.requires["a"]
end
def test_gemspec_multiple
- save_gemspec 'a', 1 do |s|
- s.add_dependency 'b', 2
+ save_gemspec "a", 1 do |s|
+ s.add_dependency "b", 2
end
- save_gemspec 'b', 2 do |s|
- s.add_dependency 'c', 3
+ save_gemspec "b", 2 do |s|
+ s.add_dependency "c", 3
end
e = assert_raise ArgumentError do
@@ -558,27 +558,27 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
def test_gemspec_name
- save_gemspec 'a', 1 do |s|
- s.add_dependency 'b', 2
+ save_gemspec "a", 1 do |s|
+ s.add_dependency "b", 2
end
- save_gemspec 'b', 2 do |s|
- s.add_dependency 'c', 3
+ save_gemspec "b", 2 do |s|
+ s.add_dependency "c", 3
end
- @gda.gemspec :name => 'b'
+ @gda.gemspec :name => "b"
- assert_equal [dep('b', '= 2'), dep('c', '= 3')], @set.dependencies
+ assert_equal [dep("b", "= 2"), dep("c", "= 3")], @set.dependencies
end
def test_gemspec_named
- save_gemspec 'a', 1 do |s|
- s.add_dependency 'b', 2
+ save_gemspec "a", 1 do |s|
+ s.add_dependency "b", 2
end
@gda.gemspec
- assert_equal [dep('a', '= 1'), dep('b', '= 2')], @set.dependencies
+ assert_equal [dep("a", "= 1"), dep("b", "= 2")], @set.dependencies
end
def test_gemspec_none
@@ -590,27 +590,27 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
end
def test_gemspec_path
- FileUtils.mkdir 'other'
+ FileUtils.mkdir "other"
- save_gemspec 'a', 1, 'other' do |s|
- s.add_dependency 'b', 2
+ save_gemspec "a", 1, "other" do |s|
+ s.add_dependency "b", 2
end
- @gda.gemspec :path => 'other'
+ @gda.gemspec :path => "other"
- assert_equal [dep('a', '= 1'), dep('b', '= 2')], @set.dependencies
+ assert_equal [dep("a", "= 1"), dep("b", "= 2")], @set.dependencies
end
def test_git
- @gda.git 'git://example/repo.git' do
- @gda.gem 'a'
- @gda.gem 'b'
+ @gda.git "git://example/repo.git" do
+ @gda.gem "a"
+ @gda.gem "b"
end
- assert_equal [dep('a'), dep('b')], @set.dependencies
+ assert_equal [dep("a"), dep("b")], @set.dependencies
- assert_equal %w[git://example/repo.git master], @git_set.repositories['a']
- assert_equal %w[git://example/repo.git master], @git_set.repositories['b']
+ assert_equal %w[git://example/repo.git master], @git_set.repositories["a"]
+ assert_equal %w[git://example/repo.git master], @git_set.repositories["b"]
end
def test_git_source
@@ -618,21 +618,21 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
"git://example/#{repo_name}.git"
end
- @gda.gem 'a', :example => 'repo'
+ @gda.gem "a", :example => "repo"
- assert_equal %w[git://example/repo.git master], @git_set.repositories['a']
+ assert_equal %w[git://example/repo.git master], @git_set.repositories["a"]
end
def test_group
@gda.group :test do
- @gda.gem 'a'
+ @gda.gem "a"
end
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
end
def test_load
- tf = Tempfile.open 'gem.deps.rb' do |io|
+ tf = Tempfile.open "gem.deps.rb" do |io|
io.write <<-GEM_DEPS
gem 'a'
@@ -646,7 +646,7 @@ end
assert_equal gda, gda.load
- assert_equal [dep('a'), dep('b')], @set.dependencies
+ assert_equal [dep("a"), dep("b")], @set.dependencies
io
end
tf.close!
@@ -655,18 +655,18 @@ end
def test_pin_gem_source
gda = @GDA.new @set, nil
- gda.send :pin_gem_source, 'a'
- gda.send :pin_gem_source, 'a'
+ gda.send :pin_gem_source, "a"
+ gda.send :pin_gem_source, "a"
e = assert_raise ArgumentError do
- gda.send :pin_gem_source, 'a', :path, 'vendor/a'
+ gda.send :pin_gem_source, "a", :path, "vendor/a"
end
assert_equal "duplicate source path: vendor/a for gem a",
e.message
e = assert_raise ArgumentError do
- gda.send :pin_gem_source, 'a', :git, 'git://example/repo.git'
+ gda.send :pin_gem_source, "a", :git, "git://example/repo.git"
end
assert_equal "duplicate source git: git://example/repo.git for gem a",
@@ -675,18 +675,18 @@ end
def test_platform_mswin
if win_platform?
- util_set_arch 'x86-mswin32-60' do
+ util_set_arch "x86-mswin32-60" do
@gda.platform :mswin do
- @gda.gem 'a'
+ @gda.gem "a"
end
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
refute_empty @set.dependencies
end
else
- util_set_arch 'i686-darwin8.10.1' do
+ util_set_arch "i686-darwin8.10.1" do
@gda.platform :mswin do
- @gda.gem 'a'
+ @gda.gem "a"
end
assert_empty @set.dependencies
@@ -699,9 +699,9 @@ end
gda = @GDA.new @set, nil
- with_engine_version 'ruby', '1.8.7' do
+ with_engine_version "ruby", "1.8.7" do
gda.platform :mri_19, :mri_20 do
- gda.gem 'a'
+ gda.gem "a"
end
end
@@ -709,9 +709,9 @@ end
gda = @GDA.new @set, nil
- with_engine_version 'ruby', '2.0.0' do
+ with_engine_version "ruby", "2.0.0" do
gda.platform :mri_19, :mri_20 do
- gda.gem 'a'
+ gda.gem "a"
end
end
@@ -724,28 +724,28 @@ end
win_platform, Gem.win_platform = Gem.win_platform?, false
@gda.platform :ruby do
- @gda.gem 'a'
+ @gda.gem "a"
end
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
ensure
Gem.win_platform = win_platform
end
def test_platforms
unless win_platform?
- util_set_arch 'i686-darwin8.10.1' do
+ util_set_arch "i686-darwin8.10.1" do
@gda.platforms :ruby do
- @gda.gem 'a'
+ @gda.gem "a"
end
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
@gda.platforms :mswin do
- @gda.gem 'b'
+ @gda.gem "b"
end
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
end
end
end
@@ -755,53 +755,51 @@ end
end
def test_ruby_engine
- with_engine_version 'jruby', '1.7.6' do
+ with_engine_version "jruby", "1.7.6" do
assert @gda.ruby RUBY_VERSION,
- :engine => 'jruby', :engine_version => '1.7.6'
-
+ :engine => "jruby", :engine_version => "1.7.6"
end
- with_engine_version 'truffleruby', '1.0.0-rc11' do
+ with_engine_version "truffleruby", "1.0.0-rc11" do
assert @gda.ruby RUBY_VERSION,
- :engine => 'truffleruby', :engine_version => '1.0.0-rc11'
-
+ :engine => "truffleruby", :engine_version => "1.0.0-rc11"
end
end
def test_ruby_engine_mismatch_engine
- with_engine_version 'ruby', '2.0.0' do
+ with_engine_version "ruby", "2.0.0" do
e = assert_raise Gem::RubyVersionMismatch do
- @gda.ruby RUBY_VERSION, :engine => 'jruby', :engine_version => '1.7.4'
+ @gda.ruby RUBY_VERSION, :engine => "jruby", :engine_version => "1.7.4"
end
- assert_equal 'Your Ruby engine is ruby, but your gem.deps.rb requires jruby',
+ assert_equal "Your Ruby engine is ruby, but your gem.deps.rb requires jruby",
e.message
end
end
def test_ruby_engine_mismatch_version
- with_engine_version 'jruby', '1.7.6' do
+ with_engine_version "jruby", "1.7.6" do
e = assert_raise Gem::RubyVersionMismatch do
- @gda.ruby RUBY_VERSION, :engine => 'jruby', :engine_version => '1.7.4'
+ @gda.ruby RUBY_VERSION, :engine => "jruby", :engine_version => "1.7.4"
end
- assert_equal 'Your Ruby engine version is jruby 1.7.6, but your gem.deps.rb requires jruby 1.7.4',
+ assert_equal "Your Ruby engine version is jruby 1.7.6, but your gem.deps.rb requires jruby 1.7.4",
e.message
end
end
def test_ruby_engine_no_engine_version
e = assert_raise ArgumentError do
- @gda.ruby RUBY_VERSION, :engine => 'jruby'
+ @gda.ruby RUBY_VERSION, :engine => "jruby"
end
- assert_equal 'You must specify engine_version along with the Ruby engine',
+ assert_equal "You must specify engine_version along with the Ruby engine",
e.message
end
def test_ruby_mismatch
e = assert_raise Gem::RubyVersionMismatch do
- @gda.ruby '1.8.0'
+ @gda.ruby "1.8.0"
end
assert_equal "Your Ruby version is #{RUBY_VERSION}, but your gem.deps.rb requires 1.8.0", e.message
@@ -810,19 +808,19 @@ end
def test_ruby_mismatch_installing
@gda.installing = true
- assert @gda.ruby '1.8.0'
+ assert @gda.ruby "1.8.0"
end
def test_source
sources = Gem.sources
- @gda.source 'http://first.example'
+ @gda.source "http://first.example"
assert_equal %w[http://first.example], Gem.sources
assert_same sources, Gem.sources
- @gda.source 'http://second.example'
+ @gda.source "http://second.example"
assert_equal %w[http://first.example http://second.example], Gem.sources
end
@@ -832,9 +830,9 @@ end
engine = Gem.ruby_engine
engine_version = RUBY_ENGINE_VERSION
- with_engine_version 'other', '1.2.3' do
- assert_equal 'other', Gem.ruby_engine
- assert_equal '1.2.3', RUBY_ENGINE_VERSION
+ with_engine_version "other", "1.2.3" do
+ assert_equal "other", Gem.ruby_engine
+ assert_equal "1.2.3", RUBY_ENGINE_VERSION
assert_equal version, RUBY_VERSION
end
diff --git a/test/rubygems/test_gem_request_set_lockfile.rb b/test/rubygems/test_gem_request_set_lockfile.rb
index 690b632d9b..30dcbbbfdc 100644
--- a/test/rubygems/test_gem_request_set_lockfile.rb
+++ b/test/rubygems/test_gem_request_set_lockfile.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/request_set'
-require 'rubygems/request_set/lockfile'
+require_relative "helper"
+require "rubygems/request_set"
+require "rubygems/request_set/lockfile"
class TestGemRequestSetLockfile < Gem::TestCase
def setup
@@ -9,7 +9,7 @@ class TestGemRequestSetLockfile < Gem::TestCase
Gem::RemoteFetcher.fetcher = @fetcher = Gem::FakeFetcher.new
- util_set_arch 'i686-darwin8.10.1'
+ util_set_arch "i686-darwin8.10.1"
@set = Gem::RequestSet.new
@@ -19,7 +19,7 @@ class TestGemRequestSetLockfile < Gem::TestCase
@set.instance_variable_set :@git_set, @git_set
@set.instance_variable_set :@vendor_set, @vendor_set
- @gem_deps_file = 'gem.deps.rb'
+ @gem_deps_file = "gem.deps.rb"
end
def lockfile
@@ -29,19 +29,19 @@ class TestGemRequestSetLockfile < Gem::TestCase
def write_lockfile(lockfile)
@lock_file = File.expand_path "#{@gem_deps_file}.lock"
- File.open @lock_file, 'w' do |io|
+ File.open @lock_file, "w" do |io|
io.write lockfile
end
end
def test_add_DEPENDENCIES
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2 do |s|
- s.add_development_dependency 'b'
+ fetcher.spec "a", 2 do |s|
+ s.add_development_dependency "b"
end
end
- @set.gem 'a'
+ @set.gem "a"
@set.resolve
out = []
@@ -49,8 +49,8 @@ class TestGemRequestSetLockfile < Gem::TestCase
lockfile.add_DEPENDENCIES out
expected = [
- 'DEPENDENCIES',
- ' a',
+ "DEPENDENCIES",
+ " a",
nil,
]
@@ -59,14 +59,14 @@ class TestGemRequestSetLockfile < Gem::TestCase
def test_add_DEPENDENCIES_from_gem_deps
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2 do |s|
- s.add_development_dependency 'b'
+ fetcher.spec "a", 2 do |s|
+ s.add_development_dependency "b"
end
end
- dependencies = { 'a' => Gem::Requirement.new('~> 2.0') }
+ dependencies = { "a" => Gem::Requirement.new("~> 2.0") }
- @set.gem 'a'
+ @set.gem "a"
@set.resolve
@lockfile =
Gem::RequestSet::Lockfile.new @set, @gem_deps_file, dependencies
@@ -76,8 +76,8 @@ class TestGemRequestSetLockfile < Gem::TestCase
@lockfile.add_DEPENDENCIES out
expected = [
- 'DEPENDENCIES',
- ' a (~> 2.0)',
+ "DEPENDENCIES",
+ " a (~> 2.0)",
nil,
]
@@ -86,18 +86,18 @@ class TestGemRequestSetLockfile < Gem::TestCase
def test_add_GEM
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2 do |s|
- s.add_dependency 'b'
- s.add_development_dependency 'c'
+ fetcher.spec "a", 2 do |s|
+ s.add_dependency "b"
+ s.add_development_dependency "c"
end
- fetcher.spec 'b', 2
+ fetcher.spec "b", 2
- fetcher.spec 'bundler', 1
+ fetcher.spec "bundler", 1
end
- @set.gem 'a'
- @set.gem 'bundler'
+ @set.gem "a"
+ @set.gem "bundler"
@set.resolve
out = []
@@ -105,12 +105,12 @@ class TestGemRequestSetLockfile < Gem::TestCase
lockfile.add_GEM out, lockfile.spec_groups
expected = [
- 'GEM',
- ' remote: http://gems.example.com/',
- ' specs:',
- ' a (2)',
- ' b',
- ' b (2)',
+ "GEM",
+ " remote: http://gems.example.com/",
+ " specs:",
+ " a (2)",
+ " b",
+ " b (2)",
nil,
]
@@ -119,16 +119,16 @@ class TestGemRequestSetLockfile < Gem::TestCase
def test_add_PLATFORMS
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2 do |s|
- s.add_dependency 'b'
+ fetcher.spec "a", 2 do |s|
+ s.add_dependency "b"
end
- fetcher.spec 'b', 2 do |s|
+ fetcher.spec "b", 2 do |s|
s.platform = Gem::Platform::CURRENT
end
end
- @set.gem 'a'
+ @set.gem "a"
@set.resolve
out = []
@@ -136,9 +136,9 @@ class TestGemRequestSetLockfile < Gem::TestCase
lockfile.add_PLATFORMS out
expected = [
- 'PLATFORMS',
- ' ruby',
- ' x86-darwin-8',
+ "PLATFORMS",
+ " ruby",
+ " x86-darwin-8",
nil,
]
@@ -146,21 +146,21 @@ class TestGemRequestSetLockfile < Gem::TestCase
end
def test_relative_path_from
- path = lockfile.relative_path_from '/foo', '/foo/bar'
+ path = lockfile.relative_path_from "/foo", "/foo/bar"
- assert_equal File.expand_path('/foo'), path
+ assert_equal File.expand_path("/foo"), path
- path = lockfile.relative_path_from '/foo', '/foo'
+ path = lockfile.relative_path_from "/foo", "/foo"
- assert_equal '.', path
+ assert_equal ".", path
end
def test_to_s_gem
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
+ fetcher.spec "a", 2
end
- @set.gem 'a'
+ @set.gem "a"
expected = <<-LOCKFILE
GEM
@@ -180,12 +180,12 @@ DEPENDENCIES
def test_to_s_gem_dependency
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2, 'c' => '>= 0', 'b' => '>= 0'
- fetcher.spec 'b', 2
- fetcher.spec 'c', 2
+ fetcher.spec "a", 2, "c" => ">= 0", "b" => ">= 0"
+ fetcher.spec "b", 2
+ fetcher.spec "c", 2
end
- @set.gem 'a'
+ @set.gem "a"
expected = <<-LOCKFILE
GEM
@@ -211,12 +211,12 @@ DEPENDENCIES
def test_to_s_gem_dependency_non_default
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2, 'b' => '>= 1'
- fetcher.spec 'b', 2
+ fetcher.spec "a", 2, "b" => ">= 1"
+ fetcher.spec "b", 2
end
- @set.gem 'b'
- @set.gem 'a'
+ @set.gem "b"
+ @set.gem "a"
expected = <<-LOCKFILE
GEM
@@ -239,11 +239,11 @@ DEPENDENCIES
def test_to_s_gem_dependency_requirement
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2, 'b' => '>= 0'
- fetcher.spec 'b', 2
+ fetcher.spec "a", 2, "b" => ">= 0"
+ fetcher.spec "b", 2
end
- @set.gem 'a', '>= 1'
+ @set.gem "a", ">= 1"
expected = <<-LOCKFILE
GEM
@@ -269,7 +269,7 @@ DEPENDENCIES
@vendor_set.add_vendor_gem name, directory
- @set.gem 'a'
+ @set.gem "a"
expected = <<-LOCKFILE
PATH
@@ -292,7 +292,7 @@ DEPENDENCIES
@vendor_set.add_vendor_gem name, File.expand_path(directory)
- @set.gem 'a'
+ @set.gem "a"
expected = <<-LOCKFILE
PATH
@@ -312,12 +312,12 @@ DEPENDENCIES
def test_to_s_gem_platform
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2 do |spec|
+ fetcher.spec "a", 2 do |spec|
spec.platform = Gem::Platform.local
end
end
- @set.gem 'a'
+ @set.gem "a"
expected = <<-LOCKFILE
GEM
@@ -337,17 +337,17 @@ DEPENDENCIES
def test_to_s_gem_source
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
+ fetcher.download "a", 2
end
- spec_fetcher 'http://other.example/' do |fetcher|
- fetcher.download 'b', 2
+ spec_fetcher "http://other.example/" do |fetcher|
+ fetcher.download "b", 2
end
- Gem.sources << 'http://other.example/'
+ Gem.sources << "http://other.example/"
- @set.gem 'a'
- @set.gem 'b'
+ @set.gem "a"
+ @set.gem "b"
expected = <<-LOCKFILE
GEM
@@ -377,43 +377,43 @@ DEPENDENCIES
head = nil
Dir.chdir repository do
- FileUtils.mkdir 'b'
+ FileUtils.mkdir "b"
- Dir.chdir 'b' do
- b = Gem::Specification.new 'b', 1 do |s|
- s.add_dependency 'a', '~> 1.0'
- s.add_dependency 'c', '~> 1.0'
+ Dir.chdir "b" do
+ b = Gem::Specification.new "b", 1 do |s|
+ s.add_dependency "a", "~> 1.0"
+ s.add_dependency "c", "~> 1.0"
end
- File.open 'b.gemspec', 'w' do |io|
+ File.open "b.gemspec", "w" do |io|
io.write b.to_ruby
end
- system @git, 'add', 'b.gemspec'
- system @git, 'commit', '--quiet', '-m', 'add b/b.gemspec'
+ system @git, "add", "b.gemspec"
+ system @git, "commit", "--quiet", "-m", "add b/b.gemspec"
end
- FileUtils.mkdir 'c'
+ FileUtils.mkdir "c"
- Dir.chdir 'c' do
- c = Gem::Specification.new 'c', 1
+ Dir.chdir "c" do
+ c = Gem::Specification.new "c", 1
- File.open 'c.gemspec', 'w' do |io|
+ File.open "c.gemspec", "w" do |io|
io.write c.to_ruby
end
- system @git, 'add', 'c.gemspec'
- system @git, 'commit', '--quiet', '-m', 'add c/c.gemspec'
+ system @git, "add", "c.gemspec"
+ system @git, "commit", "--quiet", "-m", "add c/c.gemspec"
end
head = `#{@git} rev-parse HEAD`.strip
end
- @git_set.add_git_gem 'a', repository, 'HEAD', true
- @git_set.add_git_gem 'b', repository, 'HEAD', true
- @git_set.add_git_gem 'c', repository, 'HEAD', true
+ @git_set.add_git_gem "a", repository, "HEAD", true
+ @git_set.add_git_gem "b", repository, "HEAD", true
+ @git_set.add_git_gem "c", repository, "HEAD", true
- @set.gem 'b'
+ @set.gem "b"
expected = <<-LOCKFILE
GIT
@@ -449,12 +449,12 @@ DEPENDENCIES
end
def test_write_error
- @set.gem 'nonexistent'
+ @set.gem "nonexistent"
gem_deps_lock_file = "#{@gem_deps_file}.lock"
- File.open gem_deps_lock_file, 'w' do |io|
- io.write 'hello'
+ File.open gem_deps_lock_file, "w" do |io|
+ io.write "hello"
end
assert_raise Gem::UnsatisfiableDependencyError do
@@ -463,6 +463,6 @@ DEPENDENCIES
assert_path_exist gem_deps_lock_file
- assert_equal 'hello', File.read(gem_deps_lock_file)
+ assert_equal "hello", File.read(gem_deps_lock_file)
end
end
diff --git a/test/rubygems/test_gem_request_set_lockfile_parser.rb b/test/rubygems/test_gem_request_set_lockfile_parser.rb
index 775085964e..757c764dc1 100644
--- a/test/rubygems/test_gem_request_set_lockfile_parser.rb
+++ b/test/rubygems/test_gem_request_set_lockfile_parser.rb
@@ -1,14 +1,14 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/request_set'
-require 'rubygems/request_set/lockfile'
-require 'rubygems/request_set/lockfile/tokenizer'
-require 'rubygems/request_set/lockfile/parser'
+require_relative "helper"
+require "rubygems/request_set"
+require "rubygems/request_set/lockfile"
+require "rubygems/request_set/lockfile/tokenizer"
+require "rubygems/request_set/lockfile/parser"
class TestGemRequestSetLockfileParser < Gem::TestCase
def setup
super
- @gem_deps_file = 'gem.deps.rb'
+ @gem_deps_file = "gem.deps.rb"
@lock_file = File.expand_path "#{@gem_deps_file}.lock"
@set = Gem::RequestSet.new
end
@@ -53,7 +53,7 @@ class TestGemRequestSetLockfileParser < Gem::TestCase
parser = tokenizer.make_parser nil, nil
e = assert_raise Gem::RequestSet::Lockfile::ParseError do
- parser.get :text, 'y'
+ parser.get :text, "y"
end
expected =
@@ -83,7 +83,7 @@ DEPENDENCIES
platforms = []
parse_lockfile @set, platforms
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
assert_equal [Gem::Platform::RUBY], platforms
@@ -91,7 +91,7 @@ DEPENDENCIES
Gem::Resolver::LockSet === set
end
- assert lockfile_set, 'could not find a LockSet'
+ assert lockfile_set, "could not find a LockSet"
assert_equal %w[a-2], lockfile_set.specs.map {|tuple| tuple.full_name }
end
@@ -113,7 +113,7 @@ DEPENDENCIES
platforms = []
parse_lockfile @set, platforms
- assert_equal [dep('a', '>= 1', '<= 2')], @set.dependencies
+ assert_equal [dep("a", ">= 1", "<= 2")], @set.dependencies
assert_equal [Gem::Platform::RUBY], platforms
@@ -121,7 +121,7 @@ DEPENDENCIES
Gem::Resolver::LockSet === set
end
- assert lockfile_set, 'could not find a LockSet'
+ assert lockfile_set, "could not find a LockSet"
assert_equal %w[a-2], lockfile_set.specs.map {|tuple| tuple.full_name }
end
@@ -159,8 +159,8 @@ DEPENDENCIES
parse_lockfile @set, []
expected = [
- dep('i18n-active_record', '= 0.0.2'),
- dep('rails-footnotes', '= 3.7.9'),
+ dep("i18n-active_record", "= 0.0.2"),
+ dep("rails-footnotes", "= 3.7.9"),
]
assert_equal expected, @set.dependencies
@@ -188,7 +188,7 @@ DEPENDENCIES
parse_lockfile @set, []
expected = [
- dep('jwt', '= 1.1'),
+ dep("jwt", "= 1.1"),
]
assert_equal expected, @set.dependencies
@@ -209,13 +209,13 @@ DEPENDENCIES
parse_lockfile @set, []
- assert_equal [dep('a', '>= 0')], @set.dependencies
+ assert_equal [dep("a", ">= 0")], @set.dependencies
lockfile_set = @set.sets.find do |set|
Gem::Resolver::LockSet === set
end
- assert lockfile_set, 'found a LockSet'
+ assert lockfile_set, "found a LockSet"
assert_equal %w[a-2], lockfile_set.specs.map {|s| s.full_name }
end
@@ -237,13 +237,13 @@ DEPENDENCIES
parse_lockfile @set, []
- assert_equal [dep('a', '>= 0')], @set.dependencies
+ assert_equal [dep("a", ">= 0")], @set.dependencies
lockfile_set = @set.sets.find do |set|
Gem::Resolver::LockSet === set
end
- assert lockfile_set, 'found a LockSet'
+ assert lockfile_set, "found a LockSet"
assert_equal %w[a-2], lockfile_set.specs.map {|s| s.full_name }
@@ -252,7 +252,7 @@ DEPENDENCIES
end
def test_parse_GIT
- @set.instance_variable_set :@install_dir, 'install_dir'
+ @set.instance_variable_set :@install_dir, "install_dir"
write_lockfile <<-LOCKFILE
GIT
@@ -269,31 +269,31 @@ DEPENDENCIES
parse_lockfile @set, []
- assert_equal [dep('a', '= 2')], @set.dependencies
+ assert_equal [dep("a", "= 2")], @set.dependencies
lockfile_set = @set.sets.find do |set|
Gem::Resolver::LockSet === set
end
- refute lockfile_set, 'fount a LockSet'
+ refute lockfile_set, "fount a LockSet"
git_set = @set.sets.find do |set|
Gem::Resolver::GitSet === set
end
- assert git_set, 'could not find a GitSet'
+ assert git_set, "could not find a GitSet"
assert_equal %w[a-2], git_set.specs.values.map {|s| s.full_name }
- assert_equal [dep('b', '>= 3'), dep('c')],
+ assert_equal [dep("b", ">= 3"), dep("c")],
git_set.specs.values.first.dependencies
expected = {
- 'a' => %w[git://example/a.git master],
+ "a" => %w[git://example/a.git master],
}
assert_equal expected, git_set.repositories
- assert_equal 'install_dir', git_set.root_dir
+ assert_equal "install_dir", git_set.root_dir
end
def test_parse_GIT_branch
@@ -312,22 +312,22 @@ DEPENDENCIES
parse_lockfile @set, []
- assert_equal [dep('a', '= 2')], @set.dependencies
+ assert_equal [dep("a", "= 2")], @set.dependencies
lockfile_set = @set.sets.find do |set|
Gem::Resolver::LockSet === set
end
- refute lockfile_set, 'fount a LockSet'
+ refute lockfile_set, "fount a LockSet"
git_set = @set.sets.find do |set|
Gem::Resolver::GitSet === set
end
- assert git_set, 'could not find a GitSet'
+ assert git_set, "could not find a GitSet"
expected = {
- 'a' => %w[git://example/a.git 1234abc],
+ "a" => %w[git://example/a.git 1234abc],
}
assert_equal expected, git_set.repositories
@@ -349,22 +349,22 @@ DEPENDENCIES
parse_lockfile @set, []
- assert_equal [dep('a', '= 2')], @set.dependencies
+ assert_equal [dep("a", "= 2")], @set.dependencies
lockfile_set = @set.sets.find do |set|
Gem::Resolver::LockSet === set
end
- refute lockfile_set, 'fount a LockSet'
+ refute lockfile_set, "fount a LockSet"
git_set = @set.sets.find do |set|
Gem::Resolver::GitSet === set
end
- assert git_set, 'could not find a GitSet'
+ assert git_set, "could not find a GitSet"
expected = {
- 'a' => %w[git://example/a.git 1234abc],
+ "a" => %w[git://example/a.git 1234abc],
}
assert_equal expected, git_set.repositories
@@ -386,22 +386,22 @@ DEPENDENCIES
parse_lockfile @set, []
- assert_equal [dep('a', '= 2')], @set.dependencies
+ assert_equal [dep("a", "= 2")], @set.dependencies
lockfile_set = @set.sets.find do |set|
Gem::Resolver::LockSet === set
end
- refute lockfile_set, 'fount a LockSet'
+ refute lockfile_set, "fount a LockSet"
git_set = @set.sets.find do |set|
Gem::Resolver::GitSet === set
end
- assert git_set, 'could not find a GitSet'
+ assert git_set, "could not find a GitSet"
expected = {
- 'a' => %w[git://example/a.git 1234abc],
+ "a" => %w[git://example/a.git 1234abc],
}
assert_equal expected, git_set.repositories
@@ -423,45 +423,45 @@ DEPENDENCIES
parse_lockfile @set, []
- assert_equal [dep('a', '= 1')], @set.dependencies
+ assert_equal [dep("a", "= 1")], @set.dependencies
lockfile_set = @set.sets.find do |set|
Gem::Resolver::LockSet === set
end
- refute lockfile_set, 'found a LockSet'
+ refute lockfile_set, "found a LockSet"
vendor_set = @set.sets.find do |set|
Gem::Resolver::VendorSet === set
end
- assert vendor_set, 'could not find a VendorSet'
+ assert vendor_set, "could not find a VendorSet"
assert_equal %w[a-1], vendor_set.specs.values.map {|s| s.full_name }
- spec = vendor_set.load_spec 'a', nil, nil, nil
+ spec = vendor_set.load_spec "a", nil, nil, nil
- assert_equal [dep('b', '= 2')], spec.dependencies
+ assert_equal [dep("b", "= 2")], spec.dependencies
end
def test_parse_dependency
- write_lockfile ' 1)'
+ write_lockfile " 1)"
tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file @lock_file
parser = tokenizer.make_parser nil, nil
- parsed = parser.parse_dependency 'a', '='
+ parsed = parser.parse_dependency "a", "="
- assert_equal dep('a', '= 1'), parsed
+ assert_equal dep("a", "= 1"), parsed
- write_lockfile ')'
+ write_lockfile ")"
tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file @lock_file
parser = tokenizer.make_parser nil, nil
- parsed = parser.parse_dependency 'a', '2'
+ parsed = parser.parse_dependency "a", "2"
- assert_equal dep('a', '= 2'), parsed
+ assert_equal dep("a", "= 2"), parsed
end
def test_parse_gem_specs_dependency
@@ -486,7 +486,7 @@ DEPENDENCIES
platforms = []
parse_lockfile @set, platforms
- assert_equal [dep('a')], @set.dependencies
+ assert_equal [dep("a")], @set.dependencies
assert_equal [Gem::Platform::RUBY], platforms
@@ -494,13 +494,13 @@ DEPENDENCIES
Gem::Resolver::LockSet === set
end
- assert lockfile_set, 'could not find a LockSet'
+ assert lockfile_set, "could not find a LockSet"
assert_equal %w[a-2 b-3], lockfile_set.specs.map {|tuple| tuple.full_name }
expected = [
Gem::Platform::RUBY,
- Gem::Platform.new('x86_64-linux'),
+ Gem::Platform.new("x86_64-linux"),
]
assert_equal expected, lockfile_set.specs.map {|tuple| tuple.platform }
@@ -508,10 +508,10 @@ DEPENDENCIES
spec = lockfile_set.specs.first
expected = [
- dep('b', '= 3'),
- dep('c', '~> 4'),
- dep('d'),
- dep('e', '~> 5.0', '>= 5.0.1'),
+ dep("b", "= 3"),
+ dep("c", "~> 4"),
+ dep("d"),
+ dep("e", "~> 5.0", ">= 5.0.1"),
]
assert_equal expected, spec.dependencies
@@ -530,7 +530,7 @@ DEPENDENCIES
end
def write_lockfile(lockfile)
- File.open @lock_file, 'w' do |io|
+ File.open @lock_file, "w" do |io|
io.write lockfile
end
end
diff --git a/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb b/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb
index f779c33012..8db180eb27 100644
--- a/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb
+++ b/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb
@@ -1,15 +1,15 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/request_set'
-require 'rubygems/request_set/lockfile'
-require 'rubygems/request_set/lockfile/tokenizer'
-require 'rubygems/request_set/lockfile/parser'
+require_relative "helper"
+require "rubygems/request_set"
+require "rubygems/request_set/lockfile"
+require "rubygems/request_set/lockfile/tokenizer"
+require "rubygems/request_set/lockfile/parser"
class TestGemRequestSetLockfileTokenizer < Gem::TestCase
def setup
super
- @gem_deps_file = 'gem.deps.rb'
+ @gem_deps_file = "gem.deps.rb"
@lock_file = File.expand_path "#{@gem_deps_file}.lock"
end
@@ -34,10 +34,10 @@ class TestGemRequestSetLockfileTokenizer < Gem::TestCase
end
def test_token_pos
- tokenizer = Gem::RequestSet::Lockfile::Tokenizer.new ''
+ tokenizer = Gem::RequestSet::Lockfile::Tokenizer.new ""
assert_equal [5, 0], tokenizer.token_pos(5)
- tokenizer = Gem::RequestSet::Lockfile::Tokenizer.new '', nil, 1, 2
+ tokenizer = Gem::RequestSet::Lockfile::Tokenizer.new "", nil, 1, 2
assert_equal [3, 1], tokenizer.token_pos(5)
end
@@ -63,74 +63,74 @@ DEPENDENCIES
LOCKFILE
expected = [
- [:section, 'GEM', 0, 0],
+ [:section, "GEM", 0, 0],
[:newline, nil, 3, 0],
- [:entry, 'remote', 2, 1],
+ [:entry, "remote", 2, 1],
[:text, @gem_repo, 10, 1],
[:newline, nil, 34, 1],
- [:entry, 'specs', 2, 2],
+ [:entry, "specs", 2, 2],
[:newline, nil, 8, 2],
- [:text, 'a', 4, 3],
+ [:text, "a", 4, 3],
[:l_paren, nil, 6, 3],
- [:text, '2', 7, 3],
+ [:text, "2", 7, 3],
[:r_paren, nil, 8, 3],
[:newline, nil, 9, 3],
- [:text, 'b', 6, 4],
+ [:text, "b", 6, 4],
[:l_paren, nil, 8, 4],
- [:requirement, '=', 9, 4],
- [:text, '2', 11, 4],
+ [:requirement, "=", 9, 4],
+ [:text, "2", 11, 4],
[:r_paren, nil, 12, 4],
[:newline, nil, 13, 4],
- [:text, 'c', 6, 5],
+ [:text, "c", 6, 5],
[:l_paren, nil, 8, 5],
- [:requirement, '!=', 9, 5],
- [:text, '3', 12, 5],
+ [:requirement, "!=", 9, 5],
+ [:text, "3", 12, 5],
[:r_paren, nil, 13, 5],
[:newline, nil, 14, 5],
- [:text, 'd', 6, 6],
+ [:text, "d", 6, 6],
[:l_paren, nil, 8, 6],
- [:requirement, '>', 9, 6],
- [:text, '4', 11, 6],
+ [:requirement, ">", 9, 6],
+ [:text, "4", 11, 6],
[:r_paren, nil, 12, 6],
[:newline, nil, 13, 6],
- [:text, 'e', 6, 7],
+ [:text, "e", 6, 7],
[:l_paren, nil, 8, 7],
- [:requirement, '<', 9, 7],
- [:text, '5', 11, 7],
+ [:requirement, "<", 9, 7],
+ [:text, "5", 11, 7],
[:r_paren, nil, 12, 7],
[:newline, nil, 13, 7],
- [:text, 'f', 6, 8],
+ [:text, "f", 6, 8],
[:l_paren, nil, 8, 8],
- [:requirement, '>=', 9, 8],
- [:text, '6', 12, 8],
+ [:requirement, ">=", 9, 8],
+ [:text, "6", 12, 8],
[:r_paren, nil, 13, 8],
[:newline, nil, 14, 8],
- [:text, 'g', 6, 9],
+ [:text, "g", 6, 9],
[:l_paren, nil, 8, 9],
- [:requirement, '<=', 9, 9],
- [:text, '7', 12, 9],
+ [:requirement, "<=", 9, 9],
+ [:text, "7", 12, 9],
[:r_paren, nil, 13, 9],
[:newline, nil, 14, 9],
- [:text, 'h', 6, 10],
+ [:text, "h", 6, 10],
[:l_paren, nil, 8, 10],
- [:requirement, '~>', 9, 10],
- [:text, '8', 12, 10],
+ [:requirement, "~>", 9, 10],
+ [:text, "8", 12, 10],
[:r_paren, nil, 13, 10],
[:newline, nil, 14, 10],
[:newline, nil, 0, 11],
- [:section, 'PLATFORMS', 0, 12],
+ [:section, "PLATFORMS", 0, 12],
[:newline, nil, 9, 12],
[:text, Gem::Platform::RUBY, 2, 13],
@@ -138,10 +138,10 @@ DEPENDENCIES
[:newline, nil, 0, 14],
- [:section, 'DEPENDENCIES', 0, 15],
+ [:section, "DEPENDENCIES", 0, 15],
[:newline, nil, 12, 15],
- [:text, 'a', 2, 16],
+ [:text, "a", 2, 16],
[:newline, nil, 3, 16],
]
@@ -163,27 +163,27 @@ DEPENDENCIES
LOCKFILE
expected = [
- [:section, 'GEM', 0, 0],
+ [:section, "GEM", 0, 0],
[:newline, nil, 3, 0],
- [:entry, 'remote', 2, 1],
+ [:entry, "remote", 2, 1],
[:text, @gem_repo, 10, 1],
[:newline, nil, 34, 1],
- [:entry, 'specs', 2, 2],
+ [:entry, "specs", 2, 2],
[:newline, nil, 8, 2],
- [:text, 'Ab', 4, 3],
+ [:text, "Ab", 4, 3],
[:l_paren, nil, 7, 3],
- [:text, '2', 8, 3],
+ [:text, "2", 8, 3],
[:r_paren, nil, 9, 3],
[:newline, nil, 10, 3],
[:newline, nil, 0, 4],
- [:section, 'PLATFORMS', 0, 5],
+ [:section, "PLATFORMS", 0, 5],
[:newline, nil, 9, 5],
[:text, Gem::Platform::RUBY, 2, 6],
[:newline, nil, 6, 6],
[:newline, nil, 0, 7],
- [:section, 'DEPENDENCIES', 0, 8],
+ [:section, "DEPENDENCIES", 0, 8],
[:newline, nil, 12, 8],
- [:text, 'Ab', 2, 9],
+ [:text, "Ab", 2, 9],
[:newline, nil, 4, 9],
]
@@ -191,7 +191,7 @@ DEPENDENCIES
end
def test_tokenize_conflict_markers
- write_lockfile '<<<<<<<'
+ write_lockfile "<<<<<<<"
e = assert_raise Gem::RequestSet::Lockfile::ParseError do
tokenize_lockfile
@@ -200,7 +200,7 @@ DEPENDENCIES
assert_equal "your #{@lock_file} contains merge conflict markers (at line 0 column 0)",
e.message
- write_lockfile '|||||||'
+ write_lockfile "|||||||"
e = assert_raise Gem::RequestSet::Lockfile::ParseError do
tokenize_lockfile
@@ -209,7 +209,7 @@ DEPENDENCIES
assert_equal "your #{@lock_file} contains merge conflict markers (at line 0 column 0)",
e.message
- write_lockfile '======='
+ write_lockfile "======="
e = assert_raise Gem::RequestSet::Lockfile::ParseError do
tokenize_lockfile
@@ -218,7 +218,7 @@ DEPENDENCIES
assert_equal "your #{@lock_file} contains merge conflict markers (at line 0 column 0)",
e.message
- write_lockfile '>>>>>>>'
+ write_lockfile ">>>>>>>"
e = assert_raise Gem::RequestSet::Lockfile::ParseError do
tokenize_lockfile
@@ -235,10 +235,10 @@ DEPENDENCIES
LOCKFILE
expected = [
- [:section, 'DEPENDENCIES', 0, 0],
+ [:section, "DEPENDENCIES", 0, 0],
[:newline, nil, 12, 0],
- [:text, 'a', 2, 1],
+ [:text, "a", 2, 1],
[:bang, nil, 3, 1],
[:newline, nil, 4, 1],
]
@@ -256,29 +256,29 @@ GEM
LOCKFILE
expected = [
- [:section, 'GEM', 0, 0],
+ [:section, "GEM", 0, 0],
[:newline, nil, 3, 0],
- [:entry, 'remote', 2, 1],
+ [:entry, "remote", 2, 1],
[:text, @gem_repo, 10, 1],
[:newline, nil, 34, 1],
- [:entry, 'specs', 2, 2],
+ [:entry, "specs", 2, 2],
[:newline, nil, 8, 2],
- [:text, 'a', 4, 3],
+ [:text, "a", 4, 3],
[:l_paren, nil, 6, 3],
- [:text, '2', 7, 3],
+ [:text, "2", 7, 3],
[:r_paren, nil, 8, 3],
[:newline, nil, 9, 3],
- [:text, 'b', 6, 4],
+ [:text, "b", 6, 4],
[:l_paren, nil, 8, 4],
- [:requirement, '~>', 9, 4],
- [:text, '3.0', 12, 4],
+ [:requirement, "~>", 9, 4],
+ [:text, "3.0", 12, 4],
[:comma, nil, 15, 4],
- [:requirement, '>=', 17, 4],
- [:text, '3.0.1', 20, 4],
+ [:requirement, ">=", 17, 4],
+ [:text, "3.0.1", 20, 4],
[:r_paren, nil, 25, 4],
[:newline, nil, 26, 4],
]
@@ -295,7 +295,7 @@ GEM
end
def write_lockfile(lockfile)
- File.open @lock_file, 'w' do |io|
+ File.open @lock_file, "w" do |io|
io.write lockfile
end
end
diff --git a/test/rubygems/test_gem_requirement.rb b/test/rubygems/test_gem_requirement.rb
index b4367681d0..37137dbdad 100644
--- a/test/rubygems/test_gem_requirement.rb
+++ b/test/rubygems/test_gem_requirement.rb
@@ -1,14 +1,14 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
require "rubygems/requirement"
class TestGemRequirement < Gem::TestCase
def test_concat
- r = req '>= 1'
+ r = req ">= 1"
- r.concat ['< 2']
+ r.concat ["< 2"]
- assert_equal [['>=', v(1)], ['<', v(2)]], r.requirements
+ assert_equal [[">=", v(1)], ["<", v(2)]], r.requirements
end
def test_equals2
@@ -60,42 +60,42 @@ class TestGemRequirement < Gem::TestCase
end
def test_for_lockfile
- assert_equal ' (~> 1.0)', req('~> 1.0').for_lockfile
+ assert_equal " (~> 1.0)", req("~> 1.0").for_lockfile
- assert_equal ' (~> 1.0, >= 1.0.1)', req('>= 1.0.1', '~> 1.0').for_lockfile
+ assert_equal " (~> 1.0, >= 1.0.1)", req(">= 1.0.1", "~> 1.0").for_lockfile
- duped = req '= 1.0'
- duped.requirements << ['=', v('1.0')]
+ duped = req "= 1.0"
+ duped.requirements << ["=", v("1.0")]
- assert_equal ' (= 1.0)', duped.for_lockfile
+ assert_equal " (= 1.0)", duped.for_lockfile
assert_nil Gem::Requirement.default.for_lockfile
end
def test_parse
- assert_equal ['=', Gem::Version.new(1)], Gem::Requirement.parse(' 1')
- assert_equal ['=', Gem::Version.new(1)], Gem::Requirement.parse('= 1')
- assert_equal ['>', Gem::Version.new(1)], Gem::Requirement.parse('> 1')
- assert_equal ['=', Gem::Version.new(1)], Gem::Requirement.parse("=\n1")
- assert_equal ['=', Gem::Version.new(1)], Gem::Requirement.parse('1.0')
+ assert_equal ["=", Gem::Version.new(1)], Gem::Requirement.parse(" 1")
+ assert_equal ["=", Gem::Version.new(1)], Gem::Requirement.parse("= 1")
+ assert_equal [">", Gem::Version.new(1)], Gem::Requirement.parse("> 1")
+ assert_equal ["=", Gem::Version.new(1)], Gem::Requirement.parse("=\n1")
+ assert_equal ["=", Gem::Version.new(1)], Gem::Requirement.parse("1.0")
- assert_equal ['=', Gem::Version.new(2)],
- Gem::Requirement.parse(Gem::Version.new('2'))
+ assert_equal ["=", Gem::Version.new(2)],
+ Gem::Requirement.parse(Gem::Version.new("2"))
end
- if RUBY_VERSION >= '2.5' && !(Gem.java_platform? && ENV["JRUBY_OPTS"] =~ /--debug/)
+ if RUBY_VERSION >= "2.5" && !(Gem.java_platform? && ENV["JRUBY_OPTS"] =~ /--debug/)
def test_parse_deduplication
- assert_same '~>', Gem::Requirement.parse('~> 1').first
+ assert_same "~>", Gem::Requirement.parse("~> 1").first
end
end
def test_parse_bad
[
nil,
- '',
- '! 1',
- '= junk',
- '1..2',
+ "",
+ "! 1",
+ "= junk",
+ "1..2",
].each do |bad|
e = assert_raise Gem::Requirement::BadRequirementError do
Gem::Requirement.parse bad
@@ -108,21 +108,21 @@ class TestGemRequirement < Gem::TestCase
end
def test_prerelease_eh
- r = req '= 1'
+ r = req "= 1"
refute r.prerelease?
- r = req '= 1.a'
+ r = req "= 1.a"
assert r.prerelease?
- r = req '> 1.a', '< 2'
+ r = req "> 1.a", "< 2"
assert r.prerelease?
end
def test_satisfied_by_eh_bang_equal
- r = req '!= 1.2'
+ r = req "!= 1.2"
assert_satisfied_by "1.1", r
refute_satisfied_by "1.2", r
@@ -362,16 +362,16 @@ class TestGemRequirement < Gem::TestCase
end
def test_specific
- refute req('> 1') .specific?
- refute req('>= 1').specific?
+ refute req("> 1") .specific?
+ refute req(">= 1").specific?
- assert req('!= 1').specific?
- assert req('< 1') .specific?
- assert req('<= 1').specific?
- assert req('= 1') .specific?
- assert req('~> 1').specific?
+ assert req("!= 1").specific?
+ assert req("< 1") .specific?
+ assert req("<= 1").specific?
+ assert req("= 1") .specific?
+ assert req("~> 1").specific?
- assert req('> 1', '> 2').specific? # GIGO
+ assert req("> 1", "> 2").specific? # GIGO
end
def test_bad
@@ -392,12 +392,12 @@ class TestGemRequirement < Gem::TestCase
end
def test_hash_with_multiple_versions
- r1 = req('1.0', '2.0')
- r2 = req('2.0', '1.0')
+ r1 = req("1.0", "2.0")
+ r2 = req("2.0", "1.0")
assert_equal r1.hash, r2.hash
- r1 = req('1.0', '2.0').tap {|r| r.concat(['3.0']) }
- r2 = req('3.0', '1.0').tap {|r| r.concat(['2.0']) }
+ r1 = req("1.0", "2.0").tap {|r| r.concat(["3.0"]) }
+ r2 = req("3.0", "1.0").tap {|r| r.concat(["2.0"]) }
assert_equal r1.hash, r2.hash
end
diff --git a/test/rubygems/test_gem_resolver.rb b/test/rubygems/test_gem_resolver.rb
index ab0cdaddb9..2271244729 100644
--- a/test/rubygems/test_gem_resolver.rb
+++ b/test/rubygems/test_gem_resolver.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolver < Gem::TestCase
def setup
@@ -80,7 +80,7 @@ class TestGemResolver < Gem::TestCase
@DR.compose_sets nil
end
- assert_equal 'one set in the composition must be non-nil', e.message
+ assert_equal "one set in the composition must be non-nil", e.message
end
def test_self_compose_sets_single
@@ -92,9 +92,9 @@ class TestGemResolver < Gem::TestCase
end
def test_requests
- a1 = util_spec 'a', 1, 'b' => 2
+ a1 = util_spec "a", 1, "b" => 2
- r1 = Gem::Resolver::DependencyRequest.new dep('a', '= 1'), nil
+ r1 = Gem::Resolver::DependencyRequest.new dep("a", "= 1"), nil
act = Gem::Resolver::ActivationRequest.new a1, r1
@@ -104,18 +104,18 @@ class TestGemResolver < Gem::TestCase
res.requests a1, act, reqs
- assert_equal ['b (= 2)'], reqs.map {|req| req.to_s }
+ assert_equal ["b (= 2)"], reqs.map {|req| req.to_s }
end
def test_requests_development
- a1 = util_spec 'a', 1, 'b' => 2
+ a1 = util_spec "a", 1, "b" => 2
spec = Gem::Resolver::SpecSpecification.new nil, a1
def spec.fetch_development_dependencies
@called = true
end
- r1 = Gem::Resolver::DependencyRequest.new dep('a', '= 1'), nil
+ r1 = Gem::Resolver::DependencyRequest.new dep("a", "= 1"), nil
act = Gem::Resolver::ActivationRequest.new spec, r1
@@ -126,15 +126,15 @@ class TestGemResolver < Gem::TestCase
res.requests spec, act, reqs
- assert_equal ['b (= 2)'], reqs.map {|req| req.to_s }
+ assert_equal ["b (= 2)"], reqs.map {|req| req.to_s }
assert spec.instance_variable_defined? :@called
end
def test_requests_ignore_dependencies
- a1 = util_spec 'a', 1, 'b' => 2
+ a1 = util_spec "a", 1, "b" => 2
- r1 = Gem::Resolver::DependencyRequest.new dep('a', '= 1'), nil
+ r1 = Gem::Resolver::DependencyRequest.new dep("a", "= 1"), nil
act = Gem::Resolver::ActivationRequest.new a1, r1
@@ -149,37 +149,37 @@ class TestGemResolver < Gem::TestCase
end
def test_resolve_conservative
- a1_spec = util_spec 'a', 1
+ a1_spec = util_spec "a", 1
- a2_spec = util_spec 'a', 2 do |s|
- s.add_dependency 'b', 2
- s.add_dependency 'c'
+ a2_spec = util_spec "a", 2 do |s|
+ s.add_dependency "b", 2
+ s.add_dependency "c"
end
- b1_spec = util_spec 'b', 1
- b2_spec = util_spec 'b', 2
+ b1_spec = util_spec "b", 1
+ b2_spec = util_spec "b", 2
- c1_spec = util_spec 'c', 1 do |s|
- s.add_dependency 'd', 2
+ c1_spec = util_spec "c", 1 do |s|
+ s.add_dependency "d", 2
end
- c2_spec = util_spec 'c', 2 do |s|
- s.add_dependency 'd', 2
+ c2_spec = util_spec "c", 2 do |s|
+ s.add_dependency "d", 2
end
- d1_spec = util_spec 'd', 1 do |s|
- s.add_dependency 'e'
+ d1_spec = util_spec "d", 1 do |s|
+ s.add_dependency "e"
end
- d2_spec = util_spec 'd', 2 do |s|
- s.add_dependency 'e'
+ d2_spec = util_spec "d", 2 do |s|
+ s.add_dependency "e"
end
- e1_spec = util_spec 'e', 1
- e2_spec = util_spec 'e', 2
+ e1_spec = util_spec "e", 1
+ e2_spec = util_spec "e", 2
- a_dep = make_dep 'a', '= 2'
- e_dep = make_dep 'e'
+ a_dep = make_dep "a", "= 2"
+ e_dep = make_dep "e"
# When requesting to install:
# a-2, e
@@ -191,7 +191,7 @@ class TestGemResolver < Gem::TestCase
# With the following gems already installed:
# a-1, b-1, c-1, e-1
- res.skip_gems = { 'a' => [a1_spec], 'b' => [b1_spec], 'c' => [c1_spec], 'e' => [e1_spec] }
+ res.skip_gems = { "a" => [a1_spec], "b" => [b1_spec], "c" => [c1_spec], "e" => [e1_spec] }
# Make sure the following gems end up getting used/installed/upgraded:
# a-2 (upgraded)
@@ -203,17 +203,17 @@ class TestGemResolver < Gem::TestCase
end
def test_resolve_development
- a_spec = util_spec 'a', 1 do |s|
- s.add_development_dependency 'b'
+ a_spec = util_spec "a", 1 do |s|
+ s.add_development_dependency "b"
end
- b_spec = util_spec 'b', 1 do
- |s| s.add_development_dependency 'c'
+ b_spec = util_spec "b", 1 do
+ |s| s.add_development_dependency "c"
end
- c_spec = util_spec 'c', 1
+ c_spec = util_spec "c", 1
- a_dep = make_dep 'a', '= 1'
+ a_dep = make_dep "a", "= 1"
deps = [a_dep]
@@ -227,24 +227,24 @@ class TestGemResolver < Gem::TestCase
end
def test_resolve_development_shallow
- a_spec = util_spec 'a', 1 do |s|
- s.add_development_dependency 'b'
- s.add_runtime_dependency 'd'
+ a_spec = util_spec "a", 1 do |s|
+ s.add_development_dependency "b"
+ s.add_runtime_dependency "d"
end
- b_spec = util_spec 'b', 1 do |s|
- s.add_development_dependency 'c'
+ b_spec = util_spec "b", 1 do |s|
+ s.add_development_dependency "c"
end
- c_spec = util_spec 'c', 1
+ c_spec = util_spec "c", 1
- d_spec = util_spec 'd', 1 do |s|
- s.add_development_dependency 'e'
+ d_spec = util_spec "d", 1 do |s|
+ s.add_development_dependency "e"
end
- e_spec = util_spec 'e', 1
+ e_spec = util_spec "e", 1
- a_dep = make_dep 'a', '= 1'
+ a_dep = make_dep "a", "= 1"
deps = [a_dep]
@@ -262,7 +262,7 @@ class TestGemResolver < Gem::TestCase
@fetcher = Gem::FakeFetcher.new
Gem::RemoteFetcher.fetcher = @fetcher
- a_dep = make_dep 'a', '= 1'
+ a_dep = make_dep "a", "= 1"
res = Gem::Resolver.new [a_dep], Gem::Resolver::IndexSet.new
@@ -274,7 +274,7 @@ class TestGemResolver < Gem::TestCase
end
def test_no_overlap_specifically
- a = util_spec "a", '1'
+ a = util_spec "a", "1"
b = util_spec "b", "1"
ad = make_dep "a", "= 1"
@@ -290,7 +290,7 @@ class TestGemResolver < Gem::TestCase
end
def test_pulls_in_dependencies
- a = util_spec "a", '1'
+ a = util_spec "a", "1"
b = util_spec "b", "1", "c" => "= 1"
c = util_spec "c", "1"
@@ -307,8 +307,8 @@ class TestGemResolver < Gem::TestCase
end
def test_picks_highest_version
- a1 = util_spec "a", '1'
- a2 = util_spec "a", '2'
+ a1 = util_spec "a", "1"
+ a2 = util_spec "a", "2"
s = set(a1, a2)
@@ -321,17 +321,17 @@ class TestGemResolver < Gem::TestCase
def test_picks_best_platform
is = Gem::Resolver::IndexSpecification
- unknown = Gem::Platform.new 'unknown'
+ unknown = Gem::Platform.new "unknown"
a2_p1 = a3_p2 = nil
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
+ fetcher.spec "a", 2
- a2_p1 = fetcher.spec 'a', 2 do |s|
+ a2_p1 = fetcher.spec "a", 2 do |s|
s.platform = Gem::Platform.local
end
- a3_p2 = fetcher.spec 'a', 3 do |s|
+ a3_p2 = fetcher.spec "a", 3 do |s|
s.platform = unknown
end
end
@@ -342,9 +342,9 @@ class TestGemResolver < Gem::TestCase
s = set
- a2 = is.new s, 'a', v2, source, Gem::Platform::RUBY
- a2_p1 = is.new s, 'a', v2, source, Gem::Platform.local.to_s
- a3_p2 = is.new s, 'a', v3, source, unknown
+ a2 = is.new s, "a", v2, source, Gem::Platform::RUBY
+ a2_p1 = is.new s, "a", v2, source, Gem::Platform.local.to_s
+ a3_p2 = is.new s, "a", v3, source, unknown
s.add a3_p2
s.add a2_p1
@@ -509,7 +509,7 @@ class TestGemResolver < Gem::TestCase
def test_raises_and_reports_an_implicit_request_properly
a1 = util_spec "a", "1" do |s|
- s.add_runtime_dependency 'b', '= 2'
+ s.add_runtime_dependency "b", "= 2"
end
ad = make_dep "a", "= 1"
@@ -546,14 +546,14 @@ class TestGemResolver < Gem::TestCase
dependency = e.conflict.dependency
assert_includes %w[a b], dependency.name
- assert_equal req('>= 0'), dependency.requirement
+ assert_equal req(">= 0"), dependency.requirement
activated = e.conflict.activated
- assert_equal 'c-1', activated.full_name
+ assert_equal "c-1", activated.full_name
- assert_equal dep('c', '= 1'), activated.request.dependency
+ assert_equal dep("c", "= 1"), activated.request.dependency
- assert_equal [dep('c', '>= 2'), dep('c', '= 1')],
+ assert_equal [dep("c", ">= 2"), dep("c", "= 1")],
e.conflict.conflicting_dependencies
end
@@ -617,15 +617,15 @@ class TestGemResolver < Gem::TestCase
end
def test_resolve_conflict
- a1 = util_spec 'a', 1
- a2 = util_spec 'a', 2
+ a1 = util_spec "a", 1
+ a2 = util_spec "a", 2
- b2 = util_spec 'b', 2, 'a' => '~> 2.0'
+ b2 = util_spec "b", 2, "a" => "~> 2.0"
s = set a1, a2, b2
- a_dep = dep 'a', '~> 1.0'
- b_dep = dep 'b'
+ a_dep = dep "a", "~> 1.0"
+ b_dep = dep "b"
r = Gem::Resolver.new [a_dep, b_dep], s
@@ -635,18 +635,18 @@ class TestGemResolver < Gem::TestCase
end
def test_resolve_bug_699
- a1 = util_spec 'a', '1', 'b' => '= 2',
- 'c' => '~> 1.0.3'
+ a1 = util_spec "a", "1", "b" => "= 2",
+ "c" => "~> 1.0.3"
- b1 = util_spec 'b', '2', 'c' => '~> 1.0'
+ b1 = util_spec "b", "2", "c" => "~> 1.0"
- c1 = util_spec 'c', '1.0.9'
- c2 = util_spec 'c', '1.1.0'
- c3 = util_spec 'c', '1.2.0'
+ c1 = util_spec "c", "1.0.9"
+ c2 = util_spec "c", "1.1.0"
+ c3 = util_spec "c", "1.2.0"
s = set a1, b1, c1, c2, c3
- a_dep = dep 'a', '= 1'
+ a_dep = dep "a", "= 1"
r = Gem::Resolver.new [a_dep], s
@@ -654,16 +654,16 @@ class TestGemResolver < Gem::TestCase
end
def test_resolve_rollback
- a1 = util_spec 'a', 1
- a2 = util_spec 'a', 2
+ a1 = util_spec "a", 1
+ a2 = util_spec "a", 2
- b1 = util_spec 'b', 1, 'a' => '~> 1.0'
- b2 = util_spec 'b', 2, 'a' => '~> 2.0'
+ b1 = util_spec "b", 1, "a" => "~> 1.0"
+ b2 = util_spec "b", 2, "a" => "~> 2.0"
s = set a1, a2, b1, b2
- a_dep = dep 'a', '~> 1.0'
- b_dep = dep 'b'
+ a_dep = dep "a", "~> 1.0"
+ b_dep = dep "b"
r = Gem::Resolver.new [a_dep, b_dep], s
@@ -711,15 +711,15 @@ class TestGemResolver < Gem::TestCase
end
def test_sorts_by_source_then_version
- sourceA = Gem::Source.new 'http://example.com/a'
- sourceB = Gem::Source.new 'http://example.com/b'
- sourceC = Gem::Source.new 'http://example.com/c'
+ sourceA = Gem::Source.new "http://example.com/a"
+ sourceB = Gem::Source.new "http://example.com/b"
+ sourceC = Gem::Source.new "http://example.com/c"
- spec_A_1 = util_spec 'some-dep', '0.0.1'
- spec_A_2 = util_spec 'some-dep', '1.0.0'
- spec_B_1 = util_spec 'some-dep', '0.0.1'
- spec_B_2 = util_spec 'some-dep', '0.0.2'
- spec_C_1 = util_spec 'some-dep', '0.1.0'
+ spec_A_1 = util_spec "some-dep", "0.0.1"
+ spec_A_2 = util_spec "some-dep", "1.0.0"
+ spec_B_1 = util_spec "some-dep", "0.0.1"
+ spec_B_2 = util_spec "some-dep", "0.0.2"
+ spec_C_1 = util_spec "some-dep", "0.1.0"
set = StaticSet.new [
Gem::Resolver::SpecSpecification.new(nil, spec_B_1, sourceB),
@@ -729,7 +729,7 @@ class TestGemResolver < Gem::TestCase
Gem::Resolver::SpecSpecification.new(nil, spec_A_1, sourceA),
]
- dependency = make_dep 'some-dep', '> 0'
+ dependency = make_dep "some-dep", "> 0"
resolver = Gem::Resolver.new [dependency], set
@@ -739,14 +739,14 @@ class TestGemResolver < Gem::TestCase
def test_select_local_platforms
r = Gem::Resolver.new nil, nil
- a1 = util_spec 'a', 1
+ a1 = util_spec "a", 1
- a1_p1 = util_spec 'a', 1 do |s|
+ a1_p1 = util_spec "a", 1 do |s|
s.platform = Gem::Platform.local
end
- a1_p2 = util_spec 'a', 1 do |s|
- s.platform = 'unknown'
+ a1_p2 = util_spec "a", 1 do |s|
+ s.platform = "unknown"
end
selected = r.select_local_platforms [a1, a1_p1, a1_p2]
@@ -755,18 +755,18 @@ class TestGemResolver < Gem::TestCase
end
def test_search_for_local_platform_partial_string_match
- a1 = util_spec 'a', 1
+ a1 = util_spec "a", 1
- a1_p1 = util_spec 'a', 1 do |s|
+ a1_p1 = util_spec "a", 1 do |s|
s.platform = Gem::Platform.local.os
end
- a1_p2 = util_spec 'a', 1 do |s|
- s.platform = 'unknown'
+ a1_p2 = util_spec "a", 1 do |s|
+ s.platform = "unknown"
end
s = set(a1_p1, a1_p2, a1)
- d = [make_dep('a')]
+ d = [make_dep("a")]
r = Gem::Resolver.new(d, s)
assert_resolves_to [a1_p1], r
diff --git a/test/rubygems/test_gem_resolver_activation_request.rb b/test/rubygems/test_gem_resolver_activation_request.rb
index c7b726a230..397eb1e10d 100644
--- a/test/rubygems/test_gem_resolver_activation_request.rb
+++ b/test/rubygems/test_gem_resolver_activation_request.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverActivationRequest < Gem::TestCase
def setup
@@ -7,12 +7,12 @@ class TestGemResolverActivationRequest < Gem::TestCase
@DR = Gem::Resolver
- @dep = @DR::DependencyRequest.new dep('a', '>= 0'), nil
+ @dep = @DR::DependencyRequest.new dep("a", ">= 0"), nil
source = Gem::Source::Local.new
platform = Gem::Platform::RUBY
- @a3 = @DR::IndexSpecification.new nil, 'a', v(3), source, platform
+ @a3 = @DR::IndexSpecification.new nil, "a", v(3), source, platform
@req = @DR::ActivationRequest.new @a3, @dep
end
@@ -20,7 +20,7 @@ class TestGemResolverActivationRequest < Gem::TestCase
def test_development_eh
refute @req.development?
- dep_req = @DR::DependencyRequest.new dep('a', '>= 0', :development), nil
+ dep_req = @DR::DependencyRequest.new dep("a", ">= 0", :development), nil
act_req = @DR::ActivationRequest.new @a3, dep_req
@@ -28,8 +28,8 @@ class TestGemResolverActivationRequest < Gem::TestCase
end
def test_inspect
- assert_match 'a-3', @req.inspect
- assert_match 'from a (>= 0)', @req.inspect
+ assert_match "a-3", @req.inspect
+ assert_match "from a (>= 0)", @req.inspect
end
def test_installed_eh
diff --git a/test/rubygems/test_gem_resolver_api_set.rb b/test/rubygems/test_gem_resolver_api_set.rb
index c3db25d7aa..5c13311b1b 100644
--- a/test/rubygems/test_gem_resolver_api_set.rb
+++ b/test/rubygems/test_gem_resolver_api_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverAPISet < Gem::TestCase
def setup
@@ -12,17 +12,17 @@ class TestGemResolverAPISet < Gem::TestCase
def test_initialize
set = @DR::APISet.new
- assert_equal URI('https://index.rubygems.org/info/'), set.dep_uri
- assert_equal URI('https://index.rubygems.org/'), set.uri
- assert_equal Gem::Source.new(URI('https://index.rubygems.org')), set.source
+ assert_equal URI("https://index.rubygems.org/info/"), set.dep_uri
+ assert_equal URI("https://index.rubygems.org/"), set.uri
+ assert_equal Gem::Source.new(URI("https://index.rubygems.org")), set.source
end
def test_initialize_deeper_uri
- set = @DR::APISet.new 'https://rubygemsserver.com/mygems/info'
+ set = @DR::APISet.new "https://rubygemsserver.com/mygems/info"
- assert_equal URI('https://rubygemsserver.com/mygems/info'), set.dep_uri
- assert_equal URI('https://rubygemsserver.com/'), set.uri
- assert_equal Gem::Source.new(URI('https://rubygemsserver.com/')), set.source
+ assert_equal URI("https://rubygemsserver.com/mygems/info"), set.dep_uri
+ assert_equal URI("https://rubygemsserver.com/"), set.uri
+ assert_equal Gem::Source.new(URI("https://rubygemsserver.com/")), set.source
end
def test_initialize_uri
@@ -36,9 +36,9 @@ class TestGemResolverAPISet < Gem::TestCase
spec_fetcher
data = [
- { :name => 'a',
- :number => '1',
- :platform => 'ruby',
+ { :name => "a",
+ :number => "1",
+ :platform => "ruby",
:dependencies => [] },
]
@@ -46,7 +46,7 @@ class TestGemResolverAPISet < Gem::TestCase
set = @DR::APISet.new @dep_uri
- a_dep = @DR::DependencyRequest.new dep('a'), nil
+ a_dep = @DR::DependencyRequest.new dep("a"), nil
expected = [
@DR::APISpecification.new(set, data.first),
@@ -59,13 +59,13 @@ class TestGemResolverAPISet < Gem::TestCase
spec_fetcher
data = [
- { :name => 'a',
- :number => '1',
- :platform => 'ruby',
+ { :name => "a",
+ :number => "1",
+ :platform => "ruby",
:dependencies => [] },
- { :name => 'a',
- :number => '2.a',
- :platform => 'ruby',
+ { :name => "a",
+ :number => "2.a",
+ :platform => "ruby",
:dependencies => [] },
]
@@ -74,7 +74,7 @@ class TestGemResolverAPISet < Gem::TestCase
set = @DR::APISet.new @dep_uri
set.prerelease = true
- a_dep = @DR::DependencyRequest.new dep('a'), nil
+ a_dep = @DR::DependencyRequest.new dep("a"), nil
expected = [
@DR::APISpecification.new(set, data.first),
@@ -88,9 +88,9 @@ class TestGemResolverAPISet < Gem::TestCase
spec_fetcher
data = [
- { :name => 'a',
- :number => '1',
- :platform => 'ruby',
+ { :name => "a",
+ :number => "1",
+ :platform => "ruby",
:dependencies => [] },
]
@@ -98,7 +98,7 @@ class TestGemResolverAPISet < Gem::TestCase
set = @DR::APISet.new @dep_uri
- a_dep = @DR::DependencyRequest.new dep('a'), nil
+ a_dep = @DR::DependencyRequest.new dep("a"), nil
set.prefetch [a_dep]
@@ -115,7 +115,7 @@ class TestGemResolverAPISet < Gem::TestCase
set = @DR::APISet.new @dep_uri
set.remote = false
- a_dep = @DR::DependencyRequest.new dep('a'), nil
+ a_dep = @DR::DependencyRequest.new dep("a"), nil
assert_empty set.find_all(a_dep)
end
@@ -127,7 +127,7 @@ class TestGemResolverAPISet < Gem::TestCase
set = @DR::APISet.new @dep_uri
- a_dep = @DR::DependencyRequest.new dep('a'), nil
+ a_dep = @DR::DependencyRequest.new dep("a"), nil
assert_empty set.find_all(a_dep)
@@ -144,8 +144,8 @@ class TestGemResolverAPISet < Gem::TestCase
set = @DR::APISet.new @dep_uri
- a_dep = @DR::DependencyRequest.new dep('a'), nil
- b_dep = @DR::DependencyRequest.new dep('b'), nil
+ a_dep = @DR::DependencyRequest.new dep("a"), nil
+ b_dep = @DR::DependencyRequest.new dep("b"), nil
set.prefetch [a_dep, b_dep]
@@ -160,8 +160,8 @@ class TestGemResolverAPISet < Gem::TestCase
set = @DR::APISet.new @dep_uri
- a_dep = @DR::DependencyRequest.new dep('a'), nil
- b_dep = @DR::DependencyRequest.new dep('b'), nil
+ a_dep = @DR::DependencyRequest.new dep("a"), nil
+ b_dep = @DR::DependencyRequest.new dep("b"), nil
set.prefetch [a_dep]
@@ -179,8 +179,8 @@ class TestGemResolverAPISet < Gem::TestCase
set = @DR::APISet.new @dep_uri
- a_dep = @DR::DependencyRequest.new dep('a'), nil
- b_dep = @DR::DependencyRequest.new dep('b'), nil
+ a_dep = @DR::DependencyRequest.new dep("a"), nil
+ b_dep = @DR::DependencyRequest.new dep("b"), nil
set.prefetch [a_dep, b_dep]
@@ -199,8 +199,8 @@ class TestGemResolverAPISet < Gem::TestCase
set = @DR::APISet.new @dep_uri
set.remote = false
- a_dep = @DR::DependencyRequest.new dep('a'), nil
- b_dep = @DR::DependencyRequest.new dep('b'), nil
+ a_dep = @DR::DependencyRequest.new dep("a"), nil
+ b_dep = @DR::DependencyRequest.new dep("b"), nil
set.prefetch [a_dep, b_dep]
diff --git a/test/rubygems/test_gem_resolver_api_specification.rb b/test/rubygems/test_gem_resolver_api_specification.rb
index 3f9b81868f..98981e53e9 100644
--- a/test/rubygems/test_gem_resolver_api_specification.rb
+++ b/test/rubygems/test_gem_resolver_api_specification.rb
@@ -1,28 +1,28 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverAPISpecification < Gem::TestCase
def test_initialize
set = Gem::Resolver::APISet.new
data = {
- :name => 'rails',
- :number => '3.0.3',
+ :name => "rails",
+ :number => "3.0.3",
:platform => Gem::Platform.local.to_s,
:dependencies => [
- ['bundler', '~> 1.0'],
- ['railties', '= 3.0.3'],
+ ["bundler", "~> 1.0"],
+ ["railties", "= 3.0.3"],
],
}
spec = Gem::Resolver::APISpecification.new set, data
- assert_equal 'rails', spec.name
- assert_equal Gem::Version.new('3.0.3'), spec.version
+ assert_equal "rails", spec.name
+ assert_equal Gem::Version.new("3.0.3"), spec.version
assert_equal Gem::Platform.local, spec.platform
expected = [
- Gem::Dependency.new('bundler', '~> 1.0'),
- Gem::Dependency.new('railties', '= 3.0.3'),
+ Gem::Dependency.new("bundler", "~> 1.0"),
+ Gem::Dependency.new("railties", "= 3.0.3"),
]
assert_equal expected, spec.dependencies
@@ -30,26 +30,26 @@ class TestGemResolverAPISpecification < Gem::TestCase
def test_fetch_development_dependencies
specs = spec_fetcher do |fetcher|
- fetcher.spec 'rails', '3.0.3' do |s|
- s.add_runtime_dependency 'bundler', '~> 1.0'
- s.add_runtime_dependency 'railties', '= 3.0.3'
- s.add_development_dependency 'a', '= 1'
+ fetcher.spec "rails", "3.0.3" do |s|
+ s.add_runtime_dependency "bundler", "~> 1.0"
+ s.add_runtime_dependency "railties", "= 3.0.3"
+ s.add_development_dependency "a", "= 1"
end
end
- rails = specs['rails-3.0.3']
+ rails = specs["rails-3.0.3"]
- repo = @gem_repo + 'info'
+ repo = @gem_repo + "info"
set = Gem::Resolver::APISet.new repo
data = {
- :name => 'rails',
- :number => '3.0.3',
- :platform => 'ruby',
+ :name => "rails",
+ :number => "3.0.3",
+ :platform => "ruby",
:dependencies => [
- ['bundler', '~> 1.0'],
- ['railties', '= 3.0.3'],
+ ["bundler", "~> 1.0"],
+ ["railties", "= 3.0.3"],
],
}
@@ -60,9 +60,9 @@ class TestGemResolverAPISpecification < Gem::TestCase
spec.fetch_development_dependencies
expected = [
- Gem::Dependency.new('bundler', '~> 1.0'),
- Gem::Dependency.new('railties', '= 3.0.3'),
- Gem::Dependency.new('a', '= 1', :development),
+ Gem::Dependency.new("bundler", "~> 1.0"),
+ Gem::Dependency.new("railties", "= 3.0.3"),
+ Gem::Dependency.new("a", "= 1", :development),
]
assert_equal expected, spec.dependencies
@@ -71,9 +71,9 @@ class TestGemResolverAPISpecification < Gem::TestCase
def test_installable_platform_eh
set = Gem::Resolver::APISet.new
data = {
- :name => 'a',
- :number => '1',
- :platform => 'ruby',
+ :name => "a",
+ :number => "1",
+ :platform => "ruby",
:dependencies => [],
}
@@ -82,9 +82,9 @@ class TestGemResolverAPISpecification < Gem::TestCase
assert a_spec.installable_platform?
data = {
- :name => 'b',
- :number => '1',
- :platform => 'cpu-other_platform-1',
+ :name => "b",
+ :number => "1",
+ :platform => "cpu-other_platform-1",
:dependencies => [],
}
@@ -93,8 +93,8 @@ class TestGemResolverAPISpecification < Gem::TestCase
refute b_spec.installable_platform?
data = {
- :name => 'c',
- :number => '1',
+ :name => "c",
+ :number => "1",
:platform => Gem::Platform.local.to_s,
:dependencies => [],
}
@@ -107,9 +107,9 @@ class TestGemResolverAPISpecification < Gem::TestCase
def test_source
set = Gem::Resolver::APISet.new
data = {
- :name => 'a',
- :number => '1',
- :platform => 'ruby',
+ :name => "a",
+ :number => "1",
+ :platform => "ruby",
:dependencies => [],
}
@@ -120,15 +120,15 @@ class TestGemResolverAPISpecification < Gem::TestCase
def test_spec
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
- dep_uri = URI(@gem_repo) + 'info'
+ dep_uri = URI(@gem_repo) + "info"
set = Gem::Resolver::APISet.new dep_uri
data = {
- :name => 'a',
- :number => '1',
- :platform => 'ruby',
+ :name => "a",
+ :number => "1",
+ :platform => "ruby",
:dependencies => [],
}
@@ -137,22 +137,22 @@ class TestGemResolverAPISpecification < Gem::TestCase
spec = api_spec.spec
assert_kind_of Gem::Specification, spec
- assert_equal 'a-1', spec.full_name
+ assert_equal "a-1", spec.full_name
end
def test_spec_jruby_platform
spec_fetcher do |fetcher|
- fetcher.gem 'j', 1 do |spec|
- spec.platform = 'jruby'
+ fetcher.gem "j", 1 do |spec|
+ spec.platform = "jruby"
end
end
- dep_uri = URI(@gem_repo) + 'info'
+ dep_uri = URI(@gem_repo) + "info"
set = Gem::Resolver::APISet.new dep_uri
data = {
- :name => 'j',
- :number => '1',
- :platform => 'jruby',
+ :name => "j",
+ :number => "1",
+ :platform => "jruby",
:dependencies => [],
}
@@ -161,6 +161,6 @@ class TestGemResolverAPISpecification < Gem::TestCase
spec = api_spec.spec
assert_kind_of Gem::Specification, spec
- assert_equal 'j-1-java', spec.full_name
+ assert_equal "j-1-java", spec.full_name
end
end
diff --git a/test/rubygems/test_gem_resolver_best_set.rb b/test/rubygems/test_gem_resolver_best_set.rb
index 0e279d16a8..c1c67ba832 100644
--- a/test/rubygems/test_gem_resolver_best_set.rb
+++ b/test/rubygems/test_gem_resolver_best_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverBestSet < Gem::TestCase
def setup
@@ -16,14 +16,14 @@ class TestGemResolverBestSet < Gem::TestCase
def test_find_all_index
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'b', 1
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "b", 1
end
set = @DR::BestSet.new
- dependency = dep 'a', '~> 1'
+ dependency = dep "a", "~> 1"
req = @DR::DependencyRequest.new dependency, nil
@@ -34,7 +34,7 @@ class TestGemResolverBestSet < Gem::TestCase
def test_find_all_fallback
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
set = @DR::BestSet.new
@@ -43,7 +43,7 @@ class TestGemResolverBestSet < Gem::TestCase
set.sets << Gem::Resolver::APISet.new(api_uri)
- dependency = dep 'a', '~> 1'
+ dependency = dep "a", "~> 1"
req = @DR::DependencyRequest.new dependency, nil
@@ -54,15 +54,15 @@ class TestGemResolverBestSet < Gem::TestCase
def test_find_all_local
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'b', 1
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "b", 1
end
set = @DR::BestSet.new
set.remote = false
- dependency = dep 'a', '~> 1'
+ dependency = dep "a", "~> 1"
req = @DR::DependencyRequest.new dependency, nil
@@ -73,7 +73,7 @@ class TestGemResolverBestSet < Gem::TestCase
def test_prefetch
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
set = @DR::BestSet.new
@@ -85,7 +85,7 @@ class TestGemResolverBestSet < Gem::TestCase
def test_prefetch_local
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
set = @DR::BestSet.new
@@ -99,14 +99,14 @@ class TestGemResolverBestSet < Gem::TestCase
def test_replace_failed_api_set
set = @DR::BestSet.new
- api_uri = URI(@gem_repo) + './info/'
+ api_uri = URI(@gem_repo) + "./info/"
api_set = Gem::Resolver::APISet.new api_uri
set.sets << api_set
- error_uri = api_uri + 'a'
+ error_uri = api_uri + "a"
- error = Gem::RemoteFetcher::FetchError.new 'bogus', error_uri
+ error = Gem::RemoteFetcher::FetchError.new "bogus", error_uri
set.replace_failed_api_set error
@@ -124,7 +124,7 @@ class TestGemResolverBestSet < Gem::TestCase
set.sets << index_set
- error = Gem::RemoteFetcher::FetchError.new 'bogus', @gem_repo
+ error = Gem::RemoteFetcher::FetchError.new "bogus", @gem_repo
e = assert_raise Gem::RemoteFetcher::FetchError do
set.replace_failed_api_set error
@@ -136,16 +136,16 @@ class TestGemResolverBestSet < Gem::TestCase
def test_replace_failed_api_set_uri_with_credentials
set = @DR::BestSet.new
- api_uri = URI(@gem_repo) + './info/'
- api_uri.user = 'user'
- api_uri.password = 'pass'
+ api_uri = URI(@gem_repo) + "./info/"
+ api_uri.user = "user"
+ api_uri.password = "pass"
api_set = Gem::Resolver::APISet.new api_uri
set.sets << api_set
- error_uri = api_uri + 'a'
+ error_uri = api_uri + "a"
- error = Gem::RemoteFetcher::FetchError.new 'bogus', error_uri
+ error = Gem::RemoteFetcher::FetchError.new "bogus", error_uri
set.replace_failed_api_set error
diff --git a/test/rubygems/test_gem_resolver_composed_set.rb b/test/rubygems/test_gem_resolver_composed_set.rb
index 405753a373..5feceebb34 100644
--- a/test/rubygems/test_gem_resolver_composed_set.rb
+++ b/test/rubygems/test_gem_resolver_composed_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverComposedSet < Gem::TestCase
def test_errors
diff --git a/test/rubygems/test_gem_resolver_conflict.rb b/test/rubygems/test_gem_resolver_conflict.rb
index 1d46e69c3f..8bee6699c8 100644
--- a/test/rubygems/test_gem_resolver_conflict.rb
+++ b/test/rubygems/test_gem_resolver_conflict.rb
@@ -1,16 +1,16 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverConflict < Gem::TestCase
def test_explanation
root =
- dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
+ dependency_request dep("net-ssh", ">= 2.0.13"), "rye", "0.9.8"
child =
- dependency_request dep('net-ssh', '>= 2.6.5'), 'net-ssh', '2.2.2', root
+ dependency_request dep("net-ssh", ">= 2.6.5"), "net-ssh", "2.2.2", root
- dep = Gem::Resolver::DependencyRequest.new dep('net-ssh', '>= 2.0.13'), nil
+ dep = Gem::Resolver::DependencyRequest.new dep("net-ssh", ">= 2.0.13"), nil
- spec = util_spec 'net-ssh', '2.2.2'
+ spec = util_spec "net-ssh", "2.2.2"
active =
Gem::Resolver::ActivationRequest.new spec, dep
@@ -37,10 +37,10 @@ class TestGemResolverConflict < Gem::TestCase
def test_explanation_user_request
@DR = Gem::Resolver
- spec = util_spec 'a', 2
+ spec = util_spec "a", 2
- a1_req = @DR::DependencyRequest.new dep('a', '= 1'), nil
- a2_req = @DR::DependencyRequest.new dep('a', '= 2'), nil
+ a1_req = @DR::DependencyRequest.new dep("a", "= 1"), nil
+ a2_req = @DR::DependencyRequest.new dep("a", "= 2"), nil
activated = @DR::ActivationRequest.new spec, a2_req
@@ -63,17 +63,17 @@ class TestGemResolverConflict < Gem::TestCase
def test_request_path
root =
- dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
+ dependency_request dep("net-ssh", ">= 2.0.13"), "rye", "0.9.8"
child =
- dependency_request dep('other', '>= 1.0'), 'net-ssh', '2.2.2', root
+ dependency_request dep("other", ">= 1.0"), "net-ssh", "2.2.2", root
conflict =
Gem::Resolver::Conflict.new nil, nil
expected = [
- 'net-ssh (>= 2.0.13), 2.2.2 activated',
- 'rye (= 0.9.8), 0.9.8 activated',
+ "net-ssh (>= 2.0.13), 2.2.2 activated",
+ "rye (= 0.9.8), 0.9.8 activated",
]
assert_equal expected, conflict.request_path(child.requester)
diff --git a/test/rubygems/test_gem_resolver_dependency_request.rb b/test/rubygems/test_gem_resolver_dependency_request.rb
index cea0a7952d..6ad3a09028 100644
--- a/test/rubygems/test_gem_resolver_dependency_request.rb
+++ b/test/rubygems/test_gem_resolver_dependency_request.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverDependencyRequest < Gem::TestCase
def setup
@@ -9,13 +9,13 @@ class TestGemResolverDependencyRequest < Gem::TestCase
end
def test_development_eh
- a_dep = dep 'a', '>= 1'
+ a_dep = dep "a", ">= 1"
a_dep_req = @DR.new a_dep, nil
refute a_dep_req.development?
- b_dep = dep 'b', '>= 1', :development
+ b_dep = dep "b", ">= 1", :development
b_dep_req = @DR.new b_dep, nil
@@ -23,8 +23,8 @@ class TestGemResolverDependencyRequest < Gem::TestCase
end
def test_match_eh
- spec = util_spec 'a', 1
- dependency = dep 'a', '>= 1'
+ spec = util_spec "a", 1
+ dependency = dep "a", ">= 1"
dr = @DR.new dependency, nil
@@ -32,31 +32,31 @@ class TestGemResolverDependencyRequest < Gem::TestCase
end
def test_match_eh_prerelease
- spec = util_spec 'a', '1.a'
+ spec = util_spec "a", "1.a"
- a_dep = dep 'a', '>= 1'
+ a_dep = dep "a", ">= 1"
a_dr = @DR.new a_dep, nil
refute a_dr.match? spec
- a_pre_dep = dep 'a', '>= 1.a'
+ a_pre_dep = dep "a", ">= 1.a"
a_pre_dr = @DR.new a_pre_dep, nil
assert a_pre_dr.match? spec
end
def test_match_eh_prerelease_allow_prerelease
- spec = util_spec 'a', '2.a'
+ spec = util_spec "a", "2.a"
- a_dep = dep 'a', '>= 1'
+ a_dep = dep "a", ">= 1"
a_dr = @DR.new a_dep, nil
assert a_dr.match? spec, true
end
def test_matches_spec_eh
- spec = util_spec 'a', 1
- dependency = dep 'a', '>= 1'
+ spec = util_spec "a", 1
+ dependency = dep "a", ">= 1"
dr = @DR.new dependency, nil
@@ -64,16 +64,16 @@ class TestGemResolverDependencyRequest < Gem::TestCase
end
def test_matches_spec_eh_prerelease
- spec = util_spec 'a', '1.a'
+ spec = util_spec "a", "1.a"
- dependency = dep 'a', '>= 0'
+ dependency = dep "a", ">= 0"
dr = @DR.new dependency, nil
assert dr.matches_spec? spec
end
def test_requirement
- dependency = dep 'a', '>= 1'
+ dependency = dep "a", ">= 1"
dr = @DR.new dependency, nil
diff --git a/test/rubygems/test_gem_resolver_git_set.rb b/test/rubygems/test_gem_resolver_git_set.rb
index 145cd6c7df..f7063b3d45 100644
--- a/test/rubygems/test_gem_resolver_git_set.rb
+++ b/test/rubygems/test_gem_resolver_git_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverGitSet < Gem::TestCase
def setup
@@ -13,9 +13,9 @@ class TestGemResolverGitSet < Gem::TestCase
def test_add_git_gem
name, version, repository, = git_gem
- @set.add_git_gem name, repository, 'master', false
+ @set.add_git_gem name, repository, "master", false
- dependency = dep 'a'
+ dependency = dep "a"
specs = @set.find_all dependency
@@ -27,9 +27,9 @@ class TestGemResolverGitSet < Gem::TestCase
def test_add_git_gem_submodules
name, _, repository, = git_gem
- @set.add_git_gem name, repository, 'master', true
+ @set.add_git_gem name, repository, "master", true
- dependency = dep 'a'
+ dependency = dep "a"
refute_empty @set.find_all dependency
@@ -41,7 +41,7 @@ class TestGemResolverGitSet < Gem::TestCase
@set.add_git_spec name, version, repository, revision, true
- dependency = dep 'a'
+ dependency = dep "a"
specs = @set.find_all dependency
@@ -57,9 +57,9 @@ class TestGemResolverGitSet < Gem::TestCase
def test_find_all
name, _, repository, = git_gem
- @set.add_git_gem name, repository, 'master', false
+ @set.add_git_gem name, repository, "master", false
- dependency = dep 'a', '~> 1.0'
+ dependency = dep "a", "~> 1.0"
req = Gem::Resolver::DependencyRequest.new dependency, nil
@reqs.add req
@@ -67,16 +67,16 @@ class TestGemResolverGitSet < Gem::TestCase
found = @set.find_all dependency
- assert_equal [@set.specs['a']], found
+ assert_equal [@set.specs["a"]], found
end
def test_find_all_local
name, _, repository, = git_gem
- @set.add_git_gem name, repository, 'master', false
+ @set.add_git_gem name, repository, "master", false
@set.remote = false
- dependency = dep 'a', '~> 1.0'
+ dependency = dep "a", "~> 1.0"
req = Gem::Resolver::DependencyRequest.new dependency, nil
@reqs.add req
@@ -86,11 +86,11 @@ class TestGemResolverGitSet < Gem::TestCase
end
def test_find_all_prerelease
- name, _, repository, = git_gem 'a', '1.a'
+ name, _, repository, = git_gem "a", "1.a"
- @set.add_git_gem name, repository, 'master', false
+ @set.add_git_gem name, repository, "master", false
- dependency = dep 'a', '>= 0'
+ dependency = dep "a", ">= 0"
req = Gem::Resolver::DependencyRequest.new dependency, nil
@reqs.add req
@@ -100,7 +100,7 @@ class TestGemResolverGitSet < Gem::TestCase
assert_empty found
- dependency = dep 'a', '>= 0.a'
+ dependency = dep "a", ">= 0.a"
req = Gem::Resolver::DependencyRequest.new dependency, nil
@reqs.add req
@@ -122,7 +122,7 @@ class TestGemResolverGitSet < Gem::TestCase
def test_prefetch
name, _, repository, = git_gem
- @set.add_git_gem name, repository, 'master', false
+ @set.add_git_gem name, repository, "master", false
dependency = dep name
req = Gem::Resolver::DependencyRequest.new dependency, nil
@@ -136,7 +136,7 @@ class TestGemResolverGitSet < Gem::TestCase
def test_prefetch_cache
name, _, repository, = git_gem
- @set.add_git_gem name, repository, 'master', false
+ @set.add_git_gem name, repository, "master", false
dependency = dep name
req = Gem::Resolver::DependencyRequest.new dependency, nil
@@ -154,21 +154,21 @@ class TestGemResolverGitSet < Gem::TestCase
def test_prefetch_filter
name, _, repository, = git_gem
- @set.add_git_gem name, repository, 'master', false
+ @set.add_git_gem name, repository, "master", false
- dependency = dep 'b'
+ dependency = dep "b"
req = Gem::Resolver::DependencyRequest.new dependency, nil
@reqs.add req
@set.prefetch @reqs
- refute_empty @set.specs, 'the git source does not filter'
+ refute_empty @set.specs, "the git source does not filter"
end
def test_prefetch_root_dir
name, _, repository, = git_gem
- @set.add_git_gem name, repository, 'master', false
+ @set.add_git_gem name, repository, "master", false
dependency = dep name
req = Gem::Resolver::DependencyRequest.new dependency, nil
diff --git a/test/rubygems/test_gem_resolver_git_specification.rb b/test/rubygems/test_gem_resolver_git_specification.rb
index 857452c159..fef071aa76 100644
--- a/test/rubygems/test_gem_resolver_git_specification.rb
+++ b/test/rubygems/test_gem_resolver_git_specification.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/installer'
+require_relative "helper"
+require "rubygems/installer"
class TestGemResolverGitSpecification < Gem::TestCase
def setup
super
@set = Gem::Resolver::GitSet.new
- @spec = Gem::Specification.new 'a', 1
+ @spec = Gem::Specification.new "a", 1
end
def test_equals2
@@ -15,7 +15,7 @@ class TestGemResolverGitSpecification < Gem::TestCase
assert_equal g_spec_a, g_spec_a
- spec_b = Gem::Specification.new 'b', 1
+ spec_b = Gem::Specification.new "b", 1
g_spec_b = Gem::Resolver::GitSpecification.new @set, spec_b
refute_equal g_spec_a, g_spec_b
@@ -28,17 +28,17 @@ class TestGemResolverGitSpecification < Gem::TestCase
i_set = Gem::Resolver::IndexSet.new
source = Gem::Source.new @gem_repo
i_spec = Gem::Resolver::IndexSpecification.new(
- i_set, 'a', v(1), source, Gem::Platform::RUBY)
+ i_set, "a", v(1), source, Gem::Platform::RUBY)
refute_equal g_spec_a, i_spec
end
def test_add_dependency
- git_gem 'a', 1
+ git_gem "a", 1
git_spec = Gem::Resolver::GitSpecification.new @set, @spec
- b_dep = dep 'b'
+ b_dep = dep "b"
git_spec.add_dependency b_dep
@@ -46,7 +46,7 @@ class TestGemResolverGitSpecification < Gem::TestCase
end
def test_install
- git_gem 'a', 1
+ git_gem "a", 1
git_spec = Gem::Resolver::GitSpecification.new @set, @spec
@@ -63,28 +63,28 @@ class TestGemResolverGitSpecification < Gem::TestCase
def test_install_extension
pend if Gem.java_platform?
- pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?('GITHUB_ACTIONS') # not working from the beginning
- name, _, repository, = git_gem 'a', 1 do |s|
- s.extensions << 'ext/extconf.rb'
+ pend if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS") # not working from the beginning
+ name, _, repository, = git_gem "a", 1 do |s|
+ s.extensions << "ext/extconf.rb"
end
- Dir.chdir 'git/a' do
- FileUtils.mkdir_p 'ext/lib'
+ Dir.chdir "git/a" do
+ FileUtils.mkdir_p "ext/lib"
- File.open 'ext/extconf.rb', 'w' do |io|
+ File.open "ext/extconf.rb", "w" do |io|
io.puts 'require "mkmf"'
io.puts 'create_makefile "a"'
end
- FileUtils.touch 'ext/lib/b.rb'
+ FileUtils.touch "ext/lib/b.rb"
- system @git, 'add', 'ext/extconf.rb'
- system @git, 'add', 'ext/lib/b.rb'
+ system @git, "add", "ext/extconf.rb"
+ system @git, "add", "ext/lib/b.rb"
- system @git, 'commit', '--quiet', '-m', 'Add extension files'
+ system @git, "commit", "--quiet", "-m", "Add extension files"
end
- source = Gem::Source::Git.new name, repository, 'master', true
+ source = Gem::Source::Git.new name, repository, "master", true
spec = source.specs.first
@@ -92,11 +92,11 @@ class TestGemResolverGitSpecification < Gem::TestCase
git_spec.install({})
- assert_path_exist File.join git_spec.spec.extension_dir, 'b.rb'
+ assert_path_exist File.join git_spec.spec.extension_dir, "b.rb"
end
def test_install_installed
- git_gem 'a', 1
+ git_gem "a", 1
git_spec = Gem::Resolver::GitSpecification.new @set, @spec
diff --git a/test/rubygems/test_gem_resolver_index_set.rb b/test/rubygems/test_gem_resolver_index_set.rb
index ddae0c2b82..3b8f047808 100644
--- a/test/rubygems/test_gem_resolver_index_set.rb
+++ b/test/rubygems/test_gem_resolver_index_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverIndexSet < Gem::TestCase
def setup
@@ -17,7 +17,7 @@ class TestGemResolverIndexSet < Gem::TestCase
end
def test_initialize_source
- set = @DR::IndexSet.new 'http://alternate.example'
+ set = @DR::IndexSet.new "http://alternate.example"
fetcher = set.instance_variable_get :@f
@@ -28,14 +28,14 @@ class TestGemResolverIndexSet < Gem::TestCase
def test_find_all
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'b', 1
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "b", 1
end
set = @DR::IndexSet.new
- dependency = dep 'a', '~> 1'
+ dependency = dep "a", "~> 1"
req = @DR::DependencyRequest.new dependency, nil
@@ -46,15 +46,15 @@ class TestGemResolverIndexSet < Gem::TestCase
def test_find_all_local
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'b', 1
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "b", 1
end
set = @DR::IndexSet.new
set.remote = false
- dependency = dep 'a', '~> 1'
+ dependency = dep "a", "~> 1"
req = @DR::DependencyRequest.new dependency, nil
@@ -63,12 +63,12 @@ class TestGemResolverIndexSet < Gem::TestCase
def test_find_all_prerelease
spec_fetcher do |fetcher|
- fetcher.spec 'a', '1.a'
+ fetcher.spec "a", "1.a"
end
set = @DR::IndexSet.new
- dependency = dep 'a'
+ dependency = dep "a"
req = @DR::DependencyRequest.new dependency, nil
diff --git a/test/rubygems/test_gem_resolver_index_specification.rb b/test/rubygems/test_gem_resolver_index_specification.rb
index ef9c17034e..339445cb44 100644
--- a/test/rubygems/test_gem_resolver_index_specification.rb
+++ b/test/rubygems/test_gem_resolver_index_specification.rb
@@ -1,17 +1,17 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/available_set'
+require_relative "helper"
+require "rubygems/available_set"
class TestGemResolverIndexSpecification < Gem::TestCase
def test_initialize
set = Gem::Resolver::IndexSet.new
source = Gem::Source.new @gem_repo
- version = Gem::Version.new '3.0.3'
+ version = Gem::Version.new "3.0.3"
spec = Gem::Resolver::IndexSpecification.new(
- set, 'rails', version, source, Gem::Platform::RUBY)
+ set, "rails", version, source, Gem::Platform::RUBY)
- assert_equal 'rails', spec.name
+ assert_equal "rails", spec.name
assert_equal version, spec.version
assert_equal Gem::Platform::RUBY, spec.platform
@@ -21,24 +21,24 @@ class TestGemResolverIndexSpecification < Gem::TestCase
def test_initialize_platform
set = Gem::Resolver::IndexSet.new
source = Gem::Source::Local.new
- version = Gem::Version.new '3.0.3'
+ version = Gem::Version.new "3.0.3"
spec = Gem::Resolver::IndexSpecification.new(
- set, 'rails', version, source, Gem::Platform.local)
+ set, "rails", version, source, Gem::Platform.local)
assert_equal Gem::Platform.local.to_s, spec.platform
end
def test_install
spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
set = Gem::Resolver::IndexSet.new
source = Gem::Source.new @gem_repo
spec = Gem::Resolver::IndexSpecification.new(
- set, 'a', v(2), source, Gem::Platform::RUBY)
+ set, "a", v(2), source, Gem::Platform::RUBY)
called = false
@@ -46,15 +46,15 @@ class TestGemResolverIndexSpecification < Gem::TestCase
called = installer
end
- assert_path_exist File.join @gemhome, 'specifications', 'a-2.gemspec'
+ assert_path_exist File.join @gemhome, "specifications", "a-2.gemspec"
assert_kind_of Gem::Installer, called
end
def test_spec
specs = spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
- fetcher.spec 'a', 2 do |s|
+ fetcher.spec "a", 2
+ fetcher.spec "a", 2 do |s|
s.platform = Gem::Platform.local
end
end
@@ -64,7 +64,7 @@ class TestGemResolverIndexSpecification < Gem::TestCase
set = Gem::Resolver::IndexSet.new
i_spec = Gem::Resolver::IndexSpecification.new \
- set, 'a', version, source, Gem::Platform.local
+ set, "a", version, source, Gem::Platform.local
spec = i_spec.spec
@@ -72,7 +72,7 @@ class TestGemResolverIndexSpecification < Gem::TestCase
end
def test_spec_local
- a_2_p = util_spec 'a', 2 do |s|
+ a_2_p = util_spec "a", 2 do |s|
s.platform = Gem::Platform.local
end
@@ -83,7 +83,7 @@ class TestGemResolverIndexSpecification < Gem::TestCase
set.always_install << a_2_p
i_spec = Gem::Resolver::IndexSpecification.new \
- set, 'a', v(2), source, Gem::Platform.local
+ set, "a", v(2), source, Gem::Platform.local
spec = i_spec.spec
diff --git a/test/rubygems/test_gem_resolver_installed_specification.rb b/test/rubygems/test_gem_resolver_installed_specification.rb
index 0e5ea02fb9..156a88144d 100644
--- a/test/rubygems/test_gem_resolver_installed_specification.rb
+++ b/test/rubygems/test_gem_resolver_installed_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverInstalledSpecification < Gem::TestCase
def setup
@@ -9,17 +9,17 @@ class TestGemResolverInstalledSpecification < Gem::TestCase
end
def test_initialize
- source_spec = util_spec 'a'
+ source_spec = util_spec "a"
spec = Gem::Resolver::InstalledSpecification.new @set, source_spec
- assert_equal 'a', spec.name
+ assert_equal "a", spec.name
assert_equal Gem::Version.new(2), spec.version
assert_equal Gem::Platform::RUBY, spec.platform
end
def test_install
- a = util_spec 'a'
+ a = util_spec "a"
spec = Gem::Resolver::InstalledSpecification.new @set, a
@@ -33,7 +33,7 @@ class TestGemResolverInstalledSpecification < Gem::TestCase
end
def test_installable_platform_eh
- b, b_gem = util_gem 'a', 1 do |s|
+ b, b_gem = util_gem "a", 1 do |s|
s.platform = Gem::Platform.new %w[cpu other_platform 1]
end
diff --git a/test/rubygems/test_gem_resolver_installer_set.rb b/test/rubygems/test_gem_resolver_installer_set.rb
index 7a6d17f2b0..8d84c28172 100644
--- a/test/rubygems/test_gem_resolver_installer_set.rb
+++ b/test/rubygems/test_gem_resolver_installer_set.rb
@@ -1,26 +1,26 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverInstallerSet < Gem::TestCase
def test_add_always_install
spec_fetcher do |fetcher|
- fetcher.download 'a', 1
- fetcher.download 'a', 2
+ fetcher.download "a", 1
+ fetcher.download "a", 2
end
- util_gem 'a', 1
+ util_gem "a", 1
set = Gem::Resolver::InstallerSet.new :both
- set.add_always_install dep('a')
+ set.add_always_install dep("a")
assert_equal %w[a-2], set.always_install.map {|s| s.full_name }
e = assert_raise Gem::UnsatisfiableDependencyError do
- set.add_always_install dep('b')
+ set.add_always_install dep("b")
end
- assert_equal dep('b'), e.dependency.dependency
+ assert_equal dep("b"), e.dependency.dependency
end
def test_add_always_install_errors
@@ -30,7 +30,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
set = Gem::Resolver::InstallerSet.new :both
e = assert_raise Gem::UnsatisfiableDependencyError do
- set.add_always_install dep 'a'
+ set.add_always_install dep "a"
end
refute_empty e.errors
@@ -38,64 +38,64 @@ class TestGemResolverInstallerSet < Gem::TestCase
def test_add_always_install_platform
spec_fetcher do |fetcher|
- fetcher.download 'a', 1
- fetcher.download 'a', 2 do |s|
- s.platform = Gem::Platform.new 'x86-freebsd-9'
+ fetcher.download "a", 1
+ fetcher.download "a", 2 do |s|
+ s.platform = Gem::Platform.new "x86-freebsd-9"
end
end
set = Gem::Resolver::InstallerSet.new :both
- set.add_always_install dep('a')
+ set.add_always_install dep("a")
assert_equal %w[a-1], set.always_install.map {|s| s.full_name }
end
def test_add_always_install_prerelease
spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
- fetcher.gem 'a', '3.a'
+ fetcher.gem "a", 1
+ fetcher.gem "a", "3.a"
end
set = Gem::Resolver::InstallerSet.new :both
- set.add_always_install dep('a')
+ set.add_always_install dep("a")
assert_equal %w[a-1], set.always_install.map {|s| s.full_name }
end
def test_add_always_install_prerelease_github_problem
spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
+ fetcher.gem "a", 1
end
# Github has an issue in which it will generate a misleading prerelease output in its RubyGems server API and
# returns a 0 version for the gem while it doesn't exist.
@fetcher.data["#{@gem_repo}prerelease_specs.#{Gem.marshal_version}.gz"] = util_gzip(Marshal.dump([
- Gem::NameTuple.new('a', Gem::Version.new(0), 'ruby'),
+ Gem::NameTuple.new("a", Gem::Version.new(0), "ruby"),
]))
set = Gem::Resolver::InstallerSet.new :both
- set.add_always_install dep('a')
+ set.add_always_install dep("a")
assert_equal %w[a-1], set.always_install.map {|s| s.full_name }
end
def test_add_always_install_prerelease_only
spec_fetcher do |fetcher|
- fetcher.gem 'a', '3.a'
+ fetcher.gem "a", "3.a"
end
set = Gem::Resolver::InstallerSet.new :both
assert_raise Gem::UnsatisfiableDependencyError do
- set.add_always_install dep('a')
+ set.add_always_install dep("a")
end
end
def test_add_local
- a_1, a_1_gem = util_gem 'a', 1
+ a_1, a_1_gem = util_gem "a", 1
a_1_source = Gem::Source::SpecificFile.new a_1_gem
@@ -108,7 +108,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
FileUtils.rm a_1_gem
util_clear_gems
- req = Gem::Resolver::DependencyRequest.new dep('a'), nil
+ req = Gem::Resolver::DependencyRequest.new dep("a"), nil
assert_equal %w[a-1], set.find_all(req).map {|spec| spec.full_name }
end
@@ -146,7 +146,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
set.instance_variable_get(:@errors) << :a
- req = Gem::Resolver::DependencyRequest.new dep('a'), nil
+ req = Gem::Resolver::DependencyRequest.new dep("a"), nil
set.find_all req
@@ -155,33 +155,33 @@ class TestGemResolverInstallerSet < Gem::TestCase
def test_find_all_always_install
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
+ fetcher.download "a", 2
end
- util_gem 'a', 1
+ util_gem "a", 1
set = Gem::Resolver::InstallerSet.new :both
- set.add_always_install dep 'a'
+ set.add_always_install dep "a"
- req = Gem::Resolver::DependencyRequest.new dep('a'), nil
+ req = Gem::Resolver::DependencyRequest.new dep("a"), nil
assert_equal %w[a-2], set.find_all(req).map {|spec| spec.full_name }
end
def test_find_all_prerelease
spec_fetcher do |fetcher|
- fetcher.download 'a', '1'
- fetcher.download 'a', '1.a'
+ fetcher.download "a", "1"
+ fetcher.download "a", "1.a"
end
set = Gem::Resolver::InstallerSet.new :both
- req = Gem::Resolver::DependencyRequest.new dep('a'), nil
+ req = Gem::Resolver::DependencyRequest.new dep("a"), nil
assert_equal %w[a-1], set.find_all(req).map {|spec| spec.full_name }
- req = Gem::Resolver::DependencyRequest.new dep('a', '>= 0.a'), nil
+ req = Gem::Resolver::DependencyRequest.new dep("a", ">= 0.a"), nil
assert_equal %w[a-1 a-1.a],
set.find_all(req).map {|spec| spec.full_name }.sort
@@ -189,8 +189,8 @@ class TestGemResolverInstallerSet < Gem::TestCase
def test_load_spec
specs = spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
- fetcher.spec 'a', 2 do |s|
+ fetcher.spec "a", 2
+ fetcher.spec "a", 2 do |s|
s.platform = Gem::Platform.local
end
end
@@ -200,7 +200,7 @@ class TestGemResolverInstallerSet < Gem::TestCase
set = Gem::Resolver::InstallerSet.new :remote
- spec = set.load_spec 'a', version, Gem::Platform.local, source
+ spec = set.load_spec "a", version, Gem::Platform.local, source
assert_equal specs["a-2-#{Gem::Platform.local}"].full_name, spec.full_name
end
diff --git a/test/rubygems/test_gem_resolver_local_specification.rb b/test/rubygems/test_gem_resolver_local_specification.rb
index c11f736128..4ada391cb9 100644
--- a/test/rubygems/test_gem_resolver_local_specification.rb
+++ b/test/rubygems/test_gem_resolver_local_specification.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/available_set'
+require_relative "helper"
+require "rubygems/available_set"
class TestGemResolverLocalSpecification < Gem::TestCase
def setup
@@ -11,12 +11,12 @@ class TestGemResolverLocalSpecification < Gem::TestCase
def test_install
specs = spec_fetcher do |fetcher|
- fetcher.gem 'a', 2
+ fetcher.gem "a", 2
end
- source = Gem::Source::SpecificFile.new 'gems/a-2.gem'
+ source = Gem::Source::SpecificFile.new "gems/a-2.gem"
- spec = Gem::Resolver::LocalSpecification.new @set, specs['a-2'], source
+ spec = Gem::Resolver::LocalSpecification.new @set, specs["a-2"], source
called = false
@@ -24,13 +24,13 @@ class TestGemResolverLocalSpecification < Gem::TestCase
called = installer
end
- assert_path_exist File.join @gemhome, 'specifications', 'a-2.gemspec'
+ assert_path_exist File.join @gemhome, "specifications", "a-2.gemspec"
assert_kind_of Gem::Installer, called
end
def test_installable_platform_eh
- b, b_gem = util_gem 'a', 1 do |s|
+ b, b_gem = util_gem "a", 1 do |s|
s.platform = Gem::Platform.new %w[cpu other_platform 1]
end
diff --git a/test/rubygems/test_gem_resolver_lock_set.rb b/test/rubygems/test_gem_resolver_lock_set.rb
index dc7767a3f8..e01d73093c 100644
--- a/test/rubygems/test_gem_resolver_lock_set.rb
+++ b/test/rubygems/test_gem_resolver_lock_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverLockSet < Gem::TestCase
def setup
@@ -12,7 +12,7 @@ class TestGemResolverLockSet < Gem::TestCase
end
def test_add
- specs = @set.add 'a', '2', Gem::Platform::RUBY
+ specs = @set.add "a", "2", Gem::Platform::RUBY
spec = specs.first
assert_equal %w[a-2], @set.specs.map {|t| t.full_name }
@@ -20,39 +20,39 @@ class TestGemResolverLockSet < Gem::TestCase
assert_kind_of Gem::Resolver::LockSpecification, spec
assert_equal @set, spec.set
- assert_equal 'a', spec.name
+ assert_equal "a", spec.name
assert_equal v(2), spec.version
assert_equal Gem::Platform::RUBY, spec.platform
assert_equal @lock_source, spec.source
end
def test_find_all
- @set.add 'a', '1.a', Gem::Platform::RUBY
- @set.add 'a', '2', Gem::Platform::RUBY
- @set.add 'b', '2', Gem::Platform::RUBY
+ @set.add "a", "1.a", Gem::Platform::RUBY
+ @set.add "a", "2", Gem::Platform::RUBY
+ @set.add "b", "2", Gem::Platform::RUBY
- found = @set.find_all dep 'a'
+ found = @set.find_all dep "a"
assert_equal %w[a-2], found.map {|s| s.full_name }
- found = @set.find_all dep 'a', '>= 0.a'
+ found = @set.find_all dep "a", ">= 0.a"
assert_equal %w[a-1.a a-2], found.map {|s| s.full_name }
end
def test_load_spec
spec_fetcher do |fetcher|
- fetcher.spec 'a', 2
+ fetcher.spec "a", 2
end
version = v(2)
- @set.add 'a', version, Gem::Platform::RUBY
+ @set.add "a", version, Gem::Platform::RUBY
- loaded = @set.load_spec 'a', version, Gem::Platform::RUBY, nil
+ loaded = @set.load_spec "a", version, Gem::Platform::RUBY, nil
assert_kind_of Gem::Specification, loaded
- assert_equal 'a-2', loaded.full_name
+ assert_equal "a-2", loaded.full_name
end
def test_prefetch
diff --git a/test/rubygems/test_gem_resolver_lock_specification.rb b/test/rubygems/test_gem_resolver_lock_specification.rb
index 46c8e5edd6..32adc25f94 100644
--- a/test/rubygems/test_gem_resolver_lock_specification.rb
+++ b/test/rubygems/test_gem_resolver_lock_specification.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/installer'
-require 'rubygems/resolver'
+require_relative "helper"
+require "rubygems/installer"
+require "rubygems/resolver"
class TestGemResolverLockSpecification < Gem::TestCase
def setup
@@ -14,9 +14,9 @@ class TestGemResolverLockSpecification < Gem::TestCase
end
def test_initialize
- spec = @LS.new @set, 'a', v(2), [@source], Gem::Platform::RUBY
+ spec = @LS.new @set, "a", v(2), [@source], Gem::Platform::RUBY
- assert_equal 'a', spec.name
+ assert_equal "a", spec.name
assert_equal v(2), spec.version
assert_equal Gem::Platform::RUBY, spec.platform
@@ -24,9 +24,9 @@ class TestGemResolverLockSpecification < Gem::TestCase
end
def test_add_dependency
- l_spec = @LS.new @set, 'a', v(2), [@source], Gem::Platform::RUBY
+ l_spec = @LS.new @set, "a", v(2), [@source], Gem::Platform::RUBY
- b_dep = dep('b', '>= 0')
+ b_dep = dep("b", ">= 0")
l_spec.add_dependency b_dep
@@ -35,10 +35,10 @@ class TestGemResolverLockSpecification < Gem::TestCase
def test_install
spec_fetcher do |fetcher|
- fetcher.download 'a', 2
+ fetcher.download "a", 2
end
- spec = @LS.new @set, 'a', v(2), [@source], Gem::Platform::RUBY
+ spec = @LS.new @set, "a", v(2), [@source], Gem::Platform::RUBY
called = false
@@ -50,9 +50,9 @@ class TestGemResolverLockSpecification < Gem::TestCase
end
def test_install_installed
- spec = @LS.new @set, 'a', v(2), [@source], Gem::Platform::RUBY
+ spec = @LS.new @set, "a", v(2), [@source], Gem::Platform::RUBY
- FileUtils.touch File.join(@gemhome, 'specifications', spec.spec.spec_name)
+ FileUtils.touch File.join(@gemhome, "specifications", spec.spec.spec_name)
called = false
@@ -66,17 +66,17 @@ class TestGemResolverLockSpecification < Gem::TestCase
def test_spec
version = v(2)
- l_spec = @LS.new @set, 'a', version, [@source], Gem::Platform::RUBY
+ l_spec = @LS.new @set, "a", version, [@source], Gem::Platform::RUBY
- b_dep = dep 'b', '>= 0'
- c_dep = dep 'c', '~> 1'
+ b_dep = dep "b", ">= 0"
+ c_dep = dep "c", "~> 1"
l_spec.add_dependency b_dep
l_spec.add_dependency c_dep
spec = l_spec.spec
- assert_equal 'a', spec.name
+ assert_equal "a", spec.name
assert_equal version, spec.version
assert_equal Gem::Platform::RUBY, spec.platform
@@ -84,13 +84,13 @@ class TestGemResolverLockSpecification < Gem::TestCase
end
def test_spec_loaded
- real_spec = util_spec 'a', 2
+ real_spec = util_spec "a", 2
install_specs real_spec
real_spec.activate
version = v(2)
- l_spec = @LS.new @set, 'a', version, [@source], Gem::Platform::RUBY
+ l_spec = @LS.new @set, "a", version, [@source], Gem::Platform::RUBY
assert_same real_spec, l_spec.spec
end
diff --git a/test/rubygems/test_gem_resolver_requirement_list.rb b/test/rubygems/test_gem_resolver_requirement_list.rb
index 806c387669..e9e0d87bf5 100644
--- a/test/rubygems/test_gem_resolver_requirement_list.rb
+++ b/test/rubygems/test_gem_resolver_requirement_list.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverRequirementList < Gem::TestCase
def setup
diff --git a/test/rubygems/test_gem_resolver_specification.rb b/test/rubygems/test_gem_resolver_specification.rb
index 9f28c1c0cf..a8cba3dfd6 100644
--- a/test/rubygems/test_gem_resolver_specification.rb
+++ b/test/rubygems/test_gem_resolver_specification.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverSpecification < Gem::TestCase
class TestSpec < Gem::Resolver::Specification
@@ -16,31 +16,31 @@ class TestGemResolverSpecification < Gem::TestCase
def test_install
gemhome = "#{@gemhome}2"
spec_fetcher do |fetcher|
- fetcher.gem 'a', 1
+ fetcher.gem "a", 1
end
- a = util_spec 'a', 1
+ a = util_spec "a", 1
a_spec = TestSpec.new a
a_spec.source = Gem::Source.new @gem_repo
a_spec.install :install_dir => gemhome
- assert_path_exist File.join gemhome, 'gems', a.full_name
+ assert_path_exist File.join gemhome, "gems", a.full_name
- expected = File.join gemhome, 'specifications', a.spec_name
+ expected = File.join gemhome, "specifications", a.spec_name
assert_equal expected, a_spec.spec.loaded_from
end
def test_installable_platform_eh
- a = util_spec 'a', 1
+ a = util_spec "a", 1
a_spec = TestSpec.new a
assert a_spec.installable_platform?
- b = util_spec 'a', 1 do |s|
+ b = util_spec "a", 1 do |s|
s.platform = Gem::Platform.new %w[cpu other_platform 1]
end
@@ -50,7 +50,7 @@ class TestGemResolverSpecification < Gem::TestCase
end
def test_source
- a = util_spec 'a', 1
+ a = util_spec "a", 1
source = Gem::Source.new @gem_repo
diff --git a/test/rubygems/test_gem_resolver_vendor_set.rb b/test/rubygems/test_gem_resolver_vendor_set.rb
index e16d43ac1a..9517a4b06e 100644
--- a/test/rubygems/test_gem_resolver_vendor_set.rb
+++ b/test/rubygems/test_gem_resolver_vendor_set.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverVendorSet < Gem::TestCase
def setup
@@ -40,7 +40,7 @@ class TestGemResolverVendorSet < Gem::TestCase
@set.add_vendor_gem name, directory
- dependency = dep 'a', '~> 1'
+ dependency = dep "a", "~> 1"
req = Gem::Resolver::DependencyRequest.new dependency, nil
@@ -58,15 +58,15 @@ class TestGemResolverVendorSet < Gem::TestCase
end
def test_find_all_prerelease
- name, _, directory = vendor_gem 'a', '1.a'
+ name, _, directory = vendor_gem "a", "1.a"
@set.add_vendor_gem name, directory
- req = Gem::Resolver::DependencyRequest.new dep('a'), nil
+ req = Gem::Resolver::DependencyRequest.new dep("a"), nil
assert_empty @set.find_all req
- req = Gem::Resolver::DependencyRequest.new dep('a', '>= 0.a'), nil
+ req = Gem::Resolver::DependencyRequest.new dep("a", ">= 0.a"), nil
refute_empty @set.find_all req
end
@@ -75,7 +75,7 @@ class TestGemResolverVendorSet < Gem::TestCase
error = Object.const_defined?(:KeyError) ? KeyError : IndexError
assert_raise error do
- @set.load_spec 'b', v(1), Gem::Platform::RUBY, nil
+ @set.load_spec "b", v(1), Gem::Platform::RUBY, nil
end
end
end
diff --git a/test/rubygems/test_gem_resolver_vendor_specification.rb b/test/rubygems/test_gem_resolver_vendor_specification.rb
index 93382ccd81..d92ef0b010 100644
--- a/test/rubygems/test_gem_resolver_vendor_specification.rb
+++ b/test/rubygems/test_gem_resolver_vendor_specification.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemResolverVendorSpecification < Gem::TestCase
def setup
super
@set = Gem::Resolver::VendorSet.new
- @spec = Gem::Specification.new 'a', 1
+ @spec = Gem::Specification.new "a", 1
end
def test_equals2
@@ -14,7 +14,7 @@ class TestGemResolverVendorSpecification < Gem::TestCase
assert_equal v_spec_a, v_spec_a
- spec_b = Gem::Specification.new 'b', 1
+ spec_b = Gem::Specification.new "b", 1
v_spec_b = Gem::Resolver::VendorSpecification.new @set, spec_b
refute_equal v_spec_a, v_spec_b
@@ -27,24 +27,24 @@ class TestGemResolverVendorSpecification < Gem::TestCase
i_set = Gem::Resolver::IndexSet.new
source = Gem::Source.new @gem_repo
i_spec = Gem::Resolver::IndexSpecification.new(
- i_set, 'a', v(1), source, Gem::Platform::RUBY)
+ i_set, "a", v(1), source, Gem::Platform::RUBY)
refute_equal v_spec_a, i_spec
end
def test_dependencies
- @spec.add_dependency 'b'
- @spec.add_dependency 'c'
+ @spec.add_dependency "b"
+ @spec.add_dependency "c"
v_spec = Gem::Resolver::VendorSpecification.new @set, @spec
- assert_equal [dep('b'), dep('c')], v_spec.dependencies
+ assert_equal [dep("b"), dep("c")], v_spec.dependencies
end
def test_full_name
v_spec = Gem::Resolver::VendorSpecification.new @set, @spec
- assert_equal 'a-1', v_spec.full_name
+ assert_equal "a-1", v_spec.full_name
end
def test_install
@@ -62,7 +62,7 @@ class TestGemResolverVendorSpecification < Gem::TestCase
def test_name
v_spec = Gem::Resolver::VendorSpecification.new @set, @spec
- assert_equal 'a', v_spec.name
+ assert_equal "a", v_spec.name
end
def test_platform
@@ -72,7 +72,7 @@ class TestGemResolverVendorSpecification < Gem::TestCase
end
def test_version
- spec = Gem::Specification.new 'a', 1
+ spec = Gem::Specification.new "a", 1
v_spec = Gem::Resolver::VendorSpecification.new @set, spec
diff --git a/test/rubygems/test_gem_security.rb b/test/rubygems/test_gem_security.rb
index 415ec2b5f6..f0b9824aab 100644
--- a/test/rubygems/test_gem_security.rb
+++ b/test/rubygems/test_gem_security.rb
@@ -1,22 +1,22 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/security'
+require_relative "helper"
+require "rubygems/security"
unless Gem::HAVE_OPENSSL
- warn 'Skipping Gem::Security tests. openssl not found.'
+ warn "Skipping Gem::Security tests. openssl not found."
end
if Gem.java_platform?
- warn 'Skipping Gem::Security tests on jruby.'
+ warn "Skipping Gem::Security tests on jruby."
end
class TestGemSecurity < Gem::TestCase
- CHILD_KEY = load_key 'child'
- EC_KEY = load_key 'private_ec', 'Foo bar'
+ CHILD_KEY = load_key "child"
+ EC_KEY = load_key "private_ec", "Foo bar"
- ALTERNATE_CERT = load_cert 'child'
- CHILD_CERT = load_cert 'child'
- EXPIRED_CERT = load_cert 'expired'
+ ALTERNATE_CERT = load_cert "child"
+ CHILD_CERT = load_cert "child"
+ EXPIRED_CERT = load_cert "expired"
def setup
super
@@ -42,19 +42,19 @@ class TestGemSecurity < Gem::TestCase
assert_equal 3, cert.extensions.length,
cert.extensions.map {|e| e.to_a.first }
- constraints = cert.extensions.find {|ext| ext.oid == 'basicConstraints' }
- assert_equal 'CA:FALSE', constraints.value
+ constraints = cert.extensions.find {|ext| ext.oid == "basicConstraints" }
+ assert_equal "CA:FALSE", constraints.value
- key_usage = cert.extensions.find {|ext| ext.oid == 'keyUsage' }
- assert_equal 'Digital Signature, Key Encipherment, Data Encipherment',
+ key_usage = cert.extensions.find {|ext| ext.oid == "keyUsage" }
+ assert_equal "Digital Signature, Key Encipherment, Data Encipherment",
key_usage.value
- key_ident = cert.extensions.find {|ext| ext.oid == 'subjectKeyIdentifier' }
+ key_ident = cert.extensions.find {|ext| ext.oid == "subjectKeyIdentifier" }
assert_equal 59, key_ident.value.length
- assert_equal '5F:43:6E:F6:9A:8E:45:25:E9:22:E3:7D:37:5E:A4:D5:36:02:85:1B',
+ assert_equal "5F:43:6E:F6:9A:8E:45:25:E9:22:E3:7D:37:5E:A4:D5:36:02:85:1B",
key_ident.value
- assert_equal '', cert.issuer.to_s
+ assert_equal "", cert.issuer.to_s
assert_equal name.to_s, cert.subject.to_s
end
@@ -63,12 +63,12 @@ class TestGemSecurity < Gem::TestCase
cert = @SEC.create_cert_self_signed subject, PRIVATE_KEY, 60
- assert_equal '/CN=nobody/DC=example', cert.issuer.to_s
+ assert_equal "/CN=nobody/DC=example", cert.issuer.to_s
assert_equal "sha256WithRSAEncryption", cert.signature_algorithm
end
def test_class_create_cert_email
- email = 'nobody@example'
+ email = "nobody@example"
name = PUBLIC_CERT.subject
key = PRIVATE_KEY
@@ -87,37 +87,37 @@ class TestGemSecurity < Gem::TestCase
assert_equal 5, cert.extensions.length,
cert.extensions.map {|e| e.to_a.first }
- constraints = cert.extensions.find {|ext| ext.oid == 'subjectAltName' }
- assert_equal 'email:nobody@example', constraints.value
+ constraints = cert.extensions.find {|ext| ext.oid == "subjectAltName" }
+ assert_equal "email:nobody@example", constraints.value
- constraints = cert.extensions.find {|ext| ext.oid == 'basicConstraints' }
- assert_equal 'CA:FALSE', constraints.value
+ constraints = cert.extensions.find {|ext| ext.oid == "basicConstraints" }
+ assert_equal "CA:FALSE", constraints.value
- key_usage = cert.extensions.find {|ext| ext.oid == 'keyUsage' }
- assert_equal 'Digital Signature, Key Encipherment, Data Encipherment',
+ key_usage = cert.extensions.find {|ext| ext.oid == "keyUsage" }
+ assert_equal "Digital Signature, Key Encipherment, Data Encipherment",
key_usage.value
- key_ident = cert.extensions.find {|ext| ext.oid == 'subjectKeyIdentifier' }
+ key_ident = cert.extensions.find {|ext| ext.oid == "subjectKeyIdentifier" }
assert_equal 59, key_ident.value.length
- assert_equal '5F:43:6E:F6:9A:8E:45:25:E9:22:E3:7D:37:5E:A4:D5:36:02:85:1B',
+ assert_equal "5F:43:6E:F6:9A:8E:45:25:E9:22:E3:7D:37:5E:A4:D5:36:02:85:1B",
key_ident.value
end
def test_class_create_key
- key = @SEC.create_key 'rsa'
+ key = @SEC.create_key "rsa"
assert_kind_of OpenSSL::PKey::RSA, key
end
def test_class_create_key_downcases
- key = @SEC.create_key 'DSA'
+ key = @SEC.create_key "DSA"
assert_kind_of OpenSSL::PKey::DSA, key
end
def test_class_create_key_raises_unknown_algorithm
e = assert_raise Gem::Security::Exception do
- @SEC.create_key 'NOT_RSA'
+ @SEC.create_key "NOT_RSA"
end
assert_equal "NOT_RSA algorithm not found. RSA, DSA, and EC algorithms are supported.",
@@ -137,17 +137,17 @@ class TestGemSecurity < Gem::TestCase
end
def test_class_email_to_name
- assert_equal '/CN=nobody/DC=example',
- @SEC.email_to_name('nobody@example').to_s
+ assert_equal "/CN=nobody/DC=example",
+ @SEC.email_to_name("nobody@example").to_s
- assert_equal '/CN=nobody/DC=example/DC=com',
- @SEC.email_to_name('nobody@example.com').to_s
+ assert_equal "/CN=nobody/DC=example/DC=com",
+ @SEC.email_to_name("nobody@example.com").to_s
- assert_equal '/CN=no.body/DC=example',
- @SEC.email_to_name('no.body@example').to_s
+ assert_equal "/CN=no.body/DC=example",
+ @SEC.email_to_name("no.body@example").to_s
- assert_equal '/CN=no_body/DC=example',
- @SEC.email_to_name('no+body@example').to_s
+ assert_equal "/CN=no_body/DC=example",
+ @SEC.email_to_name("no+body@example").to_s
end
def test_class_re_sign
@@ -168,7 +168,7 @@ class TestGemSecurity < Gem::TestCase
end
child_alt_name = CHILD_CERT.extensions.find do |extension|
- extension.oid == 'subjectAltName'
+ extension.oid == "subjectAltName"
end
assert_equal "#{child_alt_name.value} is not self-signed, contact " +
@@ -217,20 +217,20 @@ class TestGemSecurity < Gem::TestCase
assert_equal 4, signed.extensions.length,
signed.extensions.map {|e| e.to_a.first }
- constraints = signed.extensions.find {|ext| ext.oid == 'issuerAltName' }
- assert_equal 'email:nobody@example', constraints.value, 'issuerAltName'
+ constraints = signed.extensions.find {|ext| ext.oid == "issuerAltName" }
+ assert_equal "email:nobody@example", constraints.value, "issuerAltName"
- constraints = signed.extensions.find {|ext| ext.oid == 'basicConstraints' }
- assert_equal 'CA:FALSE', constraints.value
+ constraints = signed.extensions.find {|ext| ext.oid == "basicConstraints" }
+ assert_equal "CA:FALSE", constraints.value
- key_usage = signed.extensions.find {|ext| ext.oid == 'keyUsage' }
- assert_equal 'Digital Signature, Key Encipherment, Data Encipherment',
+ key_usage = signed.extensions.find {|ext| ext.oid == "keyUsage" }
+ assert_equal "Digital Signature, Key Encipherment, Data Encipherment",
key_usage.value
key_ident =
- signed.extensions.find {|ext| ext.oid == 'subjectKeyIdentifier' }
+ signed.extensions.find {|ext| ext.oid == "subjectKeyIdentifier" }
assert_equal 59, key_ident.value.length
- assert_equal '5F:43:6E:F6:9A:8E:45:25:E9:22:E3:7D:37:5E:A4:D5:36:02:85:1B',
+ assert_equal "5F:43:6E:F6:9A:8E:45:25:E9:22:E3:7D:37:5E:A4:D5:36:02:85:1B",
key_ident.value
assert signed.verify key
@@ -240,7 +240,7 @@ class TestGemSecurity < Gem::TestCase
issuer = PUBLIC_CERT.subject
signee = OpenSSL::X509::Name.parse "/CN=signee/DC=example"
- cert = @SEC.create_cert_email 'signee@example', PRIVATE_KEY
+ cert = @SEC.create_cert_email "signee@example", PRIVATE_KEY
signed = @SEC.sign cert, PRIVATE_KEY, PUBLIC_CERT, 60
@@ -256,23 +256,23 @@ class TestGemSecurity < Gem::TestCase
assert_equal 5, signed.extensions.length,
signed.extensions.map {|e| e.to_a.first }
- constraints = signed.extensions.find {|ext| ext.oid == 'issuerAltName' }
- assert_equal 'email:nobody@example', constraints.value, 'issuerAltName'
+ constraints = signed.extensions.find {|ext| ext.oid == "issuerAltName" }
+ assert_equal "email:nobody@example", constraints.value, "issuerAltName"
- constraints = signed.extensions.find {|ext| ext.oid == 'subjectAltName' }
- assert_equal 'email:signee@example', constraints.value, 'subjectAltName'
+ constraints = signed.extensions.find {|ext| ext.oid == "subjectAltName" }
+ assert_equal "email:signee@example", constraints.value, "subjectAltName"
- constraints = signed.extensions.find {|ext| ext.oid == 'basicConstraints' }
- assert_equal 'CA:FALSE', constraints.value
+ constraints = signed.extensions.find {|ext| ext.oid == "basicConstraints" }
+ assert_equal "CA:FALSE", constraints.value
- key_usage = signed.extensions.find {|ext| ext.oid == 'keyUsage' }
- assert_equal 'Digital Signature, Key Encipherment, Data Encipherment',
+ key_usage = signed.extensions.find {|ext| ext.oid == "keyUsage" }
+ assert_equal "Digital Signature, Key Encipherment, Data Encipherment",
key_usage.value
key_ident =
- signed.extensions.find {|ext| ext.oid == 'subjectKeyIdentifier' }
+ signed.extensions.find {|ext| ext.oid == "subjectKeyIdentifier" }
assert_equal 59, key_ident.value.length
- assert_equal '5F:43:6E:F6:9A:8E:45:25:E9:22:E3:7D:37:5E:A4:D5:36:02:85:1B',
+ assert_equal "5F:43:6E:F6:9A:8E:45:25:E9:22:E3:7D:37:5E:A4:D5:36:02:85:1B",
key_ident.value
assert signed.verify PUBLIC_KEY
@@ -281,15 +281,15 @@ class TestGemSecurity < Gem::TestCase
def test_class_trust_dir
trust_dir = @SEC.trust_dir
- expected = File.join Gem.user_home, '.gem/trust'
+ expected = File.join Gem.user_home, ".gem/trust"
assert_equal expected, trust_dir.dir
end
def test_class_write
- key = @SEC.create_key 'rsa'
+ key = @SEC.create_key "rsa"
- path = File.join @tempdir, 'test-private_key.pem'
+ path = File.join @tempdir, "test-private_key.pem"
@SEC.write key, path
@@ -301,11 +301,11 @@ class TestGemSecurity < Gem::TestCase
end
def test_class_write_encrypted
- key = @SEC.create_key 'rsa'
+ key = @SEC.create_key "rsa"
- path = File.join @tempdir, 'test-private_encrypted_key.pem'
+ path = File.join @tempdir, "test-private_encrypted_key.pem"
- passphrase = 'It should be long.'
+ passphrase = "It should be long."
@SEC.write key, path, 0600, passphrase
@@ -317,13 +317,13 @@ class TestGemSecurity < Gem::TestCase
end
def test_class_write_encrypted_cipher
- key = @SEC.create_key 'rsa'
+ key = @SEC.create_key "rsa"
- path = File.join @tempdir, 'test-private_encrypted__with_non_default_cipher_key.pem'
+ path = File.join @tempdir, "test-private_encrypted__with_non_default_cipher_key.pem"
- passphrase = 'It should be long.'
+ passphrase = "It should be long."
- cipher = OpenSSL::Cipher.new 'AES-192-CBC'
+ cipher = OpenSSL::Cipher.new "AES-192-CBC"
@SEC.write key, path, 0600, passphrase, cipher
diff --git a/test/rubygems/test_gem_security_policy.rb b/test/rubygems/test_gem_security_policy.rb
index 515b8ea00b..6680238245 100644
--- a/test/rubygems/test_gem_security_policy.rb
+++ b/test/rubygems/test_gem_security_policy.rb
@@ -1,34 +1,34 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
unless Gem::HAVE_OPENSSL
- warn 'Skipping Gem::Security::Policy tests. openssl not found.'
+ warn "Skipping Gem::Security::Policy tests. openssl not found."
end
class TestGemSecurityPolicy < Gem::TestCase
- ALTERNATE_KEY = load_key 'alternate'
- INVALID_KEY = load_key 'invalid'
- CHILD_KEY = load_key 'child'
- GRANDCHILD_KEY = load_key 'grandchild'
- INVALIDCHILD_KEY = load_key 'invalidchild'
-
- ALTERNATE_CERT = load_cert 'alternate'
- CA_CERT = load_cert 'ca'
- CHILD_CERT = load_cert 'child'
- EXPIRED_CERT = load_cert 'expired'
- FUTURE_CERT = load_cert 'future'
- GRANDCHILD_CERT = load_cert 'grandchild'
- INVALIDCHILD_CERT = load_cert 'invalidchild'
- INVALID_ISSUER_CERT = load_cert 'invalid_issuer'
- INVALID_SIGNER_CERT = load_cert 'invalid_signer'
- WRONG_KEY_CERT = load_cert 'wrong_key'
+ ALTERNATE_KEY = load_key "alternate"
+ INVALID_KEY = load_key "invalid"
+ CHILD_KEY = load_key "child"
+ GRANDCHILD_KEY = load_key "grandchild"
+ INVALIDCHILD_KEY = load_key "invalidchild"
+
+ ALTERNATE_CERT = load_cert "alternate"
+ CA_CERT = load_cert "ca"
+ CHILD_CERT = load_cert "child"
+ EXPIRED_CERT = load_cert "expired"
+ FUTURE_CERT = load_cert "future"
+ GRANDCHILD_CERT = load_cert "grandchild"
+ INVALIDCHILD_CERT = load_cert "invalidchild"
+ INVALID_ISSUER_CERT = load_cert "invalid_issuer"
+ INVALID_SIGNER_CERT = load_cert "invalid_signer"
+ WRONG_KEY_CERT = load_cert "wrong_key"
def setup
super
- @spec = quick_gem 'a' do |s|
- s.description = 'Ï€'
+ @spec = quick_gem "a" do |s|
+ s.description = "Ï€"
s.files = %w[lib/code.rb]
end
@@ -42,7 +42,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@high = Gem::Security::HighSecurity
@chain = Gem::Security::Policy.new(
- 'Chain',
+ "Chain",
:verify_data => true,
:verify_signer => true,
:verify_chain => true,
@@ -52,7 +52,7 @@ class TestGemSecurityPolicy < Gem::TestCase
)
@root = Gem::Security::Policy.new(
- 'Root',
+ "Root",
:verify_data => true,
:verify_signer => true,
:verify_chain => true,
@@ -63,7 +63,7 @@ class TestGemSecurityPolicy < Gem::TestCase
end
def test_check_data
- data = digest 'hello'
+ data = digest "hello"
signature = sign data
@@ -71,17 +71,17 @@ class TestGemSecurityPolicy < Gem::TestCase
end
def test_check_data_invalid
- data = digest 'hello'
+ data = digest "hello"
signature = sign data
- invalid = digest 'hello!'
+ invalid = digest "hello!"
e = assert_raise Gem::Security::Exception do
@almost_no.check_data PUBLIC_KEY, @digest, signature, invalid
end
- assert_equal 'invalid signature', e.message
+ assert_equal "invalid signature", e.message
end
def test_check_chain
@@ -95,7 +95,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@chain.check_chain [], Time.now
end
- assert_equal 'empty signing chain', e.message
+ assert_equal "empty signing chain", e.message
end
def test_check_chain_invalid
@@ -115,7 +115,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@chain.check_chain nil, Time.now
end
- assert_equal 'missing signing chain', e.message
+ assert_equal "missing signing chain", e.message
end
def test_check_cert
@@ -161,7 +161,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@high.check_cert(nil, nil, Time.now)
end
- assert_equal 'missing signing certificate', e.message
+ assert_equal "missing signing certificate", e.message
end
def test_check_key
@@ -175,7 +175,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@high.check_key(nil, nil)
end
- assert_equal 'missing key or signature', e.message
+ assert_equal "missing key or signature", e.message
end
def test_check_key_wrong_key
@@ -198,7 +198,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@chain.check_root [], Time.now
end
- assert_equal 'missing root certificate', e.message
+ assert_equal "missing root certificate", e.message
end
def test_check_root_invalid_signer
@@ -230,7 +230,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@chain.check_root nil, Time.now
end
- assert_equal 'missing signing chain', e.message
+ assert_equal "missing signing chain", e.message
end
def test_check_trust
@@ -250,7 +250,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@chain.check_trust [], @digest, @trust_dir
end
- assert_equal 'missing root certificate', e.message
+ assert_equal "missing root certificate", e.message
end
def test_check_trust_mismatch
@@ -269,7 +269,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@chain.check_trust nil, @digest, @trust_dir
end
- assert_equal 'missing signing chain', e.message
+ assert_equal "missing signing chain", e.message
end
def test_check_trust_no_trust
@@ -290,8 +290,8 @@ class TestGemSecurityPolicy < Gem::TestCase
end
def test_subject
- assert_equal 'email:nobody@example', @no.subject(PUBLIC_CERT)
- assert_equal '/C=JP/ST=Tokyo/O=RubyGemsTest/CN=CA', @no.subject(CA_CERT)
+ assert_equal "email:nobody@example", @no.subject(PUBLIC_CERT)
+ assert_equal "/C=JP/ST=Tokyo/O=RubyGemsTest/CN=CA", @no.subject(CA_CERT)
end
def test_verify
@@ -319,7 +319,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@almost_no.verify [PUBLIC_CERT], nil, {}, signatures
end
- assert_equal 'no digests provided (probable bug)', e.message
+ assert_equal "no digests provided (probable bug)", e.message
end
def test_verify_no_digests_no_security
@@ -331,7 +331,7 @@ class TestGemSecurityPolicy < Gem::TestCase
@no.verify [PUBLIC_CERT], nil, {}, signatures
end
- assert_equal 'missing digest for 0', e.message
+ assert_equal "missing digest for 0", e.message
end
def test_verify_no_signatures
@@ -340,7 +340,7 @@ class TestGemSecurityPolicy < Gem::TestCase
digests, = dummy_signatures
use_ui @ui do
- @no.verify [PUBLIC_CERT], nil, digests, {}, 'some_gem'
+ @no.verify [PUBLIC_CERT], nil, digests, {}, "some_gem"
end
assert_match "WARNING: some_gem is not signed\n", @ui.error
@@ -354,7 +354,7 @@ class TestGemSecurityPolicy < Gem::TestCase
Gem::Security.trust_dir.trust_cert PUBLIC_CERT
use_ui @ui do
- @no.verify [PUBLIC_CERT], nil, {}, {}, 'some_gem'
+ @no.verify [PUBLIC_CERT], nil, {}, {}, "some_gem"
end
assert_empty @ui.output
@@ -366,7 +366,7 @@ class TestGemSecurityPolicy < Gem::TestCase
digests, signatures = dummy_signatures
- data = digest 'goodbye'
+ data = digest "goodbye"
signatures[1] = PRIVATE_KEY.sign @digest.new, data.digest
@@ -374,14 +374,14 @@ class TestGemSecurityPolicy < Gem::TestCase
@almost_no.verify [PUBLIC_CERT], nil, digests, signatures
end
- assert_equal 'missing digest for 1', e.message
+ assert_equal "missing digest for 1", e.message
end
def test_verify_no_trust
digests, signatures = dummy_signatures
use_ui @ui do
- @low.verify [PUBLIC_CERT], nil, digests, signatures, 'some_gem'
+ @low.verify [PUBLIC_CERT], nil, digests, signatures, "some_gem"
end
assert_equal "WARNING: email:nobody@example is not trusted for some_gem\n",
@@ -395,18 +395,18 @@ class TestGemSecurityPolicy < Gem::TestCase
def test_verify_wrong_digest_type
Gem::Security.trust_dir.trust_cert PUBLIC_CERT
- data = OpenSSL::Digest.new('SHA512')
- data << 'hello'
+ data = OpenSSL::Digest.new("SHA512")
+ data << "hello"
- digests = { 'SHA512' => { 0 => data } }
- signature = PRIVATE_KEY.sign 'sha512', data.digest
+ digests = { "SHA512" => { 0 => data } }
+ signature = PRIVATE_KEY.sign "sha512", data.digest
signatures = { 0 => signature }
e = assert_raise Gem::Security::Exception do
@almost_no.verify [PUBLIC_CERT], nil, digests, signatures
end
- assert_equal 'no digests provided (probable bug)', e.message
+ assert_equal "no digests provided (probable bug)", e.message
end
def test_verify_signatures_chain
@@ -448,17 +448,17 @@ class TestGemSecurityPolicy < Gem::TestCase
metadata_gz = Gem::Util.gzip @spec.to_yaml
- package = Gem::Package.new 'nonexistent.gem'
+ package = Gem::Package.new "nonexistent.gem"
package.checksums[Gem::Security::DIGEST_NAME] = {}
s = StringIO.new metadata_gz
- def s.full_name() 'metadata.gz' end
+ def s.full_name() "metadata.gz" end
digests = package.digest s
- metadata_gz_digest = digests[Gem::Security::DIGEST_NAME]['metadata.gz']
+ metadata_gz_digest = digests[Gem::Security::DIGEST_NAME]["metadata.gz"]
signatures = {}
- signatures['metadata.gz'] =
+ signatures["metadata.gz"] =
PRIVATE_KEY.sign @digest.new, metadata_gz_digest.digest
assert @high.verify_signatures @spec, digests, signatures
@@ -471,26 +471,26 @@ class TestGemSecurityPolicy < Gem::TestCase
metadata_gz = Gem::Util.gzip @spec.to_yaml
- package = Gem::Package.new 'nonexistent.gem'
+ package = Gem::Package.new "nonexistent.gem"
package.checksums[Gem::Security::DIGEST_NAME] = {}
s = StringIO.new metadata_gz
- def s.full_name() 'metadata.gz' end
+ def s.full_name() "metadata.gz" end
digests = package.digest s
- digests[Gem::Security::DIGEST_NAME]['data.tar.gz'] = @digest.hexdigest 'hello'
+ digests[Gem::Security::DIGEST_NAME]["data.tar.gz"] = @digest.hexdigest "hello"
- metadata_gz_digest = digests[Gem::Security::DIGEST_NAME]['metadata.gz']
+ metadata_gz_digest = digests[Gem::Security::DIGEST_NAME]["metadata.gz"]
signatures = {}
- signatures['metadata.gz'] =
+ signatures["metadata.gz"] =
PRIVATE_KEY.sign @digest.new, metadata_gz_digest.digest
e = assert_raise Gem::Security::Exception do
@high.verify_signatures @spec, digests, signatures
end
- assert_equal 'missing signature for data.tar.gz', e.message
+ assert_equal "missing signature for data.tar.gz", e.message
end
def test_verify_signatures_none
@@ -500,14 +500,14 @@ class TestGemSecurityPolicy < Gem::TestCase
metadata_gz = Gem::Util.gzip @spec.to_yaml
- package = Gem::Package.new 'nonexistent.gem'
+ package = Gem::Package.new "nonexistent.gem"
package.checksums[Gem::Security::DIGEST_NAME] = {}
s = StringIO.new metadata_gz
- def s.full_name() 'metadata.gz' end
+ def s.full_name() "metadata.gz" end
digests = package.digest s
- digests[Gem::Security::DIGEST_NAME]['data.tar.gz'] = @digest.hexdigest 'hello'
+ digests[Gem::Security::DIGEST_NAME]["data.tar.gz"] = @digest.hexdigest "hello"
assert_raise Gem::Security::Exception do
@high.verify_signatures @spec, digests, {}
@@ -525,7 +525,7 @@ class TestGemSecurityPolicy < Gem::TestCase
end
def dummy_signatures(key = PRIVATE_KEY)
- data = digest 'hello'
+ data = digest "hello"
digests = { Gem::Security::DIGEST_NAME => { 0 => data } }
signatures = { 0 => sign(data, key) }
diff --git a/test/rubygems/test_gem_security_signer.rb b/test/rubygems/test_gem_security_signer.rb
index 7bd6510b50..d9f320eeb0 100644
--- a/test/rubygems/test_gem_security_signer.rb
+++ b/test/rubygems/test_gem_security_signer.rb
@@ -1,18 +1,18 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
unless Gem::HAVE_OPENSSL
- warn 'Skipping Gem::Security::Signer tests. openssl not found.'
+ warn "Skipping Gem::Security::Signer tests. openssl not found."
end
class TestGemSecuritySigner < Gem::TestCase
- ALTERNATE_KEY = load_key 'alternate'
- CHILD_KEY = load_key 'child'
- GRANDCHILD_KEY = load_key 'grandchild'
+ ALTERNATE_KEY = load_key "alternate"
+ CHILD_KEY = load_key "child"
+ GRANDCHILD_KEY = load_key "grandchild"
- CHILD_CERT = load_cert 'child'
- GRANDCHILD_CERT = load_cert 'grandchild'
- EXPIRED_CERT = load_cert 'expired'
+ CHILD_CERT = load_cert "child"
+ GRANDCHILD_CERT = load_cert "grandchild"
+ EXPIRED_CERT = load_cert "expired"
def setup
super
@@ -42,7 +42,7 @@ class TestGemSecuritySigner < Gem::TestCase
def test_initialize_cert_chain_invalid
assert_raise OpenSSL::X509::CertificateError do
- Gem::Security::Signer.new nil, ['garbage']
+ Gem::Security::Signer.new nil, ["garbage"]
end
end
@@ -54,12 +54,12 @@ class TestGemSecuritySigner < Gem::TestCase
end
def test_initialize_default
- FileUtils.mkdir_p File.join(Gem.user_home, '.gem')
+ FileUtils.mkdir_p File.join(Gem.user_home, ".gem")
- private_key_path = File.join Gem.user_home, '.gem', 'gem-private_key.pem'
+ private_key_path = File.join Gem.user_home, ".gem", "gem-private_key.pem"
Gem::Security.write PRIVATE_KEY, private_key_path
- public_cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ public_cert_path = File.join Gem.user_home, ".gem", "gem-public_cert.pem"
Gem::Security.write PUBLIC_CERT, public_cert_path
signer = Gem::Security::Signer.new nil, nil
@@ -87,7 +87,7 @@ class TestGemSecuritySigner < Gem::TestCase
def test_extract_name
signer = Gem::Security::Signer.new nil, nil
- assert_equal 'child@example', signer.extract_name(CHILD_CERT)
+ assert_equal "child@example", signer.extract_name(CHILD_CERT)
end
def test_load_cert_chain
@@ -117,7 +117,7 @@ class TestGemSecuritySigner < Gem::TestCase
def test_sign
signer = Gem::Security::Signer.new PRIVATE_KEY, [PUBLIC_CERT]
- signature = signer.sign 'hello'
+ signature = signer.sign "hello"
expected = <<-EXPECTED
cHze2sEfRysoUMCfGVAx/7o8jxj5liJJ2ptNxe2jf3l+EZvyjdqpXo9Ndzxx
@@ -128,14 +128,14 @@ qhlqFP4jR6zXFeyBCOr0KpTiWBNuxBFXDsxmhGyt2BOIjD6qmKn7RSIfYg/U
toqvglr0kdbknSRRjBVLK6tsgr07aLT9gNP7mTW2PA==
EXPECTED
- assert_equal expected, [signature].pack('m')
+ assert_equal expected, [signature].pack("m")
end
def test_sign_expired
signer = Gem::Security::Signer.new PRIVATE_KEY, [EXPIRED_CERT]
e = assert_raise Gem::Security::Exception do
- signer.sign 'hello'
+ signer.sign "hello"
end
assert_match "certificate /CN=nobody/DC=example not valid after 1970-01-01 00:00:00 UTC", e.message
@@ -143,17 +143,17 @@ toqvglr0kdbknSRRjBVLK6tsgr07aLT9gNP7mTW2PA==
def test_sign_expired_auto_update
pend if Gem.java_platform?
- FileUtils.mkdir_p File.join(Gem.user_home, '.gem'), :mode => 0700
+ FileUtils.mkdir_p File.join(Gem.user_home, ".gem"), :mode => 0700
- private_key_path = File.join(Gem.user_home, '.gem', 'gem-private_key.pem')
+ private_key_path = File.join(Gem.user_home, ".gem", "gem-private_key.pem")
Gem::Security.write PRIVATE_KEY, private_key_path
- cert_path = File.join Gem.user_home, '.gem', 'gem-public_cert.pem'
+ cert_path = File.join Gem.user_home, ".gem", "gem-public_cert.pem"
Gem::Security.write EXPIRED_CERT, cert_path
signer = Gem::Security::Signer.new PRIVATE_KEY, [EXPIRED_CERT]
- signer.sign 'hello'
+ signer.sign "hello"
cert = OpenSSL::X509::Certificate.new File.read cert_path
@@ -163,14 +163,14 @@ toqvglr0kdbknSRRjBVLK6tsgr07aLT9gNP7mTW2PA==
expiry = EXPIRED_CERT.not_after.strftime "%Y%m%d%H%M%S"
expired_path =
- File.join Gem.user_home, '.gem', "gem-public_cert.pem.expired.#{expiry}"
+ File.join Gem.user_home, ".gem", "gem-public_cert.pem.expired.#{expiry}"
assert_path_exist expired_path
assert_equal EXPIRED_CERT.to_pem, File.read(expired_path)
end
def test_sign_expired_auto_update_exists
- FileUtils.mkdir_p File.join(Gem.user_home, '.gem'), :mode => 0700
+ FileUtils.mkdir_p File.join(Gem.user_home, ".gem"), :mode => 0700
expiry = EXPIRED_CERT.not_after.strftime "%Y%m%d%H%M%S"
expired_path =
@@ -178,16 +178,16 @@ toqvglr0kdbknSRRjBVLK6tsgr07aLT9gNP7mTW2PA==
Gem::Security.write EXPIRED_CERT, expired_path
- private_key_path = File.join(Gem.user_home, 'gem-private_key.pem')
+ private_key_path = File.join(Gem.user_home, "gem-private_key.pem")
Gem::Security.write PRIVATE_KEY, private_key_path
- cert_path = File.join Gem.user_home, 'gem-public_cert.pem'
+ cert_path = File.join Gem.user_home, "gem-public_cert.pem"
Gem::Security.write EXPIRED_CERT, cert_path
signer = Gem::Security::Signer.new PRIVATE_KEY, [EXPIRED_CERT]
e = assert_raise Gem::Security::Exception do
- signer.sign 'hello'
+ signer.sign "hello"
end
assert_match %r{certificate /CN=nobody/DC=example not valid}, e.message
@@ -196,14 +196,14 @@ toqvglr0kdbknSRRjBVLK6tsgr07aLT9gNP7mTW2PA==
def test_sign_no_key
signer = Gem::Security::Signer.new nil, nil
- assert_nil signer.sign 'stuff'
+ assert_nil signer.sign "stuff"
end
def test_sign_wrong_key
signer = Gem::Security::Signer.new ALTERNATE_KEY, [PUBLIC_CERT]
assert_raise Gem::Security::Exception do
- signer.sign 'hello'
+ signer.sign "hello"
end
end
@@ -211,7 +211,7 @@ toqvglr0kdbknSRRjBVLK6tsgr07aLT9gNP7mTW2PA==
signer = Gem::Security::Signer.new ALTERNATE_KEY, []
assert_raise Gem::Security::Exception do
- signer.sign 'hello'
+ signer.sign "hello"
end
end
end if Gem::HAVE_OPENSSL
diff --git a/test/rubygems/test_gem_security_trust_dir.rb b/test/rubygems/test_gem_security_trust_dir.rb
index fc88c84865..8c59286679 100644
--- a/test/rubygems/test_gem_security_trust_dir.rb
+++ b/test/rubygems/test_gem_security_trust_dir.rb
@@ -1,17 +1,17 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
unless Gem::HAVE_OPENSSL
- warn 'Skipping Gem::Security::TrustDir tests. openssl not found.'
+ warn "Skipping Gem::Security::TrustDir tests. openssl not found."
end
class TestGemSecurityTrustDir < Gem::TestCase
- CHILD_CERT = load_cert 'child'
+ CHILD_CERT = load_cert "child"
def setup
super
- @dest_dir = File.join @tempdir, 'trust'
+ @dest_dir = File.join @tempdir, "trust"
@trust_dir = Gem::Security::TrustDir.new @dest_dir
end
diff --git a/test/rubygems/test_gem_silent_ui.rb b/test/rubygems/test_gem_silent_ui.rb
index 355255fb48..c5d2a35c34 100644
--- a/test/rubygems/test_gem_silent_ui.rb
+++ b/test/rubygems/test_gem_silent_ui.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/user_interaction'
-require 'timeout'
+require_relative "helper"
+require "rubygems/user_interaction"
+require "timeout"
class TestGemSilentUI < Gem::TestCase
def setup
@@ -18,28 +18,28 @@ class TestGemSilentUI < Gem::TestCase
value = nil
out, err = capture_output do
use_ui @sui do
- value = @sui.ask 'Problem?'
+ value = @sui.ask "Problem?"
end
end
- assert_empty out, 'No output'
- assert_empty err, 'No output'
+ assert_empty out, "No output"
+ assert_empty err, "No output"
- assert_nil value, 'No value'
+ assert_nil value, "No value"
end
def test_ask_for_password
value = nil
out, err = capture_output do
use_ui @sui do
- value = @sui.ask_for_password 'Problem?'
+ value = @sui.ask_for_password "Problem?"
end
end
- assert_empty out, 'No output'
- assert_empty err, 'No output'
+ assert_empty out, "No output"
+ assert_empty err, "No output"
- assert_nil value, 'No value'
+ assert_nil value, "No value"
end
def test_ask_yes_no
@@ -47,70 +47,76 @@ class TestGemSilentUI < Gem::TestCase
out, err = capture_output do
use_ui @sui do
assert_raise(Gem::OperationNotSupportedError) do
- @sui.ask_yes_no 'Problem?'
+ @sui.ask_yes_no "Problem?"
end
end
end
- assert_empty out, 'No output'
- assert_empty err, 'No output'
+ assert_empty out, "No output"
+ assert_empty err, "No output"
out, err = capture_output do
use_ui @sui do
- value = @sui.ask_yes_no 'Problem?', true
+ value = @sui.ask_yes_no "Problem?", true
end
end
- assert_empty out, 'No output'
- assert_empty err, 'No output'
+ assert_empty out, "No output"
+ assert_empty err, "No output"
- assert value, 'Value is true'
+ assert value, "Value is true"
out, err = capture_output do
use_ui @sui do
- value = @sui.ask_yes_no 'Problem?', false
+ value = @sui.ask_yes_no "Problem?", false
end
end
- assert_empty out, 'No output'
- assert_empty err, 'No output'
+ assert_empty out, "No output"
+ assert_empty err, "No output"
- assert_equal value, false, 'Value is false'
+ assert_equal value, false, "Value is false"
end
def test_choose_from_list
value = nil
out, err = capture_output do
use_ui @sui do
- value = @sui.choose_from_list 'Problem?', %w[yes no]
+ value = @sui.choose_from_list "Problem?", %w[yes no]
end
end
- assert_empty out, 'No output'
- assert_empty err, 'No output'
+ assert_empty out, "No output"
+ assert_empty err, "No output"
- assert_equal [nil, nil], value, 'Value is nil!'
+ assert_equal [nil, nil], value, "Value is nil!"
end
def test_progress_reporter
out, err = capture_output do
use_ui @sui do
- @sui.progress_reporter 10, 'hi'
+ @sui.progress_reporter 10, "hi"
end
end
- assert_empty out, 'No output'
- assert_empty err, 'No output'
+ assert_empty out, "No output"
+ assert_empty err, "No output"
end
def test_download_reporter
out, err = capture_output do
use_ui @sui do
- @sui.download_reporter.fetch 'a.gem', 1024
+ @sui.download_reporter.fetch "a.gem", 1024
end
end
- assert_empty out, 'No output'
- assert_empty err, 'No output'
+ assert_empty out, "No output"
+ assert_empty err, "No output"
+ end
+
+ def test_new_without_dev_null
+ File.stub(:open, ->(path, mode) { raise Errno::ENOTCAPABLE if path == IO::NULL }) do
+ Gem::SilentUI.new
+ end
end
end
diff --git a/test/rubygems/test_gem_source.rb b/test/rubygems/test_gem_source.rb
index 24312626f4..e164215b57 100644
--- a/test/rubygems/test_gem_source.rb
+++ b/test/rubygems/test_gem_source.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/source'
-require 'rubygems/indexer'
+require_relative "helper"
+require "rubygems/source"
+require "rubygems/indexer"
class TestGemSource < Gem::TestCase
def tuple(*args)
@@ -12,10 +12,10 @@ class TestGemSource < Gem::TestCase
super
@specs = spec_fetcher do |fetcher|
- fetcher.spec 'a', '1.a'
- fetcher.gem 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'b', 2
+ fetcher.spec "a", "1.a"
+ fetcher.gem "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "b", 2
end
@source = Gem::Source.new(@gem_repo)
@@ -23,14 +23,14 @@ class TestGemSource < Gem::TestCase
def test_initialize_invalid_uri
assert_raise URI::InvalidURIError do
- Gem::Source.new 'git@example:a.git'
+ Gem::Source.new "git@example:a.git"
end
end
def test_initialize_git
- repository = 'git@example:a.git'
+ repository = "git@example:a.git"
- source = Gem::Source::Git.new 'a', repository, 'master', false
+ source = Gem::Source::Git.new "a", repository, "master", false
assert_equal repository, source.uri
end
@@ -38,13 +38,13 @@ class TestGemSource < Gem::TestCase
def test_cache_dir_escapes_windows_paths
uri = URI.parse("file:///C:/WINDOWS/Temp/gem_repo")
root = Gem.spec_cache_dir
- cache_dir = @source.cache_dir(uri).gsub(root, '')
+ cache_dir = @source.cache_dir(uri).gsub(root, "")
assert cache_dir !~ /:/, "#{cache_dir} should not contain a :"
end
def test_dependency_resolver_set_bundler_api
- response = Net::HTTPResponse.new '1.1', 200, 'OK'
- response.uri = URI('http://example')
+ response = Net::HTTPResponse.new "1.1", 200, "OK"
+ response.uri = URI("http://example")
@fetcher.data[@gem_repo] = response
@@ -70,11 +70,11 @@ class TestGemSource < Gem::TestCase
end
def test_fetch_spec
- a1 = @specs['a-1']
+ a1 = @specs["a-1"]
spec_uri = "#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{a1.spec_name}"
- spec = @source.fetch_spec tuple('a', Gem::Version.new(1), 'ruby')
+ spec = @source.fetch_spec tuple("a", Gem::Version.new(1), "ruby")
assert_equal a1.full_name, spec.full_name
cache_dir = @source.cache_dir URI.parse(spec_uri)
@@ -85,7 +85,7 @@ class TestGemSource < Gem::TestCase
end
def test_fetch_spec_cached
- a1 = @specs['a-1']
+ a1 = @specs["a-1"]
spec_uri = "#{@gem_repo}/#{Gem::MARSHAL_SPEC_DIR}#{a1.spec_name}"
@fetcher.data["#{spec_uri}.rz"] = nil
@@ -95,11 +95,11 @@ class TestGemSource < Gem::TestCase
cache_file = File.join cache_dir, a1.spec_name
- File.open cache_file, 'wb' do |io|
+ File.open cache_file, "wb" do |io|
Marshal.dump a1, io
end
- spec = @source.fetch_spec tuple('a', Gem::Version.new(1), 'ruby')
+ spec = @source.fetch_spec tuple("a", Gem::Version.new(1), "ruby")
assert_equal a1.full_name, spec.full_name
end
@@ -108,24 +108,24 @@ class TestGemSource < Gem::TestCase
fetcher.legacy_platform
end
- spec = @source.fetch_spec tuple('pl', Gem::Version.new(1), 'i386-linux')
+ spec = @source.fetch_spec tuple("pl", Gem::Version.new(1), "i386-linux")
- assert_equal specs['pl-1-x86-linux'].full_name, spec.full_name
+ assert_equal specs["pl-1-x86-linux"].full_name, spec.full_name
end
def test_fetch_spec_platform_ruby
- spec = @source.fetch_spec tuple('a', Gem::Version.new(1), nil)
- assert_equal @specs['a-1'].full_name, spec.full_name
+ spec = @source.fetch_spec tuple("a", Gem::Version.new(1), nil)
+ assert_equal @specs["a-1"].full_name, spec.full_name
- spec = @source.fetch_spec tuple('a', Gem::Version.new(1), '')
- assert_equal @specs['a-1'].full_name, spec.full_name
+ spec = @source.fetch_spec tuple("a", Gem::Version.new(1), "")
+ assert_equal @specs["a-1"].full_name, spec.full_name
end
def test_load_specs
released = @source.load_specs(:released).map {|spec| spec.full_name }
assert_equal %W[a-2 a-1 b-2], released
- cache_dir = File.join Gem.spec_cache_dir, 'gems.example.com%80'
+ cache_dir = File.join Gem.spec_cache_dir, "gems.example.com%80"
assert File.exist?(cache_dir), "#{cache_dir} does not exist"
cache_file = File.join cache_dir, "specs.#{Gem.marshal_version}"
@@ -136,19 +136,19 @@ class TestGemSource < Gem::TestCase
latest_specs = @source.load_specs :latest
# Make sure the cached version is actually different:
- latest_specs << Gem::NameTuple.new('cached', Gem::Version.new('1.0.0'), 'ruby')
+ latest_specs << Gem::NameTuple.new("cached", Gem::Version.new("1.0.0"), "ruby")
@fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] = nil
@fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}"] =
- ' ' * Marshal.dump(latest_specs).length
+ " " * Marshal.dump(latest_specs).length
- cache_dir = File.join Gem.spec_cache_dir, 'gems.example.com%80'
+ cache_dir = File.join Gem.spec_cache_dir, "gems.example.com%80"
FileUtils.mkdir_p cache_dir
cache_file = File.join cache_dir, "latest_specs.#{Gem.marshal_version}"
- File.open cache_file, 'wb' do |io|
+ File.open cache_file, "wb" do |io|
Marshal.dump latest_specs, io
end
@@ -161,18 +161,18 @@ class TestGemSource < Gem::TestCase
latest_specs = @source.load_specs :latest
# Make sure the cached version is actually different:
- latest_specs << Gem::NameTuple.new('fixed', Gem::Version.new('1.0.0'), 'ruby')
+ latest_specs << Gem::NameTuple.new("fixed", Gem::Version.new("1.0.0"), "ruby")
# Setup valid data on the 'remote'
@fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] =
util_gzip(Marshal.dump(latest_specs))
- cache_dir = File.join Gem.spec_cache_dir, 'gems.example.com%80'
+ cache_dir = File.join Gem.spec_cache_dir, "gems.example.com%80"
FileUtils.mkdir_p cache_dir
cache_file = File.join cache_dir, "latest_specs.#{Gem.marshal_version}"
- File.open cache_file, 'wb' do |io|
+ File.open cache_file, "wb" do |io|
# Setup invalid data in the cache:
io.write Marshal.dump(latest_specs)[0, 10]
end
@@ -192,34 +192,34 @@ class TestGemSource < Gem::TestCase
def test_spaceship
remote = @source
- specific = Gem::Source::SpecificFile.new @specs['a-1'].cache_file
+ specific = Gem::Source::SpecificFile.new @specs["a-1"].cache_file
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, remote.<=>(installed), "remote <=> installed")
+ 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
sourceA = Gem::Source.new "http://example.com/a"
sourceB = Gem::Source.new "http://example.com/b"
- assert_equal(0, sourceA.<=>(sourceA), 'sourceA <=> sourceA')
- assert_equal(1, sourceA.<=>(sourceB), 'sourceA <=> sourceB')
- assert_equal(1, sourceB.<=>(sourceA), 'sourceB <=> sourceA')
+ assert_equal(0, sourceA.<=>(sourceA), "sourceA <=> sourceA")
+ assert_equal(1, sourceA.<=>(sourceB), "sourceA <=> sourceB")
+ assert_equal(1, sourceB.<=>(sourceA), "sourceB <=> sourceA")
end
def test_update_cache_eh
diff --git a/test/rubygems/test_gem_source_fetch_problem.rb b/test/rubygems/test_gem_source_fetch_problem.rb
index 816407781d..143c29050e 100644
--- a/test/rubygems/test_gem_source_fetch_problem.rb
+++ b/test/rubygems/test_gem_source_fetch_problem.rb
@@ -1,10 +1,10 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemSourceFetchProblem < Gem::TestCase
def test_exception
source = Gem::Source.new @gem_repo
- error = RuntimeError.new 'test'
+ error = RuntimeError.new "test"
sf = Gem::SourceFetchProblem.new source, error
@@ -12,25 +12,25 @@ class TestGemSourceFetchProblem < Gem::TestCase
raise sf
end
- assert_equal 'test', e.message
+ assert_equal "test", e.message
end
def test_password_redacted
- source = Gem::Source.new 'https://username:secret@gemsource.com'
- error = RuntimeError.new 'test'
+ source = Gem::Source.new "https://username:secret@gemsource.com"
+ error = RuntimeError.new "test"
sf = Gem::SourceFetchProblem.new source, error
- refute_match sf.wordy, 'secret'
+ refute_match sf.wordy, "secret"
end
def test_source_password_no_redacted
- source = Gem::Source.new 'https://username:secret@gemsource.com'
- error = RuntimeError.new 'test'
+ source = Gem::Source.new "https://username:secret@gemsource.com"
+ error = RuntimeError.new "test"
sf = Gem::SourceFetchProblem.new source, error
sf.wordy
- assert_match 'secret', source.uri.to_s
+ assert_match "secret", source.uri.to_s
end
end
diff --git a/test/rubygems/test_gem_source_git.rb b/test/rubygems/test_gem_source_git.rb
index b97556d61d..5702da0597 100644
--- a/test/rubygems/test_gem_source_git.rb
+++ b/test/rubygems/test_gem_source_git.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/source'
+require_relative "helper"
+require "rubygems/source"
class TestGemSourceGit < Gem::TestCase
def setup
@@ -10,36 +10,36 @@ class TestGemSourceGit < Gem::TestCase
@hash = Digest::SHA1.hexdigest @repository
- @source = Gem::Source::Git.new @name, @repository, 'master', false
+ @source = Gem::Source::Git.new @name, @repository, "master", false
end
def test_base_dir
- assert_equal File.join(Gem.dir, 'bundler'), @source.base_dir
+ assert_equal File.join(Gem.dir, "bundler"), @source.base_dir
@source.root_dir = "#{@gemhome}2"
- assert_equal File.join("#{@gemhome}2", 'bundler'), @source.base_dir
+ assert_equal File.join("#{@gemhome}2", "bundler"), @source.base_dir
end
def test_checkout
@source.checkout
- assert_path_exist File.join @source.install_dir, 'a.gemspec'
+ assert_path_exist File.join @source.install_dir, "a.gemspec"
end
def test_checkout_master
Dir.chdir @repository do
- system @git, 'checkout', '-q', '-b', 'other'
- system @git, 'mv', 'a.gemspec', 'b.gemspec'
- system @git, 'commit', '-q', '-a', '-m', 'rename gemspec'
- system @git, 'checkout', '-q', 'master'
+ system @git, "checkout", "-q", "-b", "other"
+ system @git, "mv", "a.gemspec", "b.gemspec"
+ system @git, "commit", "-q", "-a", "-m", "rename gemspec"
+ system @git, "checkout", "-q", "master"
end
- @source = Gem::Source::Git.new @name, @repository, 'other', false
+ @source = Gem::Source::Git.new @name, @repository, "other", false
@source.checkout
- assert_path_exist File.join @source.install_dir, 'b.gemspec'
+ assert_path_exist File.join @source.install_dir, "b.gemspec"
end
def test_checkout_local
@@ -47,9 +47,9 @@ class TestGemSourceGit < Gem::TestCase
@source.checkout
- install_dir = File.join Gem.dir, 'bundler', 'gems', "a-#{@head[0..11]}"
+ install_dir = File.join Gem.dir, "bundler", "gems", "a-#{@head[0..11]}"
- assert_path_not_exist File.join install_dir, 'a.gemspec'
+ assert_path_not_exist File.join install_dir, "a.gemspec"
end
def test_checkout_local_cached
@@ -59,26 +59,26 @@ class TestGemSourceGit < Gem::TestCase
@source.checkout
- assert_path_exist File.join @source.install_dir, 'a.gemspec'
+ assert_path_exist File.join @source.install_dir, "a.gemspec"
end
def test_checkout_submodules
- source = Gem::Source::Git.new @name, @repository, 'master', true
+ source = Gem::Source::Git.new @name, @repository, "master", true
- git_gem 'b'
+ git_gem "b"
- Dir.chdir 'git/a' do
+ Dir.chdir "git/a" do
require "open3"
- output, status = Open3.capture2e(@git, 'submodule', '--quiet', 'add', File.expand_path('../b'), 'b')
+ output, status = Open3.capture2e(@git, "submodule", "--quiet", "add", File.expand_path("../b"), "b")
assert status.success?, output
- system @git, 'commit', '--quiet', '-m', 'add submodule b'
+ system @git, "commit", "--quiet", "-m", "add submodule b"
end
source.checkout
- assert_path_exist File.join source.install_dir, 'a.gemspec'
- assert_path_exist File.join source.install_dir, 'b/b.gemspec'
+ assert_path_exist File.join source.install_dir, "a.gemspec"
+ assert_path_exist File.join source.install_dir, "b/b.gemspec"
end
def test_cache
@@ -87,7 +87,7 @@ class TestGemSourceGit < Gem::TestCase
assert_path_exist @source.repo_cache_dir
Dir.chdir @source.repo_cache_dir do
- assert_equal @head, Gem::Util.popen(@git, 'rev-parse', 'master').strip
+ assert_equal @head, Gem::Util.popen(@git, "rev-parse", "master").strip
end
end
@@ -115,17 +115,17 @@ class TestGemSourceGit < Gem::TestCase
assert_equal @source, @source.dup
source =
- Gem::Source::Git.new @source.name, @source.repository, 'other', false
+ Gem::Source::Git.new @source.name, @source.repository, "other", false
refute_equal @source, source
source =
- Gem::Source::Git.new @source.name, 'repo/other', @source.reference, false
+ Gem::Source::Git.new @source.name, "repo/other", @source.reference, false
refute_equal @source, source
source =
- Gem::Source::Git.new 'b', @source.repository, @source.reference, false
+ Gem::Source::Git.new "b", @source.repository, @source.reference, false
refute_equal @source, source
@@ -139,7 +139,7 @@ class TestGemSourceGit < Gem::TestCase
def test_install_dir
@source.cache
- expected = File.join Gem.dir, 'bundler', 'gems', "a-#{@head[0..11]}"
+ expected = File.join Gem.dir, "bundler", "gems", "a-#{@head[0..11]}"
assert_equal expected, @source.install_dir
end
@@ -152,14 +152,14 @@ class TestGemSourceGit < Gem::TestCase
def test_repo_cache_dir
expected =
- File.join Gem.dir, 'cache', 'bundler', 'git', "a-#{@hash}"
+ File.join Gem.dir, "cache", "bundler", "git", "a-#{@hash}"
assert_equal expected, @source.repo_cache_dir
@source.root_dir = "#{@gemhome}2"
expected =
- File.join "#{@gemhome}2", 'cache', 'bundler', 'git', "a-#{@hash}"
+ File.join "#{@gemhome}2", "cache", "bundler", "git", "a-#{@hash}"
assert_equal expected, @source.repo_cache_dir
end
@@ -170,20 +170,20 @@ class TestGemSourceGit < Gem::TestCase
assert_equal @head, @source.rev_parse
Dir.chdir @repository do
- system @git, 'checkout', '--quiet', '-b', 'other'
+ system @git, "checkout", "--quiet", "-b", "other"
end
master_head = @head
- git_gem 'a', 2
+ git_gem "a", 2
- source = Gem::Source::Git.new @name, @repository, 'other', false
+ source = Gem::Source::Git.new @name, @repository, "other", false
source.cache
refute_equal master_head, source.rev_parse
- source = Gem::Source::Git.new @name, @repository, 'nonexistent', false
+ source = Gem::Source::Git.new @name, @repository, "nonexistent", false
source.cache
@@ -204,38 +204,38 @@ class TestGemSourceGit < Gem::TestCase
end
def test_spaceship
- git = Gem::Source::Git.new 'a', 'git/a', 'master', false
+ git = Gem::Source::Git.new "a", "git/a", "master", false
remote = Gem::Source.new @gem_repo
installed = Gem::Source::Installed.new
- vendor = Gem::Source::Vendor.new 'vendor/foo'
+ vendor = Gem::Source::Vendor.new "vendor/foo"
- assert_equal(0, git.<=>(git), 'git <=> git')
+ assert_equal(0, git.<=>(git), "git <=> git")
- assert_equal(1, git.<=>(remote), 'git <=> remote')
- assert_equal(-1, remote.<=>(git), 'remote <=> git')
+ assert_equal(1, git.<=>(remote), "git <=> remote")
+ assert_equal(-1, remote.<=>(git), "remote <=> git")
- assert_equal(1, git.<=>(installed), 'git <=> installed')
- assert_equal(-1, installed.<=>(git), 'installed <=> git')
+ assert_equal(1, git.<=>(installed), "git <=> installed")
+ 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
- source = Gem::Source::Git.new @name, @repository, 'master', true
+ source = Gem::Source::Git.new @name, @repository, "master", true
- Dir.chdir 'git/a' do
- FileUtils.mkdir 'b'
+ Dir.chdir "git/a" do
+ FileUtils.mkdir "b"
- Dir.chdir 'b' do
- b = Gem::Specification.new 'b', 1
+ Dir.chdir "b" do
+ b = Gem::Specification.new "b", 1
- File.open 'b.gemspec', 'w' do |io|
+ File.open "b.gemspec", "w" do |io|
io.write b.to_ruby
end
- system @git, 'add', 'b.gemspec'
- system @git, 'commit', '--quiet', '-m', 'add b/b.gemspec'
+ system @git, "add", "b.gemspec"
+ system @git, "commit", "--quiet", "-m", "add b/b.gemspec"
end
end
@@ -252,11 +252,11 @@ class TestGemSourceGit < Gem::TestCase
base_dir = File.dirname File.dirname source.install_dir
assert_equal source.install_dir, a_spec.full_gem_path
- assert_equal File.join(source.install_dir, 'a.gemspec'), a_spec.loaded_from
+ assert_equal File.join(source.install_dir, "a.gemspec"), a_spec.loaded_from
assert_equal base_dir, a_spec.base_dir
extension_dir =
- File.join Gem.dir, 'bundler', 'extensions',
+ File.join Gem.dir, "bundler", "extensions",
Gem::Platform.local.to_s, Gem.extension_api_version,
"a-#{source.dir_shortref}"
@@ -264,8 +264,8 @@ class TestGemSourceGit < Gem::TestCase
b_spec = specs.shift
- assert_equal File.join(source.install_dir, 'b'), b_spec.full_gem_path
- assert_equal File.join(source.install_dir, 'b', 'b.gemspec'),
+ assert_equal File.join(source.install_dir, "b"), b_spec.full_gem_path
+ assert_equal File.join(source.install_dir, "b", "b.gemspec"),
b_spec.loaded_from
assert_equal base_dir, b_spec.base_dir
@@ -273,7 +273,7 @@ class TestGemSourceGit < Gem::TestCase
end
def test_specs_local
- source = Gem::Source::Git.new @name, @repository, 'master', true
+ source = Gem::Source::Git.new @name, @repository, "master", true
source.remote = false
capture_output do
@@ -289,15 +289,15 @@ class TestGemSourceGit < Gem::TestCase
assert_equal @hash, @source.uri_hash
source =
- Gem::Source::Git.new 'a', 'http://git@example/repo.git', 'master', false
+ Gem::Source::Git.new "a", "http://git@example/repo.git", "master", false
- assert_equal '291c4caac7feba8bb64c297987028acb3dde6cfe',
+ assert_equal "291c4caac7feba8bb64c297987028acb3dde6cfe",
source.uri_hash
source =
- Gem::Source::Git.new 'a', 'HTTP://git@EXAMPLE/repo.git', 'master', false
+ Gem::Source::Git.new "a", "HTTP://git@EXAMPLE/repo.git", "master", false
- assert_equal '291c4caac7feba8bb64c297987028acb3dde6cfe',
+ assert_equal "291c4caac7feba8bb64c297987028acb3dde6cfe",
source.uri_hash
end
end
diff --git a/test/rubygems/test_gem_source_installed.rb b/test/rubygems/test_gem_source_installed.rb
index ef9b63e611..7fb5017c59 100644
--- a/test/rubygems/test_gem_source_installed.rb
+++ b/test/rubygems/test_gem_source_installed.rb
@@ -1,34 +1,34 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/source'
+require_relative "helper"
+require "rubygems/source"
class TestGemSourceInstalled < Gem::TestCase
def test_spaceship
- a1 = quick_gem 'a', '1'
+ a1 = quick_gem "a", "1"
util_build_gem a1
remote = Gem::Source.new @gem_repo
specific = Gem::Source::SpecificFile.new a1.cache_file
installed = Gem::Source::Installed.new
local = Gem::Source::Local.new
- git = Gem::Source::Git.new 'a', 'a', 'master'
- vendor = Gem::Source::Vendor.new 'a'
+ git = Gem::Source::Git.new "a", "a", "master"
+ vendor = Gem::Source::Vendor.new "a"
- assert_equal(0, installed.<=>(installed), 'installed <=> installed')
+ assert_equal(0, installed.<=>(installed), "installed <=> installed")
- assert_equal(-1, remote.<=>(installed), 'remote <=> installed')
- assert_equal(1, installed.<=>(remote), 'installed <=> remote')
+ assert_equal(-1, remote.<=>(installed), "remote <=> installed")
+ assert_equal(1, installed.<=>(remote), "installed <=> remote")
- assert_equal(1, installed.<=>(local), 'installed <=> local')
- assert_equal(-1, local.<=>(installed), 'local <=> installed')
+ assert_equal(1, installed.<=>(local), "installed <=> local")
+ assert_equal(-1, local.<=>(installed), "local <=> installed")
- assert_equal(-1, specific.<=>(installed), 'specific <=> installed')
- assert_equal(1, installed.<=>(specific), 'installed <=> specific')
+ assert_equal(-1, specific.<=>(installed), "specific <=> installed")
+ assert_equal(1, installed.<=>(specific), "installed <=> specific")
- assert_equal(1, git. <=>(installed), 'git <=> installed')
- assert_equal(-1, installed.<=>(git), 'installed <=> git')
+ assert_equal(1, git. <=>(installed), "git <=> installed")
+ assert_equal(-1, installed.<=>(git), "installed <=> git")
- assert_equal(1, vendor.<=>(installed), 'vendor <=> installed')
- assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor')
+ assert_equal(1, vendor.<=>(installed), "vendor <=> installed")
+ assert_equal(-1, installed.<=>(vendor), "installed <=> vendor")
end
end
diff --git a/test/rubygems/test_gem_source_list.rb b/test/rubygems/test_gem_source_list.rb
index 6ac5dbb2a6..9fd1b3bdf9 100644
--- a/test/rubygems/test_gem_source_list.rb
+++ b/test/rubygems/test_gem_source_list.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require 'rubygems'
-require 'rubygems/source_list'
-require_relative 'helper'
+require "rubygems"
+require "rubygems/source_list"
+require_relative "helper"
class TestGemSourceList < Gem::TestCase
def setup
@@ -45,7 +45,7 @@ class TestGemSourceList < Gem::TestCase
def test_clear
sl = Gem::SourceList.new
- sl << 'http://source.example'
+ sl << "http://source.example"
sl.clear
@@ -76,7 +76,7 @@ class TestGemSourceList < Gem::TestCase
assert_empty sl
- sl << 'http://source.example'
+ sl << "http://source.example"
refute_empty sl
end
diff --git a/test/rubygems/test_gem_source_local.rb b/test/rubygems/test_gem_source_local.rb
index 2d4ddbc3a4..ace3923009 100644
--- a/test/rubygems/test_gem_source_local.rb
+++ b/test/rubygems/test_gem_source_local.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/source'
+require_relative "helper"
+require "rubygems/source"
-require 'fileutils'
+require "fileutils"
class TestGemSourceLocal < Gem::TestCase
def setup
@@ -10,9 +10,9 @@ class TestGemSourceLocal < Gem::TestCase
@sl = Gem::Source::Local.new
- @a, @a_gem = util_gem "a", '1'
- @ap, @ap_gem = util_gem "a", '2.a'
- @b, @b_gem = util_gem "b", '1'
+ @a, @a_gem = util_gem "a", "1"
+ @ap, @ap_gem = util_gem "a", "2.a"
+ @b, @b_gem = util_gem "b", "1"
FileUtils.mv @a_gem, @tempdir
FileUtils.mv @ap_gem, @tempdir
@@ -84,7 +84,7 @@ class TestGemSourceLocal < Gem::TestCase
end
def test_spaceship
- a1 = quick_gem 'a', '1'
+ a1 = quick_gem "a", "1"
util_build_gem a1
remote = Gem::Source.new @gem_repo
@@ -92,15 +92,15 @@ 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, local.<=>(installed), 'local <=> installed')
+ 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
diff --git a/test/rubygems/test_gem_source_lock.rb b/test/rubygems/test_gem_source_lock.rb
index 5f916cdf7f..ff9465d0ad 100644
--- a/test/rubygems/test_gem_source_lock.rb
+++ b/test/rubygems/test_gem_source_lock.rb
@@ -1,24 +1,24 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemSourceLock < Gem::TestCase
def test_fetch_spec
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
- name_tuple = Gem::NameTuple.new 'a', v(1), 'ruby'
+ name_tuple = Gem::NameTuple.new "a", v(1), "ruby"
remote = Gem::Source.new @gem_repo
lock = Gem::Source::Lock.new remote
spec = lock.fetch_spec name_tuple
- assert_equal 'a-1', spec.full_name
+ assert_equal "a-1", spec.full_name
end
def test_equals2
- git = Gem::Source::Git.new 'a', 'git/a', 'master', false
+ git = Gem::Source::Git.new "a", "git/a", "master", false
g_lock = Gem::Source::Lock.new git
installed = Gem::Source::Installed.new
@@ -30,77 +30,77 @@ class TestGemSourceLock < Gem::TestCase
end
def test_spaceship
- git = Gem::Source::Git.new 'a', 'git/a', 'master', false
+ git = Gem::Source::Git.new "a", "git/a", "master", false
g_lock = Gem::Source::Lock.new git
installed = Gem::Source::Installed.new
i_lock = Gem::Source::Lock.new installed
- vendor = Gem::Source::Vendor.new 'vendor/a'
+ vendor = Gem::Source::Vendor.new "vendor/a"
v_lock = Gem::Source::Lock.new vendor
- assert_equal(0, g_lock.<=>(g_lock), 'g_lock <=> g_lock')
- assert_equal(0, i_lock.<=>(i_lock), 'i_lock <=> i_lock')
- assert_equal(0, v_lock.<=>(v_lock), 'v_lock <=> v_lock')
+ assert_equal(0, g_lock.<=>(g_lock), "g_lock <=> g_lock")
+ assert_equal(0, i_lock.<=>(i_lock), "i_lock <=> i_lock")
+ assert_equal(0, v_lock.<=>(v_lock), "v_lock <=> v_lock")
- assert_equal(1, g_lock.<=>(i_lock), 'g_lock <=> i_lock')
- assert_equal(-1, i_lock.<=>(g_lock), 'i_lock <=> g_lock')
+ assert_equal(1, g_lock.<=>(i_lock), "g_lock <=> i_lock")
+ assert_equal(-1, i_lock.<=>(g_lock), "i_lock <=> g_lock")
- assert_equal(-1, g_lock.<=>(v_lock), 'g_lock <=> v_lock')
- assert_equal(1, v_lock.<=>(g_lock), 'v_lock <=> g_lock')
+ assert_equal(-1, g_lock.<=>(v_lock), "g_lock <=> v_lock")
+ assert_equal(1, v_lock.<=>(g_lock), "v_lock <=> g_lock")
- assert_equal(-1, i_lock.<=>(v_lock), 'i_lock <=> v_lock')
- assert_equal(1, v_lock.<=>(i_lock), 'i_lock <=> v_lock')
+ assert_equal(-1, i_lock.<=>(v_lock), "i_lock <=> v_lock")
+ assert_equal(1, v_lock.<=>(i_lock), "i_lock <=> v_lock")
end
def test_spaceship_git
- git = Gem::Source::Git.new 'a', 'git/a', 'master', false
+ git = Gem::Source::Git.new "a", "git/a", "master", false
lock = Gem::Source::Lock.new git
- assert_equal(1, lock.<=>(git), 'lock <=> git')
- assert_equal(-1, git.<=>(lock), 'git <=> lock')
+ assert_equal(1, lock.<=>(git), "lock <=> git")
+ assert_equal(-1, git.<=>(lock), "git <=> lock")
end
def test_spaceship_installed
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
local = Gem::Source::Local.new
lock = Gem::Source::Lock.new local # nonsense
- assert_equal(1, lock.<=>(local), 'lock <=> local')
- assert_equal(-1, local.<=>(lock), 'local <=> lock')
+ assert_equal(1, lock.<=>(local), "lock <=> local")
+ assert_equal(-1, local.<=>(lock), "local <=> lock")
end
def test_spaceship_remote
remote = Gem::Source.new @gem_repo
lock = Gem::Source::Lock.new remote
- assert_equal(1, lock.<=>(remote), 'lock <=> remote')
- assert_equal(-1, remote.<=>(lock), 'remote <=> lock')
+ assert_equal(1, lock.<=>(remote), "lock <=> remote")
+ assert_equal(-1, remote.<=>(lock), "remote <=> lock")
end
def test_spaceship_specific_file
- _, gem = util_gem 'a', 1
+ _, gem = util_gem "a", 1
specific = Gem::Source::SpecificFile.new gem
lock = Gem::Source::Lock.new specific # nonsense
- assert_equal(1, lock.<=>(specific), 'lock <=> specific')
- assert_equal(-1, specific.<=>(lock), 'specific <=> lock')
+ assert_equal(1, lock.<=>(specific), "lock <=> specific")
+ assert_equal(-1, specific.<=>(lock), "specific <=> lock")
end
def test_spaceship_vendor
- vendor = Gem::Source::Vendor.new 'vendor/a'
+ vendor = Gem::Source::Vendor.new "vendor/a"
lock = Gem::Source::Lock.new vendor
- assert_equal(1, lock.<=>(vendor), 'lock <=> vendor')
- assert_equal(-1, vendor.<=>(lock), 'vendor <=> lock')
+ assert_equal(1, lock.<=>(vendor), "lock <=> vendor")
+ assert_equal(-1, vendor.<=>(lock), "vendor <=> lock")
end
def test_uri
diff --git a/test/rubygems/test_gem_source_specific_file.rb b/test/rubygems/test_gem_source_specific_file.rb
index 72ed993a88..f9a572b76d 100644
--- a/test/rubygems/test_gem_source_specific_file.rb
+++ b/test/rubygems/test_gem_source_specific_file.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/source'
+require_relative "helper"
+require "rubygems/source"
class TestGemSourceSpecificFile < Gem::TestCase
def setup
super
- @a, @a_gem = util_gem "a", '1'
+ @a, @a_gem = util_gem "a", "1"
@sf = Gem::Source::SpecificFile.new(@a_gem)
end
@@ -37,7 +37,7 @@ class TestGemSourceSpecificFile < Gem::TestCase
end
def test_spaceship
- a1 = quick_gem 'a', '1'
+ a1 = quick_gem "a", "1"
util_build_gem a1
remote = Gem::Source.new @gem_repo
@@ -45,31 +45,31 @@ 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.<=>(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, specific. <=>(installed), "specific <=> installed")
+ assert_equal(1, installed.<=>(specific), "installed <=> specific")
- a2 = quick_gem 'a', '2'
+ a2 = quick_gem "a", "2"
util_build_gem a2
- b1 = quick_gem 'b', '1'
+ b1 = quick_gem "b", "1"
util_build_gem b1
a1_source = specific
a2_source = Gem::Source::SpecificFile.new a2.cache_file
b1_source = Gem::Source::SpecificFile.new b1.cache_file
- assert_nil a1_source.<=>(b1_source), 'a1_source <=> b1_source'
+ assert_nil a1_source.<=>(b1_source), "a1_source <=> b1_source"
- assert_equal(-1, a1_source.<=>(a2_source), 'a1_source <=> a2_source')
- assert_equal(0, a1_source.<=>(a1_source), 'a1_source <=> a1_source')
- assert_equal(1, a2_source.<=>(a1_source), 'a2_source <=> a1_source')
+ assert_equal(-1, a1_source.<=>(a2_source), "a1_source <=> a2_source")
+ assert_equal(0, a1_source.<=>(a1_source), "a1_source <=> a1_source")
+ assert_equal(1, a2_source.<=>(a1_source), "a2_source <=> a1_source")
end
end
diff --git a/test/rubygems/test_gem_source_subpath_problem.rb b/test/rubygems/test_gem_source_subpath_problem.rb
index c37df39f0c..219c344290 100644
--- a/test/rubygems/test_gem_source_subpath_problem.rb
+++ b/test/rubygems/test_gem_source_subpath_problem.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/source'
+require_relative "helper"
+require "rubygems/source"
class TestGemSourceSubpathProblem < Gem::TestCase
def tuple(*args)
@@ -20,8 +20,8 @@ class TestGemSourceSubpathProblem < Gem::TestCase
end
def test_dependency_resolver_set
- response = Net::HTTPResponse.new '1.1', 200, 'OK'
- response.uri = URI('http://example')
+ response = Net::HTTPResponse.new "1.1", 200, "OK"
+ response.uri = URI("http://example")
@fetcher.data["#{@gem_repo}/"] = response
@@ -33,14 +33,14 @@ class TestGemSourceSubpathProblem < Gem::TestCase
def test_fetch_spec
@fetcher.data["#{@gem_repo}/#{Gem::MARSHAL_SPEC_DIR}#{@a1.spec_name}.rz"] = Zlib::Deflate.deflate(Marshal.dump(@a1))
- spec = @source.fetch_spec tuple('a', Gem::Version.new(1), 'ruby')
+ spec = @source.fetch_spec tuple("a", Gem::Version.new(1), "ruby")
assert_equal @a1.full_name, spec.full_name
end
def test_load_specs
@fetcher.data["#{@gem_repo}/latest_specs.#{Gem.marshal_version}.gz"] = util_gzip(Marshal.dump([
- Gem::NameTuple.new(@a1.name, @a1.version, 'ruby'),
- Gem::NameTuple.new(@b2.name, @b2.version, 'ruby'),
+ Gem::NameTuple.new(@a1.name, @a1.version, "ruby"),
+ Gem::NameTuple.new(@b2.name, @b2.version, "ruby"),
]))
released = @source.load_specs(:latest).map {|spec| spec.full_name }
diff --git a/test/rubygems/test_gem_source_vendor.rb b/test/rubygems/test_gem_source_vendor.rb
index a5ffb0f223..29846e5c13 100644
--- a/test/rubygems/test_gem_source_vendor.rb
+++ b/test/rubygems/test_gem_source_vendor.rb
@@ -1,29 +1,29 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/source'
+require_relative "helper"
+require "rubygems/source"
class TestGemSourceVendor < Gem::TestCase
def test_initialize
- source = Gem::Source::Vendor.new 'vendor/foo'
+ source = Gem::Source::Vendor.new "vendor/foo"
- assert_equal 'vendor/foo', source.uri
+ assert_equal "vendor/foo", source.uri
end
def test_spaceship
- vendor = Gem::Source::Vendor.new 'vendor/foo'
+ vendor = Gem::Source::Vendor.new "vendor/foo"
remote = Gem::Source.new @gem_repo
- git = Gem::Source::Git.new 'a', 'a', 'master'
+ git = Gem::Source::Git.new "a", "a", "master"
installed = Gem::Source::Installed.new
- assert_equal(0, vendor.<=>(vendor), 'vendor <=> vendor')
+ assert_equal(0, vendor.<=>(vendor), "vendor <=> vendor")
- assert_equal(1, vendor.<=>(remote), 'vendor <=> remote')
- assert_equal(-1, remote.<=>(vendor), 'remote <=> vendor')
+ assert_equal(1, vendor.<=>(remote), "vendor <=> remote")
+ 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, vendor.<=>(installed), "vendor <=> installed")
+ assert_equal(-1, installed.<=>(vendor), "installed <=> vendor")
end
end
diff --git a/test/rubygems/test_gem_spec_fetcher.rb b/test/rubygems/test_gem_spec_fetcher.rb
index afae46e120..f23a93350b 100644
--- a/test/rubygems/test_gem_spec_fetcher.rb
+++ b/test/rubygems/test_gem_spec_fetcher.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/spec_fetcher'
+require_relative "helper"
+require "rubygems/spec_fetcher"
class TestGemSpecFetcher < Gem::TestCase
def tuple(*args)
@@ -23,7 +23,7 @@ class TestGemSpecFetcher < Gem::TestCase
end
def test_initialize_source
- alternate = 'http://alternate.example'
+ alternate = "http://alternate.example"
fetcher = Gem::SpecFetcher.new alternate
refute_same Gem.sources, fetcher.sources
@@ -38,7 +38,7 @@ class TestGemSpecFetcher < Gem::TestCase
end
def test_initialize_unwritable_home_dir
- pend 'chmod not supported' if Gem.win_platform?
+ pend "chmod not supported" if Gem.win_platform?
FileUtils.chmod 0000, Gem.user_home
@@ -51,13 +51,13 @@ class TestGemSpecFetcher < Gem::TestCase
def test_spec_for_dependency_all
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '2.a'
- fetcher.spec 'a', 2
- fetcher.spec 'a', '3.a'
+ fetcher.spec "a", 1
+ fetcher.spec "a", "2.a"
+ fetcher.spec "a", 2
+ fetcher.spec "a", "3.a"
end
- dep = Gem::Dependency.new 'a', ">= 1"
+ dep = Gem::Dependency.new "a", ">= 1"
specs_and_sources, _ = @sf.spec_for_dependency dep
@@ -65,7 +65,7 @@ class TestGemSpecFetcher < Gem::TestCase
[spec.full_name, source_uri]
end
- expected = [['a-1', @source], ['a-2', @source]]
+ expected = [["a-1", @source], ["a-2", @source]]
assert_equal expected, spec_names
@@ -74,63 +74,63 @@ class TestGemSpecFetcher < Gem::TestCase
def test_spec_for_dependency_latest
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'a', '3.a'
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "a", "3.a"
end
- dep = Gem::Dependency.new 'a'
+ dep = Gem::Dependency.new "a"
specs_and_sources, _ = @sf.spec_for_dependency dep
spec_names = specs_and_sources.map do |spec, source_uri|
[spec.full_name, source_uri]
end
- assert_equal [['a-2', Gem::Source.new(@gem_repo)]],
+ assert_equal [["a-2", Gem::Source.new(@gem_repo)]],
spec_names
end
def test_spec_for_dependency_prerelease
spec_fetcher do |fetcher|
- fetcher.spec 'a', '1.a'
- fetcher.spec 'a', 1
+ fetcher.spec "a", "1.a"
+ fetcher.spec "a", 1
end
- specs_and_sources, _ = @sf.spec_for_dependency dep('a', '1.a')
+ specs_and_sources, _ = @sf.spec_for_dependency dep("a", "1.a")
spec_names = specs_and_sources.map do |spec, source_uri|
[spec.full_name, source_uri]
end
- assert_equal [['a-1.a', Gem::Source.new(@gem_repo)]], spec_names
+ assert_equal [["a-1.a", Gem::Source.new(@gem_repo)]], spec_names
end
def test_spec_for_dependency_platform
- util_set_arch 'i386-linux'
+ util_set_arch "i386-linux"
spec_fetcher do |fetcher|
fetcher.legacy_platform
end
- dep = Gem::Dependency.new 'pl', 1
+ dep = Gem::Dependency.new "pl", 1
specs_and_sources, _ = @sf.spec_for_dependency dep
spec_names = specs_and_sources.map do |spec, source_uri|
[spec.full_name, source_uri]
end
- assert_equal [['pl-1-x86-linux', Gem::Source.new(@gem_repo)]],
+ assert_equal [["pl-1-x86-linux", Gem::Source.new(@gem_repo)]],
spec_names
end
def test_spec_for_dependency_mismatched_platform
- util_set_arch 'hrpa-989'
+ util_set_arch "hrpa-989"
spec_fetcher do |fetcher|
fetcher.legacy_platform
end
- dep = Gem::Dependency.new 'pl', 1
+ dep = Gem::Dependency.new "pl", 1
specs_and_sources, errors = @sf.spec_for_dependency dep
assert_equal 0, specs_and_sources.size
@@ -150,13 +150,13 @@ class TestGemSpecFetcher < Gem::TestCase
Gem.sources.replace [src]
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '2.a'
- fetcher.spec 'a', 2
- fetcher.spec 'a', '3.a'
+ fetcher.spec "a", 1
+ fetcher.spec "a", "2.a"
+ fetcher.spec "a", 2
+ fetcher.spec "a", "3.a"
end
- dep = Gem::Dependency.new 'a', ">= 1"
+ dep = Gem::Dependency.new "a", ">= 1"
specs_and_sources, errors = @sf.spec_for_dependency dep
@@ -170,38 +170,38 @@ class TestGemSpecFetcher < Gem::TestCase
def test_suggest_gems_from_name_latest
spec_fetcher do|fetcher|
- fetcher.spec 'example', 1
- fetcher.spec 'other-example', 1
- fetcher.spec 'examp', 1
+ fetcher.spec "example", 1
+ fetcher.spec "other-example", 1
+ fetcher.spec "examp", 1
end
- suggestions = @sf.suggest_gems_from_name('examplw', :latest, 1)
- assert_equal ['example'], suggestions
+ suggestions = @sf.suggest_gems_from_name("examplw", :latest, 1)
+ assert_equal ["example"], suggestions
- suggestions = @sf.suggest_gems_from_name('other')
- assert_equal ['other-example'], suggestions
+ suggestions = @sf.suggest_gems_from_name("other")
+ assert_equal ["other-example"], suggestions
- suggestions = @sf.suggest_gems_from_name('exam')
- assert suggestions.any? { ['examp'] }
- assert suggestions.any? { ['example'] }
- assert suggestions.any? { ['other-example'] }
+ suggestions = @sf.suggest_gems_from_name("exam")
+ assert suggestions.any? { ["examp"] }
+ assert suggestions.any? { ["example"] }
+ assert suggestions.any? { ["other-example"] }
end
def test_suggest_gems_from_name_prerelease
spec_fetcher do|fetcher|
- fetcher.spec 'example', '1.a'
- fetcher.spec 'other-example', 1
+ fetcher.spec "example", "1.a"
+ fetcher.spec "other-example", 1
end
- suggestions = @sf.suggest_gems_from_name('examplw')
- assert_equal ['example'], suggestions
+ suggestions = @sf.suggest_gems_from_name("examplw")
+ assert_equal ["example"], suggestions
end
def test_available_specs_latest
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', 2
- fetcher.spec 'a', '3.a'
+ fetcher.spec "a", 1
+ fetcher.spec "a", 2
+ fetcher.spec "a", "3.a"
fetcher.legacy_platform
end
@@ -210,15 +210,15 @@ class TestGemSpecFetcher < Gem::TestCase
assert_equal [@source], specs.keys
expected = Gem::NameTuple.from_list \
- [['a', v(2), Gem::Platform::RUBY],
- ['pl', v(1), 'i386-linux']]
+ [["a", v(2), Gem::Platform::RUBY],
+ ["pl", v(1), "i386-linux"]]
assert_equal expected, specs[@source]
end
def test_available_specs_released
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
fetcher.legacy_platform
end
@@ -227,17 +227,17 @@ class TestGemSpecFetcher < Gem::TestCase
assert_equal [@source], specs.keys
expected = Gem::NameTuple.from_list \
- [['a', v(1), Gem::Platform::RUBY],
- ['pl', v(1), 'i386-linux']]
+ [["a", v(1), Gem::Platform::RUBY],
+ ["pl", v(1), "i386-linux"]]
assert_equal expected, specs[@source]
end
def test_available_specs_complete
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '2.a'
- fetcher.spec 'b', 2
+ fetcher.spec "a", 1
+ fetcher.spec "a", "2.a"
+ fetcher.spec "b", 2
fetcher.legacy_platform
end
@@ -246,19 +246,19 @@ class TestGemSpecFetcher < Gem::TestCase
assert_equal [@source], specs.keys
expected = Gem::NameTuple.from_list \
- [['a', v(1), Gem::Platform::RUBY],
- ['a', v('2.a'), Gem::Platform::RUBY],
- ['b', v(2), Gem::Platform::RUBY],
- ['pl', v(1), 'i386-linux']]
+ [["a", v(1), Gem::Platform::RUBY],
+ ["a", v("2.a"), Gem::Platform::RUBY],
+ ["b", v(2), Gem::Platform::RUBY],
+ ["pl", v(1), "i386-linux"]]
assert_equal expected, specs[@source]
end
def test_available_specs_complete_handles_no_prerelease
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '2.a'
- fetcher.spec 'b', 2
+ fetcher.spec "a", 1
+ fetcher.spec "a", "2.a"
+ fetcher.spec "b", 2
fetcher.legacy_platform
end
@@ -270,16 +270,16 @@ class TestGemSpecFetcher < Gem::TestCase
assert_equal [@source], specs.keys
expected = Gem::NameTuple.from_list \
- [['a', v(1), Gem::Platform::RUBY],
- ['b', v(2), Gem::Platform::RUBY],
- ['pl', v(1), 'i386-linux']]
+ [["a", v(1), Gem::Platform::RUBY],
+ ["b", v(2), Gem::Platform::RUBY],
+ ["pl", v(1), "i386-linux"]]
assert_equal expected, specs[@source]
end
def test_available_specs_cache
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
+ fetcher.spec "a", 1
end
specs, _ = @sf.available_specs(:latest)
@@ -295,9 +295,9 @@ class TestGemSpecFetcher < Gem::TestCase
def test_available_specs_cache_released
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '2.a'
- fetcher.spec 'b', 2
+ fetcher.spec "a", 1
+ fetcher.spec "a", "2.a"
+ fetcher.spec "b", 2
fetcher.legacy_platform
end
@@ -314,14 +314,14 @@ class TestGemSpecFetcher < Gem::TestCase
def test_available_specs_prerelease
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1
- fetcher.spec 'a', '2.a'
+ fetcher.spec "a", 1
+ fetcher.spec "a", "2.a"
end
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
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 729db81944..0c67f600ea 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-require 'benchmark'
-require_relative 'helper'
-require 'date'
-require 'pathname'
-require 'stringio'
-require 'rubygems/ext'
-require 'rubygems/specification'
-require 'rubygems/installer'
-require 'rubygems/platform'
+require "benchmark"
+require_relative "helper"
+require "date"
+require "pathname"
+require "stringio"
+require "rubygems/ext"
+require "rubygems/specification"
+require "rubygems/installer"
+require "rubygems/platform"
class TestGemSpecification < Gem::TestCase
LEGACY_YAML_SPEC = <<-EOF.freeze
@@ -44,16 +44,16 @@ end
EOF
def make_spec_c1
- @c1 = util_spec 'a', '1' do |s|
- s.executable = 'exec'
- s.extensions << 'ext/a/extconf.rb'
- s.test_file = 'test/suite.rb'
- s.requirements << 'A working computer'
- s.license = 'MIT'
+ @c1 = util_spec "a", "1" do |s|
+ s.executable = "exec"
+ s.extensions << "ext/a/extconf.rb"
+ s.test_file = "test/suite.rb"
+ s.requirements << "A working computer"
+ s.license = "MIT"
- s.add_dependency 'rake', '> 0.4'
- s.add_dependency 'jabber4r', '> 0.0.0'
- s.add_dependency 'pqa', ['> 0.4', '<= 0.6']
+ s.add_dependency "rake", "> 0.4"
+ s.add_dependency "jabber4r", "> 0.0.0"
+ s.add_dependency "pqa", ["> 0.4", "<= 0.6"]
s.mark_version
s.files = %w[lib/code.rb]
@@ -61,16 +61,16 @@ end
end
def ext_spec(platform: Gem::Platform::RUBY)
- @ext = util_spec 'ext', '1' do |s|
- s.executable = 'exec'
- s.test_file = 'test/suite.rb'
+ @ext = util_spec "ext", "1" do |s|
+ s.executable = "exec"
+ s.test_file = "test/suite.rb"
s.extensions = %w[ext/extconf.rb]
- s.license = 'MIT'
+ s.license = "MIT"
s.platform = platform
s.mark_version
s.files = %w[lib/code.rb]
- s.installed_by_version = v('2.2')
+ s.installed_by_version = v("2.2")
end
end
@@ -88,40 +88,40 @@ end
# is not set.
Gem.instance_variable_set(:'@default_source_date_epoch', nil)
- @a1 = util_spec 'a', '1' do |s|
- s.executable = 'exec'
- s.test_file = 'test/suite.rb'
- s.requirements << 'A working computer'
- s.license = 'MIT'
+ @a1 = util_spec "a", "1" do |s|
+ s.executable = "exec"
+ s.test_file = "test/suite.rb"
+ s.requirements << "A working computer"
+ s.license = "MIT"
s.mark_version
s.files = %w[lib/code.rb]
end
- @a2 = util_spec 'a', '2' do |s|
+ @a2 = util_spec "a", "2" do |s|
s.files = %w[lib/code.rb]
end
- @a3 = util_spec 'a', '3' do |s|
- s.metadata['allowed_push_host'] = "https://privategemserver.com"
+ @a3 = util_spec "a", "3" do |s|
+ s.metadata["allowed_push_host"] = "https://privategemserver.com"
end
@current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
end
def test_self_find_active_stub_by_path
- spec = util_spec('a', '1', nil, 'lib/foo.rb')
+ spec = util_spec("a", "1", nil, "lib/foo.rb")
spec.activated = true
# There used to be a bug (introduced in a9c1aaf) when Gem::Specification
# objects are present in the @stubs collection. This test verifies that
# this scenario works correctly.
Gem::Specification.all = [spec]
- assert_equal spec, Gem::Specification.find_active_stub_by_path('foo')
+ assert_equal spec, Gem::Specification.find_active_stub_by_path("foo")
end
def test_self_activate
- foo = util_spec 'foo', '1'
+ foo = util_spec "foo", "1"
assert_activate %w[foo-1], foo
end
@@ -147,7 +147,7 @@ end
end
def test_find_in_unresolved_tree_is_not_exponentiental
- pend "currently slower in CI on TruffleRuby" if RUBY_ENGINE == 'truffleruby'
+ pend "currently slower in CI on TruffleRuby" if RUBY_ENGINE == "truffleruby"
num_of_pkg = 7
num_of_version_per_pkg = 3
packages = (0..num_of_pkg).map do |pkgi|
@@ -166,7 +166,7 @@ end
base.activate
tms = Benchmark.measure do
- assert_raise(LoadError) { require 'no_such_file_foo' }
+ assert_raise(LoadError) { require "no_such_file_foo" }
end
assert_operator tms.total, :<=, 10
end
@@ -372,13 +372,13 @@ end
# [B] ~> 1.0 (satisfied by 1.0)
def test_self_activate_checks_dependencies
- a = util_spec 'a', '1.0'
- a.add_dependency 'c', '= 1.0'
- a.add_dependency 'b', '~> 1.0'
+ a = util_spec "a", "1.0"
+ a.add_dependency "c", "= 1.0"
+ a.add_dependency "b", "~> 1.0"
- b1 = util_spec 'b', '1.0'
- b2 = util_spec 'b', '2.0'
- c = util_spec 'c', '1.0', 'b' => '= 2.0'
+ b1 = util_spec "b", "1.0"
+ b2 = util_spec "b", "2.0"
+ c = util_spec "c", "1.0", "b" => "= 2.0"
install_specs b1, b2, c, a
e = assert_raise Gem::LoadError do
@@ -396,10 +396,10 @@ end
# [B] = 2.0
def test_self_activate_divergent
- a = util_spec 'a', '1.0', 'b' => '~> 1.0', 'c' => '= 1.0'
- b1 = util_spec 'b', '1.0'
- b2 = util_spec 'b', '2.0'
- c = util_spec 'c', '1.0', 'b' => '= 2.0'
+ a = util_spec "a", "1.0", "b" => "~> 1.0", "c" => "= 1.0"
+ b1 = util_spec "b", "1.0"
+ b2 = util_spec "b", "2.0"
+ c = util_spec "c", "1.0", "b" => "= 2.0"
install_specs b1, b2, c, a
@@ -415,9 +415,9 @@ end
# DOC
def test_self_activate_old_required
- e1, = util_spec 'e', '1', 'd' => '= 1'
- @d1 = util_spec 'd', '1'
- @d2 = util_spec 'd', '2'
+ e1, = util_spec "e", "1", "d" => "= 1"
+ @d1 = util_spec "d", "1"
+ @d2 = util_spec "d", "2"
install_specs @d1, @d2, e1
@@ -428,17 +428,17 @@ end
# DOC
def test_self_activate_platform_alternate
- @x1_m = util_spec 'x', '1' do |s|
+ @x1_m = util_spec "x", "1" do |s|
s.platform = Gem::Platform.new %w[cpu my_platform 1]
end
- @x1_o = util_spec 'x', '1' do |s|
+ @x1_o = util_spec "x", "1" do |s|
s.platform = Gem::Platform.new %w[cpu other_platform 1]
end
- @w1 = util_spec 'w', '1', 'x' => nil
+ @w1 = util_spec "w", "1", "x" => nil
- util_set_arch 'cpu-my_platform1'
+ util_set_arch "cpu-my_platform1"
install_specs @x1_m, @x1_o, @w1
assert_activate %w[x-1-cpu-my_platform-1 w-1], @w1, @x1_m
@@ -448,13 +448,13 @@ end
# DOC
def test_self_activate_platform_bump
- @y1 = util_spec 'y', '1'
+ @y1 = util_spec "y", "1"
- @y1_1_p = util_spec 'y', '1.1' do |s|
+ @y1_1_p = util_spec "y", "1.1" do |s|
s.platform = Gem::Platform.new %w[cpu my_platform 1]
end
- @z1 = util_spec 'z', '1', 'y' => nil
+ @z1 = util_spec "z", "1", "y" => nil
install_specs @y1, @y1_1_p, @z1
assert_activate %w[y-1 z-1], @z1, @y1
@@ -467,11 +467,11 @@ end
# [A] >= 0 (satisfied by 1.a)
def test_self_activate_prerelease
- @c1_pre = util_spec 'c', '1.a', "a" => "1.a", "b" => "1"
- @a1_pre = util_spec 'a', '1.a'
- @b1 = util_spec 'b', '1' do |s|
- s.add_dependency 'a'
- s.add_development_dependency 'aa'
+ @c1_pre = util_spec "c", "1.a", "a" => "1.a", "b" => "1"
+ @a1_pre = util_spec "a", "1.a"
+ @b1 = util_spec "b", "1" do |s|
+ s.add_dependency "a"
+ s.add_development_dependency "aa"
end
install_specs @a1_pre, @b1, @c1_pre
@@ -533,7 +533,7 @@ end
end
def test_self_activate_loaded
- foo = util_spec 'foo', '1'
+ foo = util_spec "foo", "1"
assert foo.activate
refute foo.activate
@@ -545,9 +545,9 @@ end
# [C] depends on nothing
def test_self_activate_unrelated
- a = util_spec 'a', '1.0', 'b' => '>= 1.0'
- b = util_spec 'b', '1.0'
- c = util_spec 'c', '1.0'
+ a = util_spec "a", "1.0", "b" => ">= 1.0"
+ b = util_spec "b", "1.0"
+ c = util_spec "c", "1.0"
install_specs b, c, a
assert_activate %w[b-1.0 c-1.0 a-1.0], a, c, "b"
@@ -563,11 +563,11 @@ end
# TODO: move these to specification
def test_self_activate_over
- a = util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '= 1.0'
- install_specs util_spec 'b', '1.0'
- install_specs util_spec 'b', '1.1'
- install_specs util_spec 'b', '2.0'
- install_specs util_spec 'c', '1.0', 'b' => '~> 1.0'
+ a = util_spec "a", "1.0", "b" => ">= 1.0", "c" => "= 1.0"
+ install_specs util_spec "b", "1.0"
+ install_specs util_spec "b", "1.1"
+ install_specs util_spec "b", "2.0"
+ install_specs util_spec "c", "1.0", "b" => "~> 1.0"
install_specs a
a.activate
@@ -588,10 +588,10 @@ end
# first resolve through a dependency that is later pruned.
def test_self_activate_under
- a = util_spec 'a', '1.0', 'b' => '~> 1.0', 'c' => '= 1.0'
- b1 = util_spec 'b', '1.0'
- b1_1 = util_spec 'b', '1.1'
- c = util_spec 'c', '1.0', 'b' => '= 1.0'
+ a = util_spec "a", "1.0", "b" => "~> 1.0", "c" => "= 1.0"
+ b1 = util_spec "b", "1.0"
+ b1_1 = util_spec "b", "1.1"
+ c = util_spec "c", "1.0", "b" => "= 1.0"
install_specs b1, b1_1, c, a
@@ -607,10 +607,10 @@ end
# [C1] depends on nothing
def test_self_activate_dropped
- a1 = util_spec 'a', '1', 'b' => nil
- b1 = util_spec 'b', '1', 'c' => nil
- b2 = util_spec 'b', '2'
- c1 = util_spec 'c', '1'
+ a1 = util_spec "a", "1", "b" => nil
+ b1 = util_spec "b", "1", "c" => nil
+ b2 = util_spec "b", "2"
+ c1 = util_spec "c", "1"
install_specs c1, b1, b2, a1
assert_activate %w[b-2 a-1], a1, "b"
@@ -627,11 +627,11 @@ end
# resolve.
def test_self_activate_raggi_the_edgecase_generator
- a = util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '>= 1.0'
- b1 = util_spec 'b', '1.0'
- b1_0 = util_spec 'b', '1.1', 'z' => '>= 1.0'
- c = util_spec 'c', '1.0', 'b' => '= 1.0'
- z = util_spec 'z', '1'
+ a = util_spec "a", "1.0", "b" => ">= 1.0", "c" => ">= 1.0"
+ b1 = util_spec "b", "1.0"
+ b1_0 = util_spec "b", "1.1", "z" => ">= 1.0"
+ c = util_spec "c", "1.0", "b" => "= 1.0"
+ z = util_spec "z", "1"
install_specs z, b1, b1_0, c, z
@@ -639,8 +639,8 @@ end
end
def test_self_activate_conflict
- install_specs util_spec 'b', '1.0'
- install_specs util_spec 'b', '2.0'
+ install_specs util_spec "b", "1.0"
+ install_specs util_spec "b", "2.0"
gem "b", "= 1.0"
@@ -655,7 +655,7 @@ end
install_specs a
Gem::Specification.all = [a]
- assert_equal a, Gem::Specification.find_inactive_by_path('foo')
+ assert_equal a, Gem::Specification.find_inactive_by_path("foo")
end
def test_self_attribute_names
@@ -698,13 +698,13 @@ end
def test_self__load_future
spec = Gem::Specification.new
- spec.name = 'a'
- spec.version = '1'
+ spec.name = "a"
+ spec.version = "1"
spec.specification_version = @current_version + 1
load_spec = Marshal.load Marshal.dump(spec)
- assert_equal 'a', load_spec.name
+ assert_equal "a", load_spec.name
assert_equal Gem::Version.new(1), load_spec.version
assert_equal @current_version, load_spec.specification_version
end
@@ -783,20 +783,20 @@ dependencies: []
end
def test_self_load_relative
- File.open 'a-2.gemspec', 'w' do |io|
+ File.open "a-2.gemspec", "w" do |io|
io.write @a2.to_ruby_for_cache
end
- spec = Gem::Specification.load 'a-2.gemspec'
+ spec = Gem::Specification.load "a-2.gemspec"
@a2.files.clear
assert_equal @a2, spec
- assert_equal File.join(@tempdir, 'a-2.gemspec'), spec.loaded_from
+ assert_equal File.join(@tempdir, "a-2.gemspec"), spec.loaded_from
end
- if RUBY_ENGINE == 'ruby' and RUBY_VERSION < '2.7'
+ if RUBY_ENGINE == "ruby" and RUBY_VERSION < "2.7"
def test_self_load_tainted
full_path = @a2.spec_file
write_file full_path do |io|
@@ -874,13 +874,13 @@ dependencies: []
end
def test_self_load_utf8_with_ascii_encoding
- with_internal_encoding('US-ASCII') do
+ with_internal_encoding("US-ASCII") do
spec2 = @a2.dup
bin = "\u5678".dup
spec2.authors = [bin]
full_path = spec2.spec_file
write_file full_path do |io|
- io.write spec2.to_ruby_for_cache.force_encoding('BINARY').sub("\\u{5678}", bin.force_encoding('BINARY'))
+ io.write spec2.to_ruby_for_cache.force_encoding("BINARY").sub("\\u{5678}", bin.force_encoding("BINARY"))
end
spec = Gem::Specification.load full_path
@@ -895,10 +895,10 @@ dependencies: []
spec = Gem::Deprecate.skip_during do
eval LEGACY_RUBY_SPEC
end
- assert_equal 'keyedlist', spec.name
- assert_equal '0.4.0', spec.version.to_s
+ assert_equal "keyedlist", spec.name
+ assert_equal "0.4.0", spec.version.to_s
assert_kind_of Time, spec.date
- assert spec.required_ruby_version.satisfied_by?(Gem::Version.new('1'))
+ assert spec.required_ruby_version.satisfied_by?(Gem::Version.new("1"))
assert_equal false, spec.has_unit_tests?
end
@@ -933,9 +933,9 @@ dependencies: []
def test_self_outdated
spec_fetcher do |fetcher|
- fetcher.download 'a', 4
+ fetcher.download "a", 4
- fetcher.spec 'a', 3
+ fetcher.spec "a", 3
end
assert_equal %w[a], Gem::Specification.outdated
@@ -943,16 +943,16 @@ dependencies: []
def test_self_outdated_and_latest_remotes
spec_fetcher do |fetcher|
- fetcher.download 'a', 4
- fetcher.download 'b', 3
+ fetcher.download "a", 4
+ fetcher.download "b", 3
- fetcher.spec 'a', '3.a'
- fetcher.spec 'b', 2
+ fetcher.spec "a", "3.a"
+ fetcher.spec "b", 2
end
expected = [
- [Gem::Specification.stubs.find {|s| s.full_name == 'a-3.a' }, v(4)],
- [Gem::Specification.stubs.find {|s| s.full_name == 'b-2' }, v(3)],
+ [Gem::Specification.stubs.find {|s| s.full_name == "a-3.a" }, v(4)],
+ [Gem::Specification.stubs.find {|s| s.full_name == "b-2" }, v(3)],
]
assert_equal expected, Gem::Specification.outdated_and_latest_version.to_a
@@ -961,18 +961,18 @@ dependencies: []
def test_self_remove_spec
install_specs @a1
- assert_includes Gem::Specification.all_names, 'a-1'
- assert_includes Gem::Specification.stubs.map {|s| s.full_name }, 'a-1'
+ assert_includes Gem::Specification.all_names, "a-1"
+ assert_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
uninstall_gem @a1
Gem::Specification.reset
- refute_includes Gem::Specification.all_names, 'a-1'
- refute_includes Gem::Specification.stubs.map {|s| s.full_name }, 'a-1'
+ refute_includes Gem::Specification.all_names, "a-1"
+ refute_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
end
def test_self_remove_spec_removed
- File.open @a1.spec_file, 'w' do |io|
+ File.open @a1.spec_file, "w" do |io|
io.write @a1.to_ruby
end
@@ -982,40 +982,40 @@ dependencies: []
Gem::Specification.reset
- refute_includes Gem::Specification.all_names, 'a-1'
- refute_includes Gem::Specification.stubs.map {|s| s.full_name }, 'a-1'
+ refute_includes Gem::Specification.all_names, "a-1"
+ refute_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
end
def test_self_stubs_for_lazy_loading
Gem.loaded_specs.clear
Gem::Specification.class_variable_set(:@@stubs, nil)
- dir_standard_specs = File.join Gem.dir, 'specifications'
+ dir_standard_specs = File.join Gem.dir, "specifications"
- save_gemspec('a-1', '1', dir_standard_specs) {|s| s.name = 'a' }
- save_gemspec('b-1', '1', dir_standard_specs) {|s| s.name = 'b' }
+ save_gemspec("a-1", "1", dir_standard_specs) {|s| s.name = "a" }
+ save_gemspec("b-1", "1", dir_standard_specs) {|s| s.name = "b" }
- assert_equal ['a-1'], Gem::Specification.stubs_for('a').map {|s| s.full_name }
+ assert_equal ["a-1"], Gem::Specification.stubs_for("a").map {|s| s.full_name }
assert_equal 1, Gem::Specification.class_variable_get(:@@stubs_by_name).length
- assert_equal ['b-1'], Gem::Specification.stubs_for('b').map {|s| s.full_name }
+ assert_equal ["b-1"], Gem::Specification.stubs_for("b").map {|s| s.full_name }
assert_equal 2, Gem::Specification.class_variable_get(:@@stubs_by_name).length
assert_equal(
- Gem::Specification.stubs_for('a').map {|s| s.object_id },
- Gem::Specification.stubs_for('a').map {|s| s.object_id }
+ Gem::Specification.stubs_for("a").map {|s| s.object_id },
+ Gem::Specification.stubs_for("a").map {|s| s.object_id }
)
- Gem.loaded_specs.delete 'a'
- Gem.loaded_specs.delete 'b'
+ Gem.loaded_specs.delete "a"
+ Gem.loaded_specs.delete "b"
Gem::Specification.class_variable_set(:@@stubs, nil)
end
def test_self_stubs_for_no_lazy_loading_after_all_specs_setup
- Gem::Specification.all = [util_spec('a', '1')]
+ Gem::Specification.all = [util_spec("a", "1")]
- save_gemspec('b-1', '1', File.join(Gem.dir, 'specifications')) {|s| s.name = 'b' }
+ save_gemspec("b-1", "1", File.join(Gem.dir, "specifications")) {|s| s.name = "b" }
- assert_equal [], Gem::Specification.stubs_for('b').map {|s| s.full_name }
+ assert_equal [], Gem::Specification.stubs_for("b").map {|s| s.full_name }
end
def test_self_stubs_for_mult_platforms
@@ -1025,30 +1025,30 @@ dependencies: []
orig_platform = Gem.platforms.dup
# 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
# dirs doesn't include user ?
Gem::Specification.dirs << user_spec_dir
- gem = 'mingw'
- v = '1.1.1'
- platforms = ['x86-mingw32', 'x64-mingw32']
+ gem = "mingw"
+ v = "1.1.1"
+ platforms = ["x86-mingw32", "x64-mingw32"]
#create specs
platforms.each do |plat|
spec = Gem::Specification.new(gem, v) {|s| s.platform = plat }
- File.open File.join(user_spec_dir, "#{gem}-#{v}-#{plat}.gemspec"), 'w' do |io|
+ File.open File.join(user_spec_dir, "#{gem}-#{v}-#{plat}.gemspec"), "w" do |io|
io.write spec.to_ruby
end
end
platforms.each do |plat|
cur_plat = Gem::Platform.new plat
- Gem.platforms = ['ruby', cur_plat]
+ Gem.platforms = ["ruby", cur_plat]
Gem::Specification.class_variable_set :@@stubs, nil
Gem::Specification.stubs if plat == platforms.last # test loading via stubs
- t = Gem::Specification.stubs_for 'mingw'
+ t = Gem::Specification.stubs_for "mingw"
assert_equal 1, t.length
assert_equal cur_plat, t.first.platform
@@ -1058,17 +1058,17 @@ dependencies: []
end
def test_self_stubs_returns_only_specified_named_specs
- dir_standard_specs = File.join Gem.dir, 'specifications'
+ dir_standard_specs = File.join Gem.dir, "specifications"
- save_gemspec('a-1', '1', dir_standard_specs) {|s| s.name = 'a' }
- save_gemspec('a-2', '2', dir_standard_specs) {|s| s.name = 'a' }
- save_gemspec('a-a', '3', dir_standard_specs) {|s| s.name = 'a-a' }
+ save_gemspec("a-1", "1", dir_standard_specs) {|s| s.name = "a" }
+ save_gemspec("a-2", "2", dir_standard_specs) {|s| s.name = "a" }
+ save_gemspec("a-a", "3", dir_standard_specs) {|s| s.name = "a-a" }
- assert_equal ['a-1', 'a-2'], Gem::Specification.stubs_for('a').map(&:full_name).sort
+ assert_equal ["a-1", "a-2"], Gem::Specification.stubs_for("a").map(&:full_name).sort
end
def test_handles_private_null_type
- path = File.expand_path 'data/pry-0.4.7.gemspec.rz', __dir__
+ path = File.expand_path "data/pry-0.4.7.gemspec.rz", __dir__
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))
@@ -1076,7 +1076,7 @@ dependencies: []
end
def test_handles_dependencies_with_syck_requirements_bug
- path = File.expand_path 'data/excon-0.7.7.gemspec.rz', __dir__
+ path = File.expand_path "data/excon-0.7.7.gemspec.rz", __dir__
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))
@@ -1102,9 +1102,9 @@ dependencies: []
assert_equal [], spec.extensions
assert_equal [], spec.requirements
assert_equal [], spec.dependencies
- assert_equal 'bin', spec.bindir
- assert_equal '>= 0', spec.required_ruby_version.to_s
- assert_equal '>= 0', spec.required_rubygems_version.to_s
+ assert_equal "bin", spec.bindir
+ assert_equal ">= 0", spec.required_ruby_version.to_s
+ assert_equal ">= 0", spec.required_rubygems_version.to_s
end
def test_initialize_future
@@ -1126,18 +1126,18 @@ dependencies: []
spec = Gem::Specification.new do |s|
s.name = "blah"
s.version = "1.3.5"
- s.summary = 'summary'
- s.description = 'description'
- s.authors = 'author a', 'author b'
- s.licenses = 'BSD-2-Clause'
- s.files = 'lib/file.rb'
- s.test_files = 'test/file.rb'
- s.rdoc_options = '--foo'
- s.extra_rdoc_files = 'README.txt'
- s.executables = 'exec'
- s.extensions = 'ext/extconf.rb'
- s.requirements = 'requirement'
- s.add_dependency 'some_gem'
+ s.summary = "summary"
+ s.description = "description"
+ s.authors = "author a", "author b"
+ s.licenses = "BSD-2-Clause"
+ s.files = "lib/file.rb"
+ s.test_files = "test/file.rb"
+ s.rdoc_options = "--foo"
+ s.extra_rdoc_files = "README.txt"
+ s.executables = "exec"
+ s.extensions = "ext/extconf.rb"
+ s.requirements = "requirement"
+ s.add_dependency "some_gem"
end
dup_spec = spec.dup
@@ -1151,69 +1151,69 @@ dependencies: []
assert_equal Gem::Platform::RUBY, spec.platform
assert_same spec.platform, dup_spec.platform
- assert_equal 'summary', spec.summary
+ assert_equal "summary", spec.summary
assert_same spec.summary, dup_spec.summary
assert_equal %w[README.txt bin/exec ext/extconf.rb lib/file.rb
test/file.rb].sort,
spec.files
- refute_same spec.files, dup_spec.files, 'files'
+ refute_same spec.files, dup_spec.files, "files"
assert_equal %w[test/file.rb], spec.test_files
- refute_same spec.test_files, dup_spec.test_files, 'test_files'
+ refute_same spec.test_files, dup_spec.test_files, "test_files"
assert_equal %w[--foo], spec.rdoc_options
- refute_same spec.rdoc_options, dup_spec.rdoc_options, 'rdoc_options'
+ refute_same spec.rdoc_options, dup_spec.rdoc_options, "rdoc_options"
assert_equal %w[README.txt], spec.extra_rdoc_files
refute_same spec.extra_rdoc_files, dup_spec.extra_rdoc_files,
- 'extra_rdoc_files'
+ "extra_rdoc_files"
assert_equal %w[exec], spec.executables
- refute_same spec.executables, dup_spec.executables, 'executables'
+ refute_same spec.executables, dup_spec.executables, "executables"
assert_equal %w[ext/extconf.rb], spec.extensions
- refute_same spec.extensions, dup_spec.extensions, 'extensions'
+ refute_same spec.extensions, dup_spec.extensions, "extensions"
assert_equal %w[requirement], spec.requirements
- refute_same spec.requirements, dup_spec.requirements, 'requirements'
+ refute_same spec.requirements, dup_spec.requirements, "requirements"
- assert_equal [Gem::Dependency.new('some_gem', Gem::Requirement.default)],
+ assert_equal [Gem::Dependency.new("some_gem", Gem::Requirement.default)],
spec.dependencies
- refute_same spec.dependencies, dup_spec.dependencies, 'dependencies'
+ refute_same spec.dependencies, dup_spec.dependencies, "dependencies"
- assert_equal 'bin', spec.bindir
+ assert_equal "bin", spec.bindir
assert_same spec.bindir, dup_spec.bindir
- assert_equal '>= 0', spec.required_ruby_version.to_s
+ assert_equal ">= 0", spec.required_ruby_version.to_s
assert_same spec.required_ruby_version, dup_spec.required_ruby_version
- assert_equal '>= 0', spec.required_rubygems_version.to_s
+ assert_equal ">= 0", spec.required_rubygems_version.to_s
assert_same spec.required_rubygems_version,
dup_spec.required_rubygems_version
end
def test_initialize_copy_broken
spec = Gem::Specification.new do |s|
- s.name = 'a'
- s.version = '1'
+ s.name = "a"
+ s.version = "1"
end
spec.instance_variable_set :@licenses, (class << (Object.new);self;end)
- spec.loaded_from = '/path/to/file'
+ spec.loaded_from = "/path/to/file"
e = assert_raise Gem::FormatException do
spec.dup
end
- assert_equal 'a-1 has an invalid value for @licenses', e.message
- assert_equal '/path/to/file', e.file_path
+ assert_equal "a-1 has an invalid value for @licenses", e.message
+ assert_equal "/path/to/file", e.file_path
end
def test_initialize_prerelease_version_before_name
spec = Gem::Specification.new do |s|
- s.version = '1.0.0.dev'
- s.name = 'a'
+ s.version = "1.0.0.dev"
+ s.name = "a"
end
assert_equal "a", spec.name
@@ -1222,13 +1222,13 @@ dependencies: []
def test__dump
@a2.platform = Gem::Platform.local
- @a2.instance_variable_set :@original_platform, 'old_platform'
+ @a2.instance_variable_set :@original_platform, "old_platform"
data = Marshal.dump @a2
same_spec = Marshal.load data
- assert_equal 'old_platform', same_spec.original_platform
+ assert_equal "old_platform", same_spec.original_platform
end
def test_activate
@@ -1247,7 +1247,7 @@ dependencies: []
end
def test_add_dependency_from_existing_dependency
- dep = Gem::Dependency.new("existing_dep", Gem::Requirement.new('> 1'), :runtime)
+ dep = Gem::Dependency.new("existing_dep", Gem::Requirement.new("> 1"), :runtime)
spec = Gem::Specification.new {|s| s.add_dependency dep }
assert_equal dep, spec.dependencies.first
end
@@ -1262,22 +1262,22 @@ dependencies: []
end
def test_author
- assert_equal 'A User', @a1.author
+ assert_equal "A User", @a1.author
end
def test_authors
- assert_equal ['A User'], @a1.authors
+ assert_equal ["A User"], @a1.authors
end
def test_bindir_equals
- @a1.bindir = 'apps'
+ @a1.bindir = "apps"
- assert_equal 'apps', @a1.bindir
+ assert_equal "apps", @a1.bindir
end
def test_bindir_equals_nil
@a2.bindir = nil
- @a2.executable = 'app'
+ @a2.executable = "app"
assert_nil @a2.bindir
assert_equal %w[app lib/code.rb].sort, @a2.files
@@ -1313,14 +1313,14 @@ dependencies: []
assert_empty @ext.build_args
- File.open @ext.build_info_file, 'w' do |io|
+ File.open @ext.build_info_file, "w" do |io|
io.puts
end
assert_empty @ext.build_args
- File.open @ext.build_info_file, 'w' do |io|
- io.puts '--with-foo-dir=wherever'
+ File.open @ext.build_info_file, "w" do |io|
+ io.puts "--with-foo-dir=wherever"
end
assert_equal %w[--with-foo-dir=wherever], @ext.build_args
@@ -1330,13 +1330,13 @@ dependencies: []
pend "extensions don't quite work on jruby" if Gem.java_platform?
ext_spec
- assert_path_not_exist @ext.extension_dir, 'sanity check'
- refute_empty @ext.extensions, 'sanity check'
+ assert_path_not_exist @ext.extension_dir, "sanity check"
+ refute_empty @ext.extensions, "sanity check"
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
FileUtils.mkdir_p File.dirname extconf_rb
- File.open extconf_rb, 'w' do |f|
+ File.open extconf_rb, "w" do |f|
f.write <<-'RUBY'
File.open 'Makefile', 'w' do |f|
f.puts "clean:\n\techo clean"
@@ -1352,13 +1352,13 @@ dependencies: []
end
def test_default_spec_stub_is_marked_default
- default = new_default_spec 'default', 2
+ default = new_default_spec "default", 2
install_default_gems default
- stub = Gem::Specification.stubs.find {|s| s.name == 'default' }
+ stub = Gem::Specification.stubs.find {|s| s.name == "default" }
assert_predicate stub, :default_gem?
- stub = Gem::Specification.find_all_by_name('default').first
+ stub = Gem::Specification.find_all_by_name("default").first
assert_predicate stub, :default_gem?
end
@@ -1366,28 +1366,28 @@ dependencies: []
pend "extensions don't quite work on jruby" if Gem.java_platform?
ext_spec
- refute_empty @ext.extensions, 'sanity check'
+ refute_empty @ext.extensions, "sanity check"
gem_build_complete =
- File.join @ext.extension_dir, 'gem.build_complete'
+ File.join @ext.extension_dir, "gem.build_complete"
FileUtils.mkdir_p @ext.extension_dir
FileUtils.touch gem_build_complete
@ext.build_extensions
- gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
+ gem_make_out = File.join @ext.extension_dir, "gem_make.out"
assert_path_not_exist gem_make_out
end
def test_build_extensions_default_gem
- spec = new_default_spec 'default', 1
- spec.extensions << 'extconf.rb'
+ spec = new_default_spec "default", 1
+ spec.extensions << "extconf.rb"
extconf_rb = File.join spec.gem_dir, spec.extensions.first
FileUtils.mkdir_p File.dirname extconf_rb
- File.open extconf_rb, 'w' do |f|
+ File.open extconf_rb, "w" do |f|
f.write <<-'RUBY'
File.open 'Makefile', 'w' do |f|
f.puts "default:\n\techo built"
@@ -1405,7 +1405,7 @@ dependencies: []
pend "extensions don't quite work on jruby" if Gem.java_platform?
ext_spec
- refute_empty @ext.extensions, 'sanity check'
+ refute_empty @ext.extensions, "sanity check"
assert_raise Gem::Ext::BuildError do
@ext.build_extensions
@@ -1413,18 +1413,18 @@ dependencies: []
end
def test_build_extensions_extensions_dir_unwritable
- pend 'chmod not supported' if Gem.win_platform?
- pend 'skipped in root privilege' if Process.uid.zero?
+ pend "chmod not supported" if Gem.win_platform?
+ pend "skipped in root privilege" if Process.uid.zero?
pend "extensions don't quite work on jruby" if Gem.java_platform?
ext_spec
- refute_empty @ext.extensions, 'sanity check'
+ refute_empty @ext.extensions, "sanity check"
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
FileUtils.mkdir_p File.dirname extconf_rb
- File.open extconf_rb, 'w' do |f|
+ File.open extconf_rb, "w" do |f|
f.write <<-'RUBY'
File.open 'Makefile', 'w' do |f|
f.puts "clean:\n\techo clean"
@@ -1434,30 +1434,30 @@ dependencies: []
RUBY
end
- FileUtils.mkdir_p File.join @ext.base_dir, 'extensions'
+ FileUtils.mkdir_p File.join @ext.base_dir, "extensions"
FileUtils.chmod 0555, @ext.base_dir
- FileUtils.chmod 0555, File.join(@ext.base_dir, 'extensions')
+ FileUtils.chmod 0555, File.join(@ext.base_dir, "extensions")
@ext.build_extensions
assert_path_not_exist @ext.extension_dir
ensure
unless ($DEBUG or win_platform? or Process.uid.zero? or Gem.java_platform?)
- FileUtils.chmod 0755, File.join(@ext.base_dir, 'extensions')
+ FileUtils.chmod 0755, File.join(@ext.base_dir, "extensions")
FileUtils.chmod 0755, @ext.base_dir
end
end
def test_build_extensions_no_extensions_dir_unwritable
- pend 'chmod not supported' if Gem.win_platform?
+ pend "chmod not supported" if Gem.win_platform?
pend "extensions don't quite work on jruby" if Gem.java_platform?
ext_spec
- refute_empty @ext.extensions, 'sanity check'
+ refute_empty @ext.extensions, "sanity check"
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
FileUtils.mkdir_p File.dirname extconf_rb
- File.open extconf_rb, 'w' do |f|
+ File.open extconf_rb, "w" do |f|
f.write <<-'RUBY'
File.open 'Makefile', 'w' do |f|
f.puts "clean:\n\techo clean"
@@ -1467,20 +1467,20 @@ dependencies: []
RUBY
end
- FileUtils.rm_r File.join @gemhome, 'extensions'
+ FileUtils.rm_r File.join @gemhome, "extensions"
FileUtils.chmod 0555, @gemhome
@ext.build_extensions
- gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
+ gem_make_out = File.join @ext.extension_dir, "gem_make.out"
assert_path_not_exist gem_make_out
ensure
FileUtils.chmod 0755, @gemhome
end
def test_build_extensions_none
- assert_path_not_exist @a1.extension_dir, 'sanity check'
- assert_empty @a1.extensions, 'sanity check'
+ assert_path_not_exist @a1.extension_dir, "sanity check"
+ assert_empty @a1.extensions, "sanity check"
@a1.build_extensions
@@ -1494,7 +1494,7 @@ dependencies: []
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
FileUtils.mkdir_p File.dirname extconf_rb
- File.open extconf_rb, 'w' do |f|
+ File.open extconf_rb, "w" do |f|
f.write <<-'RUBY'
File.open 'Makefile', 'w' do |f|
f.puts "clean:\n\techo clean"
@@ -1504,22 +1504,22 @@ dependencies: []
RUBY
end
- refute_empty @ext.extensions, 'sanity check'
+ refute_empty @ext.extensions, "sanity check"
- @ext.installed_by_version = v('2.2.0.preview.2')
+ @ext.installed_by_version = v("2.2.0.preview.2")
@ext.build_extensions
- gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
+ gem_make_out = File.join @ext.extension_dir, "gem_make.out"
assert_path_exist gem_make_out
end
def test_contains_requirable_file_eh
- code_rb = File.join @a1.gem_dir, 'lib', 'code.rb'
+ code_rb = File.join @a1.gem_dir, "lib", "code.rb"
FileUtils.mkdir_p File.dirname code_rb
FileUtils.touch code_rb
- assert @a1.contains_requirable_file? 'code'
+ assert @a1.contains_requirable_file? "code"
end
def test_contains_requirable_file_eh_extension
@@ -1527,7 +1527,7 @@ dependencies: []
ext_spec
_, err = capture_output do
- refute @ext.contains_requirable_file? 'nonexistent'
+ refute @ext.contains_requirable_file? "nonexistent"
end
expected = "Ignoring ext-1 because its extensions are not built. " +
@@ -1540,7 +1540,7 @@ dependencies: []
ext_spec(platform: Gem::Platform.new("java"))
_, err = capture_output do
- refute @ext.contains_requirable_file? 'nonexistent'
+ refute @ext.contains_requirable_file? "nonexistent"
end
assert_empty err
@@ -1556,13 +1556,13 @@ dependencies: []
end
def test_date_equals_string
- @a1.date = '2003-09-17'
+ @a1.date = "2003-09-17"
assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date
end
def test_date_equals_string_bad
assert_raise Gem::InvalidSpecificationException do
- @a1.date = '9/11/2003'
+ @a1.date = "9/11/2003"
end
end
@@ -1609,7 +1609,7 @@ dependencies: []
assert_empty @gem.dependent_gems
- bonobo = util_spec 'bonobo', 1
+ bonobo = util_spec "bonobo", 1
install_gem bonobo
install_gem @gem
@@ -1621,11 +1621,11 @@ dependencies: []
end
def test_doc_dir
- assert_equal File.join(@gemhome, 'doc', 'a-1'), @a1.doc_dir
+ assert_equal File.join(@gemhome, "doc", "a-1"), @a1.doc_dir
end
def test_doc_dir_type
- assert_equal File.join(@gemhome, 'doc', 'a-1', 'ri'), @a1.doc_dir('ri')
+ assert_equal File.join(@gemhome, "doc", "a-1", "ri"), @a1.doc_dir("ri")
end
def test_runtime_dependencies
@@ -1639,12 +1639,12 @@ dependencies: []
end
def test_description
- assert_equal 'This is a test description', @a1.description
+ assert_equal "This is a test description", @a1.description
end
def test_eql_eh
- g1 = util_spec 'gem', 1
- g2 = util_spec 'gem', 1
+ g1 = util_spec "gem", 1
+ g2 = util_spec "gem", 1
assert_equal g1, g2
assert_equal g1.hash, g2.hash
@@ -1653,47 +1653,47 @@ dependencies: []
def test_eql_eh_extensions
spec = @a1.dup
- spec.extensions = 'xx'
+ spec.extensions = "xx"
refute_operator @a1, :eql?, spec
refute_operator spec, :eql?, @a1
end
def test_executables
- @a1.executable = 'app'
+ @a1.executable = "app"
assert_equal %w[app], @a1.executables
end
def test_executable_equals
- @a2.executable = 'app'
- assert_equal 'app', @a2.executable
+ @a2.executable = "app"
+ assert_equal "app", @a2.executable
assert_equal %w[bin/app lib/code.rb].sort, @a2.files
end
def test_extensions
- assert_equal ['ext/extconf.rb'], ext_spec.extensions
+ assert_equal ["ext/extconf.rb"], ext_spec.extensions
end
def test_extension_dir
- enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] =
- RbConfig::CONFIG['ENABLE_SHARED'], 'no'
+ enable_shared, RbConfig::CONFIG["ENABLE_SHARED"] =
+ RbConfig::CONFIG["ENABLE_SHARED"], "no"
ext_spec
refute_empty @ext.extensions
expected =
- File.join(@ext.base_dir, 'extensions', Gem::Platform.local.to_s,
+ File.join(@ext.base_dir, "extensions", Gem::Platform.local.to_s,
"#{Gem.ruby_api_version}-static", @ext.full_name)
assert_equal expected, @ext.extension_dir
ensure
- RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
+ RbConfig::CONFIG["ENABLE_SHARED"] = enable_shared
end
def test_extension_dir_override
- enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] =
- RbConfig::CONFIG['ENABLE_SHARED'], 'no'
+ enable_shared, RbConfig::CONFIG["ENABLE_SHARED"] =
+ RbConfig::CONFIG["ENABLE_SHARED"], "no"
class << Gem
alias orig_default_ext_dir_for default_ext_dir_for
@@ -1701,7 +1701,7 @@ dependencies: []
remove_method :default_ext_dir_for
def Gem.default_ext_dir_for(base_dir)
- 'elsewhere'
+ "elsewhere"
end
end
@@ -1709,11 +1709,11 @@ dependencies: []
refute_empty @ext.extensions
- expected = File.join @tempdir, 'elsewhere', @ext.full_name
+ expected = File.join @tempdir, "elsewhere", @ext.full_name
assert_equal expected, @ext.extension_dir
ensure
- RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
+ RbConfig::CONFIG["ENABLE_SHARED"] = enable_shared
class << Gem
remove_method :default_ext_dir_for
@@ -1803,9 +1803,9 @@ dependencies: []
end
def test_for_cache
- @a2.add_runtime_dependency 'b', '1'
+ @a2.add_runtime_dependency "b", "1"
@a2.dependencies.first.instance_variable_set :@type, nil
- @a2.required_rubygems_version = Gem::Requirement.new '> 0'
+ @a2.required_rubygems_version = Gem::Requirement.new "> 0"
@a2.test_files = %w[test/test_b.rb]
refute_empty @a2.files
@@ -1821,11 +1821,11 @@ dependencies: []
end
def test_full_gem_path
- assert_equal File.join(@gemhome, 'gems', @a1.full_name), @a1.full_gem_path
+ assert_equal File.join(@gemhome, "gems", @a1.full_name), @a1.full_gem_path
- @a1.original_platform = 'mswin32'
+ @a1.original_platform = "mswin32"
- assert_equal File.join(@gemhome, 'gems', @a1.original_name),
+ assert_equal File.join(@gemhome, "gems", @a1.original_name),
@a1.full_gem_path
end
@@ -1838,40 +1838,40 @@ dependencies: []
end
def test_full_name
- assert_equal 'a-1', @a1.full_name
+ assert_equal "a-1", @a1.full_name
@a1 = Gem::Specification.new "a", 1
- @a1.platform = Gem::Platform.new ['universal', 'darwin', nil]
- assert_equal 'a-1-universal-darwin', @a1.full_name
+ @a1.platform = Gem::Platform.new ["universal", "darwin", nil]
+ assert_equal "a-1-universal-darwin", @a1.full_name
@a1 = Gem::Specification.new "a", 1
- @a1.instance_variable_set :@new_platform, 'mswin32'
- assert_equal 'a-1-mswin32', @a1.full_name, 'legacy'
+ @a1.instance_variable_set :@new_platform, "mswin32"
+ assert_equal "a-1-mswin32", @a1.full_name, "legacy"
return if win_platform?
@a1 = Gem::Specification.new "a", 1
- @a1.platform = 'current'
- assert_equal 'a-1-x86-darwin-8', @a1.full_name
+ @a1.platform = "current"
+ assert_equal "a-1-x86-darwin-8", @a1.full_name
end
def test_full_name_windows
test_cases = {
- 'i386-mswin32' => 'a-1-x86-mswin32-60',
- 'i386-mswin32_80' => 'a-1-x86-mswin32-80',
- 'i386-mingw32' => 'a-1-x86-mingw32',
+ "i386-mswin32" => "a-1-x86-mswin32-60",
+ "i386-mswin32_80" => "a-1-x86-mswin32-80",
+ "i386-mingw32" => "a-1-x86-mingw32",
}
test_cases.each do |arch, expected|
@a1 = Gem::Specification.new "a", 1
util_set_arch arch
- @a1.platform = 'current'
+ @a1.platform = "current"
assert_equal expected, @a1.full_name
end
end
def test_gem_build_complete_path
- expected = File.join @a1.extension_dir, 'gem.build_complete'
+ expected = File.join @a1.extension_dir, "gem.build_complete"
assert_equal expected, @a1.gem_build_complete_path
end
@@ -1915,23 +1915,23 @@ dependencies: []
end
def test_license
- assert_equal 'MIT', @a1.license
+ assert_equal "MIT", @a1.license
end
def test_licenses
- assert_equal ['MIT'], @a1.licenses
+ assert_equal ["MIT"], @a1.licenses
end
def test_name
- assert_equal 'a', @a1.name
+ assert_equal "a", @a1.name
end
def test_original_name
- assert_equal 'a-1', @a1.full_name
+ assert_equal "a-1", @a1.full_name
- @a1.platform = 'i386-linux'
- @a1.instance_variable_set :@original_platform, 'i386-linux'
- assert_equal 'a-1-i386-linux', @a1.original_name
+ @a1.platform = "i386-linux"
+ @a1.instance_variable_set :@original_platform, "i386-linux"
+ assert_equal "a-1-i386-linux", @a1.original_name
end
def test_platform
@@ -1960,10 +1960,10 @@ dependencies: []
assert_equal Gem::Platform::RUBY, @a1.platform
test_cases = {
- 'i386-mswin32' => ['x86', 'mswin32', '60'],
- 'i386-mswin32_80' => ['x86', 'mswin32', '80'],
- 'i386-mingw32' => ['x86', 'mingw32', nil ],
- 'x86-darwin8' => ['x86', 'darwin', '8' ],
+ "i386-mswin32" => ["x86", "mswin32", "60"],
+ "i386-mswin32_80" => ["x86", "mswin32", "80"],
+ "i386-mingw32" => ["x86", "mingw32", nil ],
+ "x86-darwin8" => ["x86", "darwin", "8" ],
}
test_cases.each do |arch, expected|
@@ -1980,29 +1980,29 @@ dependencies: []
end
def test_platform_equals_legacy
- @a1.platform = 'mswin32'
- assert_equal Gem::Platform.new('x86-mswin32'), @a1.platform
+ @a1.platform = "mswin32"
+ assert_equal Gem::Platform.new("x86-mswin32"), @a1.platform
- @a1.platform = 'i586-linux'
- assert_equal Gem::Platform.new('x86-linux'), @a1.platform
+ @a1.platform = "i586-linux"
+ assert_equal Gem::Platform.new("x86-linux"), @a1.platform
- @a1.platform = 'powerpc-darwin'
- assert_equal Gem::Platform.new('ppc-darwin'), @a1.platform
+ @a1.platform = "powerpc-darwin"
+ assert_equal Gem::Platform.new("ppc-darwin"), @a1.platform
end
def test_prerelease_spec_adds_required_rubygems_version
- @prerelease = util_spec('tardis', '2.2.0.a')
- refute @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new('1.3.1'))
- assert @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new('1.4.0'))
+ @prerelease = util_spec("tardis", "2.2.0.a")
+ refute @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new("1.3.1"))
+ assert @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new("1.4.0"))
end
def test_require_paths
- enable_shared 'no' do
+ enable_shared "no" do
ext_spec
- @ext.require_paths = 'lib'
+ @ext.require_paths = "lib"
- assert_equal [@ext.extension_dir, 'lib'], @ext.require_paths
+ assert_equal [@ext.extension_dir, "lib"], @ext.require_paths
end
end
@@ -2014,15 +2014,15 @@ dependencies: []
end
def Gem.default_ext_dir_for(base_dir)
- '/foo'
+ "/foo"
end
- enable_shared 'no' do
+ enable_shared "no" do
ext_spec
- @ext.require_paths = 'lib'
+ @ext.require_paths = "lib"
- assert_equal [File.expand_path('/foo/ext-1'), 'lib'], @ext.require_paths
+ assert_equal [File.expand_path("/foo/ext-1"), "lib"], @ext.require_paths
end
ensure
class << Gem
@@ -2040,7 +2040,7 @@ dependencies: []
ext_spec
@ext.require_paths = %w[lib ext foo]
- @ext.extensions << 'bar/baz'
+ @ext.extensions << "bar/baz"
expected = %w[
lib
@@ -2055,10 +2055,10 @@ dependencies: []
def test_full_require_paths
ext_spec
- @ext.require_paths = 'lib'
+ @ext.require_paths = "lib"
expected = [
- File.join(@gemhome, 'gems', @ext.original_name, 'lib'),
+ File.join(@gemhome, "gems", @ext.original_name, "lib"),
@ext.extension_dir,
]
@@ -2068,10 +2068,10 @@ dependencies: []
def test_to_fullpath
ext_spec
- @ext.require_paths = 'lib'
+ @ext.require_paths = "lib"
- dir = File.join(@gemhome, 'gems', @ext.original_name, 'lib')
- expected_rb = File.join(dir, 'code.rb')
+ dir = File.join(@gemhome, "gems", @ext.original_name, "lib")
+ expected_rb = File.join(dir, "code.rb")
FileUtils.mkdir_p dir
FileUtils.touch expected_rb
@@ -2105,10 +2105,10 @@ dependencies: []
def test_fullpath_return_rb_extension_file_when_exist_the_same_name_file
ext_spec
- @ext.require_paths = 'lib'
+ @ext.require_paths = "lib"
- dir = File.join(@gemhome, 'gems', @ext.original_name, 'lib')
- expected_rb = File.join(dir, 'code.rb')
+ dir = File.join(@gemhome, "gems", @ext.original_name, "lib")
+ expected_rb = File.join(dir, "code.rb")
FileUtils.mkdir_p dir
FileUtils.touch expected_rb
@@ -2160,12 +2160,12 @@ dependencies: []
end
def test_requirements
- assert_equal ['A working computer'], @a1.requirements
+ assert_equal ["A working computer"], @a1.requirements
end
def test_allowed_push_host
- assert_nil @a1.metadata['allowed_push_host']
- assert_equal 'https://privategemserver.com', @a3.metadata['allowed_push_host']
+ assert_nil @a1.metadata["allowed_push_host"]
+ assert_equal "https://privategemserver.com", @a3.metadata["allowed_push_host"]
end
def test_runtime_dependencies_legacy
@@ -2181,8 +2181,8 @@ dependencies: []
end
def test_spaceship_name
- s1 = util_spec 'a', '1'
- s2 = util_spec 'b', '1'
+ s1 = util_spec "a", "1"
+ s2 = util_spec "b", "1"
assert_equal(-1, (s1 <=> s2))
assert_equal(0, (s1 <=> s1))
@@ -2190,9 +2190,9 @@ dependencies: []
end
def test_spaceship_platform
- s1 = util_spec 'a', '1'
- s2 = util_spec 'a', '1' do |s|
- s.platform = Gem::Platform.new 'x86-my_platform1'
+ s1 = util_spec "a", "1"
+ s2 = util_spec "a", "1" do |s|
+ s.platform = Gem::Platform.new "x86-my_platform1"
end
assert_equal(-1, (s1 <=> s2))
@@ -2201,8 +2201,8 @@ dependencies: []
end
def test_spaceship_version
- s1 = util_spec 'a', '1'
- s2 = util_spec 'a', '2'
+ s1 = util_spec "a", "1"
+ s2 = util_spec "a", "2"
assert_equal(-1, (s1 <=> s2))
assert_equal(0, (s1 <=> s1))
@@ -2210,25 +2210,25 @@ dependencies: []
end
def test_spec_file
- assert_equal File.join(@gemhome, 'specifications', 'a-1.gemspec'),
+ assert_equal File.join(@gemhome, "specifications", "a-1.gemspec"),
@a1.spec_file
end
def test_spec_name
- assert_equal 'a-1.gemspec', @a1.spec_name
+ assert_equal "a-1.gemspec", @a1.spec_name
end
def test_summary
- assert_equal 'this is a summary', @a1.summary
+ assert_equal "this is a summary", @a1.summary
end
def test_test_files
- @a1.test_file = 'test/suite.rb'
- assert_equal ['test/suite.rb'], @a1.test_files
+ @a1.test_file = "test/suite.rb"
+ assert_equal ["test/suite.rb"], @a1.test_files
end
def test_runtime_predicate_true
- @a2.add_runtime_dependency 'b', '1'
+ @a2.add_runtime_dependency "b", "1"
assert_predicate @a2.dependencies.first, :runtime?
@a2.dependencies.first.instance_variable_set :@type, nil
@@ -2236,15 +2236,15 @@ dependencies: []
end
def test_runtime_predicate_false
- @a2.add_development_dependency 'b', '1'
+ @a2.add_development_dependency "b", "1"
refute_predicate @a2.dependencies.first, :runtime?
end
def test_to_ruby
- @a2.add_runtime_dependency 'b', '1'
+ @a2.add_runtime_dependency "b", "1"
@a2.dependencies.first.instance_variable_set :@type, nil
- @a2.required_rubygems_version = Gem::Requirement.new '> 0'
- @a2.require_paths << 'other'
+ @a2.required_rubygems_version = Gem::Requirement.new "> 0"
+ @a2.require_paths << "other"
ruby_code = @a2.to_ruby
@@ -2287,8 +2287,8 @@ end
end
def test_to_ruby_with_rsa_key
- require 'rubygems/openssl'
- pend 'openssl is missing' unless defined?(OpenSSL::PKey::RSA)
+ require "rubygems/openssl"
+ pend "openssl is missing" unless defined?(OpenSSL::PKey::RSA)
rsa_key = OpenSSL::PKey::RSA.new(2048)
@a2.signing_key = rsa_key
@@ -2319,9 +2319,9 @@ end
end
def test_to_ruby_for_cache
- @a2.add_runtime_dependency 'b', '1'
+ @a2.add_runtime_dependency "b", "1"
@a2.dependencies.first.instance_variable_set :@type, nil
- @a2.required_rubygems_version = Gem::Requirement.new '> 0'
+ @a2.required_rubygems_version = Gem::Requirement.new "> 0"
@a2.installed_by_version = Gem.rubygems_version
# cached specs do not have spec.files populated:
@@ -2430,8 +2430,8 @@ end
end
def test_to_ruby_keeps_requirements_as_originally_specified
- spec = util_spec 'a', '1' do |s|
- s.add_dependency 'b', ['~> 1.0', '>= 1.0.0']
+ spec = util_spec "a", "1" do |s|
+ s.add_dependency "b", ["~> 1.0", ">= 1.0.0"]
end
assert_includes spec.to_ruby, '"~> 1.0", ">= 1.0.0"'
@@ -2460,13 +2460,13 @@ end
def test_to_ruby_platform
@a2.platform = Gem::Platform.local
- @a2.instance_variable_set :@original_platform, 'old_platform'
+ @a2.instance_variable_set :@original_platform, "old_platform"
ruby_code = @a2.to_ruby
same_spec = eval ruby_code
- assert_equal 'old_platform', same_spec.original_platform
+ assert_equal "old_platform", same_spec.original_platform
end
def test_to_yaml
@@ -2491,21 +2491,21 @@ end
end
def test_to_yaml_platform_empty_string
- @a1.instance_variable_set :@original_platform, ''
+ @a1.instance_variable_set :@original_platform, ""
assert_match %r{^platform: ruby$}, @a1.to_yaml
end
def test_to_yaml_platform_legacy
- @a1.platform = 'powerpc-darwin7.9.0'
- @a1.instance_variable_set :@original_platform, 'powerpc-darwin7.9.0'
+ @a1.platform = "powerpc-darwin7.9.0"
+ @a1.instance_variable_set :@original_platform, "powerpc-darwin7.9.0"
yaml_str = @a1.to_yaml
same_spec = load_yaml yaml_str
- assert_equal Gem::Platform.new('powerpc-darwin7'), same_spec.platform
- assert_equal 'powerpc-darwin7.9.0', same_spec.original_platform
+ assert_equal Gem::Platform.new("powerpc-darwin7"), same_spec.platform
+ assert_equal "powerpc-darwin7.9.0", same_spec.original_platform
end
def test_to_yaml_platform_nil
@@ -2522,7 +2522,7 @@ end
end
end
- def x(s); s.gsub(/xxx/, ''); end
+ def x(s); s.gsub(/xxx/, ""); end
def w; x "WARxxxNING"; end
def t; x "TOxxxDO"; end
def f; x "FxxxIXME"; end
@@ -2537,7 +2537,7 @@ end
@a1.validate
end
- assert_match "#{w}: no author specified\n", @ui.error, 'error'
+ assert_match "#{w}: no author specified\n", @ui.error, "error"
@a1.authors = [Object.new]
@@ -2571,14 +2571,14 @@ end
util_setup_validate
Dir.chdir @tempdir do
- @a1.autorequire = 'code'
+ @a1.autorequire = "code"
use_ui @ui do
@a1.validate
end
assert_match "#{w}: deprecated autorequire specified\n",
- @ui.error, 'error'
+ @ui.error, "error"
end
end
@@ -2586,19 +2586,19 @@ end
util_setup_validate
Dir.chdir @tempdir do
- @a1.add_runtime_dependency 'b', '>= 1.0.rc1'
- @a1.add_development_dependency 'c', '>= 2.0.rc2'
- @a1.add_runtime_dependency 'd', '~> 1.2.3'
- @a1.add_runtime_dependency 'e', '~> 1.2.3.4'
- @a1.add_runtime_dependency 'g', '~> 1.2.3', '>= 1.2.3.4'
- @a1.add_runtime_dependency 'h', '>= 1.2.3', '<= 2'
- @a1.add_runtime_dependency 'i', '>= 1.2'
- @a1.add_runtime_dependency 'j', '>= 1.2.3'
- @a1.add_runtime_dependency 'k', '> 1.2'
- @a1.add_runtime_dependency 'l', '> 1.2.3'
- @a1.add_runtime_dependency 'm', '~> 2.1.0'
- @a1.add_runtime_dependency 'n', '~> 0.1.0'
- @a1.add_runtime_dependency 'o'
+ @a1.add_runtime_dependency "b", ">= 1.0.rc1"
+ @a1.add_development_dependency "c", ">= 2.0.rc2"
+ @a1.add_runtime_dependency "d", "~> 1.2.3"
+ @a1.add_runtime_dependency "e", "~> 1.2.3.4"
+ @a1.add_runtime_dependency "g", "~> 1.2.3", ">= 1.2.3.4"
+ @a1.add_runtime_dependency "h", ">= 1.2.3", "<= 2"
+ @a1.add_runtime_dependency "i", ">= 1.2"
+ @a1.add_runtime_dependency "j", ">= 1.2.3"
+ @a1.add_runtime_dependency "k", "> 1.2"
+ @a1.add_runtime_dependency "l", "> 1.2.3"
+ @a1.add_runtime_dependency "m", "~> 2.1.0"
+ @a1.add_runtime_dependency "n", "~> 0.1.0"
+ @a1.add_runtime_dependency "o"
use_ui @ui do
@a1.validate
@@ -2624,7 +2624,7 @@ end
#{w}: See https://guides.rubygems.org/specification-reference/ for help
EXPECTED
- assert_equal expected, @ui.error, 'warning'
+ assert_equal expected, @ui.error, "warning"
end
end
@@ -2632,10 +2632,10 @@ end
util_setup_validate
Dir.chdir @tempdir do
- @a1.add_runtime_dependency 'b', '~> 1.2'
- @a1.add_runtime_dependency 'b', '>= 1.2.3'
- @a1.add_development_dependency 'c', '~> 1.2'
- @a1.add_development_dependency 'c', '>= 1.2.3'
+ @a1.add_runtime_dependency "b", "~> 1.2"
+ @a1.add_runtime_dependency "b", ">= 1.2.3"
+ @a1.add_development_dependency "c", "~> 1.2"
+ @a1.add_development_dependency "c", ">= 1.2.3"
use_ui @ui do
e = assert_raise Gem::InvalidSpecificationException do
@@ -2662,14 +2662,14 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
util_setup_validate
Dir.chdir @tempdir do
- @a1.add_runtime_dependency 'b', '~> 1.2'
- @a1.add_development_dependency 'b', '= 1.2.3'
+ @a1.add_runtime_dependency "b", "~> 1.2"
+ @a1.add_development_dependency "b", "= 1.2.3"
use_ui @ui do
@a1.validate
end
- assert_equal '', @ui.error, 'warning'
+ assert_equal "", @ui.error, "warning"
end
end
@@ -2677,14 +2677,14 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
util_setup_validate
Dir.chdir @tempdir do
- @a1.version = '1.0.0.beta.1'
- @a1.add_runtime_dependency 'b', '~> 1.2.0.beta.1'
+ @a1.version = "1.0.0.beta.1"
+ @a1.add_runtime_dependency "b", "~> 1.2.0.beta.1"
use_ui @ui do
@a1.validate
end
- assert_equal '', @ui.error, 'warning'
+ assert_equal "", @ui.error, "warning"
end
end
@@ -2692,8 +2692,8 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
util_setup_validate
Dir.chdir @tempdir do
- @a1.extensions = ['Rakefile']
- File.write File.join(@tempdir, 'Rakefile'), ''
+ @a1.extensions = ["Rakefile"]
+ File.write File.join(@tempdir, "Rakefile"), ""
use_ui @ui do
@a1.validate
@@ -2707,9 +2707,9 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
util_setup_validate
Dir.chdir @tempdir do
- @a1.extensions = ['Rakefile']
- @a1.add_runtime_dependency 'rake'
- File.write File.join(@tempdir, 'Rakefile'), ''
+ @a1.extensions = ["Rakefile"]
+ @a1.add_runtime_dependency "rake"
+ File.write File.join(@tempdir, "Rakefile"), ""
use_ui @ui do
@a1.validate
@@ -2723,7 +2723,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
util_setup_validate
Dir.chdir @tempdir do
- @a1.description = ''
+ @a1.description = ""
use_ui @ui do
@a1.validate
@@ -2813,7 +2813,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
Gem::Specification.new.validate
end
- assert_equal 'missing value for attribute name', e.message
+ assert_equal "missing value for attribute name", e.message
end
def test_validate_error
@@ -2823,15 +2823,15 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
end
end
- assert_match 'See https://guides.rubygems.org/specification-reference/ for help', @ui.error
+ assert_match "See https://guides.rubygems.org/specification-reference/ for help", @ui.error
end
def test_validate_executables
util_setup_validate
- FileUtils.mkdir_p File.join(@tempdir, 'bin')
- File.write File.join(@tempdir, 'bin', 'exec'), ''
- FileUtils.mkdir_p File.join(@tempdir, 'exec')
+ FileUtils.mkdir_p File.join(@tempdir, "bin")
+ File.write File.join(@tempdir, "bin", "exec"), ""
+ FileUtils.mkdir_p File.join(@tempdir, "exec")
use_ui @ui do
Dir.chdir @tempdir do
@@ -2841,13 +2841,13 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
assert_equal %w[exec], @a1.executables
- assert_equal '', @ui.output, 'output'
- assert_match "#{w}: bin/exec is missing #! line\n", @ui.error, 'error'
+ assert_equal "", @ui.output, "output"
+ assert_match "#{w}: bin/exec is missing #! line\n", @ui.error, "error"
end
def test_validate_empty_require_paths
if win_platform?
- pend 'test_validate_empty_require_paths skipped on MS Windows (symlink)'
+ pend "test_validate_empty_require_paths skipped on MS Windows (symlink)"
else
util_setup_validate
@@ -2856,26 +2856,26 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
@a1.validate
end
- assert_equal 'specification must have at least one require_path',
+ assert_equal "specification must have at least one require_path",
e.message
end
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 win_platform?
util_setup_validate
- @a1.files += ['lib', 'lib2']
- @a1.extensions << 'ext/a/extconf.rb'
+ @a1.files += ["lib", "lib2"]
+ @a1.extensions << "ext/a/extconf.rb"
Dir.chdir @tempdir do
- FileUtils.ln_s 'lib/code.rb', 'lib2' unless vc_windows?
+ FileUtils.ln_s "lib/code.rb", "lib2" unless vc_windows?
use_ui @ui do
@a1.validate
end
- assert_match 'WARNING: lib2 is a symlink, which is not supported on all platforms', @ui.error
+ assert_match "WARNING: lib2 is a symlink, which is not supported on all platforms", @ui.error
end
assert_equal %w[bin/exec ext/a/extconf.rb lib/code.rb lib2 test/suite.rb].sort,
@@ -2981,19 +2981,19 @@ Please report a bug if this causes problems.
@a1.validate
end
- assert_match "#{w}: no homepage specified\n", @ui.error, 'error'
+ assert_match "#{w}: no homepage specified\n", @ui.error, "error"
@ui = Gem::MockGemUi.new
- @a1.homepage = ''
+ @a1.homepage = ""
use_ui @ui do
@a1.validate
end
- assert_match "#{w}: no homepage specified\n", @ui.error, 'error'
+ assert_match "#{w}: no homepage specified\n", @ui.error, "error"
- @a1.homepage = 'over at my cool site'
+ @a1.homepage = "over at my cool site"
e = assert_raise Gem::InvalidSpecificationException do
@a1.validate
@@ -3001,7 +3001,7 @@ Please report a bug if this causes problems.
assert_equal '"over at my cool site" is not a valid HTTP URI', e.message
- @a1.homepage = 'ftp://rubygems.org'
+ @a1.homepage = "ftp://rubygems.org"
e = assert_raise Gem::InvalidSpecificationException do
@a1.validate
@@ -3009,12 +3009,11 @@ Please report a bug if this causes problems.
assert_equal '"ftp://rubygems.org" is not a valid HTTP URI', e.message
- @a1.homepage = 'https://rubygems.org/'
+ @a1.homepage = "https://rubygems.org/"
assert_equal true, @a1.validate
- @a1.homepage = 'https://rubygems.org'
+ @a1.homepage = "https://rubygems.org"
assert_equal true, @a1.validate
-
end
end
@@ -3051,7 +3050,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
util_setup_validate
use_ui @ui do
- @a1.rubyforge_project = 'invalid-attribute'
+ @a1.rubyforge_project = "invalid-attribute"
@a1.validate
end
@@ -3062,7 +3061,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
util_setup_validate
use_ui @ui do
- @a1.licenses = ['BSD']
+ @a1.licenses = ["BSD"]
@a1.validate
end
@@ -3076,7 +3075,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
util_setup_validate
use_ui @ui do
- @a1.licenses = ['LicenseRef-LICENSE.md']
+ @a1.licenses = ["LicenseRef-LICENSE.md"]
@a1.validate
end
@@ -3087,7 +3086,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
util_setup_validate
use_ui @ui do
- @a1.licenses = ['GPL-2.0+']
+ @a1.licenses = ["GPL-2.0+"]
@a1.validate
end
@@ -3098,7 +3097,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
util_setup_validate
use_ui @ui do
- @a1.licenses = ['GPL-2.0-or-later']
+ @a1.licenses = ["GPL-2.0-or-later"]
@a1.validate
end
@@ -3109,7 +3108,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
util_setup_validate
use_ui @ui do
- @a1.licenses = ['GPL-2.0+ WITH Autoconf-exception-2.0']
+ @a1.licenses = ["GPL-2.0+ WITH Autoconf-exception-2.0"]
@a1.validate
end
@@ -3120,7 +3119,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
util_setup_validate
use_ui @ui do
- @a1.licenses = ['GPL-2.0+ FOO', 'GPL-2.0 FOO']
+ @a1.licenses = ["GPL-2.0+ FOO", "GPL-2.0 FOO"]
@a1.validate
end
@@ -3138,7 +3137,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
util_setup_validate
use_ui @ui do
- @a1.licenses = ['GPL-2.0+ WITH Autocofn-exception-2.0']
+ @a1.licenses = ["GPL-2.0+ WITH Autocofn-exception-2.0"]
@a1.validate
end
@@ -3152,7 +3151,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
util_setup_validate
use_ui @ui do
- @a1.licenses = ['ruby']
+ @a1.licenses = ["ruby"]
@a1.validate
end
@@ -3262,13 +3261,13 @@ Did you mean 'Ruby'?
end
def test_validate_permissions
- pend 'chmod not supported' if Gem.win_platform?
+ pend "chmod not supported" if Gem.win_platform?
util_setup_validate
Dir.chdir @tempdir do
- File.chmod 0640, File.join('lib', 'code.rb')
- File.chmod 0640, File.join('bin', 'exec')
+ File.chmod 0640, File.join("lib", "code.rb")
+ File.chmod 0640, File.join("bin", "exec")
use_ui @ui do
@a1.validate
@@ -3281,12 +3280,12 @@ Did you mean 'Ruby'?
end
def test_validate_permissions_of_missing_file_non_packaging
- pend 'chmod not supported' if Gem.win_platform?
+ pend "chmod not supported" if Gem.win_platform?
util_setup_validate
Dir.chdir @tempdir do
- File.delete File.join('lib', 'code.rb')
+ File.delete File.join("lib", "code.rb")
use_ui @ui do
assert @a1.validate(false)
@@ -3298,13 +3297,13 @@ Did you mean 'Ruby'?
util_setup_validate
Dir.chdir @tempdir do
- @a1.platform = 'mswin32'
+ @a1.platform = "mswin32"
assert @a1.validate
- @a1.platform = 'i586-linux'
+ @a1.platform = "i586-linux"
assert @a1.validate
- @a1.platform = 'powerpc-darwin'
+ @a1.platform = "powerpc-darwin"
assert @a1.validate
end
end
@@ -3325,7 +3324,7 @@ Did you mean 'Ruby'?
util_setup_validate
Dir.chdir @tempdir do
- @a1.specification_version = '1.0'
+ @a1.specification_version = "1.0"
e = assert_raise Gem::InvalidSpecificationException do
use_ui @ui do
@@ -3333,7 +3332,7 @@ Did you mean 'Ruby'?
end
end
- err = 'specification_version must be an Integer (did you mean version?)'
+ err = "specification_version must be an Integer (did you mean version?)"
assert_equal err, e.message
end
end
@@ -3342,13 +3341,13 @@ Did you mean 'Ruby'?
util_setup_validate
Dir.chdir @tempdir do
- @a1.summary = ''
+ @a1.summary = ""
use_ui @ui do
@a1.validate
end
- assert_match "#{w}: no summary specified\n", @ui.error, 'error'
+ assert_match "#{w}: no summary specified\n", @ui.error, "error"
@a1.summary = "#{f} (describe your package)"
@@ -3376,11 +3375,11 @@ Did you mean 'Ruby'?
@a1.validate
end
- assert_match 'See https://guides.rubygems.org/specification-reference/ for help', @ui.error
+ assert_match "See https://guides.rubygems.org/specification-reference/ for help", @ui.error
end
def test_version
- assert_equal Gem::Version.new('1'), @a1.version
+ assert_equal Gem::Version.new("1"), @a1.version
end
def test_version_change_reset_full_name
@@ -3426,22 +3425,22 @@ Did you mean 'Ruby'?
def test_latest_specs
spec_fetcher do |fetcher|
- fetcher.spec 'a', 1 do |s|
- s.platform = Gem::Platform.new 'x86-my_platform1'
+ fetcher.spec "a", 1 do |s|
+ s.platform = Gem::Platform.new "x86-my_platform1"
end
- fetcher.spec 'a', 2
+ fetcher.spec "a", 2
- fetcher.spec 'a', 2 do |s|
- s.platform = Gem::Platform.new 'x86-my_platform1'
+ fetcher.spec "a", 2 do |s|
+ s.platform = Gem::Platform.new "x86-my_platform1"
end
- fetcher.spec 'a', 2 do |s|
- s.platform = Gem::Platform.new 'x86-other_platform1'
+ fetcher.spec "a", 2 do |s|
+ s.platform = Gem::Platform.new "x86-other_platform1"
end
- fetcher.spec 'a', 3 do |s|
- s.platform = Gem::Platform.new 'x86-other_platform1'
+ fetcher.spec "a", 3 do |s|
+ s.platform = Gem::Platform.new "x86-other_platform1"
end
end
@@ -3458,7 +3457,7 @@ Did you mean 'Ruby'?
util_setup_validate
Dir.chdir @tempdir do
- @m1 = quick_gem 'm', '1' do |s|
+ @m1 = quick_gem "m", "1" do |s|
s.files = %w[lib/code.rb]
s.metadata = {
"one" => "two",
@@ -3478,7 +3477,7 @@ Did you mean 'Ruby'?
util_setup_validate
Dir.chdir @tempdir do
- @m2 = quick_gem 'm', '2' do |s|
+ @m2 = quick_gem "m", "2" do |s|
s.files = %w[lib/code.rb]
s.metadata = { 1 => "fail" }
end
@@ -3495,7 +3494,7 @@ Did you mean 'Ruby'?
util_setup_validate
Dir.chdir @tempdir do
- @m2 = quick_gem 'm', '2' do |s|
+ @m2 = quick_gem "m", "2" do |s|
s.files = %w[lib/code.rb]
s.metadata = { ("x" * 129) => "fail" }
end
@@ -3512,9 +3511,9 @@ Did you mean 'Ruby'?
util_setup_validate
Dir.chdir @tempdir do
- @m2 = quick_gem 'm', '2' do |s|
+ @m2 = quick_gem "m", "2" do |s|
s.files = %w[lib/code.rb]
- s.metadata = { 'fail' => [] }
+ s.metadata = { "fail" => [] }
end
e = assert_raise Gem::InvalidSpecificationException do
@@ -3529,9 +3528,9 @@ Did you mean 'Ruby'?
util_setup_validate
Dir.chdir @tempdir do
- @m2 = quick_gem 'm', '2' do |s|
+ @m2 = quick_gem "m", "2" do |s|
s.files = %w[lib/code.rb]
- s.metadata = { 'fail' => ("x" * 1025) }
+ s.metadata = { "fail" => ("x" * 1025) }
end
e = assert_raise Gem::InvalidSpecificationException do
@@ -3546,9 +3545,9 @@ Did you mean 'Ruby'?
util_setup_validate
Dir.chdir @tempdir do
- @m2 = quick_gem 'm', '2' do |s|
+ @m2 = quick_gem "m", "2" do |s|
s.files = %w[lib/code.rb]
- s.metadata = { 'homepage_uri' => 'http:/example.com' }
+ s.metadata = { "homepage_uri" => "http:/example.com" }
end
e = assert_raise Gem::InvalidSpecificationException do
@@ -3560,9 +3559,9 @@ Did you mean 'Ruby'?
end
def test_metadata_specs
- @m1 = quick_gem 'm', '1' do |s|
+ @m1 = quick_gem "m", "1" do |s|
s.files = %w[lib/code.rb]
- s.metadata = { 'one' => "two", 'two' => "three" }
+ s.metadata = { "one" => "two", "two" => "three" }
end
valid_ruby_spec = <<-EOF
@@ -3599,7 +3598,7 @@ end
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
FileUtils.mkdir_p File.dirname extconf_rb
- File.open extconf_rb, 'w' do |f|
+ File.open extconf_rb, "w" do |f|
f.write <<-'RUBY'
File.open 'Makefile', 'w' do |f|
f.puts "clean:\n\techo clean"
@@ -3615,8 +3614,8 @@ end
end
def test_missing_extensions_eh_default_gem
- spec = new_default_spec 'default', 1
- spec.extensions << 'extconf.rb'
+ spec = new_default_spec "default", 1
+ spec.extensions << "extconf.rb"
refute spec.missing_extensions?
end
@@ -3626,7 +3625,7 @@ end
end
def test_find_all_by_full_name
- pl = Gem::Platform.new 'i386-linux'
+ pl = Gem::Platform.new "i386-linux"
a1 = util_spec "a", "1"
a1_pre = util_spec "a", "1.0.0.pre.1"
@@ -3693,9 +3692,9 @@ end
install_specs a
- assert_equal a, Gem::Specification.find_by_path('foo')
+ assert_equal a, Gem::Specification.find_by_path("foo")
a.activate
- assert_equal a, Gem::Specification.find_by_path('foo')
+ assert_equal a, Gem::Specification.find_by_path("foo")
end
def test_find_inactive_by_path
@@ -3703,9 +3702,9 @@ end
install_specs a
- assert_equal a, Gem::Specification.find_inactive_by_path('foo')
+ assert_equal a, Gem::Specification.find_inactive_by_path("foo")
a.activate
- assert_nil Gem::Specification.find_inactive_by_path('foo')
+ assert_nil Gem::Specification.find_inactive_by_path("foo")
end
def test_load_default_gem
diff --git a/test/rubygems/test_gem_stream_ui.rb b/test/rubygems/test_gem_stream_ui.rb
index 04de6dd36a..3dbc346271 100644
--- a/test/rubygems/test_gem_stream_ui.rb
+++ b/test/rubygems/test_gem_stream_ui.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/user_interaction'
-require 'timeout'
+require_relative "helper"
+require "rubygems/user_interaction"
+require "timeout"
class TestGemStreamUI < Gem::TestCase
# increase timeout with MJIT for --jit-wait testing
@@ -100,14 +100,14 @@ class TestGemStreamUI < Gem::TestCase
@in.puts "1"
@in.rewind
- result = @sui.choose_from_list 'which one?', %w[foo bar]
+ result = @sui.choose_from_list "which one?", %w[foo bar]
- assert_equal ['foo', 0], result
+ assert_equal ["foo", 0], result
assert_equal "which one?\n 1. foo\n 2. bar\n> ", @out.string
end
def test_choose_from_list_EOF
- result = @sui.choose_from_list 'which one?', %w[foo bar]
+ result = @sui.choose_from_list "which one?", %w[foo bar]
assert_equal [nil, nil], result
assert_equal "which one?\n 1. foo\n 2. bar\n> ", @out.string
@@ -115,27 +115,27 @@ class TestGemStreamUI < Gem::TestCase
def test_progress_reporter_silent_nil
@cfg.verbose = nil
- reporter = @sui.progress_reporter 10, 'hi'
+ reporter = @sui.progress_reporter 10, "hi"
assert_kind_of Gem::StreamUI::SilentProgressReporter, reporter
end
def test_progress_reporter_silent_false
@cfg.verbose = false
- reporter = @sui.progress_reporter 10, 'hi'
+ reporter = @sui.progress_reporter 10, "hi"
assert_kind_of Gem::StreamUI::SilentProgressReporter, reporter
assert_equal "", @out.string
end
def test_progress_reporter_simple
@cfg.verbose = true
- reporter = @sui.progress_reporter 10, 'hi'
+ reporter = @sui.progress_reporter 10, "hi"
assert_kind_of Gem::StreamUI::SimpleProgressReporter, reporter
assert_equal "hi\n", @out.string
end
def test_progress_reporter_verbose
@cfg.verbose = 0
- reporter = @sui.progress_reporter 10, 'hi'
+ reporter = @sui.progress_reporter 10, "hi"
assert_kind_of Gem::StreamUI::VerboseProgressReporter, reporter
assert_equal "hi\n", @out.string
end
@@ -143,7 +143,7 @@ class TestGemStreamUI < Gem::TestCase
def test_download_reporter_silent_nil
@cfg.verbose = nil
reporter = @sui.download_reporter
- reporter.fetch 'a.gem', 1024
+ reporter.fetch "a.gem", 1024
assert_kind_of Gem::StreamUI::SilentDownloadReporter, reporter
assert_equal "", @out.string
end
@@ -151,7 +151,7 @@ class TestGemStreamUI < Gem::TestCase
def test_download_reporter_silent_false
@cfg.verbose = false
reporter = @sui.download_reporter
- reporter.fetch 'a.gem', 1024
+ reporter.fetch "a.gem", 1024
assert_kind_of Gem::StreamUI::SilentDownloadReporter, reporter
assert_equal "", @out.string
end
@@ -165,14 +165,14 @@ class TestGemStreamUI < Gem::TestCase
def test_threaded_download_reporter
@cfg.verbose = true
reporter = @sui.download_reporter
- reporter.fetch 'a.gem', 1024
+ reporter.fetch "a.gem", 1024
assert_equal "Fetching a.gem\n", @out.string
end
def test_verbose_download_reporter_progress
@cfg.verbose = true
reporter = @sui.download_reporter
- reporter.fetch 'a.gem', 1024
+ reporter.fetch "a.gem", 1024
reporter.update 512
assert_equal "Fetching a.gem\n", @out.string
end
@@ -180,7 +180,7 @@ class TestGemStreamUI < Gem::TestCase
def test_verbose_download_reporter_progress_once
@cfg.verbose = true
reporter = @sui.download_reporter
- reporter.fetch 'a.gem', 1024
+ reporter.fetch "a.gem", 1024
reporter.update 510
reporter.update 512
assert_equal "Fetching a.gem\n", @out.string
@@ -189,7 +189,7 @@ class TestGemStreamUI < Gem::TestCase
def test_verbose_download_reporter_progress_complete
@cfg.verbose = true
reporter = @sui.download_reporter
- reporter.fetch 'a.gem', 1024
+ reporter.fetch "a.gem", 1024
reporter.update 510
reporter.done
assert_equal "Fetching a.gem\n", @out.string
@@ -198,7 +198,7 @@ class TestGemStreamUI < Gem::TestCase
def test_verbose_download_reporter_progress_nil_length
@cfg.verbose = true
reporter = @sui.download_reporter
- reporter.fetch 'a.gem', nil
+ reporter.fetch "a.gem", nil
reporter.update 1024
reporter.done
assert_equal "Fetching a.gem\n", @out.string
@@ -207,7 +207,7 @@ class TestGemStreamUI < Gem::TestCase
def test_verbose_download_reporter_progress_zero_length
@cfg.verbose = true
reporter = @sui.download_reporter
- reporter.fetch 'a.gem', 0
+ reporter.fetch "a.gem", 0
reporter.update 1024
reporter.done
assert_equal "Fetching a.gem\n", @out.string
@@ -218,7 +218,7 @@ class TestGemStreamUI < Gem::TestCase
@cfg.verbose = true
reporter = @sui.download_reporter
- reporter.fetch 'a.gem', 1024
+ reporter.fetch "a.gem", 1024
assert_equal "", @out.string
end
end
diff --git a/test/rubygems/test_gem_stub_specification.rb b/test/rubygems/test_gem_stub_specification.rb
index e01d5cad8c..22a0b6bb6f 100644
--- a/test/rubygems/test_gem_stub_specification.rb
+++ b/test/rubygems/test_gem_stub_specification.rb
@@ -10,7 +10,7 @@ class TestStubSpecification < Gem::TestCase
super
@base_dir = __dir__
- @gems_dir = File.join __dir__, 'gem'
+ @gems_dir = File.join __dir__, "gem"
@foo = Gem::StubSpecification.gemspec_stub FOO, @base_dir, @gems_dir
end
@@ -25,24 +25,24 @@ class TestStubSpecification < Gem::TestCase
def test_initialize_extension
stub = stub_with_extension
- assert_equal 'stub_e', stub.name
+ assert_equal "stub_e", stub.name
assert_equal v(2), stub.version
assert_equal Gem::Platform::RUBY, stub.platform
- assert_equal [stub.extension_dir, 'lib'], stub.require_paths
+ assert_equal [stub.extension_dir, "lib"], stub.require_paths
assert_equal %w[ext/stub_e/extconf.rb], stub.extensions
end
def test_initialize_version
stub = stub_with_version
- assert_equal 'stub_v', stub.name
+ assert_equal "stub_v", stub.name
assert_equal v(2), stub.version
end
def test_initialize_with_empty_version
stub = stub_without_version
- assert_equal 'stub_v', stub.name
+ assert_equal "stub_v", stub.name
assert_equal v(0), stub.version
end
@@ -57,18 +57,18 @@ class TestStubSpecification < Gem::TestCase
def test_contains_requirable_file_eh
stub = stub_without_extension
- code_rb = File.join stub.gem_dir, 'lib', 'code.rb'
+ code_rb = File.join stub.gem_dir, "lib", "code.rb"
FileUtils.mkdir_p File.dirname code_rb
FileUtils.touch code_rb
- assert stub.contains_requirable_file? 'code'
+ assert stub.contains_requirable_file? "code"
end
def test_contains_requirable_file_eh_extension
pend "I guess making the stub match the running platform should work" if Gem.java_platform?
stub_with_extension do |stub|
_, err = capture_output do
- refute stub.contains_requirable_file? 'nonexistent'
+ refute stub.contains_requirable_file? "nonexistent"
end
expected = "Ignoring stub_e-2 because its extensions are not built. " +
@@ -82,7 +82,7 @@ class TestStubSpecification < Gem::TestCase
stub = stub_with_extension
expected = [
- File.join(stub.full_gem_path, 'lib'),
+ File.join(stub.full_gem_path, "lib"),
stub.extension_dir,
]
@@ -92,32 +92,32 @@ class TestStubSpecification < Gem::TestCase
def test_lib_dirs_glob
stub = stub_without_extension
- assert_equal File.join(stub.full_gem_path, 'lib'), stub.lib_dirs_glob
+ assert_equal File.join(stub.full_gem_path, "lib"), stub.lib_dirs_glob
end
def test_lib_dirs_glob_with_extension
stub = stub_with_extension
- assert_equal File.join(stub.full_gem_path, 'lib'), stub.lib_dirs_glob
+ assert_equal File.join(stub.full_gem_path, "lib"), stub.lib_dirs_glob
end
def test_matches_for_glob
stub = stub_without_extension
- code_rb = File.join stub.gem_dir, 'lib', 'code.rb'
+ code_rb = File.join stub.gem_dir, "lib", "code.rb"
FileUtils.mkdir_p File.dirname code_rb
FileUtils.touch code_rb
- assert_equal code_rb, stub.matches_for_glob('code*').first
+ assert_equal code_rb, stub.matches_for_glob("code*").first
end
def test_matches_for_glob_with_bundler_inline
stub = stub_with_extension
- code_rb = File.join stub.gem_dir, 'lib', 'code.rb'
+ code_rb = File.join stub.gem_dir, "lib", "code.rb"
FileUtils.mkdir_p File.dirname code_rb
FileUtils.touch code_rb
stub.stub(:raw_require_paths, nil) do
- assert_equal code_rb, stub.matches_for_glob('code*').first
+ assert_equal code_rb, stub.matches_for_glob("code*").first
end
end
@@ -127,7 +127,7 @@ class TestStubSpecification < Gem::TestCase
extconf_rb = File.join s.gem_dir, s.extensions.first
FileUtils.mkdir_p File.dirname extconf_rb
- File.open extconf_rb, 'w' do |f|
+ File.open extconf_rb, "w" do |f|
f.write <<-'RUBY'
File.open 'Makefile', 'w' do |f|
f.puts "clean:\n\techo clean"
@@ -146,10 +146,10 @@ class TestStubSpecification < Gem::TestCase
end
def test_missing_extensions_eh_default_gem
- spec = new_default_spec 'default', 1
- spec.extensions << 'extconf.rb'
+ spec = new_default_spec "default", 1
+ spec.extensions << "extconf.rb"
- File.open spec.loaded_from, 'w' do |io|
+ File.open spec.loaded_from, "w" do |io|
io.write spec.to_ruby_for_cache
end
@@ -167,7 +167,7 @@ class TestStubSpecification < Gem::TestCase
real_foo.activate
assert_equal @foo.version, Gem.loaded_specs[@foo.name].version,
- 'sanity check'
+ "sanity check"
assert_same real_foo, @foo.to_spec
end
@@ -181,8 +181,8 @@ class TestStubSpecification < Gem::TestCase
end
def stub_with_version
- spec = File.join @gemhome, 'specifications', 'stub_e-2.gemspec'
- File.open spec, 'w' do |io|
+ spec = File.join @gemhome, "specifications", "stub_e-2.gemspec"
+ File.open spec, "w" do |io|
io.write <<-STUB
# -*- encoding: utf-8 -*-
# stub: stub_v 2 ruby lib
@@ -195,7 +195,7 @@ end
io.flush
- stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, 'gems')
+ stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, "gems")
yield stub if block_given?
@@ -204,8 +204,8 @@ end
end
def stub_without_version
- spec = File.join @gemhome, 'specifications', 'stub-2.gemspec'
- File.open spec, 'w' do |io|
+ spec = File.join @gemhome, "specifications", "stub-2.gemspec"
+ File.open spec, "w" do |io|
io.write <<-STUB
# -*- encoding: utf-8 -*-
# stub: stub_v ruby lib
@@ -218,7 +218,7 @@ end
io.flush
- stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, 'gems')
+ stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, "gems")
yield stub if block_given?
@@ -227,8 +227,8 @@ end
end
def stub_with_extension
- spec = File.join @gemhome, 'specifications', 'stub_e-2.gemspec'
- File.open spec, 'w' do |io|
+ spec = File.join @gemhome, "specifications", "stub_e-2.gemspec"
+ File.open spec, "w" do |io|
io.write <<-STUB
# -*- encoding: utf-8 -*-
# stub: stub_e 2 ruby lib
@@ -244,7 +244,7 @@ end
io.flush
- stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, 'gems')
+ stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, "gems")
yield stub if block_given?
@@ -253,8 +253,8 @@ end
end
def stub_without_extension
- spec = File.join @gemhome, 'specifications', 'stub-2.gemspec'
- File.open spec, 'w' do |io|
+ spec = File.join @gemhome, "specifications", "stub-2.gemspec"
+ File.open spec, "w" do |io|
io.write <<-STUB
# -*- encoding: utf-8 -*-
# stub: stub 2 ruby lib
@@ -267,7 +267,7 @@ end
io.flush
- stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, 'gems')
+ stub = Gem::StubSpecification.gemspec_stub io.path, @gemhome, File.join(@gemhome, "gems")
yield stub if block_given?
diff --git a/test/rubygems/test_gem_text.rb b/test/rubygems/test_gem_text.rb
index f170fbf399..95cae1287c 100644
--- a/test/rubygems/test_gem_text.rb
+++ b/test/rubygems/test_gem_text.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
require "rubygems/text"
class TestGemText < Gem::TestCase
diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb
index 9e18972864..e81a9be0ff 100644
--- a/test/rubygems/test_gem_uninstaller.rb
+++ b/test/rubygems/test_gem_uninstaller.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'installer_test_case'
-require 'rubygems/uninstaller'
+require_relative "installer_test_case"
+require "rubygems/uninstaller"
class TestGemUninstaller < Gem::InstallerTestCase
def setup
@@ -23,14 +23,14 @@ class TestGemUninstaller < Gem::InstallerTestCase
end
def test_initialize_expand_path
- FileUtils.mkdir_p 'foo/bar'
- uninstaller = Gem::Uninstaller.new nil, :install_dir => 'foo//bar'
+ FileUtils.mkdir_p "foo/bar"
+ uninstaller = Gem::Uninstaller.new nil, :install_dir => "foo//bar"
assert_match %r{foo/bar$}, uninstaller.instance_variable_get(:@gem_home)
end
def test_ask_if_ok
- c = util_spec 'c'
+ c = util_spec "c"
uninstaller = Gem::Uninstaller.new nil
@@ -60,8 +60,8 @@ class TestGemUninstaller < Gem::InstallerTestCase
def test_remove_executables_force_keep
uninstaller = Gem::Uninstaller.new nil, :executables => false
- executable = File.join Gem.bindir(@user_spec.base_dir), 'executable'
- assert File.exist?(executable), 'executable not written'
+ executable = File.join Gem.bindir(@user_spec.base_dir), "executable"
+ assert File.exist?(executable), "executable not written"
use_ui @ui do
uninstaller.remove_executables @user_spec
@@ -75,8 +75,8 @@ class TestGemUninstaller < Gem::InstallerTestCase
def test_remove_executables_force_remove
uninstaller = Gem::Uninstaller.new nil, :executables => true
- executable = File.join Gem.bindir(@user_spec.base_dir), 'executable'
- assert File.exist?(executable), 'executable not written'
+ executable = File.join Gem.bindir(@user_spec.base_dir), "executable"
+ assert File.exist?(executable), "executable not written"
use_ui @ui do
uninstaller.remove_executables @user_spec
@@ -94,14 +94,14 @@ class TestGemUninstaller < Gem::InstallerTestCase
uninstaller.remove_executables @user_spec
end
- exec_path = File.join Gem.user_dir, 'bin', 'executable'
- refute File.exist?(exec_path), 'exec still exists in user bin dir'
+ exec_path = File.join Gem.user_dir, "bin", "executable"
+ refute File.exist?(exec_path), "exec still exists in user bin dir"
assert_equal "Removing executable\n", @ui.output
end
def test_remove_executables_user_format
- Gem::Installer.exec_format = 'foo-%s-bar'
+ Gem::Installer.exec_format = "foo-%s-bar"
uninstaller = Gem::Uninstaller.new nil, :executables => true, :format_executable => true
@@ -109,8 +109,8 @@ class TestGemUninstaller < Gem::InstallerTestCase
uninstaller.remove_executables @user_spec
end
- exec_path = File.join Gem.user_dir, 'bin', 'foo-executable-bar'
- assert_equal false, File.exist?(exec_path), 'removed exec from bin dir'
+ exec_path = File.join Gem.user_dir, "bin", "foo-executable-bar"
+ assert_equal false, File.exist?(exec_path), "removed exec from bin dir"
assert_equal "Removing foo-executable-bar\n", @ui.output
ensure
@@ -118,7 +118,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
end
def test_remove_executables_user_format_disabled
- Gem::Installer.exec_format = 'foo-%s-bar'
+ Gem::Installer.exec_format = "foo-%s-bar"
uninstaller = Gem::Uninstaller.new nil, :executables => true
@@ -126,8 +126,8 @@ class TestGemUninstaller < Gem::InstallerTestCase
uninstaller.remove_executables @user_spec
end
- exec_path = File.join Gem.user_dir, 'bin', 'executable'
- refute File.exist?(exec_path), 'removed exec from bin dir'
+ exec_path = File.join Gem.user_dir, "bin", "executable"
+ refute File.exist?(exec_path), "removed exec from bin dir"
assert_equal "Removing executable\n", @ui.output
ensure
@@ -171,7 +171,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
end
def test_remove_plugins
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "puts __FILE__"
end
@@ -179,16 +179,16 @@ class TestGemUninstaller < Gem::InstallerTestCase
Gem::Installer.at(Gem::Package.build(@spec), :force => true).install
- plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
- assert File.exist?(plugin_path), 'plugin not written'
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
+ assert File.exist?(plugin_path), "plugin not written"
Gem::Uninstaller.new(nil).remove_plugins @spec
- refute File.exist?(plugin_path), 'plugin not removed'
+ refute File.exist?(plugin_path), "plugin not removed"
end
def test_remove_plugins_with_install_dir
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "puts __FILE__"
end
@@ -196,17 +196,17 @@ class TestGemUninstaller < Gem::InstallerTestCase
Gem::Installer.at(Gem::Package.build(@spec), :force => true).install
- plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
- assert File.exist?(plugin_path), 'plugin not written'
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
+ assert File.exist?(plugin_path), "plugin not written"
Dir.mkdir "#{@gemhome}2"
Gem::Uninstaller.new(nil, :install_dir => "#{@gemhome}2").remove_plugins @spec
- assert File.exist?(plugin_path), 'plugin unintentionally removed'
+ assert File.exist?(plugin_path), "plugin unintentionally removed"
end
def test_regenerate_plugins_for
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "puts __FILE__"
end
@@ -214,13 +214,13 @@ class TestGemUninstaller < Gem::InstallerTestCase
Gem::Installer.at(Gem::Package.build(@spec), :force => true).install
- plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
- assert File.exist?(plugin_path), 'plugin not written'
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
+ assert File.exist?(plugin_path), "plugin not written"
FileUtils.rm plugin_path
Gem::Uninstaller.new(nil).regenerate_plugins_for @spec, Gem.plugindir
- assert File.exist?(plugin_path), 'plugin not regenerated'
+ assert File.exist?(plugin_path), "plugin not regenerated"
end
def test_path_ok_eh
@@ -234,7 +234,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
@spec.loaded_from = @spec.loaded_from.gsub @spec.full_name, '\&-legacy'
@spec.internal_init # blow out cache. but why did ^^ depend on cache?
- @spec.platform = 'legacy'
+ @spec.platform = "legacy"
assert_equal true, uninstaller.path_ok?(@gemhome, @spec)
end
@@ -248,16 +248,16 @@ class TestGemUninstaller < Gem::InstallerTestCase
def test_uninstall
uninstaller = Gem::Uninstaller.new @spec.name, :executables => true
- gem_dir = File.join @gemhome, 'gems', @spec.full_name
+ gem_dir = File.join @gemhome, "gems", @spec.full_name
Gem.pre_uninstall do
sleep(0.1) if win_platform?
- assert File.exist?(gem_dir), 'gem_dir should exist'
+ assert File.exist?(gem_dir), "gem_dir should exist"
end
Gem.post_uninstall do
sleep(0.1) if win_platform?
- refute File.exist?(gem_dir), 'gem_dir should not exist'
+ refute File.exist?(gem_dir), "gem_dir should not exist"
end
uninstaller.uninstall
@@ -269,7 +269,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
end
def test_uninstall_default_gem
- spec = new_default_spec 'default', '2'
+ spec = new_default_spec "default", "2"
install_default_gems spec
@@ -281,14 +281,14 @@ class TestGemUninstaller < Gem::InstallerTestCase
lines = @ui.output.split("\n")
- assert_equal 'Gem default-2 cannot be uninstalled because it is a default gem', lines.shift
+ assert_equal "Gem default-2 cannot be uninstalled because it is a default gem", lines.shift
end
def test_uninstall_default_gem_with_same_version
- default_spec = new_default_spec 'default', '2'
+ default_spec = new_default_spec "default", "2"
install_default_gems default_spec
- spec = util_spec 'default', '2'
+ spec = util_spec "default", "2"
install_gem spec
Gem::Specification.reset
@@ -308,8 +308,8 @@ class TestGemUninstaller < Gem::InstallerTestCase
end
def test_uninstall_extension
- @spec.extensions << 'extconf.rb'
- write_file File.join(@tempdir, 'extconf.rb') do |io|
+ @spec.extensions << "extconf.rb"
+ write_file File.join(@tempdir, "extconf.rb") do |io|
io.write <<-RUBY
require 'mkmf'
create_makefile '#{@spec.name}'
@@ -325,7 +325,7 @@ create_makefile '#{@spec.name}'
installer.install
end
- assert_path_exist @spec.extension_dir, 'sanity check'
+ assert_path_exist @spec.extension_dir, "sanity check"
uninstaller = Gem::Uninstaller.new @spec.name, :executables => true
uninstaller.uninstall
@@ -334,7 +334,7 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_nonexistent
- uninstaller = Gem::Uninstaller.new 'bogus', :executables => true
+ uninstaller = Gem::Uninstaller.new "bogus", :executables => true
e = assert_raise Gem::InstallError do
uninstaller.uninstall
@@ -344,17 +344,17 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_not_ok
- quick_gem 'z' do |s|
+ quick_gem "z" do |s|
s.add_runtime_dependency @spec.name
end
uninstaller = Gem::Uninstaller.new @spec.name
- gem_dir = File.join @gemhome, 'gems', @spec.full_name
- executable = File.join @gemhome, 'bin', 'executable'
+ gem_dir = File.join @gemhome, "gems", @spec.full_name
+ executable = File.join @gemhome, "bin", "executable"
- assert File.exist?(gem_dir), 'gem_dir must exist'
- assert File.exist?(executable), 'executable must exist'
+ assert File.exist?(gem_dir), "gem_dir must exist"
+ assert File.exist?(executable), "executable must exist"
ui = Gem::MockGemUi.new "n\n"
@@ -364,12 +364,12 @@ create_makefile '#{@spec.name}'
end
end
- assert File.exist?(gem_dir), 'gem_dir must still exist'
- assert File.exist?(executable), 'executable must still exist'
+ assert File.exist?(gem_dir), "gem_dir must still exist"
+ assert File.exist?(executable), "executable must still exist"
end
def test_uninstall_user_install
- @user_spec = Gem::Specification.find_by_name 'b'
+ @user_spec = Gem::Specification.find_by_name "b"
uninstaller = Gem::Uninstaller.new(@user_spec.name,
:executables => true,
@@ -414,9 +414,9 @@ create_makefile '#{@spec.name}'
def test_uninstall_selection
util_make_gems
- list = Gem::Specification.find_all_by_name 'a'
+ list = Gem::Specification.find_all_by_name "a"
- uninstaller = Gem::Uninstaller.new 'a'
+ uninstaller = Gem::Uninstaller.new "a"
ui = Gem::MockGemUi.new "1\ny\n"
@@ -424,39 +424,39 @@ create_makefile '#{@spec.name}'
uninstaller.uninstall
end
- updated_list = Gem::Specification.find_all_by_name('a')
+ updated_list = Gem::Specification.find_all_by_name("a")
assert_equal list.length - 1, updated_list.length
- assert_match ' 1. a-1', ui.output
- assert_match ' 2. a-2', ui.output
- assert_match ' 3. a-3.a', ui.output
- assert_match ' 4. All versions', ui.output
- assert_match 'uninstalled a-1', ui.output
+ assert_match " 1. a-1", ui.output
+ assert_match " 2. a-2", ui.output
+ assert_match " 3. a-3.a", ui.output
+ assert_match " 4. All versions", ui.output
+ assert_match "uninstalled a-1", ui.output
end
def test_uninstall_selection_greater_than_one
util_make_gems
- list = Gem::Specification.find_all_by_name('a')
+ list = Gem::Specification.find_all_by_name("a")
- uninstaller = Gem::Uninstaller.new('a')
+ uninstaller = Gem::Uninstaller.new("a")
use_ui Gem::MockGemUi.new("2\ny\n") do
uninstaller.uninstall
end
- updated_list = Gem::Specification.find_all_by_name('a')
+ updated_list = Gem::Specification.find_all_by_name("a")
assert_equal list.length - 1, updated_list.length
end
def test_uninstall_prompts_about_broken_deps
- quick_gem 'r', '1' do |s|
- s.add_dependency 'q', '= 1'
+ quick_gem "r", "1" do |s|
+ s.add_dependency "q", "= 1"
end
- quick_gem 'q', '1'
+ quick_gem "q", "1"
- un = Gem::Uninstaller.new('q')
+ un = Gem::Uninstaller.new("q")
ui = Gem::MockGemUi.new("y\n")
use_ui ui do
@@ -475,18 +475,18 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_only_lists_unsatisfied_deps
- quick_gem 'r', '1' do |s|
- s.add_dependency 'q', '~> 1.0'
+ quick_gem "r", "1" do |s|
+ s.add_dependency "q", "~> 1.0"
end
- quick_gem 'x', '1' do |s|
- s.add_dependency 'q', '= 1.0'
+ quick_gem "x", "1" do |s|
+ s.add_dependency "q", "= 1.0"
end
- quick_gem 'q', '1.0'
- quick_gem 'q', '1.1'
+ quick_gem "q", "1.0"
+ quick_gem "q", "1.1"
- un = Gem::Uninstaller.new('q', :version => "1.0")
+ un = Gem::Uninstaller.new("q", :version => "1.0")
ui = Gem::MockGemUi.new("y\n")
use_ui ui do
@@ -505,14 +505,14 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_doesnt_prompt_when_other_gem_satisfies_requirement
- quick_gem 'r', '1' do |s|
- s.add_dependency 'q', '~> 1.0'
+ quick_gem "r", "1" do |s|
+ s.add_dependency "q", "~> 1.0"
end
- quick_gem 'q', '1.0'
- quick_gem 'q', '1.1'
+ quick_gem "q", "1.0"
+ quick_gem "q", "1.1"
- un = Gem::Uninstaller.new('q', :version => "1.0")
+ un = Gem::Uninstaller.new("q", :version => "1.0")
ui = Gem::MockGemUi.new("y\n")
use_ui ui do
@@ -525,13 +525,13 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_doesnt_prompt_when_removing_a_dev_dep
- quick_gem 'r', '1' do |s|
- s.add_development_dependency 'q', '= 1.0'
+ quick_gem "r", "1" do |s|
+ s.add_development_dependency "q", "= 1.0"
end
- quick_gem 'q', '1.0'
+ quick_gem "q", "1.0"
- un = Gem::Uninstaller.new('q', :version => "1.0")
+ un = Gem::Uninstaller.new("q", :version => "1.0")
ui = Gem::MockGemUi.new("y\n")
use_ui ui do
@@ -544,13 +544,13 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_doesnt_prompt_and_raises_when_abort_on_dependent_set
- quick_gem 'r', '1' do |s|
- s.add_dependency 'q', '= 1'
+ quick_gem "r", "1" do |s|
+ s.add_dependency "q", "= 1"
end
- quick_gem 'q', '1'
+ quick_gem "q", "1"
- un = Gem::Uninstaller.new('q', :abort_on_dependent => true)
+ un = Gem::Uninstaller.new("q", :abort_on_dependent => true)
ui = Gem::MockGemUi.new("y\n")
assert_raise Gem::DependencyRemovalException do
@@ -561,13 +561,13 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_prompt_includes_dep_type
- quick_gem 'r', '1' do |s|
- s.add_development_dependency 'q', '= 1'
+ quick_gem "r", "1" do |s|
+ s.add_development_dependency "q", "= 1"
end
- quick_gem 'q', '1'
+ quick_gem "q", "1"
- un = Gem::Uninstaller.new('q', :check_dev => true)
+ un = Gem::Uninstaller.new("q", :check_dev => true)
ui = Gem::MockGemUi.new("y\n")
use_ui ui do
@@ -586,17 +586,17 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_prompt_only_lists_the_dependents_that_prevented_uninstallation
- quick_gem 'r', '1' do |s|
- s.add_development_dependency 'q', '= 1'
+ quick_gem "r", "1" do |s|
+ s.add_development_dependency "q", "= 1"
end
- quick_gem 's', '1' do |s|
- s.add_dependency 'q', '= 1'
+ quick_gem "s", "1" do |s|
+ s.add_dependency "q", "= 1"
end
- quick_gem 'q', '1'
+ quick_gem "q", "1"
- un = Gem::Uninstaller.new('q', :check_dev => false)
+ un = Gem::Uninstaller.new("q", :check_dev => false)
ui = Gem::MockGemUi.new("y\n")
use_ui ui do
@@ -633,42 +633,42 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_keeps_plugins_up_to_date
- write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
+ write_file File.join(@tempdir, "lib", "rubygems_plugin.rb") do |io|
io.write "puts __FILE__"
end
- plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
+ plugin_path = File.join Gem.plugindir, "a_plugin.rb"
- @spec.version = '1'
+ @spec.version = "1"
Gem::Installer.at(Gem::Package.build(@spec), :force => true).install
- refute File.exist?(plugin_path), 'version without plugin installed, but plugin written'
+ refute File.exist?(plugin_path), "version without plugin installed, but plugin written"
@spec.files += %w[lib/rubygems_plugin.rb]
- @spec.version = '2'
+ @spec.version = "2"
Gem::Installer.at(Gem::Package.build(@spec), :force => true).install
- assert File.exist?(plugin_path), 'version with plugin installed, but plugin not written'
- assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), 'written plugin has incorrect content'
+ assert File.exist?(plugin_path), "version with plugin installed, but plugin not written"
+ assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), "written plugin has incorrect content"
- @spec.version = '3'
+ @spec.version = "3"
Gem::Installer.at(Gem::Package.build(@spec), :force => true).install
- assert File.exist?(plugin_path), 'version with plugin installed, but plugin removed'
- assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), 'old version installed, but plugin updated'
+ assert File.exist?(plugin_path), "version with plugin installed, but plugin removed"
+ assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), "old version installed, but plugin updated"
- Gem::Uninstaller.new('a', :version => '1', :executables => true).uninstall
+ Gem::Uninstaller.new("a", :version => "1", :executables => true).uninstall
- assert File.exist?(plugin_path), 'plugin removed when old version uninstalled'
- assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), 'old version uninstalled, but plugin updated'
+ assert File.exist?(plugin_path), "plugin removed when old version uninstalled"
+ assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), "old version uninstalled, but plugin updated"
- Gem::Uninstaller.new('a', version: '3', :executables => true).uninstall
+ Gem::Uninstaller.new("a", version: "3", :executables => true).uninstall
- assert File.exist?(plugin_path), 'plugin removed when old version uninstalled and another version with plugin still present'
- assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), 'latest version uninstalled, but plugin not updated to previous version'
+ assert File.exist?(plugin_path), "plugin removed when old version uninstalled and another version with plugin still present"
+ assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), "latest version uninstalled, but plugin not updated to previous version"
- Gem::Uninstaller.new('a', version: '2', :executables => true).uninstall
+ Gem::Uninstaller.new("a", version: "2", :executables => true).uninstall
- refute File.exist?(plugin_path), 'last version uninstalled, but plugin still present'
+ refute File.exist?(plugin_path), "last version uninstalled, but plugin still present"
end
end
diff --git a/test/rubygems/test_gem_unsatisfiable_dependency_error.rb b/test/rubygems/test_gem_unsatisfiable_dependency_error.rb
index f9d30123f0..3ce98b3cdf 100644
--- a/test/rubygems/test_gem_unsatisfiable_dependency_error.rb
+++ b/test/rubygems/test_gem_unsatisfiable_dependency_error.rb
@@ -1,11 +1,11 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestGemUnsatisfiableDependencyError < Gem::TestCase
def setup
super
- @a_dep = dep 'a', '~> 1'
+ @a_dep = dep "a", "~> 1"
@req = Gem::Resolver::DependencyRequest.new @a_dep, nil
@@ -21,7 +21,7 @@ class TestGemUnsatisfiableDependencyError < Gem::TestCase
end
def test_name
- assert_equal 'a', @e.name
+ assert_equal "a", @e.name
end
def test_version
diff --git a/test/rubygems/test_gem_uri.rb b/test/rubygems/test_gem_uri.rb
index 7fe572518b..bcd7b3b2f0 100644
--- a/test/rubygems/test_gem_uri.rb
+++ b/test/rubygems/test_gem_uri.rb
@@ -1,5 +1,5 @@
-require_relative 'helper'
-require 'rubygems/uri'
+require_relative "helper"
+require "rubygems/uri"
class TestUri < Gem::TestCase
def test_to_s_not_string
@@ -31,9 +31,9 @@ class TestUri < Gem::TestCase
end
def test_redacted_does_not_modify_uri
- url = 'https://user:password@example.com'
+ url = "https://user:password@example.com"
uri = Gem::Uri.new(url)
- assert_equal 'https://user:REDACTED@example.com', uri.redacted.to_s
+ assert_equal "https://user:REDACTED@example.com", uri.redacted.to_s
assert_equal url, uri.to_s
end
end
diff --git a/test/rubygems/test_gem_uri_formatter.rb b/test/rubygems/test_gem_uri_formatter.rb
index a41c9238ad..bdc3f76a25 100644
--- a/test/rubygems/test_gem_uri_formatter.rb
+++ b/test/rubygems/test_gem_uri_formatter.rb
@@ -1,26 +1,26 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/uri_formatter'
+require_relative "helper"
+require "rubygems/uri_formatter"
class TestGemUriFormatter < Gem::TestCase
def test_normalize_uri
- assert_equal 'FILE://example/',
- Gem::UriFormatter.new('FILE://example/').normalize
- assert_equal 'FTP://example/',
- Gem::UriFormatter.new('FTP://example/').normalize
- assert_equal 'HTTP://example/',
- Gem::UriFormatter.new('HTTP://example/').normalize
- assert_equal 'HTTPS://example/',
- Gem::UriFormatter.new('HTTPS://example/').normalize
- assert_equal 'http://example/',
- Gem::UriFormatter.new('example/').normalize
+ assert_equal "FILE://example/",
+ Gem::UriFormatter.new("FILE://example/").normalize
+ assert_equal "FTP://example/",
+ Gem::UriFormatter.new("FTP://example/").normalize
+ assert_equal "HTTP://example/",
+ Gem::UriFormatter.new("HTTP://example/").normalize
+ assert_equal "HTTPS://example/",
+ Gem::UriFormatter.new("HTTPS://example/").normalize
+ assert_equal "http://example/",
+ Gem::UriFormatter.new("example/").normalize
end
def test_escape
- assert_equal 'a%40b%5Cc', Gem::UriFormatter.new('a@b\c').escape
+ assert_equal "a%40b%5Cc", Gem::UriFormatter.new('a@b\c').escape
end
def test_unescape
- assert_equal 'a@b\c', Gem::UriFormatter.new('a%40b%5Cc').unescape
+ assert_equal 'a@b\c', Gem::UriFormatter.new("a%40b%5Cc").unescape
end
end
diff --git a/test/rubygems/test_gem_util.rb b/test/rubygems/test_gem_util.rb
index e0db5c283d..04cb000f8d 100644
--- a/test/rubygems/test_gem_util.rb
+++ b/test/rubygems/test_gem_util.rb
@@ -1,11 +1,11 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/util'
+require_relative "helper"
+require "rubygems/util"
class TestGemUtil < Gem::TestCase
def test_class_popen
pend "popen with a block does not behave well on jruby" if Gem.java_platform?
- assert_equal "0\n", Gem::Util.popen(*ruby_with_rubygems_in_load_path, '-e', 'p 0')
+ assert_equal "0\n", Gem::Util.popen(*ruby_with_rubygems_in_load_path, "-e", "p 0")
assert_raise Errno::ECHILD do
Process.wait(-1)
@@ -16,7 +16,7 @@ class TestGemUtil < Gem::TestCase
pend if Gem.java_platform?
Gem::Deprecate.skip_during do
out, err = capture_output do
- Gem::Util.silent_system(*ruby_with_rubygems_in_load_path, '-e', 'puts "hello"; warn "hello"')
+ Gem::Util.silent_system(*ruby_with_rubygems_in_load_path, "-e", 'puts "hello"; warn "hello"')
end
assert_empty out
assert_empty err
@@ -24,35 +24,35 @@ class TestGemUtil < Gem::TestCase
end
def test_traverse_parents
- FileUtils.mkdir_p 'a/b/c'
+ FileUtils.mkdir_p "a/b/c"
- enum = Gem::Util.traverse_parents 'a/b/c'
+ enum = Gem::Util.traverse_parents "a/b/c"
- assert_equal File.join(@tempdir, 'a/b/c'), enum.next
- assert_equal File.join(@tempdir, 'a/b'), enum.next
- assert_equal File.join(@tempdir, 'a'), enum.next
+ assert_equal File.join(@tempdir, "a/b/c"), enum.next
+ assert_equal File.join(@tempdir, "a/b"), enum.next
+ assert_equal File.join(@tempdir, "a"), enum.next
loop { break if enum.next.nil? } # exhaust the enumerator
end
def test_traverse_parents_does_not_crash_on_permissions_error
- pend 'skipped on MS Windows (chmod has no effect)' if win_platform? || java_platform?
+ pend "skipped on MS Windows (chmod has no effect)" if win_platform? || java_platform?
- FileUtils.mkdir_p 'd/e/f'
+ FileUtils.mkdir_p "d/e/f"
# remove 'execute' permission from "e" directory and make it
# impossible to cd into it and its children
- FileUtils.chmod(0666, 'd/e')
+ FileUtils.chmod(0666, "d/e")
- pend 'skipped in root privilege' if Process.uid.zero?
+ pend "skipped in root privilege" if Process.uid.zero?
- paths = Gem::Util.traverse_parents('d/e/f').to_a
+ paths = Gem::Util.traverse_parents("d/e/f").to_a
- assert_equal File.join(@tempdir, 'd'), paths[0]
+ assert_equal File.join(@tempdir, "d"), paths[0]
assert_equal @tempdir, paths[1]
assert_equal File.realpath("..", @tempdir), paths[2]
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? || java_platform?
+ FileUtils.chmod(0775, "d/e") unless win_platform? || java_platform?
end
def test_linked_list_find
@@ -64,19 +64,19 @@ class TestGemUtil < Gem::TestCase
end
def test_glob_files_in_dir
- FileUtils.mkdir_p 'g'
- FileUtils.touch File.join('g', 'h.rb')
- FileUtils.touch File.join('g', 'i.rb')
+ FileUtils.mkdir_p "g"
+ FileUtils.touch File.join("g", "h.rb")
+ FileUtils.touch File.join("g", "i.rb")
expected_paths = [
- File.join(@tempdir, 'g/h.rb'),
- File.join(@tempdir, 'g/i.rb'),
+ File.join(@tempdir, "g/h.rb"),
+ File.join(@tempdir, "g/i.rb"),
]
- files_with_absolute_base = Gem::Util.glob_files_in_dir('*.rb', File.join(@tempdir, 'g'))
+ files_with_absolute_base = Gem::Util.glob_files_in_dir("*.rb", File.join(@tempdir, "g"))
assert_equal expected_paths.sort, files_with_absolute_base.sort
- files_with_relative_base = Gem::Util.glob_files_in_dir('*.rb', 'g')
+ files_with_relative_base = Gem::Util.glob_files_in_dir("*.rb", "g")
assert_equal expected_paths.sort, files_with_relative_base.sort
end
diff --git a/test/rubygems/test_gem_validator.rb b/test/rubygems/test_gem_validator.rb
index 8090776b4a..80109ab8ba 100644
--- a/test/rubygems/test_gem_validator.rb
+++ b/test/rubygems/test_gem_validator.rb
@@ -11,21 +11,21 @@ class TestGemValidator < Gem::TestCase
end
def test_alien
- @spec = quick_gem 'a' do |s|
+ @spec = quick_gem "a" do |s|
s.files = %w[lib/a.rb lib/b.rb]
end
util_build_gem @spec
- FileUtils.rm File.join(@spec.gem_dir, 'lib/b.rb')
- FileUtils.touch File.join(@spec.gem_dir, 'lib/c.rb')
+ FileUtils.rm File.join(@spec.gem_dir, "lib/b.rb")
+ FileUtils.touch File.join(@spec.gem_dir, "lib/c.rb")
- alien = @validator.alien 'a'
+ alien = @validator.alien "a"
expected = {
@spec.file_name => [
- Gem::Validator::ErrorData.new('lib/b.rb', 'Missing file'),
- Gem::Validator::ErrorData.new('lib/c.rb', 'Extra file'),
+ Gem::Validator::ErrorData.new("lib/b.rb", "Missing file"),
+ Gem::Validator::ErrorData.new("lib/c.rb", "Extra file"),
],
}
@@ -33,9 +33,9 @@ class TestGemValidator < Gem::TestCase
end
def test_alien_default
- new_default_spec 'c', 1, nil, 'lib/c.rb'
+ new_default_spec "c", 1, nil, "lib/c.rb"
- alien = @validator.alien 'c'
+ alien = @validator.alien "c"
assert_empty alien
end
diff --git a/test/rubygems/test_gem_version.rb b/test/rubygems/test_gem_version.rb
index f8066ecbb8..e907eabb34 100644
--- a/test/rubygems/test_gem_version.rb
+++ b/test/rubygems/test_gem_version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
require "rubygems/version"
class TestGemVersion < Gem::TestCase
@@ -36,8 +36,8 @@ class TestGemVersion < Gem::TestCase
assert_nil Gem::Version.create(nil)
assert_equal v("5.1"), Gem::Version.create("5.1")
- ver = '1.1'.freeze
- assert_equal v('1.1'), Gem::Version.create(ver)
+ ver = "1.1".freeze
+ assert_equal v("1.1"), Gem::Version.create(ver)
end
def test_class_correct
@@ -53,8 +53,8 @@ class TestGemVersion < Gem::TestCase
end
def test_class_new_subclass
- v1 = Gem::Version.new '1'
- v2 = V.new '1'
+ v1 = Gem::Version.new "1"
+ v2 = V.new "1"
refute_same v1, v2
end
@@ -120,10 +120,10 @@ class TestGemVersion < Gem::TestCase
assert_prerelease "22.1.50.0.d"
assert_prerelease "1.2.d.42"
- assert_prerelease '1.A'
+ assert_prerelease "1.A"
- assert_prerelease '1-1'
- assert_prerelease '1-a'
+ assert_prerelease "1-1"
+ assert_prerelease "1-a"
refute_prerelease "1.2.0"
refute_prerelease "2.9"
@@ -199,7 +199,7 @@ class TestGemVersion < Gem::TestCase
# modifying the segments of a version should not affect the segments of the cached version object
def test_segments
- v('9.8.7').segments[2] += 1
+ v("9.8.7").segments[2] += 1
refute_version_equal "9.8.8", "9.8.7"
assert_equal [9,8,7], v("9.8.7").segments
@@ -212,10 +212,10 @@ class TestGemVersion < Gem::TestCase
end
def test_frozen_version
- v = v('1.freeze.test').freeze
- assert_less_than v, v('1')
- assert_version_equal v('1'), v.release
- assert_version_equal v('2'), v.bump
+ v = v("1.freeze.test").freeze
+ assert_less_than v, v("1")
+ assert_version_equal v("1"), v.release
+ assert_version_equal v("2"), v.bump
end
# Asserts that +version+ is a prerelease.
diff --git a/test/rubygems/test_gem_version_option.rb b/test/rubygems/test_gem_version_option.rb
index 74d7979e3a..92945e1b08 100644
--- a/test/rubygems/test_gem_version_option.rb
+++ b/test/rubygems/test_gem_version_option.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/command'
-require 'rubygems/version_option'
+require_relative "helper"
+require "rubygems/command"
+require "rubygems/version_option"
class TestGemVersionOption < Gem::TestCase
def setup
super
- @cmd = Gem::Command.new 'dummy', 'dummy'
+ @cmd = Gem::Command.new "dummy", "dummy"
@cmd.extend Gem::VersionOption
end
@@ -43,8 +43,8 @@ class TestGemVersionOption < Gem::TestCase
expected = [
Gem::Platform::RUBY,
- Gem::Platform.new('x86-freebsd6'),
- Gem::Platform.new('x86-freebsd7'),
+ Gem::Platform.new("x86-freebsd6"),
+ Gem::Platform.new("x86-freebsd7"),
]
assert_equal expected, Gem.platforms
@@ -69,7 +69,7 @@ class TestGemVersionOption < Gem::TestCase
expected = [
Gem::Platform::RUBY,
- Gem::Platform.new('x86-freebsd6'),
+ Gem::Platform.new("x86-freebsd6"),
]
assert_equal expected, Gem.platforms
@@ -84,7 +84,7 @@ class TestGemVersionOption < Gem::TestCase
:args => [],
:explicit_prerelease => false,
:prerelease => false,
- :version => Gem::Requirement.new('> 1'),
+ :version => Gem::Requirement.new("> 1"),
}
assert_equal expected, @cmd.options
@@ -93,13 +93,13 @@ class TestGemVersionOption < Gem::TestCase
def test_version_option_compound
@cmd.add_version_option
- @cmd.handle_options ['--version', '< 1, > 0.9']
+ @cmd.handle_options ["--version", "< 1, > 0.9"]
expected = {
:args => [],
:explicit_prerelease => false,
:prerelease => false,
- :version => Gem::Requirement.new('< 1', '> 0.9'),
+ :version => Gem::Requirement.new("< 1", "> 0.9"),
}
assert_equal expected, @cmd.options
@@ -108,13 +108,13 @@ class TestGemVersionOption < Gem::TestCase
def test_multiple_version_operator_option_compound
@cmd.add_version_option
- @cmd.handle_options ['--version', '< 1', '--version', '> 0.9']
+ @cmd.handle_options ["--version", "< 1", "--version", "> 0.9"]
expected = {
:args => [],
:explicit_prerelease => false,
:prerelease => false,
- :version => Gem::Requirement.new('< 1', '> 0.9'),
+ :version => Gem::Requirement.new("< 1", "> 0.9"),
}
assert_equal expected, @cmd.options
@@ -130,7 +130,7 @@ class TestGemVersionOption < Gem::TestCase
:args => [],
:explicit_prerelease => true,
:prerelease => true,
- :version => Gem::Requirement.new('> 1'),
+ :version => Gem::Requirement.new("> 1"),
}
assert_equal expected, @cmd.options
@@ -145,7 +145,7 @@ class TestGemVersionOption < Gem::TestCase
:args => [],
:explicit_prerelease => false,
:prerelease => true,
- :version => Gem::Requirement.new('> 1.a'),
+ :version => Gem::Requirement.new("> 1.a"),
}
assert_equal expected, @cmd.options
@@ -156,7 +156,7 @@ class TestGemVersionOption < Gem::TestCase
:args => [],
:explicit_prerelease => false,
:prerelease => false,
- :version => Gem::Requirement.new('> 1'),
+ :version => Gem::Requirement.new("> 1"),
}
assert_equal expected, @cmd.options
diff --git a/test/rubygems/test_kernel.rb b/test/rubygems/test_kernel.rb
index 4efa7e075d..cced65fa50 100644
--- a/test/rubygems/test_kernel.rb
+++ b/test/rubygems/test_kernel.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestKernel < Gem::TestCase
def setup
@@ -19,76 +19,76 @@ class TestKernel < Gem::TestCase
end
def test_gem
- assert gem('a', '= 1'), "Should load"
+ assert gem("a", "= 1"), "Should load"
assert $:.any? {|p| %r{a-1/lib} =~ p }
end
def test_gem_default
- assert gem('a', '>= 0')
+ assert gem("a", ">= 0")
- assert_equal @a2, Gem.loaded_specs['a']
+ assert_equal @a2, Gem.loaded_specs["a"]
end
def test_gem_default_re_gem
- assert gem('a', '=1')
+ assert gem("a", "=1")
- refute gem('a', '>= 0')
+ refute gem("a", ">= 0")
- assert_equal @a1, Gem.loaded_specs['a']
+ assert_equal @a1, Gem.loaded_specs["a"]
end
def test_gem_re_gem_mismatch
- assert gem('a', '=1')
+ assert gem("a", "=1")
assert_raise Gem::LoadError do
- gem('a', '= 2')
+ gem("a", "= 2")
end
- assert_equal @a1, Gem.loaded_specs['a']
+ assert_equal @a1, Gem.loaded_specs["a"]
end
def test_gem_redundant
- assert gem('a', '= 1'), "Should load"
- refute gem('a', '= 1'), "Should not load"
+ assert gem("a", "= 1"), "Should load"
+ refute gem("a", "= 1"), "Should not load"
assert_equal 1, $:.select {|p| %r{a-1/lib} =~ p }.size
end
def test_gem_overlapping
- assert gem('a', '= 1'), "Should load"
- refute gem('a', '>= 1'), "Should not load"
+ assert gem("a", "= 1"), "Should load"
+ refute gem("a", ">= 1"), "Should not load"
assert_equal 1, $:.select {|p| %r{a-1/lib} =~ p }.size
end
def test_gem_prerelease
- quick_gem 'd', '1.1.a'
- refute gem('d', '>= 1'), 'release requirement must not load prerelease'
- assert gem('d', '>= 1.a'), 'prerelease requirement may load prerelease'
+ quick_gem "d", "1.1.a"
+ refute gem("d", ">= 1"), "release requirement must not load prerelease"
+ assert gem("d", ">= 1.a"), "prerelease requirement may load prerelease"
end
def test_gem_env_req
- ENV["GEM_REQUIREMENT_A"] = '~> 2.0'
- assert_raise(Gem::MissingSpecVersionError) { gem('a', '= 1') }
- assert gem('a', '> 1')
- assert_equal @a2, Gem.loaded_specs['a']
+ ENV["GEM_REQUIREMENT_A"] = "~> 2.0"
+ assert_raise(Gem::MissingSpecVersionError) { gem("a", "= 1") }
+ assert gem("a", "> 1")
+ assert_equal @a2, Gem.loaded_specs["a"]
end
def test_gem_conflicting
- assert gem('a', '= 1'), "Should load"
+ assert gem("a", "= 1"), "Should load"
ex = assert_raise Gem::LoadError do
- gem 'a', '= 2'
+ gem "a", "= 2"
end
assert_equal "can't activate a-2, already activated a-1", ex.message
assert_match(/activated a-1/, ex.message)
- assert_equal 'a', ex.name
+ assert_equal "a", ex.name
assert $:.any? {|p| %r{a-1/lib} =~ p }
refute $:.any? {|p| %r{a-2/lib} =~ p }
end
def test_gem_not_adding_bin
- assert gem('a', '= 1'), "Should load"
+ assert gem("a", "= 1"), "Should load"
refute $:.any? {|p| %r{a-1/bin} =~ p }
end
@@ -110,19 +110,19 @@ class TestKernel < Gem::TestCase
end
def test_gem_bundler
- quick_gem 'bundler', '1'
- quick_gem 'bundler', '2.a'
+ quick_gem "bundler", "1"
+ quick_gem "bundler", "2.a"
- assert gem('bundler')
+ assert gem("bundler")
assert $:.any? {|p| %r{bundler-1/lib} =~ p }
end
def test_gem_bundler_inferred_bundler_version
Gem::BundlerVersionFinder.stub(:bundler_version, Gem::Version.new("1")) do
- quick_gem 'bundler', '1'
- quick_gem 'bundler', '2.a'
+ quick_gem "bundler", "1"
+ quick_gem "bundler", "2.a"
- assert gem('bundler', '>= 0.a')
+ assert gem("bundler", ">= 0.a")
assert $:.any? {|p| %r{bundler-1/lib} =~ p }
end
end
diff --git a/test/rubygems/test_project_sanity.rb b/test/rubygems/test_project_sanity.rb
index 27b1f11d62..aff7c66413 100644
--- a/test/rubygems/test_project_sanity.rb
+++ b/test/rubygems/test_project_sanity.rb
@@ -5,7 +5,7 @@ require "open3"
class TestProjectSanity < Gem::TestCase
def test_manifest_is_up_to_date
- pend unless File.exist?(File.expand_path('../../Rakefile', __dir__))
+ pend unless File.exist?(File.expand_path("../../Rakefile", __dir__))
_, status = Open3.capture2e("rake check_manifest")
diff --git a/test/rubygems/test_remote_fetch_error.rb b/test/rubygems/test_remote_fetch_error.rb
index b9e58389d3..55c505d879 100644
--- a/test/rubygems/test_remote_fetch_error.rb
+++ b/test/rubygems/test_remote_fetch_error.rb
@@ -1,19 +1,19 @@
# frozen_string_literal: true
-require_relative 'helper'
+require_relative "helper"
class TestRemoteFetchError < Gem::TestCase
def test_password_redacted
- error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://user:secret@gemsource.org')
+ error = Gem::RemoteFetcher::FetchError.new("There was an error fetching", "https://user:secret@gemsource.org")
refute_match %r{secret}, error.to_s
end
def test_invalid_url
- error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://::gemsource.org')
- assert_equal error.to_s, 'There was an error fetching (https://::gemsource.org)'
+ error = Gem::RemoteFetcher::FetchError.new("There was an error fetching", "https://::gemsource.org")
+ assert_equal error.to_s, "There was an error fetching (https://::gemsource.org)"
end
def test_to_s
- error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://gemsource.org')
- assert_equal error.to_s, 'There was an error fetching (https://gemsource.org)'
+ error = Gem::RemoteFetcher::FetchError.new("There was an error fetching", "https://gemsource.org")
+ assert_equal error.to_s, "There was an error fetching (https://gemsource.org)"
end
end
diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
index 3e393a4df3..f933bbb5d5 100644
--- a/test/rubygems/test_require.rb
+++ b/test/rubygems/test_require.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems'
+require_relative "helper"
+require "rubygems"
class TestGemRequire < Gem::TestCase
class Latch
@@ -35,26 +35,26 @@ class TestGemRequire < Gem::TestCase
def test_respect_loaded_features_caching_like_standard_require
dir = Dir.mktmpdir("test_require", @tempdir)
- lp1 = File.join dir, 'foo1'
- foo1 = File.join lp1, 'foo.rb'
+ lp1 = File.join dir, "foo1"
+ foo1 = File.join lp1, "foo.rb"
FileUtils.mkdir_p lp1
- File.open(foo1, 'w') {|f| f.write "class Object; HELLO = 'foo1' end" }
+ File.open(foo1, "w") {|f| f.write "class Object; HELLO = 'foo1' end" }
lp = $LOAD_PATH.dup
$LOAD_PATH.unshift lp1
- assert_require 'foo'
+ assert_require "foo"
assert_equal "foo1", ::Object::HELLO
- lp2 = File.join dir, 'foo2'
- foo2 = File.join lp2, 'foo.rb'
+ lp2 = File.join dir, "foo2"
+ foo2 = File.join lp2, "foo.rb"
FileUtils.mkdir_p lp2
- File.open(foo2, 'w') {|f| f.write "class Object; HELLO = 'foo2' end" }
+ File.open(foo2, "w") {|f| f.write "class Object; HELLO = 'foo2' end" }
$LOAD_PATH.unshift lp2
- refute_require 'foo'
+ refute_require "foo"
assert_equal "foo1", ::Object::HELLO
ensure
$LOAD_PATH.replace lp
@@ -71,18 +71,18 @@ class TestGemRequire < Gem::TestCase
install_specs c1, c2, b1, a1
dir = Dir.mktmpdir("test_require", @tempdir)
- dash_i_arg = File.join dir, 'lib'
+ dash_i_arg = File.join dir, "lib"
- c_rb = File.join dash_i_arg, 'b', 'c.rb'
+ c_rb = File.join dash_i_arg, "b", "c.rb"
FileUtils.mkdir_p File.dirname c_rb
- File.open(c_rb, 'w') {|f| f.write "class Object; HELLO = 'world' end" }
+ File.open(c_rb, "w") {|f| f.write "class Object; HELLO = 'world' end" }
# Pretend to provide a commandline argument that overrides a file in gem b
$LOAD_PATH.unshift dash_i_arg
- assert_require 'test_gem_require_a'
- assert_require 'b/c' # this should be required from -I
+ assert_require "test_gem_require_a"
+ assert_require "b/c" # this should be required from -I
assert_equal "world", ::Object::HELLO
assert_equal %w[a-1 b-1], loaded_spec_names
ensure
@@ -110,20 +110,20 @@ class TestGemRequire < Gem::TestCase
install_default_gems c1, c2, b1, a1
dir = Dir.mktmpdir("test_require", @tempdir)
- dash_i_arg = File.join dir, 'lib'
+ dash_i_arg = File.join dir, "lib"
- c_rb = File.join dash_i_arg, 'c', 'c.rb'
+ c_rb = File.join dash_i_arg, "c", "c.rb"
FileUtils.mkdir_p File.dirname c_rb
- File.open(c_rb, 'w') {|f| f.write "class Object; HELLO = 'world' end" }
+ File.open(c_rb, "w") {|f| f.write "class Object; HELLO = 'world' end" }
- assert_require 'test_gem_require_a'
+ assert_require "test_gem_require_a"
# Pretend to provide a commandline argument that overrides a file in gem b
$LOAD_PATH.unshift dash_i_arg
- assert_require 'b/c'
- assert_require 'c/c' # this should be required from -I
+ assert_require "b/c"
+ assert_require "c/c" # this should be required from -I
assert_equal "world", ::Object::HELLO
assert_equal %w[a-1 b-1], loaded_spec_names
ensure
@@ -134,12 +134,12 @@ class TestGemRequire < Gem::TestCase
pend "extensions don't quite work on jruby" if Gem.java_platform?
pend "not installed yet" unless RbConfig::TOPDIR
- dash_i_ext_arg = util_install_extension_file('a')
- dash_i_lib_arg = util_install_ruby_file('a')
+ dash_i_ext_arg = util_install_extension_file("a")
+ dash_i_lib_arg = util_install_ruby_file("a")
$LOAD_PATH.unshift dash_i_lib_arg
$LOAD_PATH.unshift dash_i_ext_arg
- assert_require 'a'
+ assert_require "a"
assert_match(/a\.rb$/, $LOADED_FEATURES.last)
end
@@ -175,7 +175,7 @@ class TestGemRequire < Gem::TestCase
install_specs b1, b2, a1
- assert_require 'test_gem_require_a'
+ assert_require "test_gem_require_a"
assert_equal %w[a-1 b-1], loaded_spec_names
assert_equal unresolved_names, []
@@ -190,7 +190,7 @@ class TestGemRequire < Gem::TestCase
install_specs b1, b2, a1
- assert_require 'test_gem_require_a'
+ assert_require "test_gem_require_a"
assert_equal %w[a-1], loaded_spec_names
assert_equal unresolved_names, ["b (>= 1)"]
@@ -204,7 +204,7 @@ class TestGemRequire < Gem::TestCase
install_specs b1, a1
- assert_require 'test_gem_require_a'
+ assert_require "test_gem_require_a"
assert_equal %w[a-1 b-1], loaded_spec_names
assert_equal unresolved_names, []
@@ -217,7 +217,7 @@ class TestGemRequire < Gem::TestCase
install_specs a1
- assert_require Pathname.new 'test_gem_require_a'
+ assert_require Pathname.new "test_gem_require_a"
assert_equal %w[a-1], loaded_spec_names
assert_equal unresolved_names, []
end
@@ -241,7 +241,7 @@ class TestGemRequire < Gem::TestCase
load_path_changed = true
end
- require 'benchmark' # the stdlib
+ require "benchmark" # the stdlib
a1 = util_spec "a", "1", { "b" => ">= 1" }, "lib/test_gem_require_a.rb"
b1 = util_spec "b", "1", nil, "lib/benchmark.rb"
@@ -250,7 +250,7 @@ class TestGemRequire < Gem::TestCase
install_specs b1, b2, a1
# Activates a-1, but not b-1 and b-2
- assert_require 'test_gem_require_a'
+ assert_require "test_gem_require_a"
assert_equal %w[a-1], loaded_spec_names
assert $LOAD_PATH.include? a1.load_paths[0]
refute $LOAD_PATH.include? b1.load_paths[0]
@@ -263,7 +263,7 @@ class TestGemRequire < Gem::TestCase
# though b-2 is earlier in $LOAD_PATH it already loaded a benchmark.rb file
# and that still exists in $LOAD_PATH (further down),
# and as a result #gem_original_require returns false.
- refute require('benchmark'), "the benchmark stdlib should be recognized as already loaded"
+ refute require("benchmark"), "the benchmark stdlib should be recognized as already loaded"
assert_includes $LOAD_PATH, b2.load_paths[0]
assert_includes $LOAD_PATH, rubylibdir
@@ -296,7 +296,7 @@ class TestGemRequire < Gem::TestCase
install_specs a2
- refute_require 'a'
+ refute_require "a"
assert_equal %w[a-1], loaded_spec_names
end
@@ -378,7 +378,7 @@ class TestGemRequire < Gem::TestCase
# Load default ruby gems fresh as if we've just started a ruby script.
Gem::Specification.reset
- require 'rubygems'
+ require "rubygems"
Gem::Specification.stubs
# Remove an old default gem version directly from disk as if someone ran
@@ -387,9 +387,9 @@ class TestGemRequire < Gem::TestCase
FileUtils.rm_rf(File.join @gemhome, "specifications", "default", "#{b1.full_name}.gemspec")
# Require gems that have not been removed.
- assert_require 'a/b'
+ assert_require "a/b"
assert_equal %w[a-1.0], loaded_spec_names
- assert_require 'b/d'
+ assert_require "b/d"
assert_equal %w[a-1.0 b-2.0], loaded_spec_names
end
@@ -471,7 +471,7 @@ class TestGemRequire < Gem::TestCase
RUBY
File.write(path, code)
- output = Gem::Util.popen({ 'GEM_HOME' => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip
+ output = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip
assert $?.success?
refute_empty output
assert_equal "999.99.9", output.lines[0].chomp
@@ -542,11 +542,11 @@ class TestGemRequire < Gem::TestCase
silence_warnings do
class << ::Gem
alias old_try_activate try_activate
- def try_activate(*); raise 'raised from try_activate'; end
+ def try_activate(*); raise "raised from try_activate"; end
end
end
- require 'does_not_exist_for_try_activate_test'
+ require "does_not_exist_for_try_activate_test"
rescue RuntimeError => e
assert_match(/raised from try_activate/, e.message)
assert Kernel::RUBYGEMS_ACTIVATION_MONITOR.try_enter, "require monitor was not unlocked when try_activate raised"
@@ -585,13 +585,13 @@ class TestGemRequire < Gem::TestCase
end
def test_require_bundler
- b1 = util_spec('bundler', '1', nil, "lib/bundler/setup.rb")
- b2a = util_spec('bundler', '2.a', nil, "lib/bundler/setup.rb")
+ b1 = util_spec("bundler", "1", nil, "lib/bundler/setup.rb")
+ b2a = util_spec("bundler", "2.a", nil, "lib/bundler/setup.rb")
install_specs b1, b2a
require "rubygems/bundler_version_finder"
$:.clear
- assert_require 'bundler/setup'
+ assert_require "bundler/setup"
assert_equal %w[bundler-2.a], loaded_spec_names
assert_empty unresolved_names
end
@@ -712,7 +712,7 @@ class TestGemRequire < Gem::TestCase
a_rb = File.join dash_i_lib_arg, "#{name}.rb"
FileUtils.mkdir_p File.dirname a_rb
- File.open(a_rb, 'w') {|f| f.write "# #{name}.rb" }
+ File.open(a_rb, "w") {|f| f.write "# #{name}.rb" }
dash_i_lib_arg
end
diff --git a/test/rubygems/test_rubygems.rb b/test/rubygems/test_rubygems.rb
index e5c0a22caf..8bd116646f 100644
--- a/test/rubygems/test_rubygems.rb
+++ b/test/rubygems/test_rubygems.rb
@@ -1,19 +1,19 @@
-require_relative 'helper'
+require_relative "helper"
class GemTest < Gem::TestCase
def test_rubygems_normal_behaviour
- _ = Gem::Util.popen(*ruby_with_rubygems_in_load_path, '-e', "'require \"rubygems\"'", { :err => [:child, :out] }).strip
+ _ = Gem::Util.popen(*ruby_with_rubygems_in_load_path, "-e", "'require \"rubygems\"'", { :err => [:child, :out] }).strip
assert $?.success?
end
def test_operating_system_other_exceptions
- pend "does not apply to truffleruby" if RUBY_ENGINE == 'truffleruby'
+ pend "does not apply to truffleruby" if RUBY_ENGINE == "truffleruby"
path = util_install_operating_system_rb <<-RUBY
intentionally_not_implemented_method
RUBY
- output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), '-e', "'require \"rubygems\"'", { :err => [:child, :out] }).strip
+ output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), "-e", "'require \"rubygems\"'", { :err => [:child, :out] }).strip
assert !$?.success?
assert_includes output, "undefined local variable or method `intentionally_not_implemented_method'"
assert_includes output, "Loading the #{operating_system_rb_at(path)} file caused an error. " \
@@ -23,8 +23,8 @@ class GemTest < Gem::TestCase
end
def test_operating_system_customizing_default_dir
- pend "does not apply to truffleruby" if RUBY_ENGINE == 'truffleruby'
- pend "loads a custom defaults/jruby file that gets in the middle" if RUBY_ENGINE == 'jruby'
+ pend "does not apply to truffleruby" if RUBY_ENGINE == "truffleruby"
+ pend "loads a custom defaults/jruby file that gets in the middle" if RUBY_ENGINE == "jruby"
# On a non existing default dir, there should be no gems
@@ -38,7 +38,7 @@ class GemTest < Gem::TestCase
output = Gem::Util.popen(
*ruby_with_rubygems_and_fake_operating_system_in_load_path(path),
- '-e',
+ "-e",
"require \"rubygems\"; puts Gem::Specification.stubs.map(&:full_name)",
{ :err => [:child, :out] }
).strip
@@ -59,7 +59,7 @@ class GemTest < Gem::TestCase
FileUtils.mkdir_p File.dirname(operating_system_rb)
- File.open(operating_system_rb, 'w') {|f| f.write content }
+ File.open(operating_system_rb, "w") {|f| f.write content }
dir_lib_arg
end
diff --git a/test/rubygems/utilities.rb b/test/rubygems/utilities.rb
index 613cf6c0ee..5f8f763cb5 100644
--- a/test/rubygems/utilities.rb
+++ b/test/rubygems/utilities.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require 'tempfile'
-require 'rubygems'
-require 'rubygems/remote_fetcher'
+require "tempfile"
+require "rubygems"
+require "rubygems/remote_fetcher"
##
# A fake Gem::RemoteFetcher for use in tests or to avoid real live HTTP
@@ -39,7 +39,7 @@ class Gem::FakeFetcher
end
def find_data(path)
- return Gem.read_binary path.path if URI === path and 'file' == path.scheme
+ return Gem.read_binary path.path if URI === path and "file" == path.scheme
if URI === path and "URI::#{path.scheme.upcase}" != path.class.name
raise ArgumentError,
@@ -48,7 +48,7 @@ class Gem::FakeFetcher
path = path.to_s
@paths << path
- raise ArgumentError, 'need full URI' unless path.start_with?("https://", "http://")
+ raise ArgumentError, "need full URI" unless path.start_with?("https://", "http://")
unless @data.key? path
raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
@@ -76,7 +76,7 @@ class Gem::FakeFetcher
def cache_update_path(uri, path = nil, update = true)
if data = fetch_path(uri)
- File.open(path, 'wb') {|io| io.write data } if path and update
+ File.open(path, "wb") {|io| io.write data } if path and update
data
else
Gem.read_binary(path) if path
@@ -108,9 +108,9 @@ class Gem::FakeFetcher
end
def pretty_print(q) # :nodoc:
- q.group 2, '[FakeFetcher', ']' do
+ q.group 2, "[FakeFetcher", "]" do
q.breakable
- q.text 'URIs:'
+ q.text "URIs:"
q.breakable
q.pp @data.keys
@@ -121,7 +121,7 @@ class Gem::FakeFetcher
path = path.to_s
@paths << path
- raise ArgumentError, 'need full URI' unless path =~ %r{^http://}
+ raise ArgumentError, "need full URI" unless path =~ %r{^http://}
unless @data.key? path
raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
@@ -288,16 +288,16 @@ class Gem::TestCase::SpecFetcherSetup
# Creates a legacy platform spec with the name 'pl' and version 1
def legacy_platform
- spec 'pl', 1 do |s|
- s.platform = Gem::Platform.new 'i386-linux'
- s.instance_variable_set :@original_platform, 'i386-linux'
+ spec "pl", 1 do |s|
+ s.platform = Gem::Platform.new "i386-linux"
+ s.instance_variable_set :@original_platform, "i386-linux"
end
end
def setup_fetcher # :nodoc:
- require 'zlib'
- require 'socket'
- require 'rubygems/remote_fetcher'
+ require "zlib"
+ require "socket"
+ require "rubygems/remote_fetcher"
unless @test.fetcher
@test.fetcher = Gem::FakeFetcher.new
@@ -338,7 +338,7 @@ class Gem::TestCase::SpecFetcherSetup
end
def write_spec(spec) # :nodoc:
- File.open spec.spec_file, 'w' do |io|
+ File.open spec.spec_file, "w" do |io|
io.write spec.to_ruby_for_cache
end
end
@@ -354,7 +354,7 @@ class TempIO < Tempfile
##
# Creates a new TempIO that will be initialized to contain +string+.
- def initialize(string = '')
+ def initialize(string = "")
super "TempIO"
binmode
write string
diff --git a/tool/bundler/dev_gems.rb.lock b/tool/bundler/dev_gems.rb.lock
index 12a8c9b686..3ff9af9b17 100644
--- a/tool/bundler/dev_gems.rb.lock
+++ b/tool/bundler/dev_gems.rb.lock
@@ -53,4 +53,4 @@ DEPENDENCIES
webrick (~> 1.6)
BUNDLED WITH
- 2.3.18
+ 2.3.19
diff --git a/tool/bundler/rubocop_gems.rb.lock b/tool/bundler/rubocop_gems.rb.lock
index 8c3462db73..4a36ab1f2a 100644
--- a/tool/bundler/rubocop_gems.rb.lock
+++ b/tool/bundler/rubocop_gems.rb.lock
@@ -62,4 +62,4 @@ DEPENDENCIES
test-unit
BUNDLED WITH
- 2.3.18
+ 2.3.19
diff --git a/tool/bundler/standard_gems.rb.lock b/tool/bundler/standard_gems.rb.lock
index d8d8130037..d39bbd1c5f 100644
--- a/tool/bundler/standard_gems.rb.lock
+++ b/tool/bundler/standard_gems.rb.lock
@@ -68,4 +68,4 @@ DEPENDENCIES
test-unit
BUNDLED WITH
- 2.3.18
+ 2.3.19
diff --git a/tool/bundler/test_gems.rb.lock b/tool/bundler/test_gems.rb.lock
index 02c3faeb4b..2f25751c45 100644
--- a/tool/bundler/test_gems.rb.lock
+++ b/tool/bundler/test_gems.rb.lock
@@ -43,4 +43,4 @@ DEPENDENCIES
webrick (= 1.7.0)
BUNDLED WITH
- 2.3.18
+ 2.3.19