rubygems-update 3.1.6 → 3.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{History.txt → CHANGELOG.md} +1452 -514
- data/CODE_OF_CONDUCT.md +55 -19
- data/CONTRIBUTING.md +74 -27
- data/Manifest.txt +154 -117
- data/POLICIES.md +27 -19
- data/README.md +10 -8
- data/UPGRADING.md +5 -81
- data/bin/gem +3 -8
- data/bin/update_rubygems +5 -5
- data/bundler/CHANGELOG.md +2358 -1430
- data/bundler/README.md +7 -9
- data/bundler/UPGRADING.md +27 -34
- data/bundler/bundler.gemspec +8 -11
- data/bundler/exe/bundle +10 -8
- data/bundler/exe/bundler +1 -1
- data/bundler/lib/bundler/.document +1 -0
- data/bundler/lib/bundler/build_metadata.rb +4 -12
- data/bundler/lib/bundler/cli/add.rb +1 -1
- data/bundler/lib/bundler/cli/binstubs.rb +6 -2
- data/bundler/lib/bundler/cli/cache.rb +3 -8
- data/bundler/lib/bundler/cli/check.rb +4 -2
- data/bundler/lib/bundler/cli/clean.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +31 -3
- data/bundler/lib/bundler/cli/config.rb +10 -1
- data/bundler/lib/bundler/cli/console.rb +1 -1
- data/bundler/lib/bundler/cli/doctor.rb +25 -6
- data/bundler/lib/bundler/cli/exec.rb +5 -10
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +219 -28
- data/bundler/lib/bundler/cli/info.rb +38 -6
- data/bundler/lib/bundler/cli/init.rb +3 -3
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +25 -54
- data/bundler/lib/bundler/cli/issue.rb +5 -4
- data/bundler/lib/bundler/cli/list.rb +19 -11
- data/bundler/lib/bundler/cli/lock.rb +5 -1
- data/bundler/lib/bundler/cli/open.rb +1 -2
- data/bundler/lib/bundler/cli/outdated.rb +105 -76
- data/bundler/lib/bundler/cli/platform.rb +2 -2
- data/bundler/lib/bundler/cli/plugin.rb +10 -0
- data/bundler/lib/bundler/cli/pristine.rb +5 -0
- data/bundler/lib/bundler/cli/remove.rb +1 -2
- data/bundler/lib/bundler/cli/show.rb +2 -2
- data/bundler/lib/bundler/cli/update.rb +20 -9
- data/bundler/lib/bundler/cli.rb +106 -83
- data/bundler/lib/bundler/compact_index_client/cache.rb +6 -23
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +29 -25
- data/bundler/lib/bundler/compact_index_client.rb +3 -9
- data/bundler/lib/bundler/current_ruby.rb +17 -6
- data/bundler/lib/bundler/definition.rb +297 -396
- data/bundler/lib/bundler/dep_proxy.rb +16 -9
- data/bundler/lib/bundler/dependency.rb +22 -77
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +76 -83
- data/bundler/lib/bundler/endpoint_specification.rb +16 -14
- data/bundler/lib/bundler/env.rb +2 -2
- data/bundler/lib/bundler/environment_preserver.rb +29 -2
- data/bundler/lib/bundler/errors.rb +30 -3
- data/bundler/lib/bundler/feature_flag.rb +0 -9
- data/bundler/lib/bundler/fetcher/base.rb +7 -9
- data/bundler/lib/bundler/fetcher/compact_index.rb +11 -16
- data/bundler/lib/bundler/fetcher/downloader.rb +10 -7
- data/bundler/lib/bundler/fetcher/index.rb +2 -30
- data/bundler/lib/bundler/fetcher.rb +24 -25
- data/bundler/lib/bundler/friendly_errors.rb +46 -47
- data/bundler/lib/bundler/gem_helper.rb +53 -31
- data/bundler/lib/bundler/gem_helpers.rb +43 -24
- data/bundler/lib/bundler/gem_version_promoter.rb +10 -20
- data/bundler/lib/bundler/graph.rb +1 -1
- data/bundler/lib/bundler/index.rb +19 -25
- data/bundler/lib/bundler/injector.rb +38 -6
- data/bundler/lib/bundler/inline.rb +4 -13
- data/bundler/lib/bundler/installer/gem_installer.rb +19 -24
- data/bundler/lib/bundler/installer/parallel_installer.rb +46 -25
- data/bundler/lib/bundler/installer/standalone.rb +58 -11
- data/bundler/lib/bundler/installer.rb +51 -81
- data/bundler/lib/bundler/lazy_specification.rb +79 -36
- data/bundler/lib/bundler/lockfile_generator.rb +3 -3
- data/bundler/lib/bundler/lockfile_parser.rb +19 -44
- data/bundler/lib/bundler/man/.document +1 -0
- data/bundler/{man → lib/bundler/man}/bundle-add.1 +21 -5
- data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +16 -4
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
- data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
- data/bundler/{man → lib/bundler/man}/bundle-cache.1 +7 -1
- data/bundler/{man/bundle-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +7 -0
- data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-config.1 +65 -47
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +74 -65
- data/bundler/lib/bundler/man/bundle-console.1 +53 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-exec.1 +2 -2
- data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-gem.1 +38 -3
- data/bundler/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
- data/bundler/lib/bundler/man/bundle-help.1 +13 -0
- data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-init.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-inject.1 +5 -2
- data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
- data/bundler/{man → lib/bundler/man}/bundle-install.1 +35 -4
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +33 -5
- data/bundler/{man → lib/bundler/man}/bundle-list.1 +7 -7
- data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-open.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
- data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
- data/bundler/{man → lib/bundler/man}/bundle-platform.1 +16 -6
- data/bundler/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
- data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-update.1 +5 -5
- data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +5 -4
- data/bundler/lib/bundler/man/bundle-version.1 +35 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/{man → lib/bundler/man}/bundle-viz.1 +4 -1
- data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
- data/bundler/{man → lib/bundler/man}/bundle.1 +15 -10
- data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +12 -7
- data/bundler/{man → lib/bundler/man}/gemfile.5 +106 -80
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +94 -83
- data/bundler/{man → lib/bundler/man}/index.txt +4 -0
- data/bundler/lib/bundler/match_metadata.rb +13 -0
- data/bundler/lib/bundler/match_platform.rb +0 -1
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/mirror.rb +2 -2
- data/bundler/lib/bundler/plugin/api/source.rb +25 -9
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/plugin/index.rb +13 -1
- data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -5
- data/bundler/lib/bundler/plugin/installer.rb +11 -11
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/plugin.rb +58 -11
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/remote_specification.rb +11 -6
- data/bundler/lib/bundler/resolver/base.rb +50 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +64 -57
- data/bundler/lib/bundler/resolver.rb +234 -230
- data/bundler/lib/bundler/retry.rb +2 -2
- data/bundler/lib/bundler/ruby_dsl.rb +1 -1
- data/bundler/lib/bundler/ruby_version.rb +6 -19
- data/bundler/lib/bundler/rubygems_ext.rb +194 -33
- data/bundler/lib/bundler/rubygems_gem_installer.rb +87 -16
- data/bundler/lib/bundler/rubygems_integration.rb +71 -153
- data/bundler/lib/bundler/runtime.rb +22 -26
- data/bundler/lib/bundler/self_manager.rb +168 -0
- data/bundler/lib/bundler/settings.rb +145 -66
- data/bundler/lib/bundler/setup.rb +2 -2
- data/bundler/lib/bundler/shared_helpers.rb +17 -32
- data/bundler/lib/bundler/similarity_detector.rb +1 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +88 -84
- data/bundler/lib/bundler/source/git.rb +50 -32
- data/bundler/lib/bundler/source/metadata.rb +3 -7
- data/bundler/lib/bundler/source/path/installer.rb +10 -10
- data/bundler/lib/bundler/source/path.rb +10 -4
- data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +201 -179
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/bundler/lib/bundler/source.rb +25 -5
- data/bundler/lib/bundler/source_list.rb +105 -63
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +62 -57
- data/bundler/lib/bundler/stub_specification.rb +30 -10
- data/bundler/lib/bundler/templates/Executable +2 -4
- data/bundler/lib/bundler/templates/Executable.bundler +8 -8
- data/bundler/lib/bundler/templates/Executable.standalone +2 -4
- data/bundler/lib/bundler/templates/Gemfile +0 -2
- data/bundler/lib/bundler/templates/gems.rb +0 -3
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +12 -1
- data/bundler/lib/bundler/templates/newgem/README.md.tt +9 -14
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +32 -5
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +27 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +27 -17
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/bundler/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
- data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
- data/bundler/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/bundler/lib/bundler/ui/shell.rb +6 -6
- data/bundler/lib/bundler/uri_credentials_filter.rb +3 -1
- data/bundler/lib/bundler/vendor/.document +1 -0
- data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +37 -5
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +34 -28
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +49 -47
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
- data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +82 -189
- data/bundler/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +10 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +27 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +5 -13
- data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
- data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- data/bundler/lib/bundler/vendored_persistent.rb +0 -7
- data/bundler/lib/bundler/vendored_tmpdir.rb +4 -0
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler/worker.rb +20 -5
- data/bundler/lib/bundler/yaml_serializer.rb +1 -1
- data/bundler/lib/bundler.rb +79 -47
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/available_set.rb +7 -9
- data/lib/rubygems/basic_specification.rb +23 -21
- data/lib/rubygems/bundler_version_finder.rb +26 -53
- data/lib/rubygems/command.rb +48 -45
- data/lib/rubygems/command_manager.rb +20 -14
- data/lib/rubygems/commands/build_command.rb +47 -27
- data/lib/rubygems/commands/cert_command.rb +78 -75
- data/lib/rubygems/commands/check_command.rb +20 -22
- data/lib/rubygems/commands/cleanup_command.rb +30 -26
- data/lib/rubygems/commands/contents_command.rb +16 -18
- data/lib/rubygems/commands/dependency_command.rb +39 -51
- data/lib/rubygems/commands/environment_command.rb +11 -10
- data/lib/rubygems/commands/fetch_command.rb +33 -16
- data/lib/rubygems/commands/generate_index_command.rb +17 -19
- data/lib/rubygems/commands/help_command.rb +6 -6
- data/lib/rubygems/commands/info_command.rb +10 -7
- data/lib/rubygems/commands/install_command.rb +29 -27
- data/lib/rubygems/commands/list_command.rb +9 -8
- data/lib/rubygems/commands/lock_command.rb +5 -7
- data/lib/rubygems/commands/mirror_command.rb +3 -5
- data/lib/rubygems/commands/open_command.rb +10 -14
- data/lib/rubygems/commands/outdated_command.rb +5 -7
- data/lib/rubygems/commands/owner_command.rb +26 -16
- data/lib/rubygems/commands/pristine_command.rb +61 -49
- data/lib/rubygems/commands/push_command.rb +22 -59
- data/lib/rubygems/commands/query_command.rb +21 -351
- data/lib/rubygems/commands/rdoc_command.rb +23 -25
- data/lib/rubygems/commands/search_command.rb +8 -8
- data/lib/rubygems/commands/server_command.rb +16 -77
- data/lib/rubygems/commands/setup_command.rb +255 -229
- data/lib/rubygems/commands/signin_command.rb +9 -11
- data/lib/rubygems/commands/signout_command.rb +7 -9
- data/lib/rubygems/commands/sources_command.rb +27 -25
- data/lib/rubygems/commands/specification_command.rb +25 -21
- data/lib/rubygems/commands/stale_command.rb +3 -5
- data/lib/rubygems/commands/uninstall_command.rb +41 -43
- data/lib/rubygems/commands/unpack_command.rb +13 -15
- data/lib/rubygems/commands/update_command.rb +132 -74
- data/lib/rubygems/commands/which_command.rb +7 -9
- data/lib/rubygems/commands/yank_command.rb +16 -19
- data/lib/rubygems/compatibility.rb +4 -2
- data/lib/rubygems/config_file.rb +42 -26
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +6 -3
- data/lib/rubygems/core_ext/kernel_warn.rb +12 -13
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +108 -32
- data/lib/rubygems/dependency.rb +21 -22
- data/lib/rubygems/dependency_installer.rb +19 -91
- data/lib/rubygems/dependency_list.rb +13 -15
- data/lib/rubygems/deprecate.rb +102 -8
- data/lib/rubygems/doctor.rb +22 -22
- data/lib/rubygems/errors.rb +6 -21
- data/lib/rubygems/exceptions.rb +33 -34
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +48 -54
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +23 -0
- data/lib/rubygems/ext/cargo_builder.rb +321 -0
- data/lib/rubygems/ext/cmake_builder.rb +6 -9
- data/lib/rubygems/ext/configure_builder.rb +5 -8
- data/lib/rubygems/ext/ext_conf_builder.rb +42 -66
- data/lib/rubygems/ext/rake_builder.rb +7 -10
- data/lib/rubygems/ext.rb +7 -6
- data/lib/rubygems/gem_runner.rb +15 -26
- data/lib/rubygems/gemcutter_utilities.rb +153 -32
- data/lib/rubygems/indexer.rb +30 -49
- data/lib/rubygems/install_default_message.rb +2 -2
- data/lib/rubygems/install_message.rb +2 -2
- data/lib/rubygems/install_update_options.rb +73 -64
- data/lib/rubygems/installer.rb +194 -151
- data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
- data/lib/rubygems/local_remote_options.rb +22 -24
- data/lib/rubygems/mock_gem_ui.rb +2 -8
- data/lib/rubygems/name_tuple.rb +9 -14
- data/lib/rubygems/openssl.rb +7 -0
- data/lib/rubygems/optparse/.document +1 -0
- data/lib/rubygems/optparse/COPYING +56 -0
- data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
- data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
- data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
- data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
- data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
- data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
- data/lib/rubygems/optparse/lib/optparse.rb +2303 -0
- data/lib/rubygems/optparse.rb +3 -0
- data/lib/rubygems/package/digest_io.rb +0 -2
- data/lib/rubygems/package/file_source.rb +2 -4
- data/lib/rubygems/package/io_source.rb +4 -2
- data/lib/rubygems/package/old.rb +9 -11
- data/lib/rubygems/package/tar_header.rb +54 -56
- data/lib/rubygems/package/tar_reader/entry.rb +2 -5
- data/lib/rubygems/package/tar_reader.rb +1 -4
- data/lib/rubygems/package/tar_writer.rb +8 -18
- data/lib/rubygems/package.rb +101 -117
- data/lib/rubygems/package_task.rb +5 -11
- data/lib/rubygems/path_support.rb +2 -9
- data/lib/rubygems/platform.rb +101 -76
- data/lib/rubygems/psych_tree.rb +1 -3
- data/lib/rubygems/query_utils.rb +351 -0
- data/lib/rubygems/rdoc.rb +2 -14
- data/lib/rubygems/remote_fetcher.rb +48 -74
- data/lib/rubygems/request/connection_pools.rb +6 -10
- data/lib/rubygems/request/http_pool.rb +2 -4
- data/lib/rubygems/request/https_pool.rb +0 -2
- data/lib/rubygems/request.rb +26 -31
- data/lib/rubygems/request_set/gem_dependency_api.rb +23 -25
- data/lib/rubygems/request_set/lockfile/parser.rb +26 -28
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +5 -7
- data/lib/rubygems/request_set/lockfile.rb +17 -21
- data/lib/rubygems/request_set.rb +27 -40
- data/lib/rubygems/requirement.rb +28 -48
- data/lib/rubygems/resolver/activation_request.rb +12 -6
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_set.rb +32 -25
- data/lib/rubygems/resolver/api_specification.rb +29 -15
- data/lib/rubygems/resolver/best_set.rb +7 -9
- data/lib/rubygems/resolver/composed_set.rb +3 -5
- data/lib/rubygems/resolver/conflict.rb +12 -14
- data/lib/rubygems/resolver/current_set.rb +0 -2
- data/lib/rubygems/resolver/dependency_request.rb +3 -5
- data/lib/rubygems/resolver/git_set.rb +2 -4
- data/lib/rubygems/resolver/git_specification.rb +6 -8
- data/lib/rubygems/resolver/index_set.rb +4 -6
- data/lib/rubygems/resolver/index_specification.rb +38 -7
- data/lib/rubygems/resolver/installed_specification.rb +4 -6
- data/lib/rubygems/resolver/installer_set.rb +66 -24
- data/lib/rubygems/resolver/local_specification.rb +2 -4
- data/lib/rubygems/resolver/lock_set.rb +6 -8
- data/lib/rubygems/resolver/lock_specification.rb +4 -6
- data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +8 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +51 -12
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +41 -8
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +76 -8
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +13 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +510 -165
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo.rb +1 -1
- data/lib/rubygems/resolver/requirement_list.rb +0 -2
- data/lib/rubygems/resolver/set.rb +0 -3
- data/lib/rubygems/resolver/source_set.rb +0 -2
- data/lib/rubygems/resolver/spec_specification.rb +14 -2
- data/lib/rubygems/resolver/specification.rb +14 -4
- data/lib/rubygems/resolver/stats.rb +0 -2
- data/lib/rubygems/resolver/vendor_set.rb +1 -3
- data/lib/rubygems/resolver/vendor_specification.rb +3 -5
- data/lib/rubygems/resolver.rb +53 -51
- data/lib/rubygems/s3_uri_signer.rb +7 -15
- data/lib/rubygems/safe_yaml.rb +14 -16
- data/lib/rubygems/security/policies.rb +11 -11
- data/lib/rubygems/security/policy.rb +25 -29
- data/lib/rubygems/security/signer.rb +13 -16
- data/lib/rubygems/security/trust_dir.rb +4 -5
- data/lib/rubygems/security.rb +103 -69
- data/lib/rubygems/security_option.rb +7 -7
- data/lib/rubygems/source/git.rb +30 -30
- data/lib/rubygems/source/installed.rb +1 -3
- data/lib/rubygems/source/local.rb +4 -6
- data/lib/rubygems/source/lock.rb +0 -2
- data/lib/rubygems/source/specific_file.rb +1 -3
- data/lib/rubygems/source/vendor.rb +0 -2
- data/lib/rubygems/source.rb +44 -38
- data/lib/rubygems/source_list.rb +9 -16
- data/lib/rubygems/spec_fetcher.rb +49 -48
- data/lib/rubygems/specification.rb +338 -295
- data/lib/rubygems/specification_policy.rb +112 -61
- data/lib/rubygems/stub_specification.rb +21 -28
- data/lib/rubygems/text.rb +21 -20
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +454 -0
- data/lib/rubygems/tsort.rb +3 -0
- data/lib/rubygems/uninstaller.rb +98 -45
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/uri.rb +126 -0
- data/lib/rubygems/uri_formatter.rb +2 -3
- data/lib/rubygems/user_interaction.rb +43 -54
- data/lib/rubygems/util/licenses.rb +115 -10
- data/lib/rubygems/util/list.rb +0 -2
- data/lib/rubygems/util.rb +18 -12
- data/lib/rubygems/validator.rb +6 -8
- data/lib/rubygems/version.rb +29 -20
- data/lib/rubygems/version_option.rb +11 -5
- data/lib/rubygems.rb +192 -289
- data/rubygems-update.gemspec +4 -4
- data/setup.rb +11 -22
- data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
- data/test/rubygems/data/pry-0.4.7.gemspec.rz +0 -0
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +380 -314
- data/{lib → test}/rubygems/installer_test_case.rb +38 -24
- data/{lib → test}/rubygems/package/tar_test_case.rb +4 -6
- data/test/rubygems/packages/ascii_binder-0.1.10.1.gem +0 -0
- data/test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem +0 -0
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
- data/test/rubygems/plugin/load/rubygems_plugin.rb +0 -2
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
- data/test/rubygems/private_ec_key.pem +9 -0
- data/test/rubygems/rubygems/commands/crash_command.rb +0 -2
- data/test/rubygems/rubygems_plugin.rb +2 -4
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +4 -6
- data/test/rubygems/test_bundled_ca.rb +43 -50
- data/test/rubygems/test_config.rb +5 -7
- data/test/rubygems/test_deprecate.rb +87 -10
- data/test/rubygems/test_exit.rb +11 -0
- data/test/rubygems/test_gem.rb +719 -639
- data/test/rubygems/test_gem_available_set.rb +24 -26
- data/test/rubygems/test_gem_bundler_version_finder.rb +37 -44
- data/test/rubygems/test_gem_command.rb +78 -49
- data/test/rubygems/test_gem_command_manager.rb +98 -35
- data/test/rubygems/test_gem_commands_build_command.rb +275 -57
- data/test/rubygems/test_gem_commands_cert_command.rb +180 -125
- data/test/rubygems/test_gem_commands_check_command.rb +9 -11
- data/test/rubygems/test_gem_commands_cleanup_command.rb +78 -69
- data/test/rubygems/test_gem_commands_contents_command.rb +73 -42
- data/test/rubygems/test_gem_commands_dependency_command.rb +38 -40
- data/test/rubygems/test_gem_commands_environment_command.rb +60 -38
- data/test/rubygems/test_gem_commands_fetch_command.rb +163 -32
- data/test/rubygems/test_gem_commands_generate_index_command.rb +8 -14
- data/test/rubygems/test_gem_commands_help_command.rb +34 -16
- data/test/rubygems/test_gem_commands_info_command.rb +33 -9
- data/test/rubygems/test_gem_commands_install_command.rb +401 -198
- data/test/rubygems/test_gem_commands_list_command.rb +5 -7
- data/test/rubygems/test_gem_commands_lock_command.rb +11 -13
- data/test/rubygems/test_gem_commands_mirror.rb +3 -5
- data/test/rubygems/test_gem_commands_open_command.rb +16 -19
- data/test/rubygems/test_gem_commands_outdated_command.rb +23 -7
- data/test/rubygems/test_gem_commands_owner_command.rb +100 -46
- data/test/rubygems/test_gem_commands_pristine_command.rb +131 -99
- data/test/rubygems/test_gem_commands_push_command.rb +134 -66
- data/test/rubygems/test_gem_commands_query_command.rb +91 -91
- data/test/rubygems/test_gem_commands_search_command.rb +2 -4
- data/test/rubygems/test_gem_commands_server_command.rb +6 -50
- data/test/rubygems/test_gem_commands_setup_command.rb +288 -179
- data/test/rubygems/test_gem_commands_signin_command.rb +162 -28
- data/test/rubygems/test_gem_commands_signout_command.rb +3 -10
- data/test/rubygems/test_gem_commands_sources_command.rb +139 -32
- data/test/rubygems/test_gem_commands_specification_command.rb +81 -55
- data/test/rubygems/test_gem_commands_stale_command.rb +4 -6
- data/test/rubygems/test_gem_commands_uninstall_command.rb +80 -82
- data/test/rubygems/test_gem_commands_unpack_command.rb +32 -34
- data/test/rubygems/test_gem_commands_update_command.rb +335 -88
- data/test/rubygems/test_gem_commands_which_command.rb +12 -14
- data/test/rubygems/test_gem_commands_yank_command.rb +80 -44
- data/test/rubygems/test_gem_config_file.rb +114 -97
- data/test/rubygems/test_gem_dependency.rb +87 -87
- data/test/rubygems/test_gem_dependency_installer.rb +277 -391
- data/test/rubygems/test_gem_dependency_list.rb +57 -59
- data/test/rubygems/test_gem_dependency_resolution_error.rb +5 -7
- data/test/rubygems/test_gem_doctor.rb +73 -47
- data/test/rubygems/test_gem_ext_builder.rb +115 -109
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +243 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +21 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/src/lib.rs +27 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +243 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +21 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +39 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +178 -0
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +75 -0
- data/test/rubygems/test_gem_ext_cmake_builder.rb +31 -38
- data/test/rubygems/test_gem_ext_configure_builder.rb +23 -39
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +66 -82
- data/test/rubygems/test_gem_ext_rake_builder.rb +49 -32
- data/test/rubygems/test_gem_gem_runner.rb +51 -8
- data/test/rubygems/test_gem_gemcutter_utilities.rb +87 -76
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -6
- data/test/rubygems/test_gem_indexer.rb +62 -64
- data/test/rubygems/test_gem_install_update_options.rb +31 -21
- data/test/rubygems/test_gem_installer.rb +798 -491
- data/test/rubygems/test_gem_local_remote_options.rb +11 -13
- data/test/rubygems/test_gem_name_tuple.rb +4 -6
- data/test/rubygems/test_gem_package.rb +318 -283
- data/test/rubygems/test_gem_package_old.rb +18 -20
- data/test/rubygems/test_gem_package_tar_header.rb +64 -47
- data/test/rubygems/test_gem_package_tar_reader.rb +8 -10
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +18 -20
- data/test/rubygems/test_gem_package_tar_writer.rb +96 -100
- data/test/rubygems/test_gem_package_task.rb +58 -25
- data/test/rubygems/test_gem_path_support.rb +15 -21
- data/test/rubygems/test_gem_platform.rb +354 -201
- data/test/rubygems/test_gem_rdoc.rb +19 -21
- data/test/rubygems/test_gem_remote_fetcher.rb +376 -337
- data/test/rubygems/test_gem_request.rb +114 -86
- data/test/rubygems/test_gem_request_connection_pools.rb +30 -34
- data/test/rubygems/test_gem_request_set.rb +123 -124
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +222 -226
- data/test/rubygems/test_gem_request_set_lockfile.rb +93 -95
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +68 -70
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +136 -138
- data/test/rubygems/test_gem_requirement.rb +133 -54
- data/test/rubygems/test_gem_resolver.rb +149 -117
- data/test/rubygems/test_gem_resolver_activation_request.rb +6 -8
- data/test/rubygems/test_gem_resolver_api_set.rb +79 -78
- data/test/rubygems/test_gem_resolver_api_specification.rb +47 -49
- data/test/rubygems/test_gem_resolver_best_set.rb +43 -22
- data/test/rubygems/test_gem_resolver_composed_set.rb +1 -3
- data/test/rubygems/test_gem_resolver_conflict.rb +12 -14
- data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -17
- data/test/rubygems/test_gem_resolver_git_set.rb +22 -24
- data/test/rubygems/test_gem_resolver_git_specification.rb +22 -23
- data/test/rubygems/test_gem_resolver_index_set.rb +14 -16
- data/test/rubygems/test_gem_resolver_index_specification.rb +16 -18
- data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -7
- data/test/rubygems/test_gem_resolver_installer_set.rb +104 -44
- data/test/rubygems/test_gem_resolver_local_specification.rb +7 -9
- data/test/rubygems/test_gem_resolver_lock_set.rb +15 -17
- data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -19
- data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -3
- data/test/rubygems/test_gem_resolver_specification.rb +8 -12
- data/test/rubygems/test_gem_resolver_vendor_set.rb +9 -11
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -12
- data/test/rubygems/test_gem_security.rb +104 -78
- data/test/rubygems/test_gem_security_policy.rb +92 -97
- data/test/rubygems/test_gem_security_signer.rb +45 -47
- data/test/rubygems/test_gem_security_trust_dir.rb +12 -14
- data/test/rubygems/test_gem_silent_ui.rb +46 -42
- data/test/rubygems/test_gem_source.rb +53 -52
- data/test/rubygems/test_gem_source_fetch_problem.rb +16 -8
- data/test/rubygems/test_gem_source_git.rb +69 -69
- data/test/rubygems/test_gem_source_installed.rb +16 -18
- data/test/rubygems/test_gem_source_list.rb +5 -6
- data/test/rubygems/test_gem_source_local.rb +15 -17
- data/test/rubygems/test_gem_source_lock.rb +31 -33
- data/test/rubygems/test_gem_source_specific_file.rb +18 -20
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_source_vendor.rb +13 -15
- data/test/rubygems/test_gem_spec_fetcher.rb +74 -67
- data/test/rubygems/test_gem_specification.rb +888 -1024
- data/test/rubygems/test_gem_stream_ui.rb +23 -23
- data/test/rubygems/test_gem_stub_specification.rb +39 -57
- data/test/rubygems/test_gem_text.rb +8 -4
- data/test/rubygems/test_gem_uninstaller.rb +233 -104
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -5
- data/test/rubygems/test_gem_uri.rb +39 -0
- data/test/rubygems/test_gem_uri_formatter.rb +14 -16
- data/test/rubygems/test_gem_util.rb +37 -35
- data/test/rubygems/test_gem_validator.rb +10 -12
- data/test/rubygems/test_gem_version.rb +31 -31
- data/test/rubygems/test_gem_version_option.rb +16 -18
- data/test/rubygems/test_kernel.rb +46 -60
- data/test/rubygems/test_project_sanity.rb +8 -3
- data/test/rubygems/test_remote_fetch_error.rb +7 -9
- data/test/rubygems/test_require.rb +240 -167
- data/test/rubygems/test_rubygems.rb +74 -0
- data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +30 -39
- data/test/test_changelog_generator.rb +17 -0
- metadata +158 -146
- data/.bundle/config +0 -2
- data/.rubocop.yml +0 -91
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -43
- data/Rakefile +0 -428
- data/bundler/CODE_OF_CONDUCT.md +0 -136
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/bundler/lib/bundler/psyched_yaml.rb +0 -37
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/bundler/man/bundle-add.1.txt +0 -58
- data/bundler/man/bundle-binstubs.1.txt +0 -48
- data/bundler/man/bundle-cache.1.txt +0 -78
- data/bundler/man/bundle-check.1.txt +0 -33
- data/bundler/man/bundle-clean.1.txt +0 -26
- data/bundler/man/bundle-config.1.txt +0 -528
- data/bundler/man/bundle-doctor.1.txt +0 -44
- data/bundler/man/bundle-exec.1.txt +0 -178
- data/bundler/man/bundle-gem.1.txt +0 -91
- data/bundler/man/bundle-info.1.txt +0 -21
- data/bundler/man/bundle-init.1.txt +0 -34
- data/bundler/man/bundle-inject.1.txt +0 -32
- data/bundler/man/bundle-install.1.txt +0 -401
- data/bundler/man/bundle-list.1.txt +0 -43
- data/bundler/man/bundle-lock.1.txt +0 -93
- data/bundler/man/bundle-open.1.txt +0 -29
- data/bundler/man/bundle-outdated.1.txt +0 -131
- data/bundler/man/bundle-platform.1.txt +0 -57
- data/bundler/man/bundle-pristine.1.txt +0 -44
- data/bundler/man/bundle-remove.1.txt +0 -34
- data/bundler/man/bundle-show.1.txt +0 -27
- data/bundler/man/bundle-update.1.txt +0 -390
- data/bundler/man/bundle-viz.1.txt +0 -39
- data/bundler/man/bundle.1.txt +0 -116
- data/bundler/man/gemfile.5.txt +0 -649
- data/lib/rubygems/psych_additions.rb +0 -10
- data/lib/rubygems/server.rb +0 -879
- data/lib/rubygems/source_local.rb +0 -7
- data/lib/rubygems/source_specific_file.rb +0 -6
- data/lib/rubygems/syck_hack.rb +0 -79
- data/lib/rubygems/uri_parser.rb +0 -36
- data/lib/rubygems/uri_parsing.rb +0 -23
- data/lib/ubygems.rb +0 -14
- data/test/rubygems/bogussources.rb +0 -9
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/test_gem_server.rb +0 -612
- data/tmp/.keep +0 -0
- data/util/CL2notes +0 -55
- data/util/bisect +0 -10
- data/util/ci.sh +0 -62
- data/util/cops/deprecations.rb +0 -52
- data/util/create_certs.rb +0 -171
- data/util/create_certs.sh +0 -27
- data/util/create_encrypted_key.rb +0 -16
- data/util/generate_spdx_license_list.rb +0 -63
- data/util/patch_with_prs.rb +0 -77
- data/util/rubocop +0 -8
- data/util/update_bundled_ca_certificates.rb +0 -137
- data/util/update_changelog.rb +0 -64
- /data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- /data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
- /data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- /data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- /data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +0 -0
- /data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- /data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
- /data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- /data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- /data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
3
|
-
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
2
|
+
require "benchmark"
|
3
|
+
require_relative "helper"
|
4
|
+
require "date"
|
5
|
+
require "pathname"
|
6
|
+
require "stringio"
|
7
|
+
require "rubygems/ext"
|
8
|
+
require "rubygems/specification"
|
9
|
+
require "rubygems/installer"
|
10
|
+
require "rubygems/platform"
|
10
11
|
|
11
12
|
class TestGemSpecification < Gem::TestCase
|
12
|
-
|
13
13
|
LEGACY_YAML_SPEC = <<-EOF.freeze
|
14
14
|
--- !ruby/object:Gem::Specification
|
15
15
|
rubygems_version: "1.0"
|
@@ -44,16 +44,16 @@ end
|
|
44
44
|
EOF
|
45
45
|
|
46
46
|
def make_spec_c1
|
47
|
-
@c1 = util_spec
|
48
|
-
s.executable =
|
49
|
-
s.extensions <<
|
50
|
-
s.test_file =
|
51
|
-
s.requirements <<
|
52
|
-
s.license =
|
47
|
+
@c1 = util_spec "a", "1" do |s|
|
48
|
+
s.executable = "exec"
|
49
|
+
s.extensions << "ext/a/extconf.rb"
|
50
|
+
s.test_file = "test/suite.rb"
|
51
|
+
s.requirements << "A working computer"
|
52
|
+
s.license = "MIT"
|
53
53
|
|
54
|
-
s.add_dependency
|
55
|
-
s.add_dependency
|
56
|
-
s.add_dependency
|
54
|
+
s.add_dependency "rake", "> 0.4"
|
55
|
+
s.add_dependency "jabber4r", "> 0.0.0"
|
56
|
+
s.add_dependency "pqa", ["> 0.4", "<= 0.6"]
|
57
57
|
|
58
58
|
s.mark_version
|
59
59
|
s.files = %w[lib/code.rb]
|
@@ -61,16 +61,16 @@ end
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def ext_spec(platform: Gem::Platform::RUBY)
|
64
|
-
@ext = util_spec
|
65
|
-
s.executable =
|
66
|
-
s.test_file =
|
64
|
+
@ext = util_spec "ext", "1" do |s|
|
65
|
+
s.executable = "exec"
|
66
|
+
s.test_file = "test/suite.rb"
|
67
67
|
s.extensions = %w[ext/extconf.rb]
|
68
|
-
s.license =
|
68
|
+
s.license = "MIT"
|
69
69
|
s.platform = platform
|
70
70
|
|
71
71
|
s.mark_version
|
72
72
|
s.files = %w[lib/code.rb]
|
73
|
-
s.installed_by_version = v(
|
73
|
+
s.installed_by_version = v("2.2")
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -88,306 +88,281 @@ end
|
|
88
88
|
# is not set.
|
89
89
|
Gem.instance_variable_set(:'@default_source_date_epoch', nil)
|
90
90
|
|
91
|
-
@a1 = util_spec
|
92
|
-
s.executable =
|
93
|
-
s.test_file =
|
94
|
-
s.requirements <<
|
95
|
-
s.license =
|
91
|
+
@a1 = util_spec "a", "1" do |s|
|
92
|
+
s.executable = "exec"
|
93
|
+
s.test_file = "test/suite.rb"
|
94
|
+
s.requirements << "A working computer"
|
95
|
+
s.license = "MIT"
|
96
96
|
|
97
97
|
s.mark_version
|
98
98
|
s.files = %w[lib/code.rb]
|
99
99
|
end
|
100
100
|
|
101
|
-
@a2 = util_spec
|
101
|
+
@a2 = util_spec "a", "2" do |s|
|
102
102
|
s.files = %w[lib/code.rb]
|
103
103
|
end
|
104
104
|
|
105
|
-
@a3 = util_spec
|
106
|
-
s.metadata[
|
105
|
+
@a3 = util_spec "a", "3" do |s|
|
106
|
+
s.metadata["allowed_push_host"] = "https://privategemserver.com"
|
107
107
|
end
|
108
108
|
|
109
109
|
@current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
110
|
-
|
111
|
-
load 'rubygems/syck_hack.rb'
|
112
110
|
end
|
113
111
|
|
114
112
|
def test_self_find_active_stub_by_path
|
115
|
-
spec = util_spec(
|
113
|
+
spec = util_spec("a", "1", nil, "lib/foo.rb")
|
116
114
|
spec.activated = true
|
117
115
|
|
118
116
|
# There used to be a bug (introduced in a9c1aaf) when Gem::Specification
|
119
117
|
# objects are present in the @stubs collection. This test verifies that
|
120
118
|
# this scenario works correctly.
|
121
119
|
Gem::Specification.all = [spec]
|
122
|
-
assert_equal spec, Gem::Specification.find_active_stub_by_path(
|
120
|
+
assert_equal spec, Gem::Specification.find_active_stub_by_path("foo")
|
123
121
|
end
|
124
122
|
|
125
123
|
def test_self_activate
|
126
|
-
foo = util_spec
|
124
|
+
foo = util_spec "foo", "1"
|
127
125
|
|
128
126
|
assert_activate %w[foo-1], foo
|
129
127
|
end
|
130
128
|
|
131
129
|
def test_self_activate_ambiguous_direct
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
c2 = util_spec "c", "2"
|
130
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
131
|
+
b1 = util_spec("b", "1", { "c" => ">= 1" }, "lib/d#{$$}.rb")
|
132
|
+
b2 = util_spec("b", "2", { "c" => ">= 2" }, "lib/d#{$$}.rb")
|
133
|
+
c1 = util_spec "c", "1"
|
134
|
+
c2 = util_spec "c", "2"
|
138
135
|
|
139
|
-
|
140
|
-
|
136
|
+
Gem::Specification.reset
|
137
|
+
install_specs c1, c2, b1, b2, a1
|
141
138
|
|
142
|
-
|
143
|
-
|
144
|
-
|
139
|
+
a1.activate
|
140
|
+
assert_equal %w[a-1], loaded_spec_names
|
141
|
+
assert_equal ["b (> 0)"], unresolved_names
|
145
142
|
|
146
|
-
|
143
|
+
require "d#{$$}"
|
147
144
|
|
148
|
-
|
149
|
-
|
150
|
-
end
|
145
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
146
|
+
assert_equal [], unresolved_names
|
151
147
|
end
|
152
148
|
|
153
149
|
def test_find_in_unresolved_tree_is_not_exponentiental
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
end
|
150
|
+
pend "currently slower in CI on TruffleRuby" if RUBY_ENGINE == "truffleruby"
|
151
|
+
num_of_pkg = 7
|
152
|
+
num_of_version_per_pkg = 3
|
153
|
+
packages = (0..num_of_pkg).map do |pkgi|
|
154
|
+
(0..num_of_version_per_pkg).map do |pkg_version|
|
155
|
+
deps = Hash[((pkgi + 1)..num_of_pkg).map do |deppkgi|
|
156
|
+
["pkg#{deppkgi}", ">= 0"]
|
157
|
+
end]
|
158
|
+
util_spec "pkg#{pkgi}", pkg_version.to_s, deps
|
164
159
|
end
|
165
|
-
|
160
|
+
end
|
161
|
+
base = util_spec "pkg_base", "1", { "pkg0" => ">= 0" }
|
166
162
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
163
|
+
Gem::Specification.reset
|
164
|
+
install_specs(*packages.flatten.reverse)
|
165
|
+
install_specs base
|
166
|
+
base.activate
|
171
167
|
|
172
|
-
|
173
|
-
|
174
|
-
end
|
175
|
-
assert_operator tms.total, :<=, 10
|
168
|
+
tms = Benchmark.measure do
|
169
|
+
assert_raise(LoadError) { require "no_such_file_foo" }
|
176
170
|
end
|
171
|
+
assert_operator tms.total, :<=, 10
|
177
172
|
end
|
178
173
|
|
179
174
|
def test_self_activate_ambiguous_indirect
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
c2 = util_spec "c", "2", nil, "lib/d#{$$}.rb"
|
175
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
176
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
177
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
178
|
+
c1 = util_spec "c", "1", nil, "lib/d#{$$}.rb"
|
179
|
+
c2 = util_spec "c", "2", nil, "lib/d#{$$}.rb"
|
186
180
|
|
187
|
-
|
181
|
+
install_specs c1, c2, b1, b2, a1
|
188
182
|
|
189
|
-
|
190
|
-
|
191
|
-
|
183
|
+
a1.activate
|
184
|
+
assert_equal %w[a-1], loaded_spec_names
|
185
|
+
assert_equal ["b (> 0)"], unresolved_names
|
192
186
|
|
193
|
-
|
187
|
+
require "d#{$$}"
|
194
188
|
|
195
|
-
|
196
|
-
|
197
|
-
end
|
189
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
190
|
+
assert_equal [], unresolved_names
|
198
191
|
end
|
199
192
|
|
200
193
|
def test_self_activate_ambiguous_indirect_conflict
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
c2 = util_spec("c", "2", { "a" => "1" }, "lib/d#{$$}.rb") # conflicts with a-2
|
194
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
195
|
+
a2 = util_spec "a", "2", "b" => "> 0"
|
196
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
197
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
198
|
+
c1 = util_spec "c", "1", nil, "lib/d#{$$}.rb"
|
199
|
+
c2 = util_spec("c", "2", { "a" => "1" }, "lib/d#{$$}.rb") # conflicts with a-2
|
208
200
|
|
209
|
-
|
201
|
+
install_specs c1, b1, a1, a2, c2, b2
|
210
202
|
|
211
|
-
|
212
|
-
|
213
|
-
|
203
|
+
a2.activate
|
204
|
+
assert_equal %w[a-2], loaded_spec_names
|
205
|
+
assert_equal ["b (> 0)"], unresolved_names
|
214
206
|
|
215
|
-
|
207
|
+
require "d#{$$}"
|
216
208
|
|
217
|
-
|
218
|
-
|
219
|
-
end
|
209
|
+
assert_equal %w[a-2 b-1 c-1], loaded_spec_names
|
210
|
+
assert_equal [], unresolved_names
|
220
211
|
end
|
221
212
|
|
222
213
|
def test_self_activate_ambiguous_unrelated
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb"
|
214
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
215
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
216
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
217
|
+
c1 = util_spec "c", "1"
|
218
|
+
c2 = util_spec "c", "2"
|
219
|
+
d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb"
|
230
220
|
|
231
|
-
|
221
|
+
install_specs d1, c1, c2, b1, b2, a1
|
232
222
|
|
233
|
-
|
234
|
-
|
235
|
-
|
223
|
+
a1.activate
|
224
|
+
assert_equal %w[a-1], loaded_spec_names
|
225
|
+
assert_equal ["b (> 0)"], unresolved_names
|
236
226
|
|
237
|
-
|
227
|
+
require "d#{$$}"
|
238
228
|
|
239
|
-
|
240
|
-
|
241
|
-
end
|
229
|
+
assert_equal %w[a-1 d-1], loaded_spec_names
|
230
|
+
assert_equal ["b (> 0)"], unresolved_names
|
242
231
|
end
|
243
232
|
|
244
233
|
def test_require_should_prefer_latest_gem_level1
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
c2 = util_spec "c", "2", nil, "lib/c#{$$}.rb"
|
234
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
235
|
+
b1 = util_spec "b", "1", "c" => ">= 0" # unresolved
|
236
|
+
b2 = util_spec "b", "2", "c" => ">= 0"
|
237
|
+
c1 = util_spec "c", "1", nil, "lib/c#{$$}.rb" # 1st level
|
238
|
+
c2 = util_spec "c", "2", nil, "lib/c#{$$}.rb"
|
251
239
|
|
252
|
-
|
240
|
+
install_specs c1, c2, b1, b2, a1
|
253
241
|
|
254
|
-
|
242
|
+
a1.activate
|
255
243
|
|
256
|
-
|
244
|
+
require "c#{$$}"
|
257
245
|
|
258
|
-
|
259
|
-
end
|
246
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
260
247
|
end
|
261
248
|
|
262
249
|
def test_require_should_prefer_latest_gem_level2
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
|
250
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
251
|
+
b1 = util_spec "b", "1", "c" => ">= 0" # unresolved
|
252
|
+
b2 = util_spec "b", "2", "c" => ">= 0"
|
253
|
+
c1 = util_spec "c", "1", "d" => ">= 0" # 1st level
|
254
|
+
c2 = util_spec "c", "2", "d" => ">= 0"
|
255
|
+
d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
|
256
|
+
d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
|
271
257
|
|
272
|
-
|
258
|
+
install_specs d1, d2, c1, c2, b1, b2, a1
|
273
259
|
|
274
|
-
|
260
|
+
a1.activate
|
275
261
|
|
276
|
-
|
262
|
+
require "d#{$$}"
|
277
263
|
|
278
|
-
|
279
|
-
end
|
264
|
+
assert_equal %w[a-1 b-2 c-2 d-2], loaded_spec_names
|
280
265
|
end
|
281
266
|
|
282
267
|
def test_require_finds_in_2nd_level_indirect
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
d3 = util_spec "d", "3", nil, "lib/d#{$$}.rb"
|
268
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
269
|
+
b1 = util_spec "b", "1", "c" => ">= 0" # unresolved
|
270
|
+
b2 = util_spec "b", "2", "c" => ">= 0"
|
271
|
+
c1 = util_spec "c", "1", "d" => "<= 2" # 1st level
|
272
|
+
c2 = util_spec "c", "2", "d" => "<= 2"
|
273
|
+
d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
|
274
|
+
d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
|
275
|
+
d3 = util_spec "d", "3", nil, "lib/d#{$$}.rb"
|
292
276
|
|
293
|
-
|
277
|
+
install_specs d1, d2, d3, c1, c2, b1, b2, a1
|
294
278
|
|
295
|
-
|
279
|
+
a1.activate
|
296
280
|
|
297
|
-
|
281
|
+
require "d#{$$}"
|
298
282
|
|
299
|
-
|
300
|
-
end
|
283
|
+
assert_equal %w[a-1 b-2 c-2 d-2], loaded_spec_names
|
301
284
|
end
|
302
285
|
|
303
286
|
def test_require_should_prefer_reachable_gems
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
287
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
288
|
+
b1 = util_spec "b", "1", "c" => ">= 0" # unresolved
|
289
|
+
b2 = util_spec "b", "2", "c" => ">= 0"
|
290
|
+
c1 = util_spec "c", "1", "d" => "<= 2" # 1st level
|
291
|
+
c2 = util_spec "c", "2", "d" => "<= 2"
|
292
|
+
d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
|
293
|
+
d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
|
294
|
+
d3 = util_spec "d", "3", nil, "lib/d#{$$}.rb"
|
295
|
+
e = util_spec "anti_d", "1", nil, "lib/d#{$$}.rb"
|
296
|
+
|
297
|
+
install_specs d1, d2, d3, e, c1, c2, b1, b2, a1
|
314
298
|
|
315
|
-
|
316
|
-
|
317
|
-
a1.activate
|
299
|
+
a1.activate
|
318
300
|
|
319
|
-
|
301
|
+
require "d#{$$}"
|
320
302
|
|
321
|
-
|
322
|
-
end
|
303
|
+
assert_equal %w[a-1 b-2 c-2 d-2], loaded_spec_names
|
323
304
|
end
|
324
305
|
|
325
306
|
def test_require_should_not_conflict
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
c3 = util_spec "c", "3", {}, "lib/c.rb"
|
335
|
-
|
336
|
-
install_specs c1, c2, c3, b1, b2, a1, a2, base
|
337
|
-
|
338
|
-
base.activate
|
339
|
-
assert_equal %w(0-1), loaded_spec_names
|
340
|
-
assert_equal ["A (>= 1)"], unresolved_names
|
307
|
+
base = util_spec "0", "1", "A" => ">= 1"
|
308
|
+
a1 = util_spec "A", "1", { "c" => ">= 2", "b" => "> 0" }, "lib/a.rb"
|
309
|
+
a2 = util_spec "A", "2", { "c" => ">= 2", "b" => "> 0" }, "lib/a.rb"
|
310
|
+
b1 = util_spec "b", "1", { "c" => "= 1" }, "lib/d#{$$}.rb"
|
311
|
+
b2 = util_spec "b", "2", { "c" => "= 2" }, "lib/d#{$$}.rb"
|
312
|
+
c1 = util_spec "c", "1", {}, "lib/c.rb"
|
313
|
+
c2 = util_spec "c", "2", {}, "lib/c.rb"
|
314
|
+
c3 = util_spec "c", "3", {}, "lib/c.rb"
|
341
315
|
|
342
|
-
|
316
|
+
install_specs c1, c2, c3, b1, b2, a1, a2, base
|
343
317
|
|
344
|
-
|
345
|
-
|
346
|
-
|
318
|
+
base.activate
|
319
|
+
assert_equal %w[0-1], loaded_spec_names
|
320
|
+
assert_equal ["A (>= 1)"], unresolved_names
|
321
|
+
|
322
|
+
require "d#{$$}"
|
323
|
+
|
324
|
+
assert_equal %w[0-1 A-2 b-2 c-2], loaded_spec_names
|
325
|
+
assert_equal [], unresolved_names
|
347
326
|
end
|
348
327
|
|
349
328
|
def test_inner_clonflict_in_indirect_gems
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
329
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
330
|
+
b1 = util_spec "b", "1", "c" => ">= 1" # unresolved
|
331
|
+
b2 = util_spec "b", "2", "c" => ">= 1", "d" => "< 3"
|
332
|
+
c1 = util_spec "c", "1", "d" => "<= 2" # 1st level
|
333
|
+
c2 = util_spec "c", "2", "d" => "<= 2"
|
334
|
+
c3 = util_spec "c", "3", "d" => "<= 3"
|
335
|
+
d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
|
336
|
+
d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
|
337
|
+
d3 = util_spec "d", "3", nil, "lib/d#{$$}.rb"
|
338
|
+
|
339
|
+
install_specs d1, d2, d3, c1, c2, c3, b1, b2, a1
|
360
340
|
|
361
|
-
|
362
|
-
|
363
|
-
a1.activate
|
341
|
+
a1.activate
|
364
342
|
|
365
|
-
|
343
|
+
require "d#{$$}"
|
366
344
|
|
367
|
-
|
368
|
-
end
|
345
|
+
assert_includes [%w[a-1 b-2 c-3 d-2],%w[a-1 b-2 d-2]], loaded_spec_names
|
369
346
|
end
|
370
347
|
|
371
348
|
def test_inner_clonflict_in_indirect_gems_reversed
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
349
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
350
|
+
b1 = util_spec "b", "1", "xc" => ">= 1" # unresolved
|
351
|
+
b2 = util_spec "b", "2", "xc" => ">= 1", "d" => "< 3"
|
352
|
+
c1 = util_spec "xc", "1", "d" => "<= 3" # 1st level
|
353
|
+
c2 = util_spec "xc", "2", "d" => "<= 2"
|
354
|
+
c3 = util_spec "xc", "3", "d" => "<= 3"
|
355
|
+
d1 = util_spec "d", "1", nil, "lib/d#{$$}.rb" # 2nd level
|
356
|
+
d2 = util_spec "d", "2", nil, "lib/d#{$$}.rb"
|
357
|
+
d3 = util_spec "d", "3", nil, "lib/d#{$$}.rb"
|
358
|
+
|
359
|
+
install_specs d1, d2, d3, c1, c2, c3, b1, b2, a1
|
382
360
|
|
383
|
-
|
361
|
+
a1.activate
|
384
362
|
|
385
|
-
|
363
|
+
require "d#{$$}"
|
386
364
|
|
387
|
-
|
388
|
-
|
389
|
-
assert_includes [%w(a-1 b-2 d-2 xc-3), %w(a-1 b-2 d-2)], loaded_spec_names
|
390
|
-
end
|
365
|
+
assert_includes [%w[a-1 b-2 d-2 xc-3], %w[a-1 b-2 d-2]], loaded_spec_names
|
391
366
|
end
|
392
367
|
|
393
368
|
##
|
@@ -397,16 +372,16 @@ end
|
|
397
372
|
# [B] ~> 1.0 (satisfied by 1.0)
|
398
373
|
|
399
374
|
def test_self_activate_checks_dependencies
|
400
|
-
a = util_spec
|
401
|
-
a.add_dependency
|
402
|
-
a.add_dependency
|
375
|
+
a = util_spec "a", "1.0"
|
376
|
+
a.add_dependency "c", "= 1.0"
|
377
|
+
a.add_dependency "b", "~> 1.0"
|
403
378
|
|
404
|
-
b1 = util_spec
|
405
|
-
b2 = util_spec
|
406
|
-
c = util_spec
|
379
|
+
b1 = util_spec "b", "1.0"
|
380
|
+
b2 = util_spec "b", "2.0"
|
381
|
+
c = util_spec "c", "1.0", "b" => "= 2.0"
|
407
382
|
install_specs b1, b2, c, a
|
408
383
|
|
409
|
-
e =
|
384
|
+
e = assert_raise Gem::LoadError do
|
410
385
|
assert_activate nil, a, c, "b"
|
411
386
|
end
|
412
387
|
|
@@ -421,14 +396,14 @@ end
|
|
421
396
|
# [B] = 2.0
|
422
397
|
|
423
398
|
def test_self_activate_divergent
|
424
|
-
a = util_spec
|
425
|
-
b1 = util_spec
|
426
|
-
b2 = util_spec
|
427
|
-
c = util_spec
|
399
|
+
a = util_spec "a", "1.0", "b" => "~> 1.0", "c" => "= 1.0"
|
400
|
+
b1 = util_spec "b", "1.0"
|
401
|
+
b2 = util_spec "b", "2.0"
|
402
|
+
c = util_spec "c", "1.0", "b" => "= 2.0"
|
428
403
|
|
429
404
|
install_specs b1, b2, c, a
|
430
405
|
|
431
|
-
e =
|
406
|
+
e = assert_raise Gem::ConflictError do
|
432
407
|
assert_activate nil, a, c, "b"
|
433
408
|
end
|
434
409
|
|
@@ -440,9 +415,9 @@ end
|
|
440
415
|
# DOC
|
441
416
|
|
442
417
|
def test_self_activate_old_required
|
443
|
-
e1, = util_spec
|
444
|
-
@d1 = util_spec
|
445
|
-
@d2 = util_spec
|
418
|
+
e1, = util_spec "e", "1", "d" => "= 1"
|
419
|
+
@d1 = util_spec "d", "1"
|
420
|
+
@d2 = util_spec "d", "2"
|
446
421
|
|
447
422
|
install_specs @d1, @d2, e1
|
448
423
|
|
@@ -453,17 +428,17 @@ end
|
|
453
428
|
# DOC
|
454
429
|
|
455
430
|
def test_self_activate_platform_alternate
|
456
|
-
@x1_m = util_spec
|
431
|
+
@x1_m = util_spec "x", "1" do |s|
|
457
432
|
s.platform = Gem::Platform.new %w[cpu my_platform 1]
|
458
433
|
end
|
459
434
|
|
460
|
-
@x1_o = util_spec
|
435
|
+
@x1_o = util_spec "x", "1" do |s|
|
461
436
|
s.platform = Gem::Platform.new %w[cpu other_platform 1]
|
462
437
|
end
|
463
438
|
|
464
|
-
@w1 = util_spec
|
439
|
+
@w1 = util_spec "w", "1", "x" => nil
|
465
440
|
|
466
|
-
util_set_arch
|
441
|
+
util_set_arch "cpu-my_platform1"
|
467
442
|
install_specs @x1_m, @x1_o, @w1
|
468
443
|
|
469
444
|
assert_activate %w[x-1-cpu-my_platform-1 w-1], @w1, @x1_m
|
@@ -473,13 +448,13 @@ end
|
|
473
448
|
# DOC
|
474
449
|
|
475
450
|
def test_self_activate_platform_bump
|
476
|
-
@y1 = util_spec
|
451
|
+
@y1 = util_spec "y", "1"
|
477
452
|
|
478
|
-
@y1_1_p = util_spec
|
453
|
+
@y1_1_p = util_spec "y", "1.1" do |s|
|
479
454
|
s.platform = Gem::Platform.new %w[cpu my_platform 1]
|
480
455
|
end
|
481
456
|
|
482
|
-
@z1 = util_spec
|
457
|
+
@z1 = util_spec "z", "1", "y" => nil
|
483
458
|
install_specs @y1, @y1_1_p, @z1
|
484
459
|
|
485
460
|
assert_activate %w[y-1 z-1], @z1, @y1
|
@@ -492,11 +467,11 @@ end
|
|
492
467
|
# [A] >= 0 (satisfied by 1.a)
|
493
468
|
|
494
469
|
def test_self_activate_prerelease
|
495
|
-
@c1_pre = util_spec
|
496
|
-
@a1_pre = util_spec
|
497
|
-
@b1 = util_spec
|
498
|
-
s.add_dependency
|
499
|
-
s.add_development_dependency
|
470
|
+
@c1_pre = util_spec "c", "1.a", "a" => "1.a", "b" => "1"
|
471
|
+
@a1_pre = util_spec "a", "1.a"
|
472
|
+
@b1 = util_spec "b", "1" do |s|
|
473
|
+
s.add_dependency "a"
|
474
|
+
s.add_development_dependency "aa"
|
500
475
|
end
|
501
476
|
install_specs @a1_pre, @b1, @c1_pre
|
502
477
|
|
@@ -511,41 +486,37 @@ end
|
|
511
486
|
install_specs b1, b2, a1
|
512
487
|
|
513
488
|
a1.activate
|
514
|
-
|
515
|
-
require "b/c"
|
516
|
-
end
|
489
|
+
require "b/c"
|
517
490
|
|
518
|
-
assert_equal %w
|
491
|
+
assert_equal %w[a-1 b-1], loaded_spec_names
|
519
492
|
end
|
520
493
|
|
521
494
|
def test_self_activate_via_require_wtf
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d#{$$}.rb" # this
|
495
|
+
a1 = util_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
|
496
|
+
b1 = util_spec "b", "1", { "c" => ">= 1" }, "lib/b#{$$}.rb"
|
497
|
+
b2 = util_spec "b", "2", { "c" => ">= 2" }, "lib/b#{$$}.rb" # this
|
498
|
+
c1 = util_spec "c", "1"
|
499
|
+
c2 = util_spec "c", "2" # this
|
500
|
+
d1 = util_spec "d", "1", { "c" => "< 2" }, "lib/d#{$$}.rb"
|
501
|
+
d2 = util_spec "d", "2", { "c" => "< 2" }, "lib/d#{$$}.rb" # this
|
530
502
|
|
531
|
-
|
503
|
+
install_specs c1, c2, b1, b2, d1, d2, a1
|
532
504
|
|
533
|
-
|
505
|
+
a1.activate
|
534
506
|
|
535
|
-
|
536
|
-
|
507
|
+
assert_equal %w[a-1], loaded_spec_names
|
508
|
+
assert_equal ["b (> 0)", "d (> 0)"], unresolved_names
|
537
509
|
|
538
|
-
|
510
|
+
require "b#{$$}"
|
539
511
|
|
540
|
-
|
541
|
-
|
542
|
-
|
512
|
+
e = assert_raise Gem::LoadError do
|
513
|
+
require "d#{$$}"
|
514
|
+
end
|
543
515
|
|
544
|
-
|
516
|
+
assert_equal "unable to find a version of 'd' to activate", e.message
|
545
517
|
|
546
|
-
|
547
|
-
|
548
|
-
end
|
518
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
519
|
+
assert_equal ["d (> 0)"], unresolved_names
|
549
520
|
end
|
550
521
|
|
551
522
|
def test_self_activate_deep_unambiguous
|
@@ -558,11 +529,11 @@ end
|
|
558
529
|
install_specs c1, c2, b1, b2, a1
|
559
530
|
|
560
531
|
a1.activate
|
561
|
-
assert_equal %w
|
532
|
+
assert_equal %w[a-1 b-1 c-1], loaded_spec_names
|
562
533
|
end
|
563
534
|
|
564
535
|
def test_self_activate_loaded
|
565
|
-
foo = util_spec
|
536
|
+
foo = util_spec "foo", "1"
|
566
537
|
|
567
538
|
assert foo.activate
|
568
539
|
refute foo.activate
|
@@ -574,9 +545,9 @@ end
|
|
574
545
|
# [C] depends on nothing
|
575
546
|
|
576
547
|
def test_self_activate_unrelated
|
577
|
-
a = util_spec
|
578
|
-
b = util_spec
|
579
|
-
c = util_spec
|
548
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0"
|
549
|
+
b = util_spec "b", "1.0"
|
550
|
+
c = util_spec "c", "1.0"
|
580
551
|
install_specs b, c, a
|
581
552
|
|
582
553
|
assert_activate %w[b-1.0 c-1.0 a-1.0], a, c, "b"
|
@@ -592,11 +563,11 @@ end
|
|
592
563
|
# TODO: move these to specification
|
593
564
|
|
594
565
|
def test_self_activate_over
|
595
|
-
a = util_spec
|
596
|
-
install_specs util_spec
|
597
|
-
install_specs util_spec
|
598
|
-
install_specs util_spec
|
599
|
-
install_specs util_spec
|
566
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0", "c" => "= 1.0"
|
567
|
+
install_specs util_spec "b", "1.0"
|
568
|
+
install_specs util_spec "b", "1.1"
|
569
|
+
install_specs util_spec "b", "2.0"
|
570
|
+
install_specs util_spec "c", "1.0", "b" => "~> 1.0"
|
600
571
|
install_specs a
|
601
572
|
|
602
573
|
a.activate
|
@@ -617,10 +588,10 @@ end
|
|
617
588
|
# first resolve through a dependency that is later pruned.
|
618
589
|
|
619
590
|
def test_self_activate_under
|
620
|
-
a = util_spec
|
621
|
-
b1 = util_spec
|
622
|
-
b1_1 = util_spec
|
623
|
-
c = util_spec
|
591
|
+
a = util_spec "a", "1.0", "b" => "~> 1.0", "c" => "= 1.0"
|
592
|
+
b1 = util_spec "b", "1.0"
|
593
|
+
b1_1 = util_spec "b", "1.1"
|
594
|
+
c = util_spec "c", "1.0", "b" => "= 1.0"
|
624
595
|
|
625
596
|
install_specs b1, b1_1, c, a
|
626
597
|
|
@@ -636,10 +607,10 @@ end
|
|
636
607
|
# [C1] depends on nothing
|
637
608
|
|
638
609
|
def test_self_activate_dropped
|
639
|
-
a1 = util_spec
|
640
|
-
b1 = util_spec
|
641
|
-
b2 = util_spec
|
642
|
-
c1 = util_spec
|
610
|
+
a1 = util_spec "a", "1", "b" => nil
|
611
|
+
b1 = util_spec "b", "1", "c" => nil
|
612
|
+
b2 = util_spec "b", "2"
|
613
|
+
c1 = util_spec "c", "1"
|
643
614
|
install_specs c1, b1, b2, a1
|
644
615
|
|
645
616
|
assert_activate %w[b-2 a-1], a1, "b"
|
@@ -656,11 +627,11 @@ end
|
|
656
627
|
# resolve.
|
657
628
|
|
658
629
|
def test_self_activate_raggi_the_edgecase_generator
|
659
|
-
a = util_spec
|
660
|
-
b1 = util_spec
|
661
|
-
b1_0 = util_spec
|
662
|
-
c = util_spec
|
663
|
-
z = util_spec
|
630
|
+
a = util_spec "a", "1.0", "b" => ">= 1.0", "c" => ">= 1.0"
|
631
|
+
b1 = util_spec "b", "1.0"
|
632
|
+
b1_0 = util_spec "b", "1.1", "z" => ">= 1.0"
|
633
|
+
c = util_spec "c", "1.0", "b" => "= 1.0"
|
634
|
+
z = util_spec "z", "1"
|
664
635
|
|
665
636
|
install_specs z, b1, b1_0, c, z
|
666
637
|
|
@@ -668,12 +639,12 @@ end
|
|
668
639
|
end
|
669
640
|
|
670
641
|
def test_self_activate_conflict
|
671
|
-
install_specs util_spec
|
672
|
-
install_specs util_spec
|
642
|
+
install_specs util_spec "b", "1.0"
|
643
|
+
install_specs util_spec "b", "2.0"
|
673
644
|
|
674
645
|
gem "b", "= 1.0"
|
675
646
|
|
676
|
-
|
647
|
+
assert_raise Gem::LoadError do
|
677
648
|
gem "b", "= 2.0"
|
678
649
|
end
|
679
650
|
end
|
@@ -684,7 +655,7 @@ end
|
|
684
655
|
install_specs a
|
685
656
|
Gem::Specification.all = [a]
|
686
657
|
|
687
|
-
assert_equal a, Gem::Specification.find_inactive_by_path(
|
658
|
+
assert_equal a, Gem::Specification.find_inactive_by_path("foo")
|
688
659
|
end
|
689
660
|
|
690
661
|
def test_self_attribute_names
|
@@ -720,20 +691,20 @@ end
|
|
720
691
|
version
|
721
692
|
]
|
722
693
|
|
723
|
-
actual_value = Gem::Specification.attribute_names.map {
|
694
|
+
actual_value = Gem::Specification.attribute_names.map {|a| a.to_s }.sort
|
724
695
|
|
725
696
|
assert_equal expected_value, actual_value
|
726
697
|
end
|
727
698
|
|
728
699
|
def test_self__load_future
|
729
700
|
spec = Gem::Specification.new
|
730
|
-
spec.name =
|
731
|
-
spec.version =
|
701
|
+
spec.name = "a"
|
702
|
+
spec.version = "1"
|
732
703
|
spec.specification_version = @current_version + 1
|
733
704
|
|
734
705
|
load_spec = Marshal.load Marshal.dump(spec)
|
735
706
|
|
736
|
-
assert_equal
|
707
|
+
assert_equal "a", load_spec.name
|
737
708
|
assert_equal Gem::Version.new(1), load_spec.version
|
738
709
|
assert_equal @current_version, load_spec.specification_version
|
739
710
|
end
|
@@ -747,125 +718,6 @@ end
|
|
747
718
|
spec.specification_version
|
748
719
|
end
|
749
720
|
|
750
|
-
def test_self_from_yaml_syck_date_bug
|
751
|
-
# This is equivalent to (and totally valid) psych 1.0 output and
|
752
|
-
# causes parse errors on syck.
|
753
|
-
yaml = @a1.to_yaml
|
754
|
-
yaml.sub!(/^date:.*/, "date: 2011-04-26 00:00:00.000000000Z")
|
755
|
-
|
756
|
-
spec = with_syck do
|
757
|
-
Gem::Specification.from_yaml yaml
|
758
|
-
end
|
759
|
-
|
760
|
-
assert_kind_of Time, @a1.date
|
761
|
-
assert_kind_of Time, spec.date
|
762
|
-
end
|
763
|
-
|
764
|
-
def test_self_from_yaml_syck_default_key_bug
|
765
|
-
# This is equivalent to (and totally valid) psych 1.0 output and
|
766
|
-
# causes parse errors on syck.
|
767
|
-
yaml = <<-YAML
|
768
|
-
--- !ruby/object:Gem::Specification
|
769
|
-
name: posix-spawn
|
770
|
-
version: !ruby/object:Gem::Version
|
771
|
-
version: 0.3.6
|
772
|
-
prerelease:
|
773
|
-
dependencies:
|
774
|
-
- !ruby/object:Gem::Dependency
|
775
|
-
name: rake-compiler
|
776
|
-
requirement: &70243867725240 !ruby/object:Gem::Requirement
|
777
|
-
none: false
|
778
|
-
requirements:
|
779
|
-
- - =
|
780
|
-
- !ruby/object:Gem::Version
|
781
|
-
version: 0.7.6
|
782
|
-
type: :development
|
783
|
-
prerelease: false
|
784
|
-
version_requirements: *70243867725240
|
785
|
-
platform: ruby
|
786
|
-
files: []
|
787
|
-
test_files: []
|
788
|
-
bindir:
|
789
|
-
YAML
|
790
|
-
|
791
|
-
spec = with_syck do
|
792
|
-
Gem::Specification.from_yaml yaml
|
793
|
-
end
|
794
|
-
|
795
|
-
op = spec.dependencies.first.requirement.requirements.first.first
|
796
|
-
refute_kind_of YAML::Syck::DefaultKey, op
|
797
|
-
|
798
|
-
refute_match %r%DefaultKey%, spec.to_ruby
|
799
|
-
end
|
800
|
-
|
801
|
-
def test_self_from_yaml_cleans_up_defaultkey
|
802
|
-
yaml = <<-YAML
|
803
|
-
--- !ruby/object:Gem::Specification
|
804
|
-
name: posix-spawn
|
805
|
-
version: !ruby/object:Gem::Version
|
806
|
-
version: 0.3.6
|
807
|
-
prerelease:
|
808
|
-
dependencies:
|
809
|
-
- !ruby/object:Gem::Dependency
|
810
|
-
name: rake-compiler
|
811
|
-
requirement: &70243867725240 !ruby/object:Gem::Requirement
|
812
|
-
none: false
|
813
|
-
requirements:
|
814
|
-
- - !ruby/object:YAML::Syck::DefaultKey {}
|
815
|
-
|
816
|
-
- !ruby/object:Gem::Version
|
817
|
-
version: 0.7.6
|
818
|
-
type: :development
|
819
|
-
prerelease: false
|
820
|
-
version_requirements: *70243867725240
|
821
|
-
platform: ruby
|
822
|
-
files: []
|
823
|
-
test_files: []
|
824
|
-
bindir:
|
825
|
-
YAML
|
826
|
-
|
827
|
-
spec = Gem::Specification.from_yaml yaml
|
828
|
-
|
829
|
-
op = spec.dependencies.first.requirement.requirements.first.first
|
830
|
-
refute_kind_of YAML::Syck::DefaultKey, op
|
831
|
-
|
832
|
-
refute_match %r%DefaultKey%, spec.to_ruby
|
833
|
-
end
|
834
|
-
|
835
|
-
def test_self_from_yaml_cleans_up_defaultkey_from_newer_192
|
836
|
-
yaml = <<-YAML
|
837
|
-
--- !ruby/object:Gem::Specification
|
838
|
-
name: posix-spawn
|
839
|
-
version: !ruby/object:Gem::Version
|
840
|
-
version: 0.3.6
|
841
|
-
prerelease:
|
842
|
-
dependencies:
|
843
|
-
- !ruby/object:Gem::Dependency
|
844
|
-
name: rake-compiler
|
845
|
-
requirement: &70243867725240 !ruby/object:Gem::Requirement
|
846
|
-
none: false
|
847
|
-
requirements:
|
848
|
-
- - !ruby/object:Syck::DefaultKey {}
|
849
|
-
|
850
|
-
- !ruby/object:Gem::Version
|
851
|
-
version: 0.7.6
|
852
|
-
type: :development
|
853
|
-
prerelease: false
|
854
|
-
version_requirements: *70243867725240
|
855
|
-
platform: ruby
|
856
|
-
files: []
|
857
|
-
test_files: []
|
858
|
-
bindir:
|
859
|
-
YAML
|
860
|
-
|
861
|
-
spec = Gem::Specification.from_yaml yaml
|
862
|
-
|
863
|
-
op = spec.dependencies.first.requirement.requirements.first.first
|
864
|
-
refute_kind_of YAML::Syck::DefaultKey, op
|
865
|
-
|
866
|
-
refute_match %r%DefaultKey%, spec.to_ruby
|
867
|
-
end
|
868
|
-
|
869
721
|
def test_self_from_yaml_cleans_up_Date_objects
|
870
722
|
yaml = <<-YAML
|
871
723
|
--- !ruby/object:Gem::Specification
|
@@ -931,20 +783,20 @@ dependencies: []
|
|
931
783
|
end
|
932
784
|
|
933
785
|
def test_self_load_relative
|
934
|
-
File.open
|
786
|
+
File.open "a-2.gemspec", "w" do |io|
|
935
787
|
io.write @a2.to_ruby_for_cache
|
936
788
|
end
|
937
789
|
|
938
|
-
spec = Gem::Specification.load
|
790
|
+
spec = Gem::Specification.load "a-2.gemspec"
|
939
791
|
|
940
792
|
@a2.files.clear
|
941
793
|
|
942
794
|
assert_equal @a2, spec
|
943
795
|
|
944
|
-
assert_equal File.join(@tempdir,
|
796
|
+
assert_equal File.join(@tempdir, "a-2.gemspec"), spec.loaded_from
|
945
797
|
end
|
946
798
|
|
947
|
-
if RUBY_ENGINE ==
|
799
|
+
if RUBY_ENGINE == "ruby" && RUBY_VERSION < "2.7"
|
948
800
|
def test_self_load_tainted
|
949
801
|
full_path = @a2.spec_file
|
950
802
|
write_file full_path do |io|
|
@@ -973,7 +825,7 @@ dependencies: []
|
|
973
825
|
io.write @a2.to_ruby_for_cache
|
974
826
|
end
|
975
827
|
rescue Errno::EINVAL
|
976
|
-
|
828
|
+
pend "cannot create '#{full_path}' on this platform"
|
977
829
|
end
|
978
830
|
|
979
831
|
spec = Gem::Specification.load full_path
|
@@ -992,7 +844,7 @@ dependencies: []
|
|
992
844
|
io.write @a2.to_ruby_for_cache
|
993
845
|
end
|
994
846
|
rescue Errno::EINVAL
|
995
|
-
|
847
|
+
pend "cannot create '#{full_path}' on this platform"
|
996
848
|
end
|
997
849
|
|
998
850
|
spec = Gem::Specification.load full_path
|
@@ -1011,7 +863,7 @@ dependencies: []
|
|
1011
863
|
io.write @a2.to_ruby_for_cache
|
1012
864
|
end
|
1013
865
|
rescue Errno::EINVAL
|
1014
|
-
|
866
|
+
pend "cannot create '#{full_path}' on this platform"
|
1015
867
|
end
|
1016
868
|
|
1017
869
|
spec = Gem::Specification.load full_path
|
@@ -1022,34 +874,31 @@ dependencies: []
|
|
1022
874
|
end
|
1023
875
|
|
1024
876
|
def test_self_load_utf8_with_ascii_encoding
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
io.write spec2.to_ruby_for_cache.force_encoding('BINARY').sub("\\u{5678}", bin.force_encoding('BINARY'))
|
1034
|
-
end
|
877
|
+
with_internal_encoding("US-ASCII") do
|
878
|
+
spec2 = @a2.dup
|
879
|
+
bin = "\u5678".dup
|
880
|
+
spec2.authors = [bin]
|
881
|
+
full_path = spec2.spec_file
|
882
|
+
write_file full_path do |io|
|
883
|
+
io.write spec2.to_ruby_for_cache.force_encoding("BINARY").sub("\\u{5678}", bin.force_encoding("BINARY"))
|
884
|
+
end
|
1035
885
|
|
1036
|
-
|
886
|
+
spec = Gem::Specification.load full_path
|
1037
887
|
|
1038
|
-
|
888
|
+
spec2.files.clear
|
1039
889
|
|
1040
|
-
|
1041
|
-
|
1042
|
-
silence_warnings { Encoding.default_internal = int_enc }
|
890
|
+
assert_equal spec2, spec
|
891
|
+
end
|
1043
892
|
end
|
1044
893
|
|
1045
894
|
def test_self_load_legacy_ruby
|
1046
895
|
spec = Gem::Deprecate.skip_during do
|
1047
896
|
eval LEGACY_RUBY_SPEC
|
1048
897
|
end
|
1049
|
-
assert_equal
|
1050
|
-
assert_equal
|
898
|
+
assert_equal "keyedlist", spec.name
|
899
|
+
assert_equal "0.4.0", spec.version.to_s
|
1051
900
|
assert_kind_of Time, spec.date
|
1052
|
-
assert spec.required_ruby_version.satisfied_by?(Gem::Version.new(
|
901
|
+
assert spec.required_ruby_version.satisfied_by?(Gem::Version.new("1"))
|
1053
902
|
assert_equal false, spec.has_unit_tests?
|
1054
903
|
end
|
1055
904
|
|
@@ -1084,26 +933,26 @@ dependencies: []
|
|
1084
933
|
|
1085
934
|
def test_self_outdated
|
1086
935
|
spec_fetcher do |fetcher|
|
1087
|
-
fetcher.download
|
936
|
+
fetcher.download "a", 4
|
1088
937
|
|
1089
|
-
fetcher.spec
|
938
|
+
fetcher.spec "a", 3
|
1090
939
|
end
|
1091
940
|
|
1092
941
|
assert_equal %w[a], Gem::Specification.outdated
|
1093
942
|
end
|
1094
943
|
|
1095
944
|
def test_self_outdated_and_latest_remotes
|
1096
|
-
|
1097
|
-
fetcher.download
|
1098
|
-
fetcher.download
|
945
|
+
spec_fetcher do |fetcher|
|
946
|
+
fetcher.download "a", 4
|
947
|
+
fetcher.download "b", 3
|
1099
948
|
|
1100
|
-
fetcher.spec
|
1101
|
-
fetcher.spec
|
949
|
+
fetcher.spec "a", "3.a"
|
950
|
+
fetcher.spec "b", 2
|
1102
951
|
end
|
1103
952
|
|
1104
953
|
expected = [
|
1105
|
-
[
|
1106
|
-
[
|
954
|
+
[Gem::Specification.stubs.find {|s| s.full_name == "a-3.a" }, v(4)],
|
955
|
+
[Gem::Specification.stubs.find {|s| s.full_name == "b-2" }, v(3)],
|
1107
956
|
]
|
1108
957
|
|
1109
958
|
assert_equal expected, Gem::Specification.outdated_and_latest_version.to_a
|
@@ -1112,18 +961,18 @@ dependencies: []
|
|
1112
961
|
def test_self_remove_spec
|
1113
962
|
install_specs @a1
|
1114
963
|
|
1115
|
-
assert_includes Gem::Specification.all_names,
|
1116
|
-
assert_includes Gem::Specification.stubs.map {
|
964
|
+
assert_includes Gem::Specification.all_names, "a-1"
|
965
|
+
assert_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
|
1117
966
|
|
1118
967
|
uninstall_gem @a1
|
1119
968
|
Gem::Specification.reset
|
1120
969
|
|
1121
|
-
refute_includes Gem::Specification.all_names,
|
1122
|
-
refute_includes Gem::Specification.stubs.map {
|
970
|
+
refute_includes Gem::Specification.all_names, "a-1"
|
971
|
+
refute_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
|
1123
972
|
end
|
1124
973
|
|
1125
974
|
def test_self_remove_spec_removed
|
1126
|
-
File.open @a1.spec_file,
|
975
|
+
File.open @a1.spec_file, "w" do |io|
|
1127
976
|
io.write @a1.to_ruby
|
1128
977
|
end
|
1129
978
|
|
@@ -1133,50 +982,40 @@ dependencies: []
|
|
1133
982
|
|
1134
983
|
Gem::Specification.reset
|
1135
984
|
|
1136
|
-
refute_includes Gem::Specification.all_names,
|
1137
|
-
refute_includes Gem::Specification.stubs.map {
|
985
|
+
refute_includes Gem::Specification.all_names, "a-1"
|
986
|
+
refute_includes Gem::Specification.stubs.map {|s| s.full_name }, "a-1"
|
1138
987
|
end
|
1139
988
|
|
1140
|
-
def
|
989
|
+
def test_self_stubs_for_lazy_loading
|
1141
990
|
Gem.loaded_specs.clear
|
1142
991
|
Gem::Specification.class_variable_set(:@@stubs, nil)
|
1143
992
|
|
1144
|
-
dir_standard_specs = File.join Gem.dir,
|
1145
|
-
dir_default_specs = Gem.default_specifications_dir
|
993
|
+
dir_standard_specs = File.join Gem.dir, "specifications"
|
1146
994
|
|
1147
|
-
|
1148
|
-
|
1149
|
-
Gem.loaded_specs['a'] = loaded_spec
|
1150
|
-
save_gemspec 'a', '2', dir_default_specs
|
1151
|
-
save_gemspec 'a', '1', dir_standard_specs
|
995
|
+
save_gemspec("a-1", "1", dir_standard_specs) {|s| s.name = "a" }
|
996
|
+
save_gemspec("b-1", "1", dir_standard_specs) {|s| s.name = "b" }
|
1152
997
|
|
1153
|
-
|
1154
|
-
assert_equal
|
998
|
+
assert_equal ["a-1"], Gem::Specification.stubs_for("a").map {|s| s.full_name }
|
999
|
+
assert_equal 1, Gem::Specification.class_variable_get(:@@stubs_by_name).length
|
1000
|
+
assert_equal ["b-1"], Gem::Specification.stubs_for("b").map {|s| s.full_name }
|
1001
|
+
assert_equal 2, Gem::Specification.class_variable_get(:@@stubs_by_name).length
|
1155
1002
|
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1003
|
+
assert_equal(
|
1004
|
+
Gem::Specification.stubs_for("a").map {|s| s.object_id },
|
1005
|
+
Gem::Specification.stubs_for("a").map {|s| s.object_id }
|
1006
|
+
)
|
1159
1007
|
|
1160
|
-
|
1161
|
-
Gem.loaded_specs.
|
1008
|
+
Gem.loaded_specs.delete "a"
|
1009
|
+
Gem.loaded_specs.delete "b"
|
1162
1010
|
Gem::Specification.class_variable_set(:@@stubs, nil)
|
1011
|
+
end
|
1163
1012
|
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
# Create gemspecs in three locations used in stubs
|
1168
|
-
loaded_spec = Gem::Specification.new 'a', '3'
|
1169
|
-
Gem.loaded_specs['a'] = loaded_spec
|
1170
|
-
save_gemspec('a-2', '2', dir_default_specs) { |s| s.name = 'a' }
|
1171
|
-
save_gemspec('a-1', '1', dir_standard_specs) { |s| s.name = 'a' }
|
1013
|
+
def test_self_stubs_for_no_lazy_loading_after_all_specs_setup
|
1014
|
+
Gem::Specification.all = [util_spec("a", "1")]
|
1172
1015
|
|
1173
|
-
|
1016
|
+
save_gemspec("b-1", "1", File.join(Gem.dir, "specifications")) {|s| s.name = "b" }
|
1174
1017
|
|
1175
|
-
assert_equal
|
1176
|
-
assert_equal 1, Gem::Specification.class_variable_get(:@@stubs_by_name).length
|
1177
|
-
|
1178
|
-
Gem.loaded_specs.delete 'a'
|
1179
|
-
Gem::Specification.class_variable_set(:@@stubs, nil)
|
1018
|
+
assert_equal [], Gem::Specification.stubs_for("b").map {|s| s.full_name }
|
1180
1019
|
end
|
1181
1020
|
|
1182
1021
|
def test_self_stubs_for_mult_platforms
|
@@ -1186,30 +1025,30 @@ dependencies: []
|
|
1186
1025
|
orig_platform = Gem.platforms.dup
|
1187
1026
|
|
1188
1027
|
# create user spec
|
1189
|
-
user_spec_dir = File.join Gem.user_dir,
|
1190
|
-
FileUtils.mkdir_p(user_spec_dir)
|
1028
|
+
user_spec_dir = File.join Gem.user_dir, "specifications"
|
1029
|
+
FileUtils.mkdir_p(user_spec_dir) unless Dir.exist? user_spec_dir
|
1191
1030
|
# dirs doesn't include user ?
|
1192
1031
|
Gem::Specification.dirs << user_spec_dir
|
1193
1032
|
|
1194
|
-
gem =
|
1195
|
-
v =
|
1196
|
-
platforms = [
|
1033
|
+
gem = "mingw"
|
1034
|
+
v = "1.1.1"
|
1035
|
+
platforms = ["x86-mingw32", "x64-mingw32"]
|
1197
1036
|
|
1198
1037
|
#create specs
|
1199
1038
|
platforms.each do |plat|
|
1200
|
-
spec = Gem::Specification.new(gem, v) {
|
1201
|
-
File.open File.join(user_spec_dir, "#{gem}-#{v}-#{plat}.gemspec"),
|
1039
|
+
spec = Gem::Specification.new(gem, v) {|s| s.platform = plat }
|
1040
|
+
File.open File.join(user_spec_dir, "#{gem}-#{v}-#{plat}.gemspec"), "w" do |io|
|
1202
1041
|
io.write spec.to_ruby
|
1203
1042
|
end
|
1204
1043
|
end
|
1205
1044
|
|
1206
1045
|
platforms.each do |plat|
|
1207
1046
|
cur_plat = Gem::Platform.new plat
|
1208
|
-
Gem.platforms = [
|
1047
|
+
Gem.platforms = ["ruby", cur_plat]
|
1209
1048
|
|
1210
1049
|
Gem::Specification.class_variable_set :@@stubs, nil
|
1211
1050
|
Gem::Specification.stubs if plat == platforms.last # test loading via stubs
|
1212
|
-
t = Gem::Specification.stubs_for
|
1051
|
+
t = Gem::Specification.stubs_for "mingw"
|
1213
1052
|
|
1214
1053
|
assert_equal 1, t.length
|
1215
1054
|
assert_equal cur_plat, t.first.platform
|
@@ -1218,14 +1057,30 @@ dependencies: []
|
|
1218
1057
|
Gem.platforms = orig_platform
|
1219
1058
|
end
|
1220
1059
|
|
1221
|
-
|
1060
|
+
def test_self_stubs_returns_only_specified_named_specs
|
1061
|
+
dir_standard_specs = File.join Gem.dir, "specifications"
|
1062
|
+
|
1063
|
+
save_gemspec("a-1", "1", dir_standard_specs) {|s| s.name = "a" }
|
1064
|
+
save_gemspec("a-2", "2", dir_standard_specs) {|s| s.name = "a" }
|
1065
|
+
save_gemspec("a-a", "3", dir_standard_specs) {|s| s.name = "a-a" }
|
1066
|
+
|
1067
|
+
assert_equal ["a-1", "a-2"], Gem::Specification.stubs_for("a").map(&:full_name).sort
|
1068
|
+
end
|
1222
1069
|
|
1223
1070
|
def test_handles_private_null_type
|
1224
|
-
path = File.
|
1071
|
+
path = File.expand_path "data/pry-0.4.7.gemspec.rz", __dir__
|
1225
1072
|
|
1226
1073
|
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))
|
1227
1074
|
|
1228
|
-
|
1075
|
+
assert_instance_of Gem::Specification, data
|
1076
|
+
end
|
1077
|
+
|
1078
|
+
def test_handles_dependencies_with_syck_requirements_bug
|
1079
|
+
path = File.expand_path "data/excon-0.7.7.gemspec.rz", __dir__
|
1080
|
+
|
1081
|
+
data = Marshal.load Gem::Util.inflate(Gem.read_binary(path))
|
1082
|
+
|
1083
|
+
assert_instance_of Gem::Specification, data
|
1229
1084
|
end
|
1230
1085
|
|
1231
1086
|
def test_initialize
|
@@ -1247,9 +1102,9 @@ dependencies: []
|
|
1247
1102
|
assert_equal [], spec.extensions
|
1248
1103
|
assert_equal [], spec.requirements
|
1249
1104
|
assert_equal [], spec.dependencies
|
1250
|
-
assert_equal
|
1251
|
-
assert_equal
|
1252
|
-
assert_equal
|
1105
|
+
assert_equal "bin", spec.bindir
|
1106
|
+
assert_equal ">= 0", spec.required_ruby_version.to_s
|
1107
|
+
assert_equal ">= 0", spec.required_rubygems_version.to_s
|
1253
1108
|
end
|
1254
1109
|
|
1255
1110
|
def test_initialize_future
|
@@ -1271,18 +1126,18 @@ dependencies: []
|
|
1271
1126
|
spec = Gem::Specification.new do |s|
|
1272
1127
|
s.name = "blah"
|
1273
1128
|
s.version = "1.3.5"
|
1274
|
-
s.summary =
|
1275
|
-
s.description =
|
1276
|
-
s.authors =
|
1277
|
-
s.licenses =
|
1278
|
-
s.files =
|
1279
|
-
s.test_files =
|
1280
|
-
s.rdoc_options =
|
1281
|
-
s.extra_rdoc_files =
|
1282
|
-
s.executables =
|
1283
|
-
s.extensions =
|
1284
|
-
s.requirements =
|
1285
|
-
s.add_dependency
|
1129
|
+
s.summary = "summary"
|
1130
|
+
s.description = "description"
|
1131
|
+
s.authors = "author a", "author b"
|
1132
|
+
s.licenses = "BSD-2-Clause"
|
1133
|
+
s.files = "lib/file.rb"
|
1134
|
+
s.test_files = "test/file.rb"
|
1135
|
+
s.rdoc_options = "--foo"
|
1136
|
+
s.extra_rdoc_files = "README.txt"
|
1137
|
+
s.executables = "exec"
|
1138
|
+
s.extensions = "ext/extconf.rb"
|
1139
|
+
s.requirements = "requirement"
|
1140
|
+
s.add_dependency "some_gem"
|
1286
1141
|
end
|
1287
1142
|
|
1288
1143
|
dup_spec = spec.dup
|
@@ -1296,84 +1151,93 @@ dependencies: []
|
|
1296
1151
|
assert_equal Gem::Platform::RUBY, spec.platform
|
1297
1152
|
assert_same spec.platform, dup_spec.platform
|
1298
1153
|
|
1299
|
-
assert_equal
|
1154
|
+
assert_equal "summary", spec.summary
|
1300
1155
|
assert_same spec.summary, dup_spec.summary
|
1301
1156
|
|
1302
1157
|
assert_equal %w[README.txt bin/exec ext/extconf.rb lib/file.rb
|
1303
1158
|
test/file.rb].sort,
|
1304
1159
|
spec.files
|
1305
|
-
refute_same spec.files, dup_spec.files,
|
1160
|
+
refute_same spec.files, dup_spec.files, "files"
|
1306
1161
|
|
1307
1162
|
assert_equal %w[test/file.rb], spec.test_files
|
1308
|
-
refute_same spec.test_files, dup_spec.test_files,
|
1163
|
+
refute_same spec.test_files, dup_spec.test_files, "test_files"
|
1309
1164
|
|
1310
1165
|
assert_equal %w[--foo], spec.rdoc_options
|
1311
|
-
refute_same spec.rdoc_options, dup_spec.rdoc_options,
|
1166
|
+
refute_same spec.rdoc_options, dup_spec.rdoc_options, "rdoc_options"
|
1312
1167
|
|
1313
1168
|
assert_equal %w[README.txt], spec.extra_rdoc_files
|
1314
1169
|
refute_same spec.extra_rdoc_files, dup_spec.extra_rdoc_files,
|
1315
|
-
|
1170
|
+
"extra_rdoc_files"
|
1316
1171
|
|
1317
1172
|
assert_equal %w[exec], spec.executables
|
1318
|
-
refute_same spec.executables, dup_spec.executables,
|
1173
|
+
refute_same spec.executables, dup_spec.executables, "executables"
|
1319
1174
|
|
1320
1175
|
assert_equal %w[ext/extconf.rb], spec.extensions
|
1321
|
-
refute_same spec.extensions, dup_spec.extensions,
|
1176
|
+
refute_same spec.extensions, dup_spec.extensions, "extensions"
|
1322
1177
|
|
1323
1178
|
assert_equal %w[requirement], spec.requirements
|
1324
|
-
refute_same spec.requirements, dup_spec.requirements,
|
1179
|
+
refute_same spec.requirements, dup_spec.requirements, "requirements"
|
1325
1180
|
|
1326
|
-
assert_equal [Gem::Dependency.new(
|
1181
|
+
assert_equal [Gem::Dependency.new("some_gem", Gem::Requirement.default)],
|
1327
1182
|
spec.dependencies
|
1328
|
-
refute_same spec.dependencies, dup_spec.dependencies,
|
1183
|
+
refute_same spec.dependencies, dup_spec.dependencies, "dependencies"
|
1329
1184
|
|
1330
|
-
assert_equal
|
1185
|
+
assert_equal "bin", spec.bindir
|
1331
1186
|
assert_same spec.bindir, dup_spec.bindir
|
1332
1187
|
|
1333
|
-
assert_equal
|
1188
|
+
assert_equal ">= 0", spec.required_ruby_version.to_s
|
1334
1189
|
assert_same spec.required_ruby_version, dup_spec.required_ruby_version
|
1335
1190
|
|
1336
|
-
assert_equal
|
1191
|
+
assert_equal ">= 0", spec.required_rubygems_version.to_s
|
1337
1192
|
assert_same spec.required_rubygems_version,
|
1338
1193
|
dup_spec.required_rubygems_version
|
1339
1194
|
end
|
1340
1195
|
|
1341
1196
|
def test_initialize_copy_broken
|
1342
1197
|
spec = Gem::Specification.new do |s|
|
1343
|
-
s.name =
|
1344
|
-
s.version =
|
1198
|
+
s.name = "a"
|
1199
|
+
s.version = "1"
|
1345
1200
|
end
|
1346
1201
|
|
1347
1202
|
spec.instance_variable_set :@licenses, (class << (Object.new);self;end)
|
1348
|
-
spec.loaded_from =
|
1203
|
+
spec.loaded_from = "/path/to/file"
|
1349
1204
|
|
1350
|
-
e =
|
1205
|
+
e = assert_raise Gem::FormatException do
|
1351
1206
|
spec.dup
|
1352
1207
|
end
|
1353
1208
|
|
1354
|
-
assert_equal
|
1355
|
-
assert_equal
|
1209
|
+
assert_equal "a-1 has an invalid value for @licenses", e.message
|
1210
|
+
assert_equal "/path/to/file", e.file_path
|
1356
1211
|
end
|
1357
1212
|
|
1358
1213
|
def test_initialize_prerelease_version_before_name
|
1359
1214
|
spec = Gem::Specification.new do |s|
|
1360
|
-
s.version =
|
1361
|
-
s.name =
|
1215
|
+
s.version = "1.0.0.dev"
|
1216
|
+
s.name = "a"
|
1362
1217
|
end
|
1363
1218
|
|
1364
1219
|
assert_equal "a", spec.name
|
1365
1220
|
assert_equal "1.0.0.dev", spec.version.to_s
|
1366
1221
|
end
|
1367
1222
|
|
1223
|
+
def test_initialize_nil_version
|
1224
|
+
expected = "nil versions are discouraged and will be deprecated in Rubygems 4\n"
|
1225
|
+
actual_stdout, actual_stderr = capture_output do
|
1226
|
+
Gem::Specification.new.version = nil
|
1227
|
+
end
|
1228
|
+
assert_empty actual_stdout
|
1229
|
+
assert_equal(expected, actual_stderr)
|
1230
|
+
end
|
1231
|
+
|
1368
1232
|
def test__dump
|
1369
1233
|
@a2.platform = Gem::Platform.local
|
1370
|
-
@a2.instance_variable_set :@original_platform,
|
1234
|
+
@a2.instance_variable_set :@original_platform, "old_platform"
|
1371
1235
|
|
1372
1236
|
data = Marshal.dump @a2
|
1373
1237
|
|
1374
1238
|
same_spec = Marshal.load data
|
1375
1239
|
|
1376
|
-
assert_equal
|
1240
|
+
assert_equal "old_platform", same_spec.original_platform
|
1377
1241
|
end
|
1378
1242
|
|
1379
1243
|
def test_activate
|
@@ -1388,12 +1252,12 @@ dependencies: []
|
|
1388
1252
|
awesome.add_dependency :gem_name
|
1389
1253
|
end
|
1390
1254
|
|
1391
|
-
assert_equal %w[true gem_name], gem.dependencies.map {
|
1255
|
+
assert_equal %w[true gem_name], gem.dependencies.map {|dep| dep.name }
|
1392
1256
|
end
|
1393
1257
|
|
1394
1258
|
def test_add_dependency_from_existing_dependency
|
1395
|
-
dep = Gem::Dependency.new("existing_dep", Gem::Requirement.new(
|
1396
|
-
spec = Gem::Specification.new {
|
1259
|
+
dep = Gem::Dependency.new("existing_dep", Gem::Requirement.new("> 1"), :runtime)
|
1260
|
+
spec = Gem::Specification.new {|s| s.add_dependency dep }
|
1397
1261
|
assert_equal dep, spec.dependencies.first
|
1398
1262
|
end
|
1399
1263
|
|
@@ -1402,27 +1266,27 @@ dependencies: []
|
|
1402
1266
|
awesome.add_development_dependency "monkey"
|
1403
1267
|
end
|
1404
1268
|
|
1405
|
-
monkey = gem.dependencies.detect {
|
1269
|
+
monkey = gem.dependencies.detect {|d| d.name == "monkey" }
|
1406
1270
|
assert_equal(:development, monkey.type)
|
1407
1271
|
end
|
1408
1272
|
|
1409
1273
|
def test_author
|
1410
|
-
assert_equal
|
1274
|
+
assert_equal "A User", @a1.author
|
1411
1275
|
end
|
1412
1276
|
|
1413
1277
|
def test_authors
|
1414
|
-
assert_equal [
|
1278
|
+
assert_equal ["A User"], @a1.authors
|
1415
1279
|
end
|
1416
1280
|
|
1417
1281
|
def test_bindir_equals
|
1418
|
-
@a1.bindir =
|
1282
|
+
@a1.bindir = "apps"
|
1419
1283
|
|
1420
|
-
assert_equal
|
1284
|
+
assert_equal "apps", @a1.bindir
|
1421
1285
|
end
|
1422
1286
|
|
1423
1287
|
def test_bindir_equals_nil
|
1424
1288
|
@a2.bindir = nil
|
1425
|
-
@a2.executable =
|
1289
|
+
@a2.executable = "app"
|
1426
1290
|
|
1427
1291
|
assert_nil @a2.bindir
|
1428
1292
|
assert_equal %w[app lib/code.rb].sort, @a2.files
|
@@ -1453,35 +1317,35 @@ dependencies: []
|
|
1453
1317
|
end
|
1454
1318
|
|
1455
1319
|
def test_build_args
|
1456
|
-
|
1320
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1457
1321
|
ext_spec
|
1458
1322
|
|
1459
1323
|
assert_empty @ext.build_args
|
1460
1324
|
|
1461
|
-
File.open @ext.build_info_file,
|
1325
|
+
File.open @ext.build_info_file, "w" do |io|
|
1462
1326
|
io.puts
|
1463
1327
|
end
|
1464
1328
|
|
1465
1329
|
assert_empty @ext.build_args
|
1466
1330
|
|
1467
|
-
File.open @ext.build_info_file,
|
1468
|
-
io.puts
|
1331
|
+
File.open @ext.build_info_file, "w" do |io|
|
1332
|
+
io.puts "--with-foo-dir=wherever"
|
1469
1333
|
end
|
1470
1334
|
|
1471
1335
|
assert_equal %w[--with-foo-dir=wherever], @ext.build_args
|
1472
1336
|
end
|
1473
1337
|
|
1474
1338
|
def test_build_extensions
|
1475
|
-
|
1339
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1476
1340
|
ext_spec
|
1477
1341
|
|
1478
|
-
|
1479
|
-
refute_empty @ext.extensions,
|
1342
|
+
assert_path_not_exist @ext.extension_dir, "sanity check"
|
1343
|
+
refute_empty @ext.extensions, "sanity check"
|
1480
1344
|
|
1481
1345
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1482
1346
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1483
1347
|
|
1484
|
-
File.open extconf_rb,
|
1348
|
+
File.open extconf_rb, "w" do |f|
|
1485
1349
|
f.write <<-'RUBY'
|
1486
1350
|
File.open 'Makefile', 'w' do |f|
|
1487
1351
|
f.puts "clean:\n\techo clean"
|
@@ -1493,46 +1357,46 @@ dependencies: []
|
|
1493
1357
|
|
1494
1358
|
@ext.build_extensions
|
1495
1359
|
|
1496
|
-
|
1360
|
+
assert_path_exist @ext.extension_dir
|
1497
1361
|
end
|
1498
1362
|
|
1499
1363
|
def test_default_spec_stub_is_marked_default
|
1500
|
-
default = new_default_spec
|
1364
|
+
default = new_default_spec "default", 2
|
1501
1365
|
install_default_gems default
|
1502
1366
|
|
1503
|
-
stub = Gem::Specification.stubs.find {
|
1367
|
+
stub = Gem::Specification.stubs.find {|s| s.name == "default" }
|
1504
1368
|
assert_predicate stub, :default_gem?
|
1505
1369
|
|
1506
|
-
stub = Gem::Specification.find_all_by_name(
|
1370
|
+
stub = Gem::Specification.find_all_by_name("default").first
|
1507
1371
|
assert_predicate stub, :default_gem?
|
1508
1372
|
end
|
1509
1373
|
|
1510
1374
|
def test_build_extensions_built
|
1511
|
-
|
1375
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1512
1376
|
ext_spec
|
1513
1377
|
|
1514
|
-
refute_empty @ext.extensions,
|
1378
|
+
refute_empty @ext.extensions, "sanity check"
|
1515
1379
|
|
1516
1380
|
gem_build_complete =
|
1517
|
-
File.join @ext.extension_dir,
|
1381
|
+
File.join @ext.extension_dir, "gem.build_complete"
|
1518
1382
|
|
1519
1383
|
FileUtils.mkdir_p @ext.extension_dir
|
1520
1384
|
FileUtils.touch gem_build_complete
|
1521
1385
|
|
1522
1386
|
@ext.build_extensions
|
1523
1387
|
|
1524
|
-
gem_make_out = File.join @ext.extension_dir,
|
1525
|
-
|
1388
|
+
gem_make_out = File.join @ext.extension_dir, "gem_make.out"
|
1389
|
+
assert_path_not_exist gem_make_out
|
1526
1390
|
end
|
1527
1391
|
|
1528
1392
|
def test_build_extensions_default_gem
|
1529
|
-
spec = new_default_spec
|
1530
|
-
spec.extensions <<
|
1393
|
+
spec = new_default_spec "default", 1
|
1394
|
+
spec.extensions << "extconf.rb"
|
1531
1395
|
|
1532
1396
|
extconf_rb = File.join spec.gem_dir, spec.extensions.first
|
1533
1397
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1534
1398
|
|
1535
|
-
File.open extconf_rb,
|
1399
|
+
File.open extconf_rb, "w" do |f|
|
1536
1400
|
f.write <<-'RUBY'
|
1537
1401
|
File.open 'Makefile', 'w' do |f|
|
1538
1402
|
f.puts "default:\n\techo built"
|
@@ -1543,33 +1407,33 @@ dependencies: []
|
|
1543
1407
|
|
1544
1408
|
spec.build_extensions
|
1545
1409
|
|
1546
|
-
|
1410
|
+
assert_path_not_exist spec.extension_dir
|
1547
1411
|
end
|
1548
1412
|
|
1549
1413
|
def test_build_extensions_error
|
1550
|
-
|
1414
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1551
1415
|
ext_spec
|
1552
1416
|
|
1553
|
-
refute_empty @ext.extensions,
|
1417
|
+
refute_empty @ext.extensions, "sanity check"
|
1554
1418
|
|
1555
|
-
|
1419
|
+
assert_raise Gem::Ext::BuildError do
|
1556
1420
|
@ext.build_extensions
|
1557
1421
|
end
|
1558
1422
|
end
|
1559
1423
|
|
1560
1424
|
def test_build_extensions_extensions_dir_unwritable
|
1561
|
-
|
1562
|
-
|
1425
|
+
pend "chmod not supported" if Gem.win_platform?
|
1426
|
+
pend "skipped in root privilege" if Process.uid.zero?
|
1563
1427
|
|
1564
|
-
|
1428
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1565
1429
|
ext_spec
|
1566
1430
|
|
1567
|
-
refute_empty @ext.extensions,
|
1431
|
+
refute_empty @ext.extensions, "sanity check"
|
1568
1432
|
|
1569
1433
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1570
1434
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1571
1435
|
|
1572
|
-
File.open extconf_rb,
|
1436
|
+
File.open extconf_rb, "w" do |f|
|
1573
1437
|
f.write <<-'RUBY'
|
1574
1438
|
File.open 'Makefile', 'w' do |f|
|
1575
1439
|
f.puts "clean:\n\techo clean"
|
@@ -1579,30 +1443,30 @@ dependencies: []
|
|
1579
1443
|
RUBY
|
1580
1444
|
end
|
1581
1445
|
|
1582
|
-
FileUtils.mkdir_p File.join @ext.base_dir,
|
1446
|
+
FileUtils.mkdir_p File.join @ext.base_dir, "extensions"
|
1583
1447
|
FileUtils.chmod 0555, @ext.base_dir
|
1584
|
-
FileUtils.chmod 0555, File.join(@ext.base_dir,
|
1448
|
+
FileUtils.chmod 0555, File.join(@ext.base_dir, "extensions")
|
1585
1449
|
|
1586
1450
|
@ext.build_extensions
|
1587
|
-
|
1451
|
+
assert_path_not_exist @ext.extension_dir
|
1588
1452
|
ensure
|
1589
|
-
unless ($DEBUG
|
1590
|
-
FileUtils.chmod 0755, File.join(@ext.base_dir,
|
1453
|
+
unless ($DEBUG || win_platform? || Process.uid.zero? || Gem.java_platform?)
|
1454
|
+
FileUtils.chmod 0755, File.join(@ext.base_dir, "extensions")
|
1591
1455
|
FileUtils.chmod 0755, @ext.base_dir
|
1592
1456
|
end
|
1593
1457
|
end
|
1594
1458
|
|
1595
1459
|
def test_build_extensions_no_extensions_dir_unwritable
|
1596
|
-
|
1597
|
-
|
1460
|
+
pend "chmod not supported" if Gem.win_platform?
|
1461
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1598
1462
|
ext_spec
|
1599
1463
|
|
1600
|
-
refute_empty @ext.extensions,
|
1464
|
+
refute_empty @ext.extensions, "sanity check"
|
1601
1465
|
|
1602
1466
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1603
1467
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1604
1468
|
|
1605
|
-
File.open extconf_rb,
|
1469
|
+
File.open extconf_rb, "w" do |f|
|
1606
1470
|
f.write <<-'RUBY'
|
1607
1471
|
File.open 'Makefile', 'w' do |f|
|
1608
1472
|
f.puts "clean:\n\techo clean"
|
@@ -1612,48 +1476,34 @@ dependencies: []
|
|
1612
1476
|
RUBY
|
1613
1477
|
end
|
1614
1478
|
|
1615
|
-
FileUtils.rm_r File.join @gemhome,
|
1479
|
+
FileUtils.rm_r File.join @gemhome, "extensions"
|
1616
1480
|
FileUtils.chmod 0555, @gemhome
|
1617
1481
|
|
1618
1482
|
@ext.build_extensions
|
1619
1483
|
|
1620
|
-
gem_make_out = File.join @ext.extension_dir,
|
1621
|
-
|
1484
|
+
gem_make_out = File.join @ext.extension_dir, "gem_make.out"
|
1485
|
+
assert_path_not_exist gem_make_out
|
1622
1486
|
ensure
|
1623
1487
|
FileUtils.chmod 0755, @gemhome
|
1624
1488
|
end
|
1625
1489
|
|
1626
1490
|
def test_build_extensions_none
|
1627
|
-
|
1628
|
-
assert_empty @a1.extensions,
|
1491
|
+
assert_path_not_exist @a1.extension_dir, "sanity check"
|
1492
|
+
assert_empty @a1.extensions, "sanity check"
|
1629
1493
|
|
1630
1494
|
@a1.build_extensions
|
1631
1495
|
|
1632
|
-
|
1633
|
-
end
|
1634
|
-
|
1635
|
-
def test_build_extensions_old
|
1636
|
-
skip "extensions don't quite work on jruby" if Gem.java_platform?
|
1637
|
-
ext_spec
|
1638
|
-
|
1639
|
-
refute_empty @ext.extensions, 'sanity check'
|
1640
|
-
|
1641
|
-
@ext.installed_by_version = v(0)
|
1642
|
-
|
1643
|
-
@ext.build_extensions
|
1644
|
-
|
1645
|
-
gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
|
1646
|
-
refute_path_exists gem_make_out
|
1496
|
+
assert_path_not_exist @a1.extension_dir
|
1647
1497
|
end
|
1648
1498
|
|
1649
1499
|
def test_build_extensions_preview
|
1650
|
-
|
1500
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1651
1501
|
ext_spec
|
1652
1502
|
|
1653
1503
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1654
1504
|
FileUtils.mkdir_p File.dirname extconf_rb
|
1655
1505
|
|
1656
|
-
File.open extconf_rb,
|
1506
|
+
File.open extconf_rb, "w" do |f|
|
1657
1507
|
f.write <<-'RUBY'
|
1658
1508
|
File.open 'Makefile', 'w' do |f|
|
1659
1509
|
f.puts "clean:\n\techo clean"
|
@@ -1663,30 +1513,30 @@ dependencies: []
|
|
1663
1513
|
RUBY
|
1664
1514
|
end
|
1665
1515
|
|
1666
|
-
refute_empty @ext.extensions,
|
1516
|
+
refute_empty @ext.extensions, "sanity check"
|
1667
1517
|
|
1668
|
-
@ext.installed_by_version = v(
|
1518
|
+
@ext.installed_by_version = v("2.2.0.preview.2")
|
1669
1519
|
|
1670
1520
|
@ext.build_extensions
|
1671
1521
|
|
1672
|
-
gem_make_out = File.join @ext.extension_dir,
|
1673
|
-
|
1522
|
+
gem_make_out = File.join @ext.extension_dir, "gem_make.out"
|
1523
|
+
assert_path_exist gem_make_out
|
1674
1524
|
end
|
1675
1525
|
|
1676
1526
|
def test_contains_requirable_file_eh
|
1677
|
-
code_rb = File.join @a1.gem_dir,
|
1527
|
+
code_rb = File.join @a1.gem_dir, "lib", "code.rb"
|
1678
1528
|
FileUtils.mkdir_p File.dirname code_rb
|
1679
1529
|
FileUtils.touch code_rb
|
1680
1530
|
|
1681
|
-
assert @a1.contains_requirable_file?
|
1531
|
+
assert @a1.contains_requirable_file? "code"
|
1682
1532
|
end
|
1683
1533
|
|
1684
1534
|
def test_contains_requirable_file_eh_extension
|
1685
|
-
|
1535
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
1686
1536
|
ext_spec
|
1687
1537
|
|
1688
|
-
_, err =
|
1689
|
-
refute @ext.contains_requirable_file?
|
1538
|
+
_, err = capture_output do
|
1539
|
+
refute @ext.contains_requirable_file? "nonexistent"
|
1690
1540
|
end
|
1691
1541
|
|
1692
1542
|
expected = "Ignoring ext-1 because its extensions are not built. " +
|
@@ -1698,8 +1548,8 @@ dependencies: []
|
|
1698
1548
|
def test_contains_requirable_file_eh_extension_java_platform
|
1699
1549
|
ext_spec(platform: Gem::Platform.new("java"))
|
1700
1550
|
|
1701
|
-
_, err =
|
1702
|
-
refute @ext.contains_requirable_file?
|
1551
|
+
_, err = capture_output do
|
1552
|
+
refute @ext.contains_requirable_file? "nonexistent"
|
1703
1553
|
end
|
1704
1554
|
|
1705
1555
|
assert_empty err
|
@@ -1715,13 +1565,13 @@ dependencies: []
|
|
1715
1565
|
end
|
1716
1566
|
|
1717
1567
|
def test_date_equals_string
|
1718
|
-
@a1.date =
|
1568
|
+
@a1.date = "2003-09-17"
|
1719
1569
|
assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date
|
1720
1570
|
end
|
1721
1571
|
|
1722
1572
|
def test_date_equals_string_bad
|
1723
|
-
|
1724
|
-
@a1.date =
|
1573
|
+
assert_raise Gem::InvalidSpecificationException do
|
1574
|
+
@a1.date = "9/11/2003"
|
1725
1575
|
end
|
1726
1576
|
end
|
1727
1577
|
|
@@ -1768,7 +1618,7 @@ dependencies: []
|
|
1768
1618
|
|
1769
1619
|
assert_empty @gem.dependent_gems
|
1770
1620
|
|
1771
|
-
bonobo = util_spec
|
1621
|
+
bonobo = util_spec "bonobo", 1
|
1772
1622
|
install_gem bonobo
|
1773
1623
|
install_gem @gem
|
1774
1624
|
|
@@ -1780,11 +1630,11 @@ dependencies: []
|
|
1780
1630
|
end
|
1781
1631
|
|
1782
1632
|
def test_doc_dir
|
1783
|
-
assert_equal File.join(@gemhome,
|
1633
|
+
assert_equal File.join(@gemhome, "doc", "a-1"), @a1.doc_dir
|
1784
1634
|
end
|
1785
1635
|
|
1786
1636
|
def test_doc_dir_type
|
1787
|
-
assert_equal File.join(@gemhome,
|
1637
|
+
assert_equal File.join(@gemhome, "doc", "a-1", "ri"), @a1.doc_dir("ri")
|
1788
1638
|
end
|
1789
1639
|
|
1790
1640
|
def test_runtime_dependencies
|
@@ -1798,12 +1648,12 @@ dependencies: []
|
|
1798
1648
|
end
|
1799
1649
|
|
1800
1650
|
def test_description
|
1801
|
-
assert_equal
|
1651
|
+
assert_equal "This is a test description", @a1.description
|
1802
1652
|
end
|
1803
1653
|
|
1804
1654
|
def test_eql_eh
|
1805
|
-
g1 = util_spec
|
1806
|
-
g2 = util_spec
|
1655
|
+
g1 = util_spec "gem", 1
|
1656
|
+
g2 = util_spec "gem", 1
|
1807
1657
|
|
1808
1658
|
assert_equal g1, g2
|
1809
1659
|
assert_equal g1.hash, g2.hash
|
@@ -1812,85 +1662,81 @@ dependencies: []
|
|
1812
1662
|
|
1813
1663
|
def test_eql_eh_extensions
|
1814
1664
|
spec = @a1.dup
|
1815
|
-
spec.extensions =
|
1665
|
+
spec.extensions = "xx"
|
1816
1666
|
|
1817
1667
|
refute_operator @a1, :eql?, spec
|
1818
1668
|
refute_operator spec, :eql?, @a1
|
1819
1669
|
end
|
1820
1670
|
|
1821
1671
|
def test_executables
|
1822
|
-
@a1.executable =
|
1672
|
+
@a1.executable = "app"
|
1823
1673
|
assert_equal %w[app], @a1.executables
|
1824
1674
|
end
|
1825
1675
|
|
1826
1676
|
def test_executable_equals
|
1827
|
-
@a2.executable =
|
1828
|
-
assert_equal
|
1677
|
+
@a2.executable = "app"
|
1678
|
+
assert_equal "app", @a2.executable
|
1829
1679
|
assert_equal %w[bin/app lib/code.rb].sort, @a2.files
|
1830
1680
|
end
|
1831
1681
|
|
1832
1682
|
def test_extensions
|
1833
|
-
assert_equal [
|
1683
|
+
assert_equal ["ext/extconf.rb"], ext_spec.extensions
|
1834
1684
|
end
|
1835
1685
|
|
1836
1686
|
def test_extension_dir
|
1837
|
-
enable_shared, RbConfig::CONFIG[
|
1838
|
-
RbConfig::CONFIG[
|
1687
|
+
enable_shared, RbConfig::CONFIG["ENABLE_SHARED"] =
|
1688
|
+
RbConfig::CONFIG["ENABLE_SHARED"], "no"
|
1839
1689
|
|
1840
1690
|
ext_spec
|
1841
1691
|
|
1842
1692
|
refute_empty @ext.extensions
|
1843
1693
|
|
1844
1694
|
expected =
|
1845
|
-
File.join(@ext.base_dir,
|
1695
|
+
File.join(@ext.base_dir, "extensions", Gem::Platform.local.to_s,
|
1846
1696
|
"#{Gem.ruby_api_version}-static", @ext.full_name)
|
1847
1697
|
|
1848
1698
|
assert_equal expected, @ext.extension_dir
|
1849
1699
|
ensure
|
1850
|
-
RbConfig::CONFIG[
|
1700
|
+
RbConfig::CONFIG["ENABLE_SHARED"] = enable_shared
|
1851
1701
|
end
|
1852
1702
|
|
1853
1703
|
def test_extension_dir_override
|
1854
|
-
enable_shared, RbConfig::CONFIG[
|
1855
|
-
RbConfig::CONFIG[
|
1704
|
+
enable_shared, RbConfig::CONFIG["ENABLE_SHARED"] =
|
1705
|
+
RbConfig::CONFIG["ENABLE_SHARED"], "no"
|
1856
1706
|
|
1857
1707
|
class << Gem
|
1858
|
-
|
1859
1708
|
alias orig_default_ext_dir_for default_ext_dir_for
|
1860
1709
|
|
1861
1710
|
remove_method :default_ext_dir_for
|
1862
1711
|
|
1863
1712
|
def Gem.default_ext_dir_for(base_dir)
|
1864
|
-
|
1713
|
+
"elsewhere"
|
1865
1714
|
end
|
1866
|
-
|
1867
1715
|
end
|
1868
1716
|
|
1869
1717
|
ext_spec
|
1870
1718
|
|
1871
1719
|
refute_empty @ext.extensions
|
1872
1720
|
|
1873
|
-
expected = File.join @tempdir,
|
1721
|
+
expected = File.join @tempdir, "elsewhere", @ext.full_name
|
1874
1722
|
|
1875
1723
|
assert_equal expected, @ext.extension_dir
|
1876
1724
|
ensure
|
1877
|
-
RbConfig::CONFIG[
|
1725
|
+
RbConfig::CONFIG["ENABLE_SHARED"] = enable_shared
|
1878
1726
|
|
1879
1727
|
class << Gem
|
1880
|
-
|
1881
1728
|
remove_method :default_ext_dir_for
|
1882
1729
|
|
1883
1730
|
alias default_ext_dir_for orig_default_ext_dir_for
|
1884
|
-
|
1885
1731
|
end
|
1886
1732
|
end
|
1887
1733
|
|
1888
1734
|
def test_files
|
1889
|
-
@a1.files = %w
|
1890
|
-
@a1.test_files = %w
|
1891
|
-
@a1.executables = %w
|
1892
|
-
@a1.extra_rdoc_files = %w
|
1893
|
-
@a1.extensions = %w
|
1735
|
+
@a1.files = %w[files bin/common]
|
1736
|
+
@a1.test_files = %w[test_files bin/common]
|
1737
|
+
@a1.executables = %w[executables common]
|
1738
|
+
@a1.extra_rdoc_files = %w[extra_rdoc_files bin/common]
|
1739
|
+
@a1.extensions = %w[extensions bin/common]
|
1894
1740
|
|
1895
1741
|
expected = %w[
|
1896
1742
|
bin/common
|
@@ -1904,11 +1750,11 @@ dependencies: []
|
|
1904
1750
|
end
|
1905
1751
|
|
1906
1752
|
def test_files_append
|
1907
|
-
@a1.files = %w
|
1908
|
-
@a1.test_files = %w
|
1909
|
-
@a1.executables = %w
|
1910
|
-
@a1.extra_rdoc_files = %w
|
1911
|
-
@a1.extensions = %w
|
1753
|
+
@a1.files = %w[files bin/common]
|
1754
|
+
@a1.test_files = %w[test_files bin/common]
|
1755
|
+
@a1.executables = %w[executables common]
|
1756
|
+
@a1.extra_rdoc_files = %w[extra_rdoc_files bin/common]
|
1757
|
+
@a1.extensions = %w[extensions bin/common]
|
1912
1758
|
|
1913
1759
|
expected = %w[
|
1914
1760
|
bin/common
|
@@ -1966,9 +1812,9 @@ dependencies: []
|
|
1966
1812
|
end
|
1967
1813
|
|
1968
1814
|
def test_for_cache
|
1969
|
-
@a2.add_runtime_dependency
|
1815
|
+
@a2.add_runtime_dependency "b", "1"
|
1970
1816
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
1971
|
-
@a2.required_rubygems_version = Gem::Requirement.new
|
1817
|
+
@a2.required_rubygems_version = Gem::Requirement.new "> 0"
|
1972
1818
|
@a2.test_files = %w[test/test_b.rb]
|
1973
1819
|
|
1974
1820
|
refute_empty @a2.files
|
@@ -1984,11 +1830,11 @@ dependencies: []
|
|
1984
1830
|
end
|
1985
1831
|
|
1986
1832
|
def test_full_gem_path
|
1987
|
-
assert_equal File.join(@gemhome,
|
1833
|
+
assert_equal File.join(@gemhome, "gems", @a1.full_name), @a1.full_gem_path
|
1988
1834
|
|
1989
|
-
@a1.original_platform =
|
1835
|
+
@a1.original_platform = "mswin32"
|
1990
1836
|
|
1991
|
-
assert_equal File.join(@gemhome,
|
1837
|
+
assert_equal File.join(@gemhome, "gems", @a1.original_name),
|
1992
1838
|
@a1.full_gem_path
|
1993
1839
|
end
|
1994
1840
|
|
@@ -2001,40 +1847,40 @@ dependencies: []
|
|
2001
1847
|
end
|
2002
1848
|
|
2003
1849
|
def test_full_name
|
2004
|
-
assert_equal
|
1850
|
+
assert_equal "a-1", @a1.full_name
|
2005
1851
|
|
2006
1852
|
@a1 = Gem::Specification.new "a", 1
|
2007
|
-
@a1.platform = Gem::Platform.new [
|
2008
|
-
assert_equal
|
1853
|
+
@a1.platform = Gem::Platform.new ["universal", "darwin", nil]
|
1854
|
+
assert_equal "a-1-universal-darwin", @a1.full_name
|
2009
1855
|
|
2010
1856
|
@a1 = Gem::Specification.new "a", 1
|
2011
|
-
@a1.instance_variable_set :@new_platform,
|
2012
|
-
assert_equal
|
1857
|
+
@a1.instance_variable_set :@new_platform, "mswin32"
|
1858
|
+
assert_equal "a-1-mswin32", @a1.full_name, "legacy"
|
2013
1859
|
|
2014
1860
|
return if win_platform?
|
2015
1861
|
|
2016
1862
|
@a1 = Gem::Specification.new "a", 1
|
2017
|
-
@a1.platform =
|
2018
|
-
assert_equal
|
1863
|
+
@a1.platform = "current"
|
1864
|
+
assert_equal "a-1-x86-darwin-8", @a1.full_name
|
2019
1865
|
end
|
2020
1866
|
|
2021
1867
|
def test_full_name_windows
|
2022
1868
|
test_cases = {
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
1869
|
+
"i386-mswin32" => "a-1-x86-mswin32-60",
|
1870
|
+
"i386-mswin32_80" => "a-1-x86-mswin32-80",
|
1871
|
+
"i386-mingw32" => "a-1-x86-mingw32",
|
2026
1872
|
}
|
2027
1873
|
|
2028
1874
|
test_cases.each do |arch, expected|
|
2029
1875
|
@a1 = Gem::Specification.new "a", 1
|
2030
1876
|
util_set_arch arch
|
2031
|
-
@a1.platform =
|
1877
|
+
@a1.platform = "current"
|
2032
1878
|
assert_equal expected, @a1.full_name
|
2033
1879
|
end
|
2034
1880
|
end
|
2035
1881
|
|
2036
1882
|
def test_gem_build_complete_path
|
2037
|
-
expected = File.join @a1.extension_dir,
|
1883
|
+
expected = File.join @a1.extension_dir, "gem.build_complete"
|
2038
1884
|
assert_equal expected, @a1.gem_build_complete_path
|
2039
1885
|
end
|
2040
1886
|
|
@@ -2078,23 +1924,23 @@ dependencies: []
|
|
2078
1924
|
end
|
2079
1925
|
|
2080
1926
|
def test_license
|
2081
|
-
assert_equal
|
1927
|
+
assert_equal "MIT", @a1.license
|
2082
1928
|
end
|
2083
1929
|
|
2084
1930
|
def test_licenses
|
2085
|
-
assert_equal [
|
1931
|
+
assert_equal ["MIT"], @a1.licenses
|
2086
1932
|
end
|
2087
1933
|
|
2088
1934
|
def test_name
|
2089
|
-
assert_equal
|
1935
|
+
assert_equal "a", @a1.name
|
2090
1936
|
end
|
2091
1937
|
|
2092
1938
|
def test_original_name
|
2093
|
-
assert_equal
|
1939
|
+
assert_equal "a-1", @a1.full_name
|
2094
1940
|
|
2095
|
-
@a1.platform =
|
2096
|
-
@a1.instance_variable_set :@original_platform,
|
2097
|
-
assert_equal
|
1941
|
+
@a1.platform = "i386-linux"
|
1942
|
+
@a1.instance_variable_set :@original_platform, "i386-linux"
|
1943
|
+
assert_equal "a-1-i386-linux", @a1.original_name
|
2098
1944
|
end
|
2099
1945
|
|
2100
1946
|
def test_platform
|
@@ -2123,10 +1969,10 @@ dependencies: []
|
|
2123
1969
|
assert_equal Gem::Platform::RUBY, @a1.platform
|
2124
1970
|
|
2125
1971
|
test_cases = {
|
2126
|
-
|
2127
|
-
|
2128
|
-
|
2129
|
-
|
1972
|
+
"i386-mswin32" => ["x86", "mswin32", "60"],
|
1973
|
+
"i386-mswin32_80" => ["x86", "mswin32", "80"],
|
1974
|
+
"i386-mingw32" => ["x86", "mingw32", nil ],
|
1975
|
+
"x86-darwin8" => ["x86", "darwin", "8" ],
|
2130
1976
|
}
|
2131
1977
|
|
2132
1978
|
test_cases.each do |arch, expected|
|
@@ -2143,59 +1989,55 @@ dependencies: []
|
|
2143
1989
|
end
|
2144
1990
|
|
2145
1991
|
def test_platform_equals_legacy
|
2146
|
-
@a1.platform =
|
2147
|
-
assert_equal Gem::Platform.new(
|
1992
|
+
@a1.platform = "mswin32"
|
1993
|
+
assert_equal Gem::Platform.new("x86-mswin32"), @a1.platform
|
2148
1994
|
|
2149
|
-
@a1.platform =
|
2150
|
-
assert_equal Gem::Platform.new(
|
1995
|
+
@a1.platform = "i586-linux"
|
1996
|
+
assert_equal Gem::Platform.new("x86-linux"), @a1.platform
|
2151
1997
|
|
2152
|
-
@a1.platform =
|
2153
|
-
assert_equal Gem::Platform.new(
|
1998
|
+
@a1.platform = "powerpc-darwin"
|
1999
|
+
assert_equal Gem::Platform.new("ppc-darwin"), @a1.platform
|
2154
2000
|
end
|
2155
2001
|
|
2156
2002
|
def test_prerelease_spec_adds_required_rubygems_version
|
2157
|
-
@prerelease = util_spec(
|
2158
|
-
refute @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new(
|
2159
|
-
assert @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new(
|
2003
|
+
@prerelease = util_spec("tardis", "2.2.0.a")
|
2004
|
+
refute @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new("1.3.1"))
|
2005
|
+
assert @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new("1.4.0"))
|
2160
2006
|
end
|
2161
2007
|
|
2162
2008
|
def test_require_paths
|
2163
|
-
enable_shared
|
2009
|
+
enable_shared "no" do
|
2164
2010
|
ext_spec
|
2165
2011
|
|
2166
|
-
@ext.require_paths =
|
2012
|
+
@ext.require_paths = "lib"
|
2167
2013
|
|
2168
|
-
assert_equal [@ext.extension_dir,
|
2014
|
+
assert_equal [@ext.extension_dir, "lib"], @ext.require_paths
|
2169
2015
|
end
|
2170
2016
|
end
|
2171
2017
|
|
2172
2018
|
def test_require_paths_default_ext_dir_for
|
2173
2019
|
class << Gem
|
2174
|
-
|
2175
2020
|
send :alias_method, :orig_default_ext_dir_for, :default_ext_dir_for
|
2176
2021
|
|
2177
2022
|
remove_method :default_ext_dir_for
|
2178
|
-
|
2179
2023
|
end
|
2180
2024
|
|
2181
2025
|
def Gem.default_ext_dir_for(base_dir)
|
2182
|
-
|
2026
|
+
"/foo"
|
2183
2027
|
end
|
2184
2028
|
|
2185
|
-
enable_shared
|
2029
|
+
enable_shared "no" do
|
2186
2030
|
ext_spec
|
2187
2031
|
|
2188
|
-
@ext.require_paths =
|
2032
|
+
@ext.require_paths = "lib"
|
2189
2033
|
|
2190
|
-
assert_equal [File.expand_path(
|
2034
|
+
assert_equal [File.expand_path("/foo/ext-1"), "lib"], @ext.require_paths
|
2191
2035
|
end
|
2192
2036
|
ensure
|
2193
2037
|
class << Gem
|
2194
|
-
|
2195
2038
|
send :remove_method, :default_ext_dir_for
|
2196
2039
|
send :alias_method, :default_ext_dir_for, :orig_default_ext_dir_for
|
2197
2040
|
send :remove_method, :orig_default_ext_dir_for
|
2198
|
-
|
2199
2041
|
end
|
2200
2042
|
end
|
2201
2043
|
|
@@ -2207,7 +2049,7 @@ dependencies: []
|
|
2207
2049
|
ext_spec
|
2208
2050
|
|
2209
2051
|
@ext.require_paths = %w[lib ext foo]
|
2210
|
-
@ext.extensions <<
|
2052
|
+
@ext.extensions << "bar/baz"
|
2211
2053
|
|
2212
2054
|
expected = %w[
|
2213
2055
|
lib
|
@@ -2222,10 +2064,10 @@ dependencies: []
|
|
2222
2064
|
def test_full_require_paths
|
2223
2065
|
ext_spec
|
2224
2066
|
|
2225
|
-
@ext.require_paths =
|
2067
|
+
@ext.require_paths = "lib"
|
2226
2068
|
|
2227
2069
|
expected = [
|
2228
|
-
File.join(@gemhome,
|
2070
|
+
File.join(@gemhome, "gems", @ext.original_name, "lib"),
|
2229
2071
|
@ext.extension_dir,
|
2230
2072
|
]
|
2231
2073
|
|
@@ -2235,10 +2077,10 @@ dependencies: []
|
|
2235
2077
|
def test_to_fullpath
|
2236
2078
|
ext_spec
|
2237
2079
|
|
2238
|
-
@ext.require_paths =
|
2080
|
+
@ext.require_paths = "lib"
|
2239
2081
|
|
2240
|
-
dir = File.join(@gemhome,
|
2241
|
-
expected_rb = File.join(dir,
|
2082
|
+
dir = File.join(@gemhome, "gems", @ext.original_name, "lib")
|
2083
|
+
expected_rb = File.join(dir, "code.rb")
|
2242
2084
|
FileUtils.mkdir_p dir
|
2243
2085
|
FileUtils.touch expected_rb
|
2244
2086
|
|
@@ -2272,10 +2114,10 @@ dependencies: []
|
|
2272
2114
|
def test_fullpath_return_rb_extension_file_when_exist_the_same_name_file
|
2273
2115
|
ext_spec
|
2274
2116
|
|
2275
|
-
@ext.require_paths =
|
2117
|
+
@ext.require_paths = "lib"
|
2276
2118
|
|
2277
|
-
dir = File.join(@gemhome,
|
2278
|
-
expected_rb = File.join(dir,
|
2119
|
+
dir = File.join(@gemhome, "gems", @ext.original_name, "lib")
|
2120
|
+
expected_rb = File.join(dir, "code.rb")
|
2279
2121
|
FileUtils.mkdir_p dir
|
2280
2122
|
FileUtils.touch expected_rb
|
2281
2123
|
|
@@ -2291,52 +2133,48 @@ dependencies: []
|
|
2291
2133
|
end
|
2292
2134
|
|
2293
2135
|
def test_require_already_activated
|
2294
|
-
|
2295
|
-
a1 = util_spec "a", "1", nil, "lib/d#{$$}.rb"
|
2136
|
+
a1 = util_spec "a", "1", nil, "lib/d#{$$}.rb"
|
2296
2137
|
|
2297
|
-
|
2138
|
+
install_specs a1 # , a2, b1, b2, c1, c2
|
2298
2139
|
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2140
|
+
a1.activate
|
2141
|
+
assert_equal %w[a-1], loaded_spec_names
|
2142
|
+
assert_equal [], unresolved_names
|
2302
2143
|
|
2303
|
-
|
2144
|
+
assert require "d#{$$}"
|
2304
2145
|
|
2305
|
-
|
2306
|
-
|
2307
|
-
end
|
2146
|
+
assert_equal %w[a-1], loaded_spec_names
|
2147
|
+
assert_equal [], unresolved_names
|
2308
2148
|
end
|
2309
2149
|
|
2310
2150
|
def test_require_already_activated_indirect_conflict
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
c2 = util_spec("c", "2", { "a" => "1" }, "lib/d#{$$}.rb") # conflicts with a-2
|
2151
|
+
a1 = util_spec "a", "1", "b" => "> 0"
|
2152
|
+
a2 = util_spec "a", "2", "b" => "> 0"
|
2153
|
+
b1 = util_spec "b", "1", "c" => ">= 1"
|
2154
|
+
b2 = util_spec "b", "2", "c" => ">= 2"
|
2155
|
+
c1 = util_spec "c", "1", nil, "lib/d#{$$}.rb"
|
2156
|
+
c2 = util_spec("c", "2", { "a" => "1" }, "lib/d#{$$}.rb") # conflicts with a-2
|
2318
2157
|
|
2319
|
-
|
2158
|
+
install_specs c1, b1, a1, a2, c2, b2
|
2320
2159
|
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2160
|
+
a1.activate
|
2161
|
+
c1.activate
|
2162
|
+
assert_equal %w[a-1 c-1], loaded_spec_names
|
2163
|
+
assert_equal ["b (> 0)"], unresolved_names
|
2325
2164
|
|
2326
|
-
|
2165
|
+
assert require "d#{$$}"
|
2327
2166
|
|
2328
|
-
|
2329
|
-
|
2330
|
-
end
|
2167
|
+
assert_equal %w[a-1 c-1], loaded_spec_names
|
2168
|
+
assert_equal ["b (> 0)"], unresolved_names
|
2331
2169
|
end
|
2332
2170
|
|
2333
2171
|
def test_requirements
|
2334
|
-
assert_equal [
|
2172
|
+
assert_equal ["A working computer"], @a1.requirements
|
2335
2173
|
end
|
2336
2174
|
|
2337
2175
|
def test_allowed_push_host
|
2338
|
-
assert_nil @a1.metadata[
|
2339
|
-
assert_equal
|
2176
|
+
assert_nil @a1.metadata["allowed_push_host"]
|
2177
|
+
assert_equal "https://privategemserver.com", @a3.metadata["allowed_push_host"]
|
2340
2178
|
end
|
2341
2179
|
|
2342
2180
|
def test_runtime_dependencies_legacy
|
@@ -2348,12 +2186,12 @@ dependencies: []
|
|
2348
2186
|
|
2349
2187
|
expected = %w[rake jabber4r pqa]
|
2350
2188
|
|
2351
|
-
assert_equal expected, @c1.runtime_dependencies.map {
|
2189
|
+
assert_equal expected, @c1.runtime_dependencies.map {|d| d.name }
|
2352
2190
|
end
|
2353
2191
|
|
2354
2192
|
def test_spaceship_name
|
2355
|
-
s1 = util_spec
|
2356
|
-
s2 = util_spec
|
2193
|
+
s1 = util_spec "a", "1"
|
2194
|
+
s2 = util_spec "b", "1"
|
2357
2195
|
|
2358
2196
|
assert_equal(-1, (s1 <=> s2))
|
2359
2197
|
assert_equal(0, (s1 <=> s1))
|
@@ -2361,9 +2199,9 @@ dependencies: []
|
|
2361
2199
|
end
|
2362
2200
|
|
2363
2201
|
def test_spaceship_platform
|
2364
|
-
s1 = util_spec
|
2365
|
-
s2 = util_spec
|
2366
|
-
s.platform = Gem::Platform.new
|
2202
|
+
s1 = util_spec "a", "1"
|
2203
|
+
s2 = util_spec "a", "1" do |s|
|
2204
|
+
s.platform = Gem::Platform.new "x86-my_platform1"
|
2367
2205
|
end
|
2368
2206
|
|
2369
2207
|
assert_equal(-1, (s1 <=> s2))
|
@@ -2372,8 +2210,8 @@ dependencies: []
|
|
2372
2210
|
end
|
2373
2211
|
|
2374
2212
|
def test_spaceship_version
|
2375
|
-
s1 = util_spec
|
2376
|
-
s2 = util_spec
|
2213
|
+
s1 = util_spec "a", "1"
|
2214
|
+
s2 = util_spec "a", "2"
|
2377
2215
|
|
2378
2216
|
assert_equal(-1, (s1 <=> s2))
|
2379
2217
|
assert_equal(0, (s1 <=> s1))
|
@@ -2381,25 +2219,25 @@ dependencies: []
|
|
2381
2219
|
end
|
2382
2220
|
|
2383
2221
|
def test_spec_file
|
2384
|
-
assert_equal File.join(@gemhome,
|
2222
|
+
assert_equal File.join(@gemhome, "specifications", "a-1.gemspec"),
|
2385
2223
|
@a1.spec_file
|
2386
2224
|
end
|
2387
2225
|
|
2388
2226
|
def test_spec_name
|
2389
|
-
assert_equal
|
2227
|
+
assert_equal "a-1.gemspec", @a1.spec_name
|
2390
2228
|
end
|
2391
2229
|
|
2392
2230
|
def test_summary
|
2393
|
-
assert_equal
|
2231
|
+
assert_equal "this is a summary", @a1.summary
|
2394
2232
|
end
|
2395
2233
|
|
2396
2234
|
def test_test_files
|
2397
|
-
@a1.test_file =
|
2398
|
-
assert_equal [
|
2235
|
+
@a1.test_file = "test/suite.rb"
|
2236
|
+
assert_equal ["test/suite.rb"], @a1.test_files
|
2399
2237
|
end
|
2400
2238
|
|
2401
2239
|
def test_runtime_predicate_true
|
2402
|
-
@a2.add_runtime_dependency
|
2240
|
+
@a2.add_runtime_dependency "b", "1"
|
2403
2241
|
assert_predicate @a2.dependencies.first, :runtime?
|
2404
2242
|
|
2405
2243
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
@@ -2407,15 +2245,15 @@ dependencies: []
|
|
2407
2245
|
end
|
2408
2246
|
|
2409
2247
|
def test_runtime_predicate_false
|
2410
|
-
@a2.add_development_dependency
|
2248
|
+
@a2.add_development_dependency "b", "1"
|
2411
2249
|
refute_predicate @a2.dependencies.first, :runtime?
|
2412
2250
|
end
|
2413
2251
|
|
2414
2252
|
def test_to_ruby
|
2415
|
-
@a2.add_runtime_dependency
|
2253
|
+
@a2.add_runtime_dependency "b", "1"
|
2416
2254
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
2417
|
-
@a2.required_rubygems_version = Gem::Requirement.new
|
2418
|
-
@a2.require_paths <<
|
2255
|
+
@a2.required_rubygems_version = Gem::Requirement.new "> 0"
|
2256
|
+
@a2.require_paths << "other"
|
2419
2257
|
|
2420
2258
|
ruby_code = @a2.to_ruby
|
2421
2259
|
|
@@ -2458,6 +2296,9 @@ end
|
|
2458
2296
|
end
|
2459
2297
|
|
2460
2298
|
def test_to_ruby_with_rsa_key
|
2299
|
+
require "rubygems/openssl"
|
2300
|
+
pend "openssl is missing" unless defined?(OpenSSL::PKey::RSA)
|
2301
|
+
|
2461
2302
|
rsa_key = OpenSSL::PKey::RSA.new(2048)
|
2462
2303
|
@a2.signing_key = rsa_key
|
2463
2304
|
ruby_code = @a2.to_ruby
|
@@ -2487,9 +2328,9 @@ end
|
|
2487
2328
|
end
|
2488
2329
|
|
2489
2330
|
def test_to_ruby_for_cache
|
2490
|
-
@a2.add_runtime_dependency
|
2331
|
+
@a2.add_runtime_dependency "b", "1"
|
2491
2332
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
2492
|
-
@a2.required_rubygems_version = Gem::Requirement.new
|
2333
|
+
@a2.required_rubygems_version = Gem::Requirement.new "> 0"
|
2493
2334
|
@a2.installed_by_version = Gem.rubygems_version
|
2494
2335
|
|
2495
2336
|
# cached specs do not have spec.files populated:
|
@@ -2598,8 +2439,8 @@ end
|
|
2598
2439
|
end
|
2599
2440
|
|
2600
2441
|
def test_to_ruby_keeps_requirements_as_originally_specified
|
2601
|
-
spec = util_spec
|
2602
|
-
s.add_dependency
|
2442
|
+
spec = util_spec "a", "1" do |s|
|
2443
|
+
s.add_dependency "b", ["~> 1.0", ">= 1.0.0"]
|
2603
2444
|
end
|
2604
2445
|
|
2605
2446
|
assert_includes spec.to_ruby, '"~> 1.0", ">= 1.0.0"'
|
@@ -2628,19 +2469,19 @@ end
|
|
2628
2469
|
|
2629
2470
|
def test_to_ruby_platform
|
2630
2471
|
@a2.platform = Gem::Platform.local
|
2631
|
-
@a2.instance_variable_set :@original_platform,
|
2472
|
+
@a2.instance_variable_set :@original_platform, "old_platform"
|
2632
2473
|
|
2633
2474
|
ruby_code = @a2.to_ruby
|
2634
2475
|
|
2635
2476
|
same_spec = eval ruby_code
|
2636
2477
|
|
2637
|
-
assert_equal
|
2478
|
+
assert_equal "old_platform", same_spec.original_platform
|
2638
2479
|
end
|
2639
2480
|
|
2640
2481
|
def test_to_yaml
|
2641
2482
|
yaml_str = @a1.to_yaml
|
2642
2483
|
|
2643
|
-
refute_match
|
2484
|
+
refute_match %r{!!null}, yaml_str
|
2644
2485
|
|
2645
2486
|
same_spec = Gem::Specification.from_yaml(yaml_str)
|
2646
2487
|
|
@@ -2659,27 +2500,27 @@ end
|
|
2659
2500
|
end
|
2660
2501
|
|
2661
2502
|
def test_to_yaml_platform_empty_string
|
2662
|
-
@a1.instance_variable_set :@original_platform,
|
2503
|
+
@a1.instance_variable_set :@original_platform, ""
|
2663
2504
|
|
2664
|
-
assert_match %r
|
2505
|
+
assert_match %r{^platform: ruby$}, @a1.to_yaml
|
2665
2506
|
end
|
2666
2507
|
|
2667
2508
|
def test_to_yaml_platform_legacy
|
2668
|
-
@a1.platform =
|
2669
|
-
@a1.instance_variable_set :@original_platform,
|
2509
|
+
@a1.platform = "powerpc-darwin7.9.0"
|
2510
|
+
@a1.instance_variable_set :@original_platform, "powerpc-darwin7.9.0"
|
2670
2511
|
|
2671
2512
|
yaml_str = @a1.to_yaml
|
2672
2513
|
|
2673
|
-
same_spec =
|
2514
|
+
same_spec = load_yaml yaml_str
|
2674
2515
|
|
2675
|
-
assert_equal Gem::Platform.new(
|
2676
|
-
assert_equal
|
2516
|
+
assert_equal Gem::Platform.new("powerpc-darwin7"), same_spec.platform
|
2517
|
+
assert_equal "powerpc-darwin7.9.0", same_spec.original_platform
|
2677
2518
|
end
|
2678
2519
|
|
2679
2520
|
def test_to_yaml_platform_nil
|
2680
2521
|
@a1.instance_variable_set :@original_platform, nil
|
2681
2522
|
|
2682
|
-
assert_match %r
|
2523
|
+
assert_match %r{^platform: ruby$}, @a1.to_yaml
|
2683
2524
|
end
|
2684
2525
|
|
2685
2526
|
def test_validate
|
@@ -2690,7 +2531,7 @@ end
|
|
2690
2531
|
end
|
2691
2532
|
end
|
2692
2533
|
|
2693
|
-
def x(s); s.gsub(/xxx/,
|
2534
|
+
def x(s); s.gsub(/xxx/, ""); end
|
2694
2535
|
def w; x "WARxxxNING"; end
|
2695
2536
|
def t; x "TOxxxDO"; end
|
2696
2537
|
def f; x "FxxxIXME"; end
|
@@ -2705,13 +2546,13 @@ end
|
|
2705
2546
|
@a1.validate
|
2706
2547
|
end
|
2707
2548
|
|
2708
|
-
assert_match "#{w}: no author specified\n", @ui.error,
|
2549
|
+
assert_match "#{w}: no author specified\n", @ui.error, "error"
|
2709
2550
|
|
2710
2551
|
@a1.authors = [Object.new]
|
2711
2552
|
|
2712
2553
|
assert_equal [], @a1.authors
|
2713
2554
|
|
2714
|
-
e =
|
2555
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2715
2556
|
@a1.validate
|
2716
2557
|
end
|
2717
2558
|
|
@@ -2719,19 +2560,19 @@ end
|
|
2719
2560
|
|
2720
2561
|
@a1.authors = ["#{f} (who is writing this software)"]
|
2721
2562
|
|
2722
|
-
e =
|
2563
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2723
2564
|
@a1.validate
|
2724
2565
|
end
|
2725
2566
|
|
2726
|
-
assert_equal %
|
2567
|
+
assert_equal %("#{f}" or "#{t}" is not an author), e.message
|
2727
2568
|
|
2728
2569
|
@a1.authors = ["#{t} (who is writing this software)"]
|
2729
2570
|
|
2730
|
-
e =
|
2571
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2731
2572
|
@a1.validate
|
2732
2573
|
end
|
2733
2574
|
|
2734
|
-
assert_equal %
|
2575
|
+
assert_equal %("#{f}" or "#{t}" is not an author), e.message
|
2735
2576
|
end
|
2736
2577
|
end
|
2737
2578
|
|
@@ -2739,14 +2580,14 @@ end
|
|
2739
2580
|
util_setup_validate
|
2740
2581
|
|
2741
2582
|
Dir.chdir @tempdir do
|
2742
|
-
@a1.autorequire =
|
2583
|
+
@a1.autorequire = "code"
|
2743
2584
|
|
2744
2585
|
use_ui @ui do
|
2745
2586
|
@a1.validate
|
2746
2587
|
end
|
2747
2588
|
|
2748
2589
|
assert_match "#{w}: deprecated autorequire specified\n",
|
2749
|
-
@ui.error,
|
2590
|
+
@ui.error, "error"
|
2750
2591
|
end
|
2751
2592
|
end
|
2752
2593
|
|
@@ -2754,19 +2595,19 @@ end
|
|
2754
2595
|
util_setup_validate
|
2755
2596
|
|
2756
2597
|
Dir.chdir @tempdir do
|
2757
|
-
@a1.add_runtime_dependency
|
2758
|
-
@a1.add_development_dependency
|
2759
|
-
@a1.add_runtime_dependency
|
2760
|
-
@a1.add_runtime_dependency
|
2761
|
-
@a1.add_runtime_dependency
|
2762
|
-
@a1.add_runtime_dependency
|
2763
|
-
@a1.add_runtime_dependency
|
2764
|
-
@a1.add_runtime_dependency
|
2765
|
-
@a1.add_runtime_dependency
|
2766
|
-
@a1.add_runtime_dependency
|
2767
|
-
@a1.add_runtime_dependency
|
2768
|
-
@a1.add_runtime_dependency
|
2769
|
-
@a1.add_runtime_dependency
|
2598
|
+
@a1.add_runtime_dependency "b", ">= 1.0.rc1"
|
2599
|
+
@a1.add_development_dependency "c", ">= 2.0.rc2"
|
2600
|
+
@a1.add_runtime_dependency "d", "~> 1.2.3"
|
2601
|
+
@a1.add_runtime_dependency "e", "~> 1.2.3.4"
|
2602
|
+
@a1.add_runtime_dependency "g", "~> 1.2.3", ">= 1.2.3.4"
|
2603
|
+
@a1.add_runtime_dependency "h", ">= 1.2.3", "<= 2"
|
2604
|
+
@a1.add_runtime_dependency "i", ">= 1.2"
|
2605
|
+
@a1.add_runtime_dependency "j", ">= 1.2.3"
|
2606
|
+
@a1.add_runtime_dependency "k", "> 1.2"
|
2607
|
+
@a1.add_runtime_dependency "l", "> 1.2.3"
|
2608
|
+
@a1.add_runtime_dependency "m", "~> 2.1.0"
|
2609
|
+
@a1.add_runtime_dependency "n", "~> 0.1.0"
|
2610
|
+
@a1.add_runtime_dependency "o"
|
2770
2611
|
|
2771
2612
|
use_ui @ui do
|
2772
2613
|
@a1.validate
|
@@ -2792,7 +2633,7 @@ end
|
|
2792
2633
|
#{w}: See https://guides.rubygems.org/specification-reference/ for help
|
2793
2634
|
EXPECTED
|
2794
2635
|
|
2795
|
-
assert_equal expected, @ui.error,
|
2636
|
+
assert_equal expected, @ui.error, "warning"
|
2796
2637
|
end
|
2797
2638
|
end
|
2798
2639
|
|
@@ -2800,13 +2641,13 @@ end
|
|
2800
2641
|
util_setup_validate
|
2801
2642
|
|
2802
2643
|
Dir.chdir @tempdir do
|
2803
|
-
@a1.add_runtime_dependency
|
2804
|
-
@a1.add_runtime_dependency
|
2805
|
-
@a1.add_development_dependency
|
2806
|
-
@a1.add_development_dependency
|
2644
|
+
@a1.add_runtime_dependency "b", "~> 1.2"
|
2645
|
+
@a1.add_runtime_dependency "b", ">= 1.2.3"
|
2646
|
+
@a1.add_development_dependency "c", "~> 1.2"
|
2647
|
+
@a1.add_development_dependency "c", ">= 1.2.3"
|
2807
2648
|
|
2808
2649
|
use_ui @ui do
|
2809
|
-
e =
|
2650
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2810
2651
|
@a1.validate
|
2811
2652
|
end
|
2812
2653
|
|
@@ -2830,14 +2671,14 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2830
2671
|
util_setup_validate
|
2831
2672
|
|
2832
2673
|
Dir.chdir @tempdir do
|
2833
|
-
@a1.add_runtime_dependency
|
2834
|
-
@a1.add_development_dependency
|
2674
|
+
@a1.add_runtime_dependency "b", "~> 1.2"
|
2675
|
+
@a1.add_development_dependency "b", "= 1.2.3"
|
2835
2676
|
|
2836
2677
|
use_ui @ui do
|
2837
2678
|
@a1.validate
|
2838
2679
|
end
|
2839
2680
|
|
2840
|
-
assert_equal
|
2681
|
+
assert_equal "", @ui.error, "warning"
|
2841
2682
|
end
|
2842
2683
|
end
|
2843
2684
|
|
@@ -2845,14 +2686,45 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2845
2686
|
util_setup_validate
|
2846
2687
|
|
2847
2688
|
Dir.chdir @tempdir do
|
2848
|
-
@a1.version =
|
2849
|
-
@a1.add_runtime_dependency
|
2689
|
+
@a1.version = "1.0.0.beta.1"
|
2690
|
+
@a1.add_runtime_dependency "b", "~> 1.2.0.beta.1"
|
2691
|
+
|
2692
|
+
use_ui @ui do
|
2693
|
+
@a1.validate
|
2694
|
+
end
|
2695
|
+
|
2696
|
+
assert_equal "", @ui.error, "warning"
|
2697
|
+
end
|
2698
|
+
end
|
2699
|
+
|
2700
|
+
def test_validate_rake_extension_have_rake_dependency_warning
|
2701
|
+
util_setup_validate
|
2702
|
+
|
2703
|
+
Dir.chdir @tempdir do
|
2704
|
+
@a1.extensions = ["Rakefile"]
|
2705
|
+
File.write File.join(@tempdir, "Rakefile"), ""
|
2850
2706
|
|
2851
2707
|
use_ui @ui do
|
2852
2708
|
@a1.validate
|
2853
2709
|
end
|
2854
2710
|
|
2855
|
-
|
2711
|
+
assert_match(/add rake as a dependency/, @ui.error)
|
2712
|
+
end
|
2713
|
+
end
|
2714
|
+
|
2715
|
+
def test_validate_rake_extension_have_rake_dependency_no_warning
|
2716
|
+
util_setup_validate
|
2717
|
+
|
2718
|
+
Dir.chdir @tempdir do
|
2719
|
+
@a1.extensions = ["Rakefile"]
|
2720
|
+
@a1.add_runtime_dependency "rake"
|
2721
|
+
File.write File.join(@tempdir, "Rakefile"), ""
|
2722
|
+
|
2723
|
+
use_ui @ui do
|
2724
|
+
@a1.validate
|
2725
|
+
end
|
2726
|
+
|
2727
|
+
refute_match(/add rake as a dependency/, @ui.error)
|
2856
2728
|
end
|
2857
2729
|
end
|
2858
2730
|
|
@@ -2860,7 +2732,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2860
2732
|
util_setup_validate
|
2861
2733
|
|
2862
2734
|
Dir.chdir @tempdir do
|
2863
|
-
@a1.description =
|
2735
|
+
@a1.description = ""
|
2864
2736
|
|
2865
2737
|
use_ui @ui do
|
2866
2738
|
@a1.validate
|
@@ -2879,19 +2751,47 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2879
2751
|
|
2880
2752
|
@a1.description = "#{f} (describe your package)"
|
2881
2753
|
|
2882
|
-
e =
|
2754
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2883
2755
|
@a1.validate
|
2884
2756
|
end
|
2885
2757
|
|
2886
|
-
assert_equal %
|
2758
|
+
assert_equal %("#{f}" or "#{t}" is not a description), e.message
|
2887
2759
|
|
2888
2760
|
@a1.description = "#{t} (describe your package)"
|
2889
2761
|
|
2890
|
-
e =
|
2762
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2763
|
+
@a1.validate
|
2764
|
+
end
|
2765
|
+
|
2766
|
+
assert_equal %("#{f}" or "#{t}" is not a description), e.message
|
2767
|
+
|
2768
|
+
# Adding #{f} anywhere after the start of the description should be fine.
|
2769
|
+
@a1.description = "(some description) #{f}"
|
2770
|
+
|
2771
|
+
assert_nothing_raised do
|
2891
2772
|
@a1.validate
|
2892
2773
|
end
|
2893
2774
|
|
2894
|
-
|
2775
|
+
# Adding #{t} anywhere after the start of the description should be fine.
|
2776
|
+
@a1.description = "(some description) #{t}"
|
2777
|
+
|
2778
|
+
assert_nothing_raised do
|
2779
|
+
@a1.validate
|
2780
|
+
end
|
2781
|
+
|
2782
|
+
# Adding #{f} at the start of the second or later line should be fine.
|
2783
|
+
@a1.description = "(some description)\n#{f}"
|
2784
|
+
|
2785
|
+
assert_nothing_raised do
|
2786
|
+
@a1.validate
|
2787
|
+
end
|
2788
|
+
|
2789
|
+
# Adding #{t} at the start of the second or later line should be fine.
|
2790
|
+
@a1.description = "(some description)\n#{t}"
|
2791
|
+
|
2792
|
+
assert_nothing_raised do
|
2793
|
+
@a1.validate
|
2794
|
+
end
|
2895
2795
|
end
|
2896
2796
|
end
|
2897
2797
|
|
@@ -2901,46 +2801,46 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2901
2801
|
Dir.chdir @tempdir do
|
2902
2802
|
@a1.email = "FIxxxXME (your e-mail)".sub(/xxx/, "")
|
2903
2803
|
|
2904
|
-
e =
|
2804
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2905
2805
|
@a1.validate
|
2906
2806
|
end
|
2907
2807
|
|
2908
|
-
assert_equal %
|
2808
|
+
assert_equal %("#{f}" or "#{t}" is not an email), e.message
|
2909
2809
|
|
2910
2810
|
@a1.email = "#{t} (your e-mail)"
|
2911
2811
|
|
2912
|
-
e =
|
2812
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2913
2813
|
@a1.validate
|
2914
2814
|
end
|
2915
2815
|
|
2916
|
-
assert_equal %
|
2816
|
+
assert_equal %("#{f}" or "#{t}" is not an email), e.message
|
2917
2817
|
end
|
2918
2818
|
end
|
2919
2819
|
|
2920
2820
|
def test_validate_empty
|
2921
|
-
e =
|
2821
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2922
2822
|
Gem::Specification.new.validate
|
2923
2823
|
end
|
2924
2824
|
|
2925
|
-
assert_equal
|
2825
|
+
assert_equal "missing value for attribute name", e.message
|
2926
2826
|
end
|
2927
2827
|
|
2928
2828
|
def test_validate_error
|
2929
|
-
|
2829
|
+
assert_raise Gem::InvalidSpecificationException do
|
2930
2830
|
use_ui @ui do
|
2931
2831
|
Gem::Specification.new.validate
|
2932
2832
|
end
|
2933
2833
|
end
|
2934
2834
|
|
2935
|
-
assert_match
|
2835
|
+
assert_match "See https://guides.rubygems.org/specification-reference/ for help", @ui.error
|
2936
2836
|
end
|
2937
2837
|
|
2938
2838
|
def test_validate_executables
|
2939
2839
|
util_setup_validate
|
2940
2840
|
|
2941
|
-
FileUtils.mkdir_p File.join(@tempdir,
|
2942
|
-
File.write File.join(@tempdir,
|
2943
|
-
FileUtils.mkdir_p File.join(@tempdir,
|
2841
|
+
FileUtils.mkdir_p File.join(@tempdir, "bin")
|
2842
|
+
File.write File.join(@tempdir, "bin", "exec"), ""
|
2843
|
+
FileUtils.mkdir_p File.join(@tempdir, "exec")
|
2944
2844
|
|
2945
2845
|
use_ui @ui do
|
2946
2846
|
Dir.chdir @tempdir do
|
@@ -2950,41 +2850,41 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2950
2850
|
|
2951
2851
|
assert_equal %w[exec], @a1.executables
|
2952
2852
|
|
2953
|
-
assert_equal
|
2954
|
-
assert_match "#{w}: bin/exec is missing #! line\n", @ui.error,
|
2853
|
+
assert_equal "", @ui.output, "output"
|
2854
|
+
assert_match "#{w}: bin/exec is missing #! line\n", @ui.error, "error"
|
2955
2855
|
end
|
2956
2856
|
|
2957
2857
|
def test_validate_empty_require_paths
|
2958
2858
|
if win_platform?
|
2959
|
-
|
2859
|
+
pend "test_validate_empty_require_paths skipped on MS Windows (symlink)"
|
2960
2860
|
else
|
2961
2861
|
util_setup_validate
|
2962
2862
|
|
2963
2863
|
@a1.require_paths = []
|
2964
|
-
e =
|
2864
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2965
2865
|
@a1.validate
|
2966
2866
|
end
|
2967
2867
|
|
2968
|
-
assert_equal
|
2868
|
+
assert_equal "specification must have at least one require_path",
|
2969
2869
|
e.message
|
2970
2870
|
end
|
2971
2871
|
end
|
2972
2872
|
|
2973
2873
|
def test_validate_files
|
2974
|
-
|
2874
|
+
pend "test_validate_files skipped on MS Windows (symlink)" if win_platform?
|
2975
2875
|
util_setup_validate
|
2976
2876
|
|
2977
|
-
@a1.files += [
|
2978
|
-
@a1.extensions <<
|
2877
|
+
@a1.files += ["lib", "lib2"]
|
2878
|
+
@a1.extensions << "ext/a/extconf.rb"
|
2979
2879
|
|
2980
2880
|
Dir.chdir @tempdir do
|
2981
|
-
FileUtils.ln_s
|
2881
|
+
FileUtils.ln_s "lib/code.rb", "lib2" unless vc_windows?
|
2982
2882
|
|
2983
2883
|
use_ui @ui do
|
2984
2884
|
@a1.validate
|
2985
2885
|
end
|
2986
2886
|
|
2987
|
-
assert_match
|
2887
|
+
assert_match "WARNING: lib2 is a symlink, which is not supported on all platforms", @ui.error
|
2988
2888
|
end
|
2989
2889
|
|
2990
2890
|
assert_equal %w[bin/exec ext/a/extconf.rb lib/code.rb lib2 test/suite.rb].sort,
|
@@ -3011,9 +2911,11 @@ WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
|
|
3011
2911
|
Please report a bug if this causes problems.
|
3012
2912
|
EXPECTED
|
3013
2913
|
|
3014
|
-
|
2914
|
+
actual_stdout, actual_stderr = capture_output do
|
3015
2915
|
specification.reset
|
3016
2916
|
end
|
2917
|
+
assert_empty actual_stdout
|
2918
|
+
assert_equal(expected, actual_stderr)
|
3017
2919
|
end
|
3018
2920
|
|
3019
2921
|
def test_unresolved_specs_with_versions
|
@@ -3027,8 +2929,8 @@ Please report a bug if this causes problems.
|
|
3027
2929
|
|
3028
2930
|
specification.define_singleton_method(:find_all_by_name) do |dep_name|
|
3029
2931
|
[
|
3030
|
-
specification.new {
|
3031
|
-
specification.new {
|
2932
|
+
specification.new {|s| s.name = "z", s.version = Gem::Version.new("1") },
|
2933
|
+
specification.new {|s| s.name = "z", s.version = Gem::Version.new("2") },
|
3032
2934
|
]
|
3033
2935
|
end
|
3034
2936
|
|
@@ -3042,9 +2944,20 @@ WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
|
|
3042
2944
|
Please report a bug if this causes problems.
|
3043
2945
|
EXPECTED
|
3044
2946
|
|
3045
|
-
|
2947
|
+
actual_stdout, actual_stderr = capture_output do
|
3046
2948
|
specification.reset
|
3047
2949
|
end
|
2950
|
+
assert_empty actual_stdout
|
2951
|
+
assert_equal(expected, actual_stderr)
|
2952
|
+
end
|
2953
|
+
|
2954
|
+
def test_duplicate_runtime_dependency
|
2955
|
+
expected = "WARNING: duplicated b dependency [\"~> 3.0\", \"~> 3.0\"]\n"
|
2956
|
+
out, err = capture_output do
|
2957
|
+
@a1.add_runtime_dependency "b", "~> 3.0", "~> 3.0"
|
2958
|
+
end
|
2959
|
+
assert_empty out
|
2960
|
+
assert_equal(expected, err)
|
3048
2961
|
end
|
3049
2962
|
|
3050
2963
|
def set_orig(cls)
|
@@ -3059,7 +2972,7 @@ Please report a bug if this causes problems.
|
|
3059
2972
|
|
3060
2973
|
@a1.files = [@a1.file_name]
|
3061
2974
|
|
3062
|
-
e =
|
2975
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3063
2976
|
@a1.validate
|
3064
2977
|
end
|
3065
2978
|
|
@@ -3077,40 +2990,39 @@ Please report a bug if this causes problems.
|
|
3077
2990
|
@a1.validate
|
3078
2991
|
end
|
3079
2992
|
|
3080
|
-
assert_match "#{w}: no homepage specified\n", @ui.error,
|
2993
|
+
assert_match "#{w}: no homepage specified\n", @ui.error, "error"
|
3081
2994
|
|
3082
2995
|
@ui = Gem::MockGemUi.new
|
3083
2996
|
|
3084
|
-
@a1.homepage =
|
2997
|
+
@a1.homepage = ""
|
3085
2998
|
|
3086
2999
|
use_ui @ui do
|
3087
3000
|
@a1.validate
|
3088
3001
|
end
|
3089
3002
|
|
3090
|
-
assert_match "#{w}: no homepage specified\n", @ui.error,
|
3003
|
+
assert_match "#{w}: no homepage specified\n", @ui.error, "error"
|
3091
3004
|
|
3092
|
-
@a1.homepage =
|
3005
|
+
@a1.homepage = "over at my cool site"
|
3093
3006
|
|
3094
|
-
e =
|
3007
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3095
3008
|
@a1.validate
|
3096
3009
|
end
|
3097
3010
|
|
3098
3011
|
assert_equal '"over at my cool site" is not a valid HTTP URI', e.message
|
3099
3012
|
|
3100
|
-
@a1.homepage =
|
3013
|
+
@a1.homepage = "ftp://rubygems.org"
|
3101
3014
|
|
3102
|
-
e =
|
3015
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3103
3016
|
@a1.validate
|
3104
3017
|
end
|
3105
3018
|
|
3106
3019
|
assert_equal '"ftp://rubygems.org" is not a valid HTTP URI', e.message
|
3107
3020
|
|
3108
|
-
@a1.homepage =
|
3021
|
+
@a1.homepage = "https://rubygems.org/"
|
3109
3022
|
assert_equal true, @a1.validate
|
3110
3023
|
|
3111
|
-
@a1.homepage =
|
3024
|
+
@a1.homepage = "https://rubygems.org"
|
3112
3025
|
assert_equal true, @a1.validate
|
3113
|
-
|
3114
3026
|
end
|
3115
3027
|
end
|
3116
3028
|
|
@@ -3122,10 +3034,21 @@ Please report a bug if this causes problems.
|
|
3122
3034
|
@a1.validate
|
3123
3035
|
end
|
3124
3036
|
|
3125
|
-
assert_match <<-
|
3037
|
+
assert_match <<-WARNING, @ui.error
|
3126
3038
|
WARNING: licenses is empty, but is recommended. Use a license identifier from
|
3127
3039
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3128
|
-
|
3040
|
+
WARNING
|
3041
|
+
end
|
3042
|
+
|
3043
|
+
def test_validate_license_in_a_non_packaging_context
|
3044
|
+
util_setup_validate
|
3045
|
+
|
3046
|
+
use_ui @ui do
|
3047
|
+
@a1.licenses.clear
|
3048
|
+
@a1.validate(false)
|
3049
|
+
end
|
3050
|
+
|
3051
|
+
assert_empty @ui.error
|
3129
3052
|
end
|
3130
3053
|
|
3131
3054
|
def test_removed_methods
|
@@ -3136,7 +3059,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3136
3059
|
util_setup_validate
|
3137
3060
|
|
3138
3061
|
use_ui @ui do
|
3139
|
-
@a1.rubyforge_project =
|
3062
|
+
@a1.rubyforge_project = "invalid-attribute"
|
3140
3063
|
@a1.validate
|
3141
3064
|
end
|
3142
3065
|
|
@@ -3147,21 +3070,32 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3147
3070
|
util_setup_validate
|
3148
3071
|
|
3149
3072
|
use_ui @ui do
|
3150
|
-
@a1.licenses = [
|
3073
|
+
@a1.licenses = ["BSD"]
|
3151
3074
|
@a1.validate
|
3152
3075
|
end
|
3153
3076
|
|
3154
|
-
assert_match <<-
|
3077
|
+
assert_match <<-WARNING, @ui.error
|
3155
3078
|
WARNING: license value 'BSD' is invalid. Use a license identifier from
|
3156
3079
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3157
|
-
|
3080
|
+
WARNING
|
3081
|
+
end
|
3082
|
+
|
3083
|
+
def test_validate_license_ref
|
3084
|
+
util_setup_validate
|
3085
|
+
|
3086
|
+
use_ui @ui do
|
3087
|
+
@a1.licenses = ["LicenseRef-LICENSE.md"]
|
3088
|
+
@a1.validate
|
3089
|
+
end
|
3090
|
+
|
3091
|
+
assert_empty @ui.error
|
3158
3092
|
end
|
3159
3093
|
|
3160
3094
|
def test_validate_license_values_plus
|
3161
3095
|
util_setup_validate
|
3162
3096
|
|
3163
3097
|
use_ui @ui do
|
3164
|
-
@a1.licenses = [
|
3098
|
+
@a1.licenses = ["GPL-2.0+"]
|
3165
3099
|
@a1.validate
|
3166
3100
|
end
|
3167
3101
|
|
@@ -3172,7 +3106,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3172
3106
|
util_setup_validate
|
3173
3107
|
|
3174
3108
|
use_ui @ui do
|
3175
|
-
@a1.licenses = [
|
3109
|
+
@a1.licenses = ["GPL-2.0-or-later"]
|
3176
3110
|
@a1.validate
|
3177
3111
|
end
|
3178
3112
|
|
@@ -3183,7 +3117,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3183
3117
|
util_setup_validate
|
3184
3118
|
|
3185
3119
|
use_ui @ui do
|
3186
|
-
@a1.licenses = [
|
3120
|
+
@a1.licenses = ["GPL-2.0+ WITH Autoconf-exception-2.0"]
|
3187
3121
|
@a1.validate
|
3188
3122
|
end
|
3189
3123
|
|
@@ -3194,47 +3128,47 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3194
3128
|
util_setup_validate
|
3195
3129
|
|
3196
3130
|
use_ui @ui do
|
3197
|
-
@a1.licenses = [
|
3131
|
+
@a1.licenses = ["GPL-2.0+ FOO", "GPL-2.0 FOO"]
|
3198
3132
|
@a1.validate
|
3199
3133
|
end
|
3200
3134
|
|
3201
|
-
assert_match <<-
|
3135
|
+
assert_match <<-WARNING, @ui.error
|
3202
3136
|
WARNING: license value 'GPL-2.0+ FOO' is invalid. Use a license identifier from
|
3203
3137
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3204
|
-
|
3205
|
-
assert_match <<-
|
3138
|
+
WARNING
|
3139
|
+
assert_match <<-WARNING, @ui.error
|
3206
3140
|
WARNING: license value 'GPL-2.0 FOO' is invalid. Use a license identifier from
|
3207
3141
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3208
|
-
|
3142
|
+
WARNING
|
3209
3143
|
end
|
3210
3144
|
|
3211
3145
|
def test_validate_license_with_invalid_exception
|
3212
3146
|
util_setup_validate
|
3213
3147
|
|
3214
3148
|
use_ui @ui do
|
3215
|
-
@a1.licenses = [
|
3149
|
+
@a1.licenses = ["GPL-2.0+ WITH Autocofn-exception-2.0"]
|
3216
3150
|
@a1.validate
|
3217
3151
|
end
|
3218
3152
|
|
3219
|
-
assert_match <<-
|
3153
|
+
assert_match <<-WARNING, @ui.error
|
3220
3154
|
WARNING: license value 'GPL-2.0+ WITH Autocofn-exception-2.0' is invalid. Use a license identifier from
|
3221
3155
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3222
|
-
|
3156
|
+
WARNING
|
3223
3157
|
end
|
3224
3158
|
|
3225
3159
|
def test_validate_license_gives_suggestions
|
3226
3160
|
util_setup_validate
|
3227
3161
|
|
3228
3162
|
use_ui @ui do
|
3229
|
-
@a1.licenses = [
|
3163
|
+
@a1.licenses = ["ruby"]
|
3230
3164
|
@a1.validate
|
3231
3165
|
end
|
3232
3166
|
|
3233
|
-
assert_match <<-
|
3167
|
+
assert_match <<-WARNING, @ui.error
|
3234
3168
|
WARNING: license value 'ruby' is invalid. Use a license identifier from
|
3235
3169
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3236
3170
|
Did you mean 'Ruby'?
|
3237
|
-
|
3171
|
+
WARNING
|
3238
3172
|
end
|
3239
3173
|
|
3240
3174
|
def test_validate_empty_files
|
@@ -3277,7 +3211,7 @@ Did you mean 'Ruby'?
|
|
3277
3211
|
def test_validate_name
|
3278
3212
|
util_setup_validate
|
3279
3213
|
|
3280
|
-
e =
|
3214
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3281
3215
|
@a1.name = :json
|
3282
3216
|
@a1.validate
|
3283
3217
|
end
|
@@ -3285,31 +3219,31 @@ Did you mean 'Ruby'?
|
|
3285
3219
|
assert_equal 'invalid value for attribute name: ":json" must be a string', e.message
|
3286
3220
|
|
3287
3221
|
@a1.name = []
|
3288
|
-
e =
|
3222
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3289
3223
|
@a1.validate
|
3290
3224
|
end
|
3291
3225
|
assert_equal "invalid value for attribute name: \"[]\" must be a string", e.message
|
3292
3226
|
|
3293
3227
|
@a1.name = ""
|
3294
|
-
e =
|
3228
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3295
3229
|
@a1.validate
|
3296
3230
|
end
|
3297
3231
|
assert_equal "invalid value for attribute name: \"\" must include at least one letter", e.message
|
3298
3232
|
|
3299
3233
|
@a1.name = "12345"
|
3300
|
-
e =
|
3234
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3301
3235
|
@a1.validate
|
3302
3236
|
end
|
3303
3237
|
assert_equal "invalid value for attribute name: \"12345\" must include at least one letter", e.message
|
3304
3238
|
|
3305
3239
|
@a1.name = "../malicious"
|
3306
|
-
e =
|
3240
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3307
3241
|
@a1.validate
|
3308
3242
|
end
|
3309
3243
|
assert_equal "invalid value for attribute name: \"../malicious\" can only include letters, numbers, dashes, and underscores", e.message
|
3310
3244
|
|
3311
3245
|
@a1.name = "\ba\t"
|
3312
|
-
e =
|
3246
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3313
3247
|
@a1.validate
|
3314
3248
|
end
|
3315
3249
|
assert_equal "invalid value for attribute name: \"\\ba\\t\" can only include letters, numbers, dashes, and underscores", e.message
|
@@ -3326,23 +3260,23 @@ Did you mean 'Ruby'?
|
|
3326
3260
|
spec = @a1.dup
|
3327
3261
|
spec.instance_variable_set "@#{name}", nil
|
3328
3262
|
|
3329
|
-
e =
|
3263
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3330
3264
|
spec.validate
|
3331
3265
|
end
|
3332
3266
|
|
3333
|
-
assert_match %r
|
3267
|
+
assert_match %r{^#{name}}, e.message
|
3334
3268
|
end
|
3335
3269
|
end
|
3336
3270
|
end
|
3337
3271
|
|
3338
3272
|
def test_validate_permissions
|
3339
|
-
|
3273
|
+
pend "chmod not supported" if Gem.win_platform?
|
3340
3274
|
|
3341
3275
|
util_setup_validate
|
3342
3276
|
|
3343
3277
|
Dir.chdir @tempdir do
|
3344
|
-
File.chmod 0640, File.join(
|
3345
|
-
File.chmod 0640, File.join(
|
3278
|
+
File.chmod 0640, File.join("lib", "code.rb")
|
3279
|
+
File.chmod 0640, File.join("bin", "exec")
|
3346
3280
|
|
3347
3281
|
use_ui @ui do
|
3348
3282
|
@a1.validate
|
@@ -3355,12 +3289,12 @@ Did you mean 'Ruby'?
|
|
3355
3289
|
end
|
3356
3290
|
|
3357
3291
|
def test_validate_permissions_of_missing_file_non_packaging
|
3358
|
-
|
3292
|
+
pend "chmod not supported" if Gem.win_platform?
|
3359
3293
|
|
3360
3294
|
util_setup_validate
|
3361
3295
|
|
3362
3296
|
Dir.chdir @tempdir do
|
3363
|
-
File.delete File.join(
|
3297
|
+
File.delete File.join("lib", "code.rb")
|
3364
3298
|
|
3365
3299
|
use_ui @ui do
|
3366
3300
|
assert @a1.validate(false)
|
@@ -3372,13 +3306,13 @@ Did you mean 'Ruby'?
|
|
3372
3306
|
util_setup_validate
|
3373
3307
|
|
3374
3308
|
Dir.chdir @tempdir do
|
3375
|
-
@a1.platform =
|
3309
|
+
@a1.platform = "mswin32"
|
3376
3310
|
assert @a1.validate
|
3377
3311
|
|
3378
|
-
@a1.platform =
|
3312
|
+
@a1.platform = "i586-linux"
|
3379
3313
|
assert @a1.validate
|
3380
3314
|
|
3381
|
-
@a1.platform =
|
3315
|
+
@a1.platform = "powerpc-darwin"
|
3382
3316
|
assert @a1.validate
|
3383
3317
|
end
|
3384
3318
|
end
|
@@ -3387,7 +3321,7 @@ Did you mean 'Ruby'?
|
|
3387
3321
|
util_setup_validate
|
3388
3322
|
|
3389
3323
|
@a1.rubygems_version = "3"
|
3390
|
-
e =
|
3324
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3391
3325
|
@a1.validate
|
3392
3326
|
end
|
3393
3327
|
|
@@ -3399,15 +3333,15 @@ Did you mean 'Ruby'?
|
|
3399
3333
|
util_setup_validate
|
3400
3334
|
|
3401
3335
|
Dir.chdir @tempdir do
|
3402
|
-
@a1.specification_version =
|
3336
|
+
@a1.specification_version = "1.0"
|
3403
3337
|
|
3404
|
-
e =
|
3338
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3405
3339
|
use_ui @ui do
|
3406
3340
|
@a1.validate
|
3407
3341
|
end
|
3408
3342
|
end
|
3409
3343
|
|
3410
|
-
err =
|
3344
|
+
err = "specification_version must be an Integer (did you mean version?)"
|
3411
3345
|
assert_equal err, e.message
|
3412
3346
|
end
|
3413
3347
|
end
|
@@ -3416,29 +3350,29 @@ Did you mean 'Ruby'?
|
|
3416
3350
|
util_setup_validate
|
3417
3351
|
|
3418
3352
|
Dir.chdir @tempdir do
|
3419
|
-
@a1.summary =
|
3353
|
+
@a1.summary = ""
|
3420
3354
|
|
3421
3355
|
use_ui @ui do
|
3422
3356
|
@a1.validate
|
3423
3357
|
end
|
3424
3358
|
|
3425
|
-
assert_match "#{w}: no summary specified\n", @ui.error,
|
3359
|
+
assert_match "#{w}: no summary specified\n", @ui.error, "error"
|
3426
3360
|
|
3427
3361
|
@a1.summary = "#{f} (describe your package)"
|
3428
3362
|
|
3429
|
-
e =
|
3363
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3430
3364
|
@a1.validate
|
3431
3365
|
end
|
3432
3366
|
|
3433
|
-
assert_equal %
|
3367
|
+
assert_equal %("#{f}" or "#{t}" is not a summary), e.message
|
3434
3368
|
|
3435
3369
|
@a1.summary = "#{t} (describe your package)"
|
3436
3370
|
|
3437
|
-
e =
|
3371
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3438
3372
|
@a1.validate
|
3439
3373
|
end
|
3440
3374
|
|
3441
|
-
assert_equal %
|
3375
|
+
assert_equal %("#{f}" or "#{t}" is not a summary), e.message
|
3442
3376
|
end
|
3443
3377
|
end
|
3444
3378
|
|
@@ -3450,11 +3384,11 @@ Did you mean 'Ruby'?
|
|
3450
3384
|
@a1.validate
|
3451
3385
|
end
|
3452
3386
|
|
3453
|
-
assert_match
|
3387
|
+
assert_match "See https://guides.rubygems.org/specification-reference/ for help", @ui.error
|
3454
3388
|
end
|
3455
3389
|
|
3456
3390
|
def test_version
|
3457
|
-
assert_equal Gem::Version.new(
|
3391
|
+
assert_equal Gem::Version.new("1"), @a1.version
|
3458
3392
|
end
|
3459
3393
|
|
3460
3394
|
def test_version_change_reset_full_name
|
@@ -3487,7 +3421,7 @@ Did you mean 'Ruby'?
|
|
3487
3421
|
specfile.write "raise 'boom'"
|
3488
3422
|
specfile.close
|
3489
3423
|
begin
|
3490
|
-
|
3424
|
+
capture_output do
|
3491
3425
|
Gem::Specification.load(specfile.path)
|
3492
3426
|
end
|
3493
3427
|
rescue => e
|
@@ -3498,43 +3432,28 @@ Did you mean 'Ruby'?
|
|
3498
3432
|
specfile.delete
|
3499
3433
|
end
|
3500
3434
|
|
3501
|
-
##
|
3502
|
-
# KEEP p-1-x86-darwin-8
|
3503
|
-
# KEEP p-1
|
3504
|
-
# KEEP c-1.2
|
3505
|
-
# KEEP a_evil-9
|
3506
|
-
# a-1
|
3507
|
-
# a-1-x86-my_platform-1
|
3508
|
-
# KEEP a-2
|
3509
|
-
# a-2-x86-other_platform-1
|
3510
|
-
# KEEP a-2-x86-my_platform-1
|
3511
|
-
# a-3.a
|
3512
|
-
# KEEP a-3-x86-other_platform-1
|
3513
|
-
|
3514
3435
|
def test_latest_specs
|
3515
3436
|
spec_fetcher do |fetcher|
|
3516
|
-
fetcher.spec
|
3517
|
-
s.platform = Gem::Platform.new
|
3437
|
+
fetcher.spec "a", 1 do |s|
|
3438
|
+
s.platform = Gem::Platform.new "x86-my_platform1"
|
3518
3439
|
end
|
3519
3440
|
|
3520
|
-
fetcher.spec
|
3441
|
+
fetcher.spec "a", 2
|
3521
3442
|
|
3522
|
-
fetcher.spec
|
3523
|
-
s.platform = Gem::Platform.new
|
3443
|
+
fetcher.spec "a", 2 do |s|
|
3444
|
+
s.platform = Gem::Platform.new "x86-my_platform1"
|
3524
3445
|
end
|
3525
3446
|
|
3526
|
-
fetcher.spec
|
3527
|
-
s.platform = Gem::Platform.new
|
3447
|
+
fetcher.spec "a", 2 do |s|
|
3448
|
+
s.platform = Gem::Platform.new "x86-other_platform1"
|
3528
3449
|
end
|
3529
3450
|
|
3530
|
-
fetcher.spec
|
3531
|
-
s.platform = Gem::Platform.new
|
3451
|
+
fetcher.spec "a", 3 do |s|
|
3452
|
+
s.platform = Gem::Platform.new "x86-other_platform1"
|
3532
3453
|
end
|
3533
3454
|
end
|
3534
3455
|
|
3535
3456
|
expected = %W[
|
3536
|
-
a-2
|
3537
|
-
a-2-x86-my_platform-1
|
3538
3457
|
a-3-x86-other_platform-1
|
3539
3458
|
]
|
3540
3459
|
|
@@ -3547,12 +3466,13 @@ Did you mean 'Ruby'?
|
|
3547
3466
|
util_setup_validate
|
3548
3467
|
|
3549
3468
|
Dir.chdir @tempdir do
|
3550
|
-
@m1 = quick_gem
|
3469
|
+
@m1 = quick_gem "m", "1" do |s|
|
3551
3470
|
s.files = %w[lib/code.rb]
|
3552
3471
|
s.metadata = {
|
3553
3472
|
"one" => "two",
|
3554
3473
|
"home" => "three",
|
3555
|
-
"homepage_uri" => "https://example.com/user/repo"
|
3474
|
+
"homepage_uri" => "https://example.com/user/repo",
|
3475
|
+
"funding_uri" => "https://example.com/donate",
|
3556
3476
|
}
|
3557
3477
|
end
|
3558
3478
|
|
@@ -3566,12 +3486,12 @@ Did you mean 'Ruby'?
|
|
3566
3486
|
util_setup_validate
|
3567
3487
|
|
3568
3488
|
Dir.chdir @tempdir do
|
3569
|
-
@m2 = quick_gem
|
3489
|
+
@m2 = quick_gem "m", "2" do |s|
|
3570
3490
|
s.files = %w[lib/code.rb]
|
3571
3491
|
s.metadata = { 1 => "fail" }
|
3572
3492
|
end
|
3573
3493
|
|
3574
|
-
e =
|
3494
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3575
3495
|
@m2.validate
|
3576
3496
|
end
|
3577
3497
|
|
@@ -3583,16 +3503,16 @@ Did you mean 'Ruby'?
|
|
3583
3503
|
util_setup_validate
|
3584
3504
|
|
3585
3505
|
Dir.chdir @tempdir do
|
3586
|
-
@m2 = quick_gem
|
3506
|
+
@m2 = quick_gem "m", "2" do |s|
|
3587
3507
|
s.files = %w[lib/code.rb]
|
3588
3508
|
s.metadata = { ("x" * 129) => "fail" }
|
3589
3509
|
end
|
3590
3510
|
|
3591
|
-
e =
|
3511
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3592
3512
|
@m2.validate
|
3593
3513
|
end
|
3594
3514
|
|
3595
|
-
assert_equal "metadata key too large (129 > 128)", e.message
|
3515
|
+
assert_equal "metadata key is too large (129 > 128)", e.message
|
3596
3516
|
end
|
3597
3517
|
end
|
3598
3518
|
|
@@ -3600,16 +3520,16 @@ Did you mean 'Ruby'?
|
|
3600
3520
|
util_setup_validate
|
3601
3521
|
|
3602
3522
|
Dir.chdir @tempdir do
|
3603
|
-
@m2 = quick_gem
|
3523
|
+
@m2 = quick_gem "m", "2" do |s|
|
3604
3524
|
s.files = %w[lib/code.rb]
|
3605
|
-
s.metadata = {
|
3525
|
+
s.metadata = { "fail" => [] }
|
3606
3526
|
end
|
3607
3527
|
|
3608
|
-
e =
|
3528
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3609
3529
|
@m2.validate
|
3610
3530
|
end
|
3611
3531
|
|
3612
|
-
assert_equal "metadata
|
3532
|
+
assert_equal "metadata['fail'] value must be a String", e.message
|
3613
3533
|
end
|
3614
3534
|
end
|
3615
3535
|
|
@@ -3617,16 +3537,16 @@ Did you mean 'Ruby'?
|
|
3617
3537
|
util_setup_validate
|
3618
3538
|
|
3619
3539
|
Dir.chdir @tempdir do
|
3620
|
-
@m2 = quick_gem
|
3540
|
+
@m2 = quick_gem "m", "2" do |s|
|
3621
3541
|
s.files = %w[lib/code.rb]
|
3622
|
-
s.metadata = {
|
3542
|
+
s.metadata = { "fail" => ("x" * 1025) }
|
3623
3543
|
end
|
3624
3544
|
|
3625
|
-
e =
|
3545
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3626
3546
|
@m2.validate
|
3627
3547
|
end
|
3628
3548
|
|
3629
|
-
assert_equal "metadata value too large (1025 > 1024)", e.message
|
3549
|
+
assert_equal "metadata['fail'] value is too large (1025 > 1024)", e.message
|
3630
3550
|
end
|
3631
3551
|
end
|
3632
3552
|
|
@@ -3634,12 +3554,12 @@ Did you mean 'Ruby'?
|
|
3634
3554
|
util_setup_validate
|
3635
3555
|
|
3636
3556
|
Dir.chdir @tempdir do
|
3637
|
-
@m2 = quick_gem
|
3557
|
+
@m2 = quick_gem "m", "2" do |s|
|
3638
3558
|
s.files = %w[lib/code.rb]
|
3639
|
-
s.metadata = {
|
3559
|
+
s.metadata = { "homepage_uri" => "http:/example.com" }
|
3640
3560
|
end
|
3641
3561
|
|
3642
|
-
e =
|
3562
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3643
3563
|
@m2.validate
|
3644
3564
|
end
|
3645
3565
|
|
@@ -3648,9 +3568,9 @@ Did you mean 'Ruby'?
|
|
3648
3568
|
end
|
3649
3569
|
|
3650
3570
|
def test_metadata_specs
|
3651
|
-
@m1 = quick_gem
|
3571
|
+
@m1 = quick_gem "m", "1" do |s|
|
3652
3572
|
s.files = %w[lib/code.rb]
|
3653
|
-
s.metadata = {
|
3573
|
+
s.metadata = { "one" => "two", "two" => "three" }
|
3654
3574
|
end
|
3655
3575
|
|
3656
3576
|
valid_ruby_spec = <<-EOF
|
@@ -3679,7 +3599,7 @@ end
|
|
3679
3599
|
end
|
3680
3600
|
|
3681
3601
|
def test_missing_extensions_eh
|
3682
|
-
|
3602
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
3683
3603
|
ext_spec
|
3684
3604
|
|
3685
3605
|
assert @ext.missing_extensions?
|
@@ -3687,7 +3607,7 @@ end
|
|
3687
3607
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
3688
3608
|
FileUtils.mkdir_p File.dirname extconf_rb
|
3689
3609
|
|
3690
|
-
File.open extconf_rb,
|
3610
|
+
File.open extconf_rb, "w" do |f|
|
3691
3611
|
f.write <<-'RUBY'
|
3692
3612
|
File.open 'Makefile', 'w' do |f|
|
3693
3613
|
f.puts "clean:\n\techo clean"
|
@@ -3703,30 +3623,18 @@ end
|
|
3703
3623
|
end
|
3704
3624
|
|
3705
3625
|
def test_missing_extensions_eh_default_gem
|
3706
|
-
spec = new_default_spec
|
3707
|
-
spec.extensions <<
|
3626
|
+
spec = new_default_spec "default", 1
|
3627
|
+
spec.extensions << "extconf.rb"
|
3708
3628
|
|
3709
3629
|
refute spec.missing_extensions?
|
3710
3630
|
end
|
3711
3631
|
|
3712
|
-
def test_missing_extensions_eh_legacy
|
3713
|
-
ext_spec
|
3714
|
-
|
3715
|
-
@ext.installed_by_version = v '2.2.0.preview.2'
|
3716
|
-
|
3717
|
-
assert @ext.missing_extensions?
|
3718
|
-
|
3719
|
-
@ext.installed_by_version = v '2.2.0.preview.1'
|
3720
|
-
|
3721
|
-
refute @ext.missing_extensions?
|
3722
|
-
end
|
3723
|
-
|
3724
3632
|
def test_missing_extensions_eh_none
|
3725
3633
|
refute @a1.missing_extensions?
|
3726
3634
|
end
|
3727
3635
|
|
3728
3636
|
def test_find_all_by_full_name
|
3729
|
-
pl = Gem::Platform.new
|
3637
|
+
pl = Gem::Platform.new "i386-linux"
|
3730
3638
|
|
3731
3639
|
a1 = util_spec "a", "1"
|
3732
3640
|
a1_pre = util_spec "a", "1.0.0.pre.1"
|
@@ -3758,7 +3666,7 @@ end
|
|
3758
3666
|
assert Gem::Specification.find_by_name "a", "1"
|
3759
3667
|
assert Gem::Specification.find_by_name "a", ">1"
|
3760
3668
|
|
3761
|
-
|
3669
|
+
assert_raise Gem::MissingSpecError do
|
3762
3670
|
Gem::Specification.find_by_name "monkeys"
|
3763
3671
|
end
|
3764
3672
|
end
|
@@ -3777,9 +3685,11 @@ end
|
|
3777
3685
|
|
3778
3686
|
install_specs b
|
3779
3687
|
|
3688
|
+
Gem::Specification.reset
|
3689
|
+
|
3780
3690
|
assert Gem::Specification.find_by_name "b"
|
3781
3691
|
|
3782
|
-
|
3692
|
+
assert_raise Gem::MissingSpecVersionError do
|
3783
3693
|
Gem::Specification.find_by_name "b", "1"
|
3784
3694
|
end
|
3785
3695
|
|
@@ -3791,9 +3701,9 @@ end
|
|
3791
3701
|
|
3792
3702
|
install_specs a
|
3793
3703
|
|
3794
|
-
assert_equal a, Gem::Specification.find_by_path(
|
3704
|
+
assert_equal a, Gem::Specification.find_by_path("foo")
|
3795
3705
|
a.activate
|
3796
|
-
assert_equal a, Gem::Specification.find_by_path(
|
3706
|
+
assert_equal a, Gem::Specification.find_by_path("foo")
|
3797
3707
|
end
|
3798
3708
|
|
3799
3709
|
def test_find_inactive_by_path
|
@@ -3801,9 +3711,9 @@ end
|
|
3801
3711
|
|
3802
3712
|
install_specs a
|
3803
3713
|
|
3804
|
-
assert_equal a, Gem::Specification.find_inactive_by_path(
|
3714
|
+
assert_equal a, Gem::Specification.find_inactive_by_path("foo")
|
3805
3715
|
a.activate
|
3806
|
-
assert_nil Gem::Specification.find_inactive_by_path(
|
3716
|
+
assert_nil Gem::Specification.find_inactive_by_path("foo")
|
3807
3717
|
end
|
3808
3718
|
|
3809
3719
|
def test_load_default_gem
|
@@ -3812,7 +3722,7 @@ end
|
|
3812
3722
|
|
3813
3723
|
default_gem_spec = new_default_spec("default", "2.0.0.0",
|
3814
3724
|
nil, "default/gem.rb")
|
3815
|
-
spec_path = File.join(@
|
3725
|
+
spec_path = File.join(@gemhome, "specifications", "default", default_gem_spec.spec_name)
|
3816
3726
|
write_file(spec_path) do |file|
|
3817
3727
|
file.print(default_gem_spec.to_ruby)
|
3818
3728
|
end
|
@@ -3837,64 +3747,18 @@ end
|
|
3837
3747
|
FileUtils.mkdir_p "test"
|
3838
3748
|
FileUtils.mkdir_p "bin"
|
3839
3749
|
|
3840
|
-
|
3841
|
-
|
3842
|
-
|
3750
|
+
begin
|
3751
|
+
umask_orig = File.umask(2)
|
3752
|
+
FileUtils.touch File.join("ext", "a", "extconf.rb")
|
3753
|
+
FileUtils.touch File.join("lib", "code.rb")
|
3754
|
+
FileUtils.touch File.join("test", "suite.rb")
|
3843
3755
|
|
3844
|
-
|
3845
|
-
|
3756
|
+
File.open "bin/exec", "w", 0755 do |fp|
|
3757
|
+
fp.puts "#!#{Gem.ruby}"
|
3758
|
+
end
|
3759
|
+
ensure
|
3760
|
+
File.umask(umask_orig)
|
3846
3761
|
end
|
3847
3762
|
end
|
3848
3763
|
end
|
3849
|
-
|
3850
|
-
def with_syck
|
3851
|
-
begin
|
3852
|
-
verbose, $VERBOSE = $VERBOSE, nil
|
3853
|
-
require "yaml"
|
3854
|
-
old_engine = YAML::ENGINE.yamler
|
3855
|
-
YAML::ENGINE.yamler = 'syck'
|
3856
|
-
load 'rubygems/syck_hack.rb'
|
3857
|
-
rescue NameError
|
3858
|
-
# probably on 1.8, ignore
|
3859
|
-
ensure
|
3860
|
-
$VERBOSE = verbose
|
3861
|
-
end
|
3862
|
-
|
3863
|
-
yield
|
3864
|
-
ensure
|
3865
|
-
begin
|
3866
|
-
YAML::ENGINE.yamler = old_engine
|
3867
|
-
load 'rubygems/syck_hack.rb'
|
3868
|
-
rescue NameError
|
3869
|
-
# ignore
|
3870
|
-
end
|
3871
|
-
end
|
3872
|
-
|
3873
|
-
def with_psych
|
3874
|
-
begin
|
3875
|
-
require "yaml"
|
3876
|
-
old_engine = YAML::ENGINE.yamler
|
3877
|
-
YAML::ENGINE.yamler = 'psych'
|
3878
|
-
load 'rubygems/syck_hack.rb'
|
3879
|
-
rescue NameError
|
3880
|
-
# probably on 1.8, ignore
|
3881
|
-
end
|
3882
|
-
|
3883
|
-
yield
|
3884
|
-
ensure
|
3885
|
-
begin
|
3886
|
-
YAML::ENGINE.yamler = old_engine
|
3887
|
-
load 'rubygems/syck_hack.rb'
|
3888
|
-
rescue NameError
|
3889
|
-
# ignore
|
3890
|
-
end
|
3891
|
-
end
|
3892
|
-
|
3893
|
-
def silence_warnings
|
3894
|
-
old_verbose, $VERBOSE = $VERBOSE, false
|
3895
|
-
yield
|
3896
|
-
ensure
|
3897
|
-
$VERBOSE = old_verbose
|
3898
|
-
end
|
3899
|
-
|
3900
3764
|
end
|