rubygems-update 3.1.6 → 3.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5619 -0
- data/CODE_OF_CONDUCT.md +55 -19
- data/CONTRIBUTING.md +97 -27
- data/Manifest.txt +185 -143
- data/POLICIES.md +70 -27
- data/README.md +29 -14
- data/UPGRADING.md +5 -81
- data/bin/gem +2 -10
- data/bin/update_rubygems +5 -5
- data/bundler/CHANGELOG.md +2605 -1431
- data/bundler/README.md +9 -14
- data/bundler/UPGRADING.md +27 -34
- data/bundler/bundler.gemspec +10 -13
- data/bundler/exe/bundle +7 -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 +2 -2
- data/bundler/lib/bundler/cli/binstubs.rb +11 -3
- data/bundler/lib/bundler/cli/cache.rb +3 -8
- data/bundler/lib/bundler/cli/check.rb +5 -3
- data/bundler/lib/bundler/cli/clean.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +32 -3
- data/bundler/lib/bundler/cli/config.rb +10 -1
- data/bundler/lib/bundler/cli/console.rb +3 -3
- data/bundler/lib/bundler/cli/doctor.rb +23 -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 +258 -45
- data/bundler/lib/bundler/cli/info.rb +38 -6
- data/bundler/lib/bundler/cli/init.rb +7 -3
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +27 -57
- 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 +11 -4
- data/bundler/lib/bundler/cli/open.rb +7 -6
- data/bundler/lib/bundler/cli/outdated.rb +106 -79
- 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/viz.rb +1 -1
- data/bundler/lib/bundler/cli.rb +151 -85
- data/bundler/lib/bundler/compact_index_client/cache.rb +7 -24
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +56 -51
- data/bundler/lib/bundler/compact_index_client.rb +3 -9
- data/bundler/lib/bundler/constants.rb +1 -1
- data/bundler/lib/bundler/current_ruby.rb +19 -6
- data/bundler/lib/bundler/definition.rb +353 -440
- data/bundler/lib/bundler/dependency.rb +23 -77
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +77 -85
- data/bundler/lib/bundler/endpoint_specification.rb +16 -14
- data/bundler/lib/bundler/env.rb +3 -3
- data/bundler/lib/bundler/environment_preserver.rb +32 -4
- data/bundler/lib/bundler/errors.rb +31 -14
- 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 +20 -27
- data/bundler/lib/bundler/fetcher/dependency.rb +2 -6
- data/bundler/lib/bundler/fetcher/downloader.rb +11 -11
- data/bundler/lib/bundler/fetcher/index.rb +2 -30
- data/bundler/lib/bundler/fetcher.rb +26 -31
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +45 -49
- data/bundler/lib/bundler/gem_helper.rb +53 -31
- data/bundler/lib/bundler/gem_helpers.rb +42 -24
- data/bundler/lib/bundler/gem_version_promoter.rb +54 -99
- data/bundler/lib/bundler/graph.rb +4 -4
- data/bundler/lib/bundler/index.rb +16 -54
- data/bundler/lib/bundler/injector.rb +41 -9
- data/bundler/lib/bundler/inline.rb +11 -22
- data/bundler/lib/bundler/installer/gem_installer.rb +19 -24
- data/bundler/lib/bundler/installer/parallel_installer.rb +34 -43
- data/bundler/lib/bundler/installer/standalone.rb +62 -11
- data/bundler/lib/bundler/installer.rb +43 -87
- data/bundler/lib/bundler/lazy_specification.rb +88 -51
- data/bundler/lib/bundler/lockfile_generator.rb +4 -4
- data/bundler/lib/bundler/lockfile_parser.rb +34 -59
- 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 +2 -2
- data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
- data/bundler/{man → lib/bundler/man}/bundle-config.1 +66 -48
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +75 -66
- 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 +6 -6
- data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +6 -6
- data/bundler/lib/bundler/man/bundle-gem.1 +105 -0
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +117 -0
- 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 +5 -1
- data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +2 -0
- 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 -33
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +33 -34
- 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 +22 -2
- data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +9 -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 +120 -83
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +109 -88
- 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 +7 -9
- 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 +17 -5
- data/bundler/lib/bundler/plugin/installer/git.rb +0 -4
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -9
- data/bundler/lib/bundler/plugin/installer.rb +16 -13
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/plugin.rb +59 -12
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/remote_specification.rb +12 -7
- data/bundler/lib/bundler/resolver/base.rb +109 -0
- data/bundler/lib/bundler/resolver/candidate.rb +94 -0
- data/bundler/lib/bundler/resolver/incompatibility.rb +15 -0
- data/bundler/lib/bundler/resolver/package.rb +72 -0
- data/bundler/lib/bundler/resolver/root.rb +25 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +49 -74
- data/bundler/lib/bundler/resolver.rb +336 -344
- 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 +231 -32
- data/bundler/lib/bundler/rubygems_gem_installer.rb +89 -16
- data/bundler/lib/bundler/rubygems_integration.rb +81 -167
- data/bundler/lib/bundler/runtime.rb +23 -31
- data/bundler/lib/bundler/self_manager.rb +168 -0
- data/bundler/lib/bundler/settings.rb +146 -73
- data/bundler/lib/bundler/setup.rb +5 -2
- data/bundler/lib/bundler/shared_helpers.rb +20 -35
- data/bundler/lib/bundler/similarity_detector.rb +1 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +263 -114
- data/bundler/lib/bundler/source/git.rb +64 -47
- data/bundler/lib/bundler/source/metadata.rb +3 -8
- data/bundler/lib/bundler/source/path/installer.rb +11 -32
- data/bundler/lib/bundler/source/path.rb +16 -10
- data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +167 -200
- 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 +112 -64
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +74 -61
- data/bundler/lib/bundler/stub_specification.rb +30 -10
- data/bundler/lib/bundler/templates/Executable +3 -5
- data/bundler/lib/bundler/templates/Executable.bundler +11 -16
- data/bundler/lib/bundler/templates/Executable.standalone +4 -4
- data/bundler/lib/bundler/templates/Gemfile +0 -2
- 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/Cargo.toml.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +15 -1
- data/bundler/lib/bundler/templates/newgem/README.md.tt +13 -16
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +43 -5
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +2 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -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 +34 -18
- 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 +37 -14
- data/bundler/lib/bundler/ui/silent.rb +21 -5
- data/bundler/lib/bundler/uri_credentials_filter.rb +3 -1
- data/bundler/lib/bundler/uri_normalizer.rb +23 -0
- 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 +56 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +41 -74
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
- 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/pub_grub/LICENSE.txt +21 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +243 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- 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 +28 -7
- 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/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 +76 -91
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +14 -21
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -17
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +3 -3
- data/bundler/lib/bundler/vendored_persistent.rb +1 -40
- data/bundler/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/version.rb +5 -1
- data/bundler/lib/bundler/worker.rb +25 -12
- data/bundler/lib/bundler/yaml_serializer.rb +1 -1
- data/bundler/lib/bundler.rb +98 -110
- 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 +27 -54
- data/lib/rubygems/command.rb +63 -52
- data/lib/rubygems/command_manager.rb +36 -16
- data/lib/rubygems/commands/build_command.rb +50 -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/exec_command.rb +248 -0
- 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 +9 -9
- data/lib/rubygems/commands/info_command.rb +10 -7
- data/lib/rubygems/commands/install_command.rb +36 -30
- 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 +70 -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 +26 -27
- 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 +44 -43
- data/lib/rubygems/commands/unpack_command.rb +14 -16
- data/lib/rubygems/commands/update_command.rb +126 -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 +75 -26
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -6
- data/lib/rubygems/core_ext/kernel_require.rb +108 -112
- data/lib/rubygems/core_ext/kernel_warn.rb +31 -36
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +124 -34
- data/lib/rubygems/dependency.rb +24 -22
- data/lib/rubygems/dependency_installer.rb +43 -115
- 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 +34 -37
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +64 -54
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +27 -0
- data/lib/rubygems/ext/cargo_builder.rb +360 -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 +43 -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 +161 -33
- data/lib/rubygems/indexer.rb +31 -50
- 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 +199 -156
- 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 +2308 -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 +65 -67
- data/lib/rubygems/package/tar_reader/entry.rb +89 -11
- data/lib/rubygems/package/tar_reader.rb +1 -32
- data/lib/rubygems/package/tar_writer.rb +8 -18
- data/lib/rubygems/package.rb +109 -120
- data/lib/rubygems/package_task.rb +5 -11
- data/lib/rubygems/path_support.rb +2 -9
- data/lib/rubygems/platform.rb +113 -74
- 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 +127 -130
- 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 +29 -49
- 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 +42 -9
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +82 -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 +1 -3
- 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 +47 -47
- data/lib/rubygems/security/policy.rb +25 -29
- data/lib/rubygems/security/signer.rb +13 -16
- data/lib/rubygems/security/trust_dir.rb +5 -6
- data/lib/rubygems/security.rb +90 -69
- data/lib/rubygems/security_option.rb +7 -7
- data/lib/rubygems/source/git.rb +31 -31
- 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 +382 -343
- data/lib/rubygems/specification_policy.rb +131 -61
- data/lib/rubygems/stub_specification.rb +24 -31
- data/lib/rubygems/text.rb +22 -21
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +452 -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/update_suggestion.rb +69 -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 +19 -17
- data/lib/rubygems/validator.rb +7 -9
- data/lib/rubygems/version.rb +31 -22
- data/lib/rubygems/version_option.rb +11 -5
- data/lib/rubygems.rb +213 -290
- data/rubygems-update.gemspec +5 -5
- data/setup.rb +11 -22
- data/test/rubygems/alternate_cert.pem +14 -14
- data/test/rubygems/alternate_cert_32.pem +15 -15
- data/test/rubygems/alternate_key.pem +25 -25
- data/test/rubygems/bundler_test_gem.rb +419 -0
- data/test/rubygems/child_cert.pem +15 -16
- data/test/rubygems/child_cert_32.pem +15 -16
- data/test/rubygems/child_key.pem +25 -25
- 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/test/rubygems/expired_cert.pem +15 -15
- data/test/rubygems/future_cert.pem +15 -15
- data/test/rubygems/future_cert_32.pem +15 -15
- data/test/rubygems/grandchild_cert.pem +15 -16
- data/test/rubygems/grandchild_cert_32.pem +15 -16
- data/test/rubygems/grandchild_key.pem +25 -25
- data/{lib/rubygems/test_case.rb → test/rubygems/helper.rb} +402 -327
- data/{lib → test}/rubygems/installer_test_case.rb +38 -24
- data/test/rubygems/invalid_issuer_cert.pem +16 -16
- data/test/rubygems/invalid_issuer_cert_32.pem +16 -16
- data/test/rubygems/invalid_key.pem +25 -25
- data/test/rubygems/invalid_signer_cert.pem +15 -15
- data/test/rubygems/invalid_signer_cert_32.pem +15 -15
- data/test/rubygems/invalidchild_cert.pem +15 -16
- data/test/rubygems/invalidchild_cert_32.pem +15 -16
- data/test/rubygems/invalidchild_key.pem +25 -25
- data/{lib → test}/rubygems/package/tar_test_case.rb +51 -18
- data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
- 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/private_key.pem +25 -25
- data/test/rubygems/public_cert.pem +16 -16
- data/test/rubygems/public_cert_32.pem +15 -15
- data/test/rubygems/public_key.pem +7 -7
- data/test/rubygems/rubygems/commands/crash_command.rb +0 -2
- data/test/rubygems/rubygems_plugin.rb +2 -4
- data/test/rubygems/simple_gem.rb +1 -1
- 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 +17 -0
- data/test/rubygems/test_gem.rb +560 -826
- data/test/rubygems/test_gem_available_set.rb +24 -26
- data/test/rubygems/test_gem_bundler_version_finder.rb +40 -46
- data/test/rubygems/test_gem_command.rb +78 -49
- data/test/rubygems/test_gem_command_manager.rb +163 -35
- data/test/rubygems/test_gem_commands_build_command.rb +285 -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_exec_command.rb +851 -0
- 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 +420 -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 +181 -46
- data/test/rubygems/test_gem_commands_pristine_command.rb +179 -99
- data/test/rubygems/test_gem_commands_push_command.rb +156 -67
- 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 +285 -183
- data/test/rubygems/test_gem_commands_signin_command.rb +187 -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 +102 -87
- data/test/rubygems/test_gem_commands_unpack_command.rb +32 -34
- data/test/rubygems/test_gem_commands_update_command.rb +341 -94
- 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 +88 -86
- 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 -111
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +233 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +10 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs +27 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -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 +247 -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/rust_ruby_example.gemspec +8 -0
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +51 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +166 -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 +60 -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 +57 -9
- data/test/rubygems/test_gem_gemcutter_utilities.rb +91 -76
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -6
- data/test/rubygems/test_gem_indexer.rb +100 -83
- data/test/rubygems/test_gem_install_update_options.rb +31 -21
- data/test/rubygems/test_gem_installer.rb +857 -484
- 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 +330 -305
- data/test/rubygems/test_gem_package_old.rb +18 -20
- data/test/rubygems/test_gem_package_tar_header.rb +69 -52
- data/test/rubygems/test_gem_package_tar_reader.rb +54 -9
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +168 -25
- 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 +388 -201
- data/test/rubygems/test_gem_rdoc.rb +19 -21
- data/test/rubygems/test_gem_remote_fetcher.rb +377 -338
- 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 +124 -125
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +227 -231
- data/test/rubygems/test_gem_request_set_lockfile.rb +93 -95
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +69 -71
- 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 +182 -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 +105 -79
- data/test/rubygems/test_gem_security_policy.rb +102 -107
- data/test/rubygems/test_gem_security_signer.rb +51 -53
- data/test/rubygems/test_gem_security_trust_dir.rb +14 -16
- 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 +78 -72
- 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 +967 -1056
- 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 +234 -105
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -5
- data/test/rubygems/test_gem_update_suggestion.rb +208 -0
- 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 +32 -32
- data/test/rubygems/test_gem_version_option.rb +16 -18
- data/test/rubygems/test_kernel.rb +47 -67
- 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 +269 -182
- data/test/rubygems/test_rubygems.rb +74 -0
- data/{lib/rubygems/test_utilities.rb → test/rubygems/utilities.rb} +63 -50
- data/test/rubygems/wrong_key_cert.pem +15 -15
- data/test/rubygems/wrong_key_cert_32.pem +15 -15
- data/test/test_changelog_generator.rb +17 -0
- metadata +190 -173
- data/.bundle/config +0 -2
- data/.rubocop.yml +0 -91
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -43
- data/History.txt +0 -4473
- data/Rakefile +0 -428
- data/bundler/CODE_OF_CONDUCT.md +0 -136
- data/bundler/lib/bundler/dep_proxy.rb +0 -48
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/bundler/lib/bundler/psyched_yaml.rb +0 -37
- data/bundler/lib/bundler/templates/gems.rb +0 -8
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- 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/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -158
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
- data/bundler/lib/bundler/version_ranges.rb +0 -122
- 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 +0 -80
- data/bundler/man/bundle-gem.1.txt +0 -91
- data/bundler/man/bundle-gem.ronn +0 -78
- 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-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-lock.ronn → lib/bundler/man/bundle-lock.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,16 +1,16 @@
|
|
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
|
-
LEGACY_YAML_SPEC = <<-EOF.freeze
|
13
|
+
LEGACY_YAML_SPEC = <<-EOF
|
14
14
|
--- !ruby/object:Gem::Specification
|
15
15
|
rubygems_version: "1.0"
|
16
16
|
name: keyedlist
|
@@ -29,7 +29,7 @@ email: flgr@ccan.de
|
|
29
29
|
has_rdoc: true
|
30
30
|
EOF
|
31
31
|
|
32
|
-
LEGACY_RUBY_SPEC = <<-EOF
|
32
|
+
LEGACY_RUBY_SPEC = <<-EOF
|
33
33
|
Gem::Specification.new do |s|
|
34
34
|
s.name = %q{keyedlist}
|
35
35
|
s.version = %q{0.4.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
|
-
|
360
|
-
|
361
|
-
install_specs d1, d2, d3, c1, c2, c3, b1, b2, a1
|
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
|
362
340
|
|
363
|
-
|
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
|
-
|
993
|
+
dir_standard_specs = File.join Gem.dir, "specifications"
|
994
|
+
|
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" }
|
1146
997
|
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
save_gemspec 'a', '1', dir_standard_specs
|
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
|
1152
1002
|
|
1153
|
-
|
1154
|
-
|
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
|
+
)
|
1155
1007
|
|
1156
|
-
Gem.loaded_specs.delete
|
1008
|
+
Gem.loaded_specs.delete "a"
|
1009
|
+
Gem.loaded_specs.delete "b"
|
1157
1010
|
Gem::Specification.class_variable_set(:@@stubs, nil)
|
1158
1011
|
end
|
1159
1012
|
|
1160
|
-
def
|
1161
|
-
Gem.
|
1162
|
-
Gem::Specification.class_variable_set(:@@stubs, nil)
|
1163
|
-
|
1164
|
-
dir_standard_specs = File.join Gem.dir, 'specifications'
|
1165
|
-
dir_default_specs = Gem.default_specifications_dir
|
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
|
|
@@ -2438,15 +2276,9 @@ Gem::Specification.new do |s|
|
|
2438
2276
|
s.rubygems_version = "#{Gem::VERSION}".freeze
|
2439
2277
|
s.summary = "this is a summary".freeze
|
2440
2278
|
|
2441
|
-
|
2442
|
-
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
|
2443
|
-
end
|
2279
|
+
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
|
2444
2280
|
|
2445
|
-
|
2446
|
-
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
2447
|
-
else
|
2448
|
-
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
2449
|
-
end
|
2281
|
+
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
2450
2282
|
end
|
2451
2283
|
SPEC
|
2452
2284
|
|
@@ -2458,6 +2290,9 @@ end
|
|
2458
2290
|
end
|
2459
2291
|
|
2460
2292
|
def test_to_ruby_with_rsa_key
|
2293
|
+
require "rubygems/openssl"
|
2294
|
+
pend "openssl is missing" unless defined?(OpenSSL::PKey::RSA)
|
2295
|
+
|
2461
2296
|
rsa_key = OpenSSL::PKey::RSA.new(2048)
|
2462
2297
|
@a2.signing_key = rsa_key
|
2463
2298
|
ruby_code = @a2.to_ruby
|
@@ -2487,9 +2322,9 @@ end
|
|
2487
2322
|
end
|
2488
2323
|
|
2489
2324
|
def test_to_ruby_for_cache
|
2490
|
-
@a2.add_runtime_dependency
|
2325
|
+
@a2.add_runtime_dependency "b", "1"
|
2491
2326
|
@a2.dependencies.first.instance_variable_set :@type, nil
|
2492
|
-
@a2.required_rubygems_version = Gem::Requirement.new
|
2327
|
+
@a2.required_rubygems_version = Gem::Requirement.new "> 0"
|
2493
2328
|
@a2.installed_by_version = Gem.rubygems_version
|
2494
2329
|
|
2495
2330
|
# cached specs do not have spec.files populated:
|
@@ -2515,15 +2350,9 @@ Gem::Specification.new do |s|
|
|
2515
2350
|
|
2516
2351
|
s.installed_by_version = "#{Gem::VERSION}" if s.respond_to? :installed_by_version
|
2517
2352
|
|
2518
|
-
|
2519
|
-
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
|
2520
|
-
end
|
2353
|
+
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
|
2521
2354
|
|
2522
|
-
|
2523
|
-
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
2524
|
-
else
|
2525
|
-
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
2526
|
-
end
|
2355
|
+
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
2527
2356
|
end
|
2528
2357
|
SPEC
|
2529
2358
|
|
@@ -2574,19 +2403,11 @@ Gem::Specification.new do |s|
|
|
2574
2403
|
s.summary = "this is a summary".freeze
|
2575
2404
|
s.test_files = ["test/suite.rb".freeze]
|
2576
2405
|
|
2577
|
-
|
2578
|
-
s.specification_version = 4
|
2579
|
-
end
|
2406
|
+
s.specification_version = 4
|
2580
2407
|
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2584
|
-
s.add_runtime_dependency(%q<pqa>.freeze, [\"> 0.4\", \"<= 0.6\"])
|
2585
|
-
else
|
2586
|
-
s.add_dependency(%q<rake>.freeze, [\"> 0.4\"])
|
2587
|
-
s.add_dependency(%q<jabber4r>.freeze, [\"> 0.0.0\"])
|
2588
|
-
s.add_dependency(%q<pqa>.freeze, [\"> 0.4\", \"<= 0.6\"])
|
2589
|
-
end
|
2408
|
+
s.add_runtime_dependency(%q<rake>.freeze, [\"> 0.4\"])
|
2409
|
+
s.add_runtime_dependency(%q<jabber4r>.freeze, [\"> 0.0.0\"])
|
2410
|
+
s.add_runtime_dependency(%q<pqa>.freeze, [\"> 0.4\", \"<= 0.6\"])
|
2590
2411
|
end
|
2591
2412
|
SPEC
|
2592
2413
|
|
@@ -2598,8 +2419,8 @@ end
|
|
2598
2419
|
end
|
2599
2420
|
|
2600
2421
|
def test_to_ruby_keeps_requirements_as_originally_specified
|
2601
|
-
spec = util_spec
|
2602
|
-
s.add_dependency
|
2422
|
+
spec = util_spec "a", "1" do |s|
|
2423
|
+
s.add_dependency "b", ["~> 1.0", ">= 1.0.0"]
|
2603
2424
|
end
|
2604
2425
|
|
2605
2426
|
assert_includes spec.to_ruby, '"~> 1.0", ">= 1.0.0"'
|
@@ -2628,19 +2449,19 @@ end
|
|
2628
2449
|
|
2629
2450
|
def test_to_ruby_platform
|
2630
2451
|
@a2.platform = Gem::Platform.local
|
2631
|
-
@a2.instance_variable_set :@original_platform,
|
2452
|
+
@a2.instance_variable_set :@original_platform, "old_platform"
|
2632
2453
|
|
2633
2454
|
ruby_code = @a2.to_ruby
|
2634
2455
|
|
2635
2456
|
same_spec = eval ruby_code
|
2636
2457
|
|
2637
|
-
assert_equal
|
2458
|
+
assert_equal "old_platform", same_spec.original_platform
|
2638
2459
|
end
|
2639
2460
|
|
2640
2461
|
def test_to_yaml
|
2641
2462
|
yaml_str = @a1.to_yaml
|
2642
2463
|
|
2643
|
-
refute_match
|
2464
|
+
refute_match %r{!!null}, yaml_str
|
2644
2465
|
|
2645
2466
|
same_spec = Gem::Specification.from_yaml(yaml_str)
|
2646
2467
|
|
@@ -2659,27 +2480,27 @@ end
|
|
2659
2480
|
end
|
2660
2481
|
|
2661
2482
|
def test_to_yaml_platform_empty_string
|
2662
|
-
@a1.instance_variable_set :@original_platform,
|
2483
|
+
@a1.instance_variable_set :@original_platform, ""
|
2663
2484
|
|
2664
|
-
assert_match %r
|
2485
|
+
assert_match %r{^platform: ruby$}, @a1.to_yaml
|
2665
2486
|
end
|
2666
2487
|
|
2667
2488
|
def test_to_yaml_platform_legacy
|
2668
|
-
@a1.platform =
|
2669
|
-
@a1.instance_variable_set :@original_platform,
|
2489
|
+
@a1.platform = "powerpc-darwin7.9.0"
|
2490
|
+
@a1.instance_variable_set :@original_platform, "powerpc-darwin7.9.0"
|
2670
2491
|
|
2671
2492
|
yaml_str = @a1.to_yaml
|
2672
2493
|
|
2673
|
-
same_spec =
|
2494
|
+
same_spec = load_yaml yaml_str
|
2674
2495
|
|
2675
|
-
assert_equal Gem::Platform.new(
|
2676
|
-
assert_equal
|
2496
|
+
assert_equal Gem::Platform.new("powerpc-darwin7"), same_spec.platform
|
2497
|
+
assert_equal "powerpc-darwin7.9.0", same_spec.original_platform
|
2677
2498
|
end
|
2678
2499
|
|
2679
2500
|
def test_to_yaml_platform_nil
|
2680
2501
|
@a1.instance_variable_set :@original_platform, nil
|
2681
2502
|
|
2682
|
-
assert_match %r
|
2503
|
+
assert_match %r{^platform: ruby$}, @a1.to_yaml
|
2683
2504
|
end
|
2684
2505
|
|
2685
2506
|
def test_validate
|
@@ -2690,7 +2511,7 @@ end
|
|
2690
2511
|
end
|
2691
2512
|
end
|
2692
2513
|
|
2693
|
-
def x(s); s.gsub(/xxx/,
|
2514
|
+
def x(s); s.gsub(/xxx/, ""); end
|
2694
2515
|
def w; x "WARxxxNING"; end
|
2695
2516
|
def t; x "TOxxxDO"; end
|
2696
2517
|
def f; x "FxxxIXME"; end
|
@@ -2705,13 +2526,13 @@ end
|
|
2705
2526
|
@a1.validate
|
2706
2527
|
end
|
2707
2528
|
|
2708
|
-
assert_match "#{w}: no author specified\n", @ui.error,
|
2529
|
+
assert_match "#{w}: no author specified\n", @ui.error, "error"
|
2709
2530
|
|
2710
2531
|
@a1.authors = [Object.new]
|
2711
2532
|
|
2712
2533
|
assert_equal [], @a1.authors
|
2713
2534
|
|
2714
|
-
e =
|
2535
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2715
2536
|
@a1.validate
|
2716
2537
|
end
|
2717
2538
|
|
@@ -2719,19 +2540,19 @@ end
|
|
2719
2540
|
|
2720
2541
|
@a1.authors = ["#{f} (who is writing this software)"]
|
2721
2542
|
|
2722
|
-
e =
|
2543
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2723
2544
|
@a1.validate
|
2724
2545
|
end
|
2725
2546
|
|
2726
|
-
assert_equal %
|
2547
|
+
assert_equal %("#{f}" or "#{t}" is not an author), e.message
|
2727
2548
|
|
2728
2549
|
@a1.authors = ["#{t} (who is writing this software)"]
|
2729
2550
|
|
2730
|
-
e =
|
2551
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2731
2552
|
@a1.validate
|
2732
2553
|
end
|
2733
2554
|
|
2734
|
-
assert_equal %
|
2555
|
+
assert_equal %("#{f}" or "#{t}" is not an author), e.message
|
2735
2556
|
end
|
2736
2557
|
end
|
2737
2558
|
|
@@ -2739,14 +2560,14 @@ end
|
|
2739
2560
|
util_setup_validate
|
2740
2561
|
|
2741
2562
|
Dir.chdir @tempdir do
|
2742
|
-
@a1.autorequire =
|
2563
|
+
@a1.autorequire = "code"
|
2743
2564
|
|
2744
2565
|
use_ui @ui do
|
2745
2566
|
@a1.validate
|
2746
2567
|
end
|
2747
2568
|
|
2748
2569
|
assert_match "#{w}: deprecated autorequire specified\n",
|
2749
|
-
@ui.error,
|
2570
|
+
@ui.error, "error"
|
2750
2571
|
end
|
2751
2572
|
end
|
2752
2573
|
|
@@ -2754,19 +2575,19 @@ end
|
|
2754
2575
|
util_setup_validate
|
2755
2576
|
|
2756
2577
|
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
|
2578
|
+
@a1.add_runtime_dependency "b", ">= 1.0.rc1"
|
2579
|
+
@a1.add_development_dependency "c", ">= 2.0.rc2"
|
2580
|
+
@a1.add_runtime_dependency "d", "~> 1.2.3"
|
2581
|
+
@a1.add_runtime_dependency "e", "~> 1.2.3.4"
|
2582
|
+
@a1.add_runtime_dependency "g", "~> 1.2.3", ">= 1.2.3.4"
|
2583
|
+
@a1.add_runtime_dependency "h", ">= 1.2.3", "<= 2"
|
2584
|
+
@a1.add_runtime_dependency "i", ">= 1.2"
|
2585
|
+
@a1.add_runtime_dependency "j", ">= 1.2.3"
|
2586
|
+
@a1.add_runtime_dependency "k", "> 1.2"
|
2587
|
+
@a1.add_runtime_dependency "l", "> 1.2.3"
|
2588
|
+
@a1.add_runtime_dependency "m", "~> 2.1.0"
|
2589
|
+
@a1.add_runtime_dependency "n", "~> 0.1.0"
|
2590
|
+
@a1.add_runtime_dependency "o"
|
2770
2591
|
|
2771
2592
|
use_ui @ui do
|
2772
2593
|
@a1.validate
|
@@ -2792,7 +2613,7 @@ end
|
|
2792
2613
|
#{w}: See https://guides.rubygems.org/specification-reference/ for help
|
2793
2614
|
EXPECTED
|
2794
2615
|
|
2795
|
-
assert_equal expected, @ui.error,
|
2616
|
+
assert_equal expected, @ui.error, "warning"
|
2796
2617
|
end
|
2797
2618
|
end
|
2798
2619
|
|
@@ -2800,13 +2621,13 @@ end
|
|
2800
2621
|
util_setup_validate
|
2801
2622
|
|
2802
2623
|
Dir.chdir @tempdir do
|
2803
|
-
@a1.add_runtime_dependency
|
2804
|
-
@a1.add_runtime_dependency
|
2805
|
-
@a1.add_development_dependency
|
2806
|
-
@a1.add_development_dependency
|
2624
|
+
@a1.add_runtime_dependency "b", "~> 1.2"
|
2625
|
+
@a1.add_runtime_dependency "b", ">= 1.2.3"
|
2626
|
+
@a1.add_development_dependency "c", "~> 1.2"
|
2627
|
+
@a1.add_development_dependency "c", ">= 1.2.3"
|
2807
2628
|
|
2808
2629
|
use_ui @ui do
|
2809
|
-
e =
|
2630
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2810
2631
|
@a1.validate
|
2811
2632
|
end
|
2812
2633
|
|
@@ -2830,14 +2651,14 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2830
2651
|
util_setup_validate
|
2831
2652
|
|
2832
2653
|
Dir.chdir @tempdir do
|
2833
|
-
@a1.add_runtime_dependency
|
2834
|
-
@a1.add_development_dependency
|
2654
|
+
@a1.add_runtime_dependency "b", "~> 1.2"
|
2655
|
+
@a1.add_development_dependency "b", "= 1.2.3"
|
2835
2656
|
|
2836
2657
|
use_ui @ui do
|
2837
2658
|
@a1.validate
|
2838
2659
|
end
|
2839
2660
|
|
2840
|
-
assert_equal
|
2661
|
+
assert_equal "", @ui.error, "warning"
|
2841
2662
|
end
|
2842
2663
|
end
|
2843
2664
|
|
@@ -2845,14 +2666,95 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2845
2666
|
util_setup_validate
|
2846
2667
|
|
2847
2668
|
Dir.chdir @tempdir do
|
2848
|
-
@a1.version =
|
2849
|
-
@a1.add_runtime_dependency
|
2669
|
+
@a1.version = "1.0.0.beta.1"
|
2670
|
+
@a1.add_runtime_dependency "b", "~> 1.2.0.beta.1"
|
2671
|
+
|
2672
|
+
use_ui @ui do
|
2673
|
+
@a1.validate
|
2674
|
+
end
|
2675
|
+
|
2676
|
+
assert_equal "", @ui.error, "warning"
|
2677
|
+
end
|
2678
|
+
end
|
2679
|
+
|
2680
|
+
def test_validate_self_referencing_dependencies
|
2681
|
+
util_setup_validate
|
2682
|
+
|
2683
|
+
Dir.chdir @tempdir do
|
2684
|
+
@a1.add_runtime_dependency @a1.name, "1"
|
2685
|
+
|
2686
|
+
use_ui @ui do
|
2687
|
+
@a1.validate
|
2688
|
+
end
|
2689
|
+
|
2690
|
+
assert_equal <<-EXPECTED, @ui.error
|
2691
|
+
#{w}: Self referencing dependency is unnecessary and strongly discouraged.
|
2692
|
+
#{w}: See https://guides.rubygems.org/specification-reference/ for help
|
2693
|
+
EXPECTED
|
2694
|
+
end
|
2695
|
+
end
|
2696
|
+
|
2697
|
+
def test_validate_rake_extension_have_rake_dependency_warning
|
2698
|
+
util_setup_validate
|
2699
|
+
|
2700
|
+
Dir.chdir @tempdir do
|
2701
|
+
@a1.extensions = ["Rakefile"]
|
2702
|
+
File.write File.join(@tempdir, "Rakefile"), ""
|
2703
|
+
|
2704
|
+
use_ui @ui do
|
2705
|
+
@a1.validate
|
2706
|
+
end
|
2707
|
+
|
2708
|
+
assert_match(/add rake as a dependency/, @ui.error)
|
2709
|
+
end
|
2710
|
+
end
|
2711
|
+
|
2712
|
+
def test_validate_rake_extension_have_rake_dependency_no_warning
|
2713
|
+
util_setup_validate
|
2714
|
+
|
2715
|
+
Dir.chdir @tempdir do
|
2716
|
+
@a1.extensions = ["Rakefile"]
|
2717
|
+
@a1.add_runtime_dependency "rake"
|
2718
|
+
File.write File.join(@tempdir, "Rakefile"), ""
|
2850
2719
|
|
2851
2720
|
use_ui @ui do
|
2852
2721
|
@a1.validate
|
2853
2722
|
end
|
2854
2723
|
|
2855
|
-
|
2724
|
+
refute_match(/add rake as a dependency/, @ui.error)
|
2725
|
+
end
|
2726
|
+
end
|
2727
|
+
|
2728
|
+
def test_validate_rust_extension_have_missing_cargo_toml_error
|
2729
|
+
util_setup_validate
|
2730
|
+
|
2731
|
+
Dir.chdir @tempdir do
|
2732
|
+
@a1.extensions = ["Cargo.toml"]
|
2733
|
+
File.write File.join(@tempdir, "Cargo.toml"), ""
|
2734
|
+
|
2735
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2736
|
+
use_ui @ui do
|
2737
|
+
@a1.validate
|
2738
|
+
end
|
2739
|
+
end
|
2740
|
+
|
2741
|
+
assert_match(/but Cargo.lock is not part of the gem files/, e.message)
|
2742
|
+
end
|
2743
|
+
end
|
2744
|
+
|
2745
|
+
def test_validate_rust_extension_have_no_missing_cargo_toml_error
|
2746
|
+
util_setup_validate
|
2747
|
+
|
2748
|
+
Dir.chdir @tempdir do
|
2749
|
+
@a1.extensions = ["Cargo.toml"]
|
2750
|
+
@a1.files << "Cargo.toml"
|
2751
|
+
@a1.files << "Cargo.lock"
|
2752
|
+
File.write File.join(@tempdir, "Cargo.toml"), ""
|
2753
|
+
File.write File.join(@tempdir, "Cargo.lock"), ""
|
2754
|
+
|
2755
|
+
use_ui @ui do
|
2756
|
+
@a1.validate
|
2757
|
+
end
|
2856
2758
|
end
|
2857
2759
|
end
|
2858
2760
|
|
@@ -2860,7 +2762,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2860
2762
|
util_setup_validate
|
2861
2763
|
|
2862
2764
|
Dir.chdir @tempdir do
|
2863
|
-
@a1.description =
|
2765
|
+
@a1.description = ""
|
2864
2766
|
|
2865
2767
|
use_ui @ui do
|
2866
2768
|
@a1.validate
|
@@ -2879,19 +2781,47 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2879
2781
|
|
2880
2782
|
@a1.description = "#{f} (describe your package)"
|
2881
2783
|
|
2882
|
-
e =
|
2784
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2883
2785
|
@a1.validate
|
2884
2786
|
end
|
2885
2787
|
|
2886
|
-
assert_equal %
|
2788
|
+
assert_equal %("#{f}" or "#{t}" is not a description), e.message
|
2887
2789
|
|
2888
2790
|
@a1.description = "#{t} (describe your package)"
|
2889
2791
|
|
2890
|
-
e =
|
2792
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2793
|
+
@a1.validate
|
2794
|
+
end
|
2795
|
+
|
2796
|
+
assert_equal %("#{f}" or "#{t}" is not a description), e.message
|
2797
|
+
|
2798
|
+
# Adding #{f} anywhere after the start of the description should be fine.
|
2799
|
+
@a1.description = "(some description) #{f}"
|
2800
|
+
|
2801
|
+
assert_nothing_raised do
|
2802
|
+
@a1.validate
|
2803
|
+
end
|
2804
|
+
|
2805
|
+
# Adding #{t} anywhere after the start of the description should be fine.
|
2806
|
+
@a1.description = "(some description) #{t}"
|
2807
|
+
|
2808
|
+
assert_nothing_raised do
|
2809
|
+
@a1.validate
|
2810
|
+
end
|
2811
|
+
|
2812
|
+
# Adding #{f} at the start of the second or later line should be fine.
|
2813
|
+
@a1.description = "(some description)\n#{f}"
|
2814
|
+
|
2815
|
+
assert_nothing_raised do
|
2891
2816
|
@a1.validate
|
2892
2817
|
end
|
2893
2818
|
|
2894
|
-
|
2819
|
+
# Adding #{t} at the start of the second or later line should be fine.
|
2820
|
+
@a1.description = "(some description)\n#{t}"
|
2821
|
+
|
2822
|
+
assert_nothing_raised do
|
2823
|
+
@a1.validate
|
2824
|
+
end
|
2895
2825
|
end
|
2896
2826
|
end
|
2897
2827
|
|
@@ -2901,46 +2831,46 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2901
2831
|
Dir.chdir @tempdir do
|
2902
2832
|
@a1.email = "FIxxxXME (your e-mail)".sub(/xxx/, "")
|
2903
2833
|
|
2904
|
-
e =
|
2834
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2905
2835
|
@a1.validate
|
2906
2836
|
end
|
2907
2837
|
|
2908
|
-
assert_equal %
|
2838
|
+
assert_equal %("#{f}" or "#{t}" is not an email), e.message
|
2909
2839
|
|
2910
2840
|
@a1.email = "#{t} (your e-mail)"
|
2911
2841
|
|
2912
|
-
e =
|
2842
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2913
2843
|
@a1.validate
|
2914
2844
|
end
|
2915
2845
|
|
2916
|
-
assert_equal %
|
2846
|
+
assert_equal %("#{f}" or "#{t}" is not an email), e.message
|
2917
2847
|
end
|
2918
2848
|
end
|
2919
2849
|
|
2920
2850
|
def test_validate_empty
|
2921
|
-
e =
|
2851
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2922
2852
|
Gem::Specification.new.validate
|
2923
2853
|
end
|
2924
2854
|
|
2925
|
-
assert_equal
|
2855
|
+
assert_equal "missing value for attribute name", e.message
|
2926
2856
|
end
|
2927
2857
|
|
2928
2858
|
def test_validate_error
|
2929
|
-
|
2859
|
+
assert_raise Gem::InvalidSpecificationException do
|
2930
2860
|
use_ui @ui do
|
2931
2861
|
Gem::Specification.new.validate
|
2932
2862
|
end
|
2933
2863
|
end
|
2934
2864
|
|
2935
|
-
assert_match
|
2865
|
+
assert_match "See https://guides.rubygems.org/specification-reference/ for help", @ui.error
|
2936
2866
|
end
|
2937
2867
|
|
2938
2868
|
def test_validate_executables
|
2939
2869
|
util_setup_validate
|
2940
2870
|
|
2941
|
-
FileUtils.mkdir_p File.join(@tempdir,
|
2942
|
-
File.write File.join(@tempdir,
|
2943
|
-
FileUtils.mkdir_p File.join(@tempdir,
|
2871
|
+
FileUtils.mkdir_p File.join(@tempdir, "bin")
|
2872
|
+
File.write File.join(@tempdir, "bin", "exec"), ""
|
2873
|
+
FileUtils.mkdir_p File.join(@tempdir, "exec")
|
2944
2874
|
|
2945
2875
|
use_ui @ui do
|
2946
2876
|
Dir.chdir @tempdir do
|
@@ -2950,41 +2880,41 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
|
2950
2880
|
|
2951
2881
|
assert_equal %w[exec], @a1.executables
|
2952
2882
|
|
2953
|
-
assert_equal
|
2954
|
-
assert_match "#{w}: bin/exec is missing #! line\n", @ui.error,
|
2883
|
+
assert_equal "", @ui.output, "output"
|
2884
|
+
assert_match "#{w}: bin/exec is missing #! line\n", @ui.error, "error"
|
2955
2885
|
end
|
2956
2886
|
|
2957
2887
|
def test_validate_empty_require_paths
|
2958
2888
|
if win_platform?
|
2959
|
-
|
2889
|
+
pend "test_validate_empty_require_paths skipped on MS Windows (symlink)"
|
2960
2890
|
else
|
2961
2891
|
util_setup_validate
|
2962
2892
|
|
2963
2893
|
@a1.require_paths = []
|
2964
|
-
e =
|
2894
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
2965
2895
|
@a1.validate
|
2966
2896
|
end
|
2967
2897
|
|
2968
|
-
assert_equal
|
2898
|
+
assert_equal "specification must have at least one require_path",
|
2969
2899
|
e.message
|
2970
2900
|
end
|
2971
2901
|
end
|
2972
2902
|
|
2973
2903
|
def test_validate_files
|
2974
|
-
|
2904
|
+
pend "test_validate_files skipped on MS Windows (symlink)" if win_platform?
|
2975
2905
|
util_setup_validate
|
2976
2906
|
|
2977
|
-
@a1.files += [
|
2978
|
-
@a1.extensions <<
|
2907
|
+
@a1.files += ["lib", "lib2"]
|
2908
|
+
@a1.extensions << "ext/a/extconf.rb"
|
2979
2909
|
|
2980
2910
|
Dir.chdir @tempdir do
|
2981
|
-
FileUtils.ln_s
|
2911
|
+
FileUtils.ln_s "lib/code.rb", "lib2" unless vc_windows?
|
2982
2912
|
|
2983
2913
|
use_ui @ui do
|
2984
2914
|
@a1.validate
|
2985
2915
|
end
|
2986
2916
|
|
2987
|
-
assert_match
|
2917
|
+
assert_match "WARNING: lib2 is a symlink, which is not supported on all platforms", @ui.error
|
2988
2918
|
end
|
2989
2919
|
|
2990
2920
|
assert_equal %w[bin/exec ext/a/extconf.rb lib/code.rb lib2 test/suite.rb].sort,
|
@@ -3011,9 +2941,11 @@ WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
|
|
3011
2941
|
Please report a bug if this causes problems.
|
3012
2942
|
EXPECTED
|
3013
2943
|
|
3014
|
-
|
2944
|
+
actual_stdout, actual_stderr = capture_output do
|
3015
2945
|
specification.reset
|
3016
2946
|
end
|
2947
|
+
assert_empty actual_stdout
|
2948
|
+
assert_equal(expected, actual_stderr)
|
3017
2949
|
end
|
3018
2950
|
|
3019
2951
|
def test_unresolved_specs_with_versions
|
@@ -3027,8 +2959,8 @@ Please report a bug if this causes problems.
|
|
3027
2959
|
|
3028
2960
|
specification.define_singleton_method(:find_all_by_name) do |dep_name|
|
3029
2961
|
[
|
3030
|
-
specification.new {
|
3031
|
-
specification.new {
|
2962
|
+
specification.new {|s| s.name = "z", s.version = Gem::Version.new("1") },
|
2963
|
+
specification.new {|s| s.name = "z", s.version = Gem::Version.new("2") },
|
3032
2964
|
]
|
3033
2965
|
end
|
3034
2966
|
|
@@ -3042,9 +2974,20 @@ WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
|
|
3042
2974
|
Please report a bug if this causes problems.
|
3043
2975
|
EXPECTED
|
3044
2976
|
|
3045
|
-
|
2977
|
+
actual_stdout, actual_stderr = capture_output do
|
3046
2978
|
specification.reset
|
3047
2979
|
end
|
2980
|
+
assert_empty actual_stdout
|
2981
|
+
assert_equal(expected, actual_stderr)
|
2982
|
+
end
|
2983
|
+
|
2984
|
+
def test_duplicate_runtime_dependency
|
2985
|
+
expected = "WARNING: duplicated b dependency [\"~> 3.0\", \"~> 3.0\"]\n"
|
2986
|
+
out, err = capture_output do
|
2987
|
+
@a1.add_runtime_dependency "b", "~> 3.0", "~> 3.0"
|
2988
|
+
end
|
2989
|
+
assert_empty out
|
2990
|
+
assert_equal(expected, err)
|
3048
2991
|
end
|
3049
2992
|
|
3050
2993
|
def set_orig(cls)
|
@@ -3059,7 +3002,7 @@ Please report a bug if this causes problems.
|
|
3059
3002
|
|
3060
3003
|
@a1.files = [@a1.file_name]
|
3061
3004
|
|
3062
|
-
e =
|
3005
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3063
3006
|
@a1.validate
|
3064
3007
|
end
|
3065
3008
|
|
@@ -3077,40 +3020,39 @@ Please report a bug if this causes problems.
|
|
3077
3020
|
@a1.validate
|
3078
3021
|
end
|
3079
3022
|
|
3080
|
-
assert_match "#{w}: no homepage specified\n", @ui.error,
|
3023
|
+
assert_match "#{w}: no homepage specified\n", @ui.error, "error"
|
3081
3024
|
|
3082
3025
|
@ui = Gem::MockGemUi.new
|
3083
3026
|
|
3084
|
-
@a1.homepage =
|
3027
|
+
@a1.homepage = ""
|
3085
3028
|
|
3086
3029
|
use_ui @ui do
|
3087
3030
|
@a1.validate
|
3088
3031
|
end
|
3089
3032
|
|
3090
|
-
assert_match "#{w}: no homepage specified\n", @ui.error,
|
3033
|
+
assert_match "#{w}: no homepage specified\n", @ui.error, "error"
|
3091
3034
|
|
3092
|
-
@a1.homepage =
|
3035
|
+
@a1.homepage = "over at my cool site"
|
3093
3036
|
|
3094
|
-
e =
|
3037
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3095
3038
|
@a1.validate
|
3096
3039
|
end
|
3097
3040
|
|
3098
3041
|
assert_equal '"over at my cool site" is not a valid HTTP URI', e.message
|
3099
3042
|
|
3100
|
-
@a1.homepage =
|
3043
|
+
@a1.homepage = "ftp://rubygems.org"
|
3101
3044
|
|
3102
|
-
e =
|
3045
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3103
3046
|
@a1.validate
|
3104
3047
|
end
|
3105
3048
|
|
3106
3049
|
assert_equal '"ftp://rubygems.org" is not a valid HTTP URI', e.message
|
3107
3050
|
|
3108
|
-
@a1.homepage =
|
3051
|
+
@a1.homepage = "https://rubygems.org/"
|
3109
3052
|
assert_equal true, @a1.validate
|
3110
3053
|
|
3111
|
-
@a1.homepage =
|
3054
|
+
@a1.homepage = "https://rubygems.org"
|
3112
3055
|
assert_equal true, @a1.validate
|
3113
|
-
|
3114
3056
|
end
|
3115
3057
|
end
|
3116
3058
|
|
@@ -3122,10 +3064,21 @@ Please report a bug if this causes problems.
|
|
3122
3064
|
@a1.validate
|
3123
3065
|
end
|
3124
3066
|
|
3125
|
-
assert_match <<-
|
3067
|
+
assert_match <<-WARNING, @ui.error
|
3126
3068
|
WARNING: licenses is empty, but is recommended. Use a license identifier from
|
3127
3069
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3128
|
-
|
3070
|
+
WARNING
|
3071
|
+
end
|
3072
|
+
|
3073
|
+
def test_validate_license_in_a_non_packaging_context
|
3074
|
+
util_setup_validate
|
3075
|
+
|
3076
|
+
use_ui @ui do
|
3077
|
+
@a1.licenses.clear
|
3078
|
+
@a1.validate(false)
|
3079
|
+
end
|
3080
|
+
|
3081
|
+
assert_empty @ui.error
|
3129
3082
|
end
|
3130
3083
|
|
3131
3084
|
def test_removed_methods
|
@@ -3136,7 +3089,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3136
3089
|
util_setup_validate
|
3137
3090
|
|
3138
3091
|
use_ui @ui do
|
3139
|
-
@a1.rubyforge_project =
|
3092
|
+
@a1.rubyforge_project = "invalid-attribute"
|
3140
3093
|
@a1.validate
|
3141
3094
|
end
|
3142
3095
|
|
@@ -3147,21 +3100,32 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3147
3100
|
util_setup_validate
|
3148
3101
|
|
3149
3102
|
use_ui @ui do
|
3150
|
-
@a1.licenses = [
|
3103
|
+
@a1.licenses = ["BSD"]
|
3151
3104
|
@a1.validate
|
3152
3105
|
end
|
3153
3106
|
|
3154
|
-
assert_match <<-
|
3107
|
+
assert_match <<-WARNING, @ui.error
|
3155
3108
|
WARNING: license value 'BSD' is invalid. Use a license identifier from
|
3156
3109
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3157
|
-
|
3110
|
+
WARNING
|
3111
|
+
end
|
3112
|
+
|
3113
|
+
def test_validate_license_ref
|
3114
|
+
util_setup_validate
|
3115
|
+
|
3116
|
+
use_ui @ui do
|
3117
|
+
@a1.licenses = ["LicenseRef-LICENSE.md"]
|
3118
|
+
@a1.validate
|
3119
|
+
end
|
3120
|
+
|
3121
|
+
assert_empty @ui.error
|
3158
3122
|
end
|
3159
3123
|
|
3160
3124
|
def test_validate_license_values_plus
|
3161
3125
|
util_setup_validate
|
3162
3126
|
|
3163
3127
|
use_ui @ui do
|
3164
|
-
@a1.licenses = [
|
3128
|
+
@a1.licenses = ["GPL-2.0+"]
|
3165
3129
|
@a1.validate
|
3166
3130
|
end
|
3167
3131
|
|
@@ -3172,7 +3136,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3172
3136
|
util_setup_validate
|
3173
3137
|
|
3174
3138
|
use_ui @ui do
|
3175
|
-
@a1.licenses = [
|
3139
|
+
@a1.licenses = ["GPL-2.0-or-later"]
|
3176
3140
|
@a1.validate
|
3177
3141
|
end
|
3178
3142
|
|
@@ -3183,7 +3147,7 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3183
3147
|
util_setup_validate
|
3184
3148
|
|
3185
3149
|
use_ui @ui do
|
3186
|
-
@a1.licenses = [
|
3150
|
+
@a1.licenses = ["GPL-2.0+ WITH Autoconf-exception-2.0"]
|
3187
3151
|
@a1.validate
|
3188
3152
|
end
|
3189
3153
|
|
@@ -3194,47 +3158,47 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
|
3194
3158
|
util_setup_validate
|
3195
3159
|
|
3196
3160
|
use_ui @ui do
|
3197
|
-
@a1.licenses = [
|
3161
|
+
@a1.licenses = ["GPL-2.0+ FOO", "GPL-2.0 FOO"]
|
3198
3162
|
@a1.validate
|
3199
3163
|
end
|
3200
3164
|
|
3201
|
-
assert_match <<-
|
3165
|
+
assert_match <<-WARNING, @ui.error
|
3202
3166
|
WARNING: license value 'GPL-2.0+ FOO' is invalid. Use a license identifier from
|
3203
3167
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3204
|
-
|
3205
|
-
assert_match <<-
|
3168
|
+
WARNING
|
3169
|
+
assert_match <<-WARNING, @ui.error
|
3206
3170
|
WARNING: license value 'GPL-2.0 FOO' is invalid. Use a license identifier from
|
3207
3171
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3208
|
-
|
3172
|
+
WARNING
|
3209
3173
|
end
|
3210
3174
|
|
3211
3175
|
def test_validate_license_with_invalid_exception
|
3212
3176
|
util_setup_validate
|
3213
3177
|
|
3214
3178
|
use_ui @ui do
|
3215
|
-
@a1.licenses = [
|
3179
|
+
@a1.licenses = ["GPL-2.0+ WITH Autocofn-exception-2.0"]
|
3216
3180
|
@a1.validate
|
3217
3181
|
end
|
3218
3182
|
|
3219
|
-
assert_match <<-
|
3183
|
+
assert_match <<-WARNING, @ui.error
|
3220
3184
|
WARNING: license value 'GPL-2.0+ WITH Autocofn-exception-2.0' is invalid. Use a license identifier from
|
3221
3185
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3222
|
-
|
3186
|
+
WARNING
|
3223
3187
|
end
|
3224
3188
|
|
3225
3189
|
def test_validate_license_gives_suggestions
|
3226
3190
|
util_setup_validate
|
3227
3191
|
|
3228
3192
|
use_ui @ui do
|
3229
|
-
@a1.licenses = [
|
3193
|
+
@a1.licenses = ["ruby"]
|
3230
3194
|
@a1.validate
|
3231
3195
|
end
|
3232
3196
|
|
3233
|
-
assert_match <<-
|
3197
|
+
assert_match <<-WARNING, @ui.error
|
3234
3198
|
WARNING: license value 'ruby' is invalid. Use a license identifier from
|
3235
3199
|
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
3236
3200
|
Did you mean 'Ruby'?
|
3237
|
-
|
3201
|
+
WARNING
|
3238
3202
|
end
|
3239
3203
|
|
3240
3204
|
def test_validate_empty_files
|
@@ -3277,7 +3241,7 @@ Did you mean 'Ruby'?
|
|
3277
3241
|
def test_validate_name
|
3278
3242
|
util_setup_validate
|
3279
3243
|
|
3280
|
-
e =
|
3244
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3281
3245
|
@a1.name = :json
|
3282
3246
|
@a1.validate
|
3283
3247
|
end
|
@@ -3285,31 +3249,31 @@ Did you mean 'Ruby'?
|
|
3285
3249
|
assert_equal 'invalid value for attribute name: ":json" must be a string', e.message
|
3286
3250
|
|
3287
3251
|
@a1.name = []
|
3288
|
-
e =
|
3252
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3289
3253
|
@a1.validate
|
3290
3254
|
end
|
3291
3255
|
assert_equal "invalid value for attribute name: \"[]\" must be a string", e.message
|
3292
3256
|
|
3293
3257
|
@a1.name = ""
|
3294
|
-
e =
|
3258
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3295
3259
|
@a1.validate
|
3296
3260
|
end
|
3297
3261
|
assert_equal "invalid value for attribute name: \"\" must include at least one letter", e.message
|
3298
3262
|
|
3299
3263
|
@a1.name = "12345"
|
3300
|
-
e =
|
3264
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3301
3265
|
@a1.validate
|
3302
3266
|
end
|
3303
3267
|
assert_equal "invalid value for attribute name: \"12345\" must include at least one letter", e.message
|
3304
3268
|
|
3305
3269
|
@a1.name = "../malicious"
|
3306
|
-
e =
|
3270
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3307
3271
|
@a1.validate
|
3308
3272
|
end
|
3309
3273
|
assert_equal "invalid value for attribute name: \"../malicious\" can only include letters, numbers, dashes, and underscores", e.message
|
3310
3274
|
|
3311
3275
|
@a1.name = "\ba\t"
|
3312
|
-
e =
|
3276
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3313
3277
|
@a1.validate
|
3314
3278
|
end
|
3315
3279
|
assert_equal "invalid value for attribute name: \"\\ba\\t\" can only include letters, numbers, dashes, and underscores", e.message
|
@@ -3326,23 +3290,23 @@ Did you mean 'Ruby'?
|
|
3326
3290
|
spec = @a1.dup
|
3327
3291
|
spec.instance_variable_set "@#{name}", nil
|
3328
3292
|
|
3329
|
-
e =
|
3293
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3330
3294
|
spec.validate
|
3331
3295
|
end
|
3332
3296
|
|
3333
|
-
assert_match %r
|
3297
|
+
assert_match %r{^#{name}}, e.message
|
3334
3298
|
end
|
3335
3299
|
end
|
3336
3300
|
end
|
3337
3301
|
|
3338
3302
|
def test_validate_permissions
|
3339
|
-
|
3303
|
+
pend "chmod not supported" if Gem.win_platform?
|
3340
3304
|
|
3341
3305
|
util_setup_validate
|
3342
3306
|
|
3343
3307
|
Dir.chdir @tempdir do
|
3344
|
-
File.chmod 0640, File.join(
|
3345
|
-
File.chmod 0640, File.join(
|
3308
|
+
File.chmod 0640, File.join("lib", "code.rb")
|
3309
|
+
File.chmod 0640, File.join("bin", "exec")
|
3346
3310
|
|
3347
3311
|
use_ui @ui do
|
3348
3312
|
@a1.validate
|
@@ -3355,12 +3319,12 @@ Did you mean 'Ruby'?
|
|
3355
3319
|
end
|
3356
3320
|
|
3357
3321
|
def test_validate_permissions_of_missing_file_non_packaging
|
3358
|
-
|
3322
|
+
pend "chmod not supported" if Gem.win_platform?
|
3359
3323
|
|
3360
3324
|
util_setup_validate
|
3361
3325
|
|
3362
3326
|
Dir.chdir @tempdir do
|
3363
|
-
File.delete File.join(
|
3327
|
+
File.delete File.join("lib", "code.rb")
|
3364
3328
|
|
3365
3329
|
use_ui @ui do
|
3366
3330
|
assert @a1.validate(false)
|
@@ -3372,13 +3336,13 @@ Did you mean 'Ruby'?
|
|
3372
3336
|
util_setup_validate
|
3373
3337
|
|
3374
3338
|
Dir.chdir @tempdir do
|
3375
|
-
@a1.platform =
|
3339
|
+
@a1.platform = "mswin32"
|
3376
3340
|
assert @a1.validate
|
3377
3341
|
|
3378
|
-
@a1.platform =
|
3342
|
+
@a1.platform = "i586-linux"
|
3379
3343
|
assert @a1.validate
|
3380
3344
|
|
3381
|
-
@a1.platform =
|
3345
|
+
@a1.platform = "powerpc-darwin"
|
3382
3346
|
assert @a1.validate
|
3383
3347
|
end
|
3384
3348
|
end
|
@@ -3387,7 +3351,7 @@ Did you mean 'Ruby'?
|
|
3387
3351
|
util_setup_validate
|
3388
3352
|
|
3389
3353
|
@a1.rubygems_version = "3"
|
3390
|
-
e =
|
3354
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3391
3355
|
@a1.validate
|
3392
3356
|
end
|
3393
3357
|
|
@@ -3399,15 +3363,15 @@ Did you mean 'Ruby'?
|
|
3399
3363
|
util_setup_validate
|
3400
3364
|
|
3401
3365
|
Dir.chdir @tempdir do
|
3402
|
-
@a1.specification_version =
|
3366
|
+
@a1.specification_version = "1.0"
|
3403
3367
|
|
3404
|
-
e =
|
3368
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3405
3369
|
use_ui @ui do
|
3406
3370
|
@a1.validate
|
3407
3371
|
end
|
3408
3372
|
end
|
3409
3373
|
|
3410
|
-
err =
|
3374
|
+
err = "specification_version must be an Integer (did you mean version?)"
|
3411
3375
|
assert_equal err, e.message
|
3412
3376
|
end
|
3413
3377
|
end
|
@@ -3416,29 +3380,29 @@ Did you mean 'Ruby'?
|
|
3416
3380
|
util_setup_validate
|
3417
3381
|
|
3418
3382
|
Dir.chdir @tempdir do
|
3419
|
-
@a1.summary =
|
3383
|
+
@a1.summary = ""
|
3420
3384
|
|
3421
3385
|
use_ui @ui do
|
3422
3386
|
@a1.validate
|
3423
3387
|
end
|
3424
3388
|
|
3425
|
-
assert_match "#{w}: no summary specified\n", @ui.error,
|
3389
|
+
assert_match "#{w}: no summary specified\n", @ui.error, "error"
|
3426
3390
|
|
3427
3391
|
@a1.summary = "#{f} (describe your package)"
|
3428
3392
|
|
3429
|
-
e =
|
3393
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3430
3394
|
@a1.validate
|
3431
3395
|
end
|
3432
3396
|
|
3433
|
-
assert_equal %
|
3397
|
+
assert_equal %("#{f}" or "#{t}" is not a summary), e.message
|
3434
3398
|
|
3435
3399
|
@a1.summary = "#{t} (describe your package)"
|
3436
3400
|
|
3437
|
-
e =
|
3401
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3438
3402
|
@a1.validate
|
3439
3403
|
end
|
3440
3404
|
|
3441
|
-
assert_equal %
|
3405
|
+
assert_equal %("#{f}" or "#{t}" is not a summary), e.message
|
3442
3406
|
end
|
3443
3407
|
end
|
3444
3408
|
|
@@ -3450,11 +3414,11 @@ Did you mean 'Ruby'?
|
|
3450
3414
|
@a1.validate
|
3451
3415
|
end
|
3452
3416
|
|
3453
|
-
assert_match
|
3417
|
+
assert_match "See https://guides.rubygems.org/specification-reference/ for help", @ui.error
|
3454
3418
|
end
|
3455
3419
|
|
3456
3420
|
def test_version
|
3457
|
-
assert_equal Gem::Version.new(
|
3421
|
+
assert_equal Gem::Version.new("1"), @a1.version
|
3458
3422
|
end
|
3459
3423
|
|
3460
3424
|
def test_version_change_reset_full_name
|
@@ -3487,7 +3451,7 @@ Did you mean 'Ruby'?
|
|
3487
3451
|
specfile.write "raise 'boom'"
|
3488
3452
|
specfile.close
|
3489
3453
|
begin
|
3490
|
-
|
3454
|
+
capture_output do
|
3491
3455
|
Gem::Specification.load(specfile.path)
|
3492
3456
|
end
|
3493
3457
|
rescue => e
|
@@ -3498,43 +3462,28 @@ Did you mean 'Ruby'?
|
|
3498
3462
|
specfile.delete
|
3499
3463
|
end
|
3500
3464
|
|
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
3465
|
def test_latest_specs
|
3515
3466
|
spec_fetcher do |fetcher|
|
3516
|
-
fetcher.spec
|
3517
|
-
s.platform = Gem::Platform.new
|
3467
|
+
fetcher.spec "a", 1 do |s|
|
3468
|
+
s.platform = Gem::Platform.new "x86-my_platform1"
|
3518
3469
|
end
|
3519
3470
|
|
3520
|
-
fetcher.spec
|
3471
|
+
fetcher.spec "a", 2
|
3521
3472
|
|
3522
|
-
fetcher.spec
|
3523
|
-
s.platform = Gem::Platform.new
|
3473
|
+
fetcher.spec "a", 2 do |s|
|
3474
|
+
s.platform = Gem::Platform.new "x86-my_platform1"
|
3524
3475
|
end
|
3525
3476
|
|
3526
|
-
fetcher.spec
|
3527
|
-
s.platform = Gem::Platform.new
|
3477
|
+
fetcher.spec "a", 2 do |s|
|
3478
|
+
s.platform = Gem::Platform.new "x86-other_platform1"
|
3528
3479
|
end
|
3529
3480
|
|
3530
|
-
fetcher.spec
|
3531
|
-
s.platform = Gem::Platform.new
|
3481
|
+
fetcher.spec "a", 3 do |s|
|
3482
|
+
s.platform = Gem::Platform.new "x86-other_platform1"
|
3532
3483
|
end
|
3533
3484
|
end
|
3534
3485
|
|
3535
3486
|
expected = %W[
|
3536
|
-
a-2
|
3537
|
-
a-2-x86-my_platform-1
|
3538
3487
|
a-3-x86-other_platform-1
|
3539
3488
|
]
|
3540
3489
|
|
@@ -3547,12 +3496,13 @@ Did you mean 'Ruby'?
|
|
3547
3496
|
util_setup_validate
|
3548
3497
|
|
3549
3498
|
Dir.chdir @tempdir do
|
3550
|
-
@m1 = quick_gem
|
3499
|
+
@m1 = quick_gem "m", "1" do |s|
|
3551
3500
|
s.files = %w[lib/code.rb]
|
3552
3501
|
s.metadata = {
|
3553
|
-
"one"
|
3554
|
-
"home"
|
3555
|
-
"homepage_uri" => "https://example.com/user/repo"
|
3502
|
+
"one" => "two",
|
3503
|
+
"home" => "three",
|
3504
|
+
"homepage_uri" => "https://example.com/user/repo",
|
3505
|
+
"funding_uri" => "https://example.com/donate",
|
3556
3506
|
}
|
3557
3507
|
end
|
3558
3508
|
|
@@ -3566,12 +3516,12 @@ Did you mean 'Ruby'?
|
|
3566
3516
|
util_setup_validate
|
3567
3517
|
|
3568
3518
|
Dir.chdir @tempdir do
|
3569
|
-
@m2 = quick_gem
|
3519
|
+
@m2 = quick_gem "m", "2" do |s|
|
3570
3520
|
s.files = %w[lib/code.rb]
|
3571
3521
|
s.metadata = { 1 => "fail" }
|
3572
3522
|
end
|
3573
3523
|
|
3574
|
-
e =
|
3524
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3575
3525
|
@m2.validate
|
3576
3526
|
end
|
3577
3527
|
|
@@ -3583,16 +3533,16 @@ Did you mean 'Ruby'?
|
|
3583
3533
|
util_setup_validate
|
3584
3534
|
|
3585
3535
|
Dir.chdir @tempdir do
|
3586
|
-
@m2 = quick_gem
|
3536
|
+
@m2 = quick_gem "m", "2" do |s|
|
3587
3537
|
s.files = %w[lib/code.rb]
|
3588
3538
|
s.metadata = { ("x" * 129) => "fail" }
|
3589
3539
|
end
|
3590
3540
|
|
3591
|
-
e =
|
3541
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3592
3542
|
@m2.validate
|
3593
3543
|
end
|
3594
3544
|
|
3595
|
-
assert_equal "metadata key too large (129 > 128)", e.message
|
3545
|
+
assert_equal "metadata key is too large (129 > 128)", e.message
|
3596
3546
|
end
|
3597
3547
|
end
|
3598
3548
|
|
@@ -3600,16 +3550,16 @@ Did you mean 'Ruby'?
|
|
3600
3550
|
util_setup_validate
|
3601
3551
|
|
3602
3552
|
Dir.chdir @tempdir do
|
3603
|
-
@m2 = quick_gem
|
3553
|
+
@m2 = quick_gem "m", "2" do |s|
|
3604
3554
|
s.files = %w[lib/code.rb]
|
3605
|
-
s.metadata = {
|
3555
|
+
s.metadata = { "fail" => [] }
|
3606
3556
|
end
|
3607
3557
|
|
3608
|
-
e =
|
3558
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3609
3559
|
@m2.validate
|
3610
3560
|
end
|
3611
3561
|
|
3612
|
-
assert_equal "metadata
|
3562
|
+
assert_equal "metadata['fail'] value must be a String", e.message
|
3613
3563
|
end
|
3614
3564
|
end
|
3615
3565
|
|
@@ -3617,16 +3567,16 @@ Did you mean 'Ruby'?
|
|
3617
3567
|
util_setup_validate
|
3618
3568
|
|
3619
3569
|
Dir.chdir @tempdir do
|
3620
|
-
@m2 = quick_gem
|
3570
|
+
@m2 = quick_gem "m", "2" do |s|
|
3621
3571
|
s.files = %w[lib/code.rb]
|
3622
|
-
s.metadata = {
|
3572
|
+
s.metadata = { "fail" => ("x" * 1025) }
|
3623
3573
|
end
|
3624
3574
|
|
3625
|
-
e =
|
3575
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3626
3576
|
@m2.validate
|
3627
3577
|
end
|
3628
3578
|
|
3629
|
-
assert_equal "metadata value too large (1025 > 1024)", e.message
|
3579
|
+
assert_equal "metadata['fail'] value is too large (1025 > 1024)", e.message
|
3630
3580
|
end
|
3631
3581
|
end
|
3632
3582
|
|
@@ -3634,12 +3584,12 @@ Did you mean 'Ruby'?
|
|
3634
3584
|
util_setup_validate
|
3635
3585
|
|
3636
3586
|
Dir.chdir @tempdir do
|
3637
|
-
@m2 = quick_gem
|
3587
|
+
@m2 = quick_gem "m", "2" do |s|
|
3638
3588
|
s.files = %w[lib/code.rb]
|
3639
|
-
s.metadata = {
|
3589
|
+
s.metadata = { "homepage_uri" => "http:/example.com" }
|
3640
3590
|
end
|
3641
3591
|
|
3642
|
-
e =
|
3592
|
+
e = assert_raise Gem::InvalidSpecificationException do
|
3643
3593
|
@m2.validate
|
3644
3594
|
end
|
3645
3595
|
|
@@ -3648,9 +3598,9 @@ Did you mean 'Ruby'?
|
|
3648
3598
|
end
|
3649
3599
|
|
3650
3600
|
def test_metadata_specs
|
3651
|
-
@m1 = quick_gem
|
3601
|
+
@m1 = quick_gem "m", "1" do |s|
|
3652
3602
|
s.files = %w[lib/code.rb]
|
3653
|
-
s.metadata = {
|
3603
|
+
s.metadata = { "one" => "two", "two" => "three" }
|
3654
3604
|
end
|
3655
3605
|
|
3656
3606
|
valid_ruby_spec = <<-EOF
|
@@ -3679,7 +3629,7 @@ end
|
|
3679
3629
|
end
|
3680
3630
|
|
3681
3631
|
def test_missing_extensions_eh
|
3682
|
-
|
3632
|
+
pend "extensions don't quite work on jruby" if Gem.java_platform?
|
3683
3633
|
ext_spec
|
3684
3634
|
|
3685
3635
|
assert @ext.missing_extensions?
|
@@ -3687,7 +3637,7 @@ end
|
|
3687
3637
|
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
3688
3638
|
FileUtils.mkdir_p File.dirname extconf_rb
|
3689
3639
|
|
3690
|
-
File.open extconf_rb,
|
3640
|
+
File.open extconf_rb, "w" do |f|
|
3691
3641
|
f.write <<-'RUBY'
|
3692
3642
|
File.open 'Makefile', 'w' do |f|
|
3693
3643
|
f.puts "clean:\n\techo clean"
|
@@ -3703,30 +3653,18 @@ end
|
|
3703
3653
|
end
|
3704
3654
|
|
3705
3655
|
def test_missing_extensions_eh_default_gem
|
3706
|
-
spec = new_default_spec
|
3707
|
-
spec.extensions <<
|
3656
|
+
spec = new_default_spec "default", 1
|
3657
|
+
spec.extensions << "extconf.rb"
|
3708
3658
|
|
3709
3659
|
refute spec.missing_extensions?
|
3710
3660
|
end
|
3711
3661
|
|
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
3662
|
def test_missing_extensions_eh_none
|
3725
3663
|
refute @a1.missing_extensions?
|
3726
3664
|
end
|
3727
3665
|
|
3728
3666
|
def test_find_all_by_full_name
|
3729
|
-
pl = Gem::Platform.new
|
3667
|
+
pl = Gem::Platform.new "i386-linux"
|
3730
3668
|
|
3731
3669
|
a1 = util_spec "a", "1"
|
3732
3670
|
a1_pre = util_spec "a", "1.0.0.pre.1"
|
@@ -3758,7 +3696,7 @@ end
|
|
3758
3696
|
assert Gem::Specification.find_by_name "a", "1"
|
3759
3697
|
assert Gem::Specification.find_by_name "a", ">1"
|
3760
3698
|
|
3761
|
-
|
3699
|
+
assert_raise Gem::MissingSpecError do
|
3762
3700
|
Gem::Specification.find_by_name "monkeys"
|
3763
3701
|
end
|
3764
3702
|
end
|
@@ -3777,23 +3715,42 @@ end
|
|
3777
3715
|
|
3778
3716
|
install_specs b
|
3779
3717
|
|
3718
|
+
Gem::Specification.reset
|
3719
|
+
|
3780
3720
|
assert Gem::Specification.find_by_name "b"
|
3781
3721
|
|
3782
|
-
|
3722
|
+
assert_raise Gem::MissingSpecVersionError do
|
3783
3723
|
Gem::Specification.find_by_name "b", "1"
|
3784
3724
|
end
|
3785
3725
|
|
3786
3726
|
assert Gem::Specification.find_by_name "b", ">1"
|
3787
3727
|
end
|
3788
3728
|
|
3729
|
+
def test_find_by_full_name
|
3730
|
+
pl = Gem::Platform.new "x86_64-linux"
|
3731
|
+
|
3732
|
+
a = util_spec "a", "1"
|
3733
|
+
install_specs a
|
3734
|
+
|
3735
|
+
a_pl = util_spec("a", "1") {|s| s.platform = pl }
|
3736
|
+
install_specs a_pl
|
3737
|
+
|
3738
|
+
assert_equal a, Gem::Specification.find_by_full_name("a-1")
|
3739
|
+
assert_equal a_pl, Gem::Specification.find_by_full_name("a-1-x86_64-linux")
|
3740
|
+
|
3741
|
+
assert_nil Gem::Specification.find_by_full_name("a-2")
|
3742
|
+
assert_nil Gem::Specification.find_by_full_name("b-1")
|
3743
|
+
assert_nil Gem::Specification.find_by_full_name("a-1-arm64-linux")
|
3744
|
+
end
|
3745
|
+
|
3789
3746
|
def test_find_by_path
|
3790
3747
|
a = util_spec "foo", "1", nil, "lib/foo.rb"
|
3791
3748
|
|
3792
3749
|
install_specs a
|
3793
3750
|
|
3794
|
-
assert_equal a, Gem::Specification.find_by_path(
|
3751
|
+
assert_equal a, Gem::Specification.find_by_path("foo")
|
3795
3752
|
a.activate
|
3796
|
-
assert_equal a, Gem::Specification.find_by_path(
|
3753
|
+
assert_equal a, Gem::Specification.find_by_path("foo")
|
3797
3754
|
end
|
3798
3755
|
|
3799
3756
|
def test_find_inactive_by_path
|
@@ -3801,9 +3758,9 @@ end
|
|
3801
3758
|
|
3802
3759
|
install_specs a
|
3803
3760
|
|
3804
|
-
assert_equal a, Gem::Specification.find_inactive_by_path(
|
3761
|
+
assert_equal a, Gem::Specification.find_inactive_by_path("foo")
|
3805
3762
|
a.activate
|
3806
|
-
assert_nil Gem::Specification.find_inactive_by_path(
|
3763
|
+
assert_nil Gem::Specification.find_inactive_by_path("foo")
|
3807
3764
|
end
|
3808
3765
|
|
3809
3766
|
def test_load_default_gem
|
@@ -3812,7 +3769,7 @@ end
|
|
3812
3769
|
|
3813
3770
|
default_gem_spec = new_default_spec("default", "2.0.0.0",
|
3814
3771
|
nil, "default/gem.rb")
|
3815
|
-
spec_path = File.join(@
|
3772
|
+
spec_path = File.join(@gemhome, "specifications", "default", default_gem_spec.spec_name)
|
3816
3773
|
write_file(spec_path) do |file|
|
3817
3774
|
file.print(default_gem_spec.to_ruby)
|
3818
3775
|
end
|
@@ -3837,64 +3794,18 @@ end
|
|
3837
3794
|
FileUtils.mkdir_p "test"
|
3838
3795
|
FileUtils.mkdir_p "bin"
|
3839
3796
|
|
3840
|
-
|
3841
|
-
|
3842
|
-
|
3797
|
+
begin
|
3798
|
+
umask_orig = File.umask(2)
|
3799
|
+
FileUtils.touch File.join("ext", "a", "extconf.rb")
|
3800
|
+
FileUtils.touch File.join("lib", "code.rb")
|
3801
|
+
FileUtils.touch File.join("test", "suite.rb")
|
3843
3802
|
|
3844
|
-
|
3845
|
-
|
3803
|
+
File.open "bin/exec", "w", 0755 do |fp|
|
3804
|
+
fp.puts "#!#{Gem.ruby}"
|
3805
|
+
end
|
3806
|
+
ensure
|
3807
|
+
File.umask(umask_orig)
|
3846
3808
|
end
|
3847
3809
|
end
|
3848
3810
|
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
3811
|
end
|