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