rubygems-update 2.6.1 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5899 -0
- data/CODE_OF_CONDUCT.md +76 -35
- data/CONTRIBUTING.md +231 -0
- data/MAINTAINERS.txt +8 -0
- data/Manifest.txt +428 -216
- data/POLICIES.md +135 -0
- data/README.md +112 -0
- data/UPGRADING.md +15 -0
- data/bundler/CHANGELOG.md +4719 -0
- data/bundler/LICENSE.md +22 -0
- data/bundler/README.md +58 -0
- data/bundler/UPGRADING.md +222 -0
- data/bundler/bundler.gemspec +46 -0
- data/bundler/exe/bundle +29 -0
- data/bundler/exe/bundler +4 -0
- data/bundler/lib/bundler/.document +1 -0
- data/bundler/lib/bundler/build_metadata.rb +45 -0
- data/bundler/lib/bundler/capistrano.rb +22 -0
- data/bundler/lib/bundler/checksum.rb +245 -0
- data/bundler/lib/bundler/ci_detector.rb +75 -0
- data/bundler/lib/bundler/cli/add.rb +47 -0
- data/bundler/lib/bundler/cli/binstubs.rb +57 -0
- data/bundler/lib/bundler/cli/cache.rb +43 -0
- data/bundler/lib/bundler/cli/check.rb +40 -0
- data/bundler/lib/bundler/cli/clean.rb +25 -0
- data/bundler/lib/bundler/cli/common.rb +138 -0
- data/bundler/lib/bundler/cli/config.rb +204 -0
- data/bundler/lib/bundler/cli/console.rb +44 -0
- data/bundler/lib/bundler/cli/doctor.rb +157 -0
- data/bundler/lib/bundler/cli/exec.rb +88 -0
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +471 -0
- data/bundler/lib/bundler/cli/info.rb +83 -0
- data/bundler/lib/bundler/cli/init.rb +51 -0
- data/bundler/lib/bundler/cli/inject.rb +60 -0
- data/bundler/lib/bundler/cli/install.rb +190 -0
- data/bundler/lib/bundler/cli/issue.rb +41 -0
- data/bundler/lib/bundler/cli/list.rb +66 -0
- data/bundler/lib/bundler/cli/lock.rb +73 -0
- data/bundler/lib/bundler/cli/open.rb +29 -0
- data/bundler/lib/bundler/cli/outdated.rb +297 -0
- data/bundler/lib/bundler/cli/platform.rb +48 -0
- data/bundler/lib/bundler/cli/plugin.rb +34 -0
- data/bundler/lib/bundler/cli/pristine.rb +60 -0
- data/bundler/lib/bundler/cli/remove.rb +17 -0
- data/bundler/lib/bundler/cli/show.rb +75 -0
- data/bundler/lib/bundler/cli/update.rb +123 -0
- data/bundler/lib/bundler/cli/viz.rb +31 -0
- data/bundler/lib/bundler/cli.rb +846 -0
- data/bundler/lib/bundler/compact_index_client/cache.rb +121 -0
- data/bundler/lib/bundler/compact_index_client/cache_file.rb +153 -0
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +32 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +115 -0
- data/bundler/lib/bundler/compact_index_client.rb +126 -0
- data/bundler/lib/bundler/constants.rb +7 -0
- data/bundler/lib/bundler/current_ruby.rb +92 -0
- data/bundler/lib/bundler/definition.rb +1005 -0
- data/bundler/lib/bundler/dependency.rb +101 -0
- data/bundler/lib/bundler/deployment.rb +69 -0
- data/bundler/lib/bundler/deprecate.rb +44 -0
- data/bundler/lib/bundler/digest.rb +71 -0
- data/bundler/lib/bundler/dsl.rb +601 -0
- data/bundler/lib/bundler/endpoint_specification.rb +147 -0
- data/bundler/lib/bundler/env.rb +148 -0
- data/bundler/lib/bundler/environment_preserver.rb +86 -0
- data/bundler/lib/bundler/errors.rb +233 -0
- data/bundler/lib/bundler/feature_flag.rb +53 -0
- data/bundler/lib/bundler/fetcher/base.rb +52 -0
- data/bundler/lib/bundler/fetcher/compact_index.rb +129 -0
- data/bundler/lib/bundler/fetcher/dependency.rb +78 -0
- data/bundler/lib/bundler/fetcher/downloader.rb +91 -0
- data/bundler/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
- data/bundler/lib/bundler/fetcher/index.rb +25 -0
- data/bundler/lib/bundler/fetcher.rb +324 -0
- data/bundler/lib/bundler/force_platform.rb +18 -0
- data/bundler/lib/bundler/friendly_errors.rb +126 -0
- data/bundler/lib/bundler/gem_helper.rb +237 -0
- data/bundler/lib/bundler/gem_helpers.rb +127 -0
- data/bundler/lib/bundler/gem_tasks.rb +7 -0
- data/bundler/lib/bundler/gem_version_promoter.rb +145 -0
- data/bundler/lib/bundler/graph.rb +152 -0
- data/bundler/lib/bundler/index.rb +205 -0
- data/bundler/lib/bundler/injector.rb +287 -0
- data/bundler/lib/bundler/inline.rb +73 -0
- data/bundler/lib/bundler/installer/gem_installer.rb +84 -0
- data/bundler/lib/bundler/installer/parallel_installer.rb +202 -0
- data/bundler/lib/bundler/installer/standalone.rb +116 -0
- data/bundler/lib/bundler/installer.rb +267 -0
- data/bundler/lib/bundler/lazy_specification.rb +170 -0
- data/bundler/lib/bundler/lockfile_generator.rb +104 -0
- data/bundler/lib/bundler/lockfile_parser.rb +289 -0
- data/bundler/lib/bundler/man/.document +1 -0
- data/bundler/lib/bundler/man/bundle-add.1 +59 -0
- data/bundler/lib/bundler/man/bundle-add.1.ronn +58 -0
- data/bundler/lib/bundler/man/bundle-binstubs.1 +30 -0
- data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +41 -0
- data/bundler/lib/bundler/man/bundle-cache.1 +40 -0
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +79 -0
- data/bundler/lib/bundler/man/bundle-check.1 +22 -0
- data/bundler/lib/bundler/man/bundle-check.1.ronn +26 -0
- data/bundler/lib/bundler/man/bundle-clean.1 +17 -0
- data/bundler/lib/bundler/man/bundle-clean.1.ronn +18 -0
- data/bundler/lib/bundler/man/bundle-config.1 +321 -0
- data/bundler/lib/bundler/man/bundle-config.1.ronn +411 -0
- data/bundler/lib/bundler/man/bundle-console.1 +35 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/lib/bundler/man/bundle-doctor.1 +30 -0
- data/bundler/lib/bundler/man/bundle-doctor.1.ronn +33 -0
- data/bundler/lib/bundler/man/bundle-exec.1 +104 -0
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +151 -0
- data/bundler/lib/bundler/man/bundle-gem.1 +69 -0
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +117 -0
- data/bundler/lib/bundler/man/bundle-help.1 +9 -0
- data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/bundler/lib/bundler/man/bundle-info.1 +14 -0
- data/bundler/lib/bundler/man/bundle-info.1.ronn +17 -0
- data/bundler/lib/bundler/man/bundle-init.1 +20 -0
- data/bundler/lib/bundler/man/bundle-init.1.ronn +31 -0
- data/bundler/lib/bundler/man/bundle-inject.1 +23 -0
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +24 -0
- data/bundler/lib/bundler/man/bundle-install.1 +215 -0
- data/bundler/lib/bundler/man/bundle-install.1.ronn +383 -0
- data/bundler/lib/bundler/man/bundle-list.1 +35 -0
- data/bundler/lib/bundler/man/bundle-list.1.ronn +33 -0
- data/bundler/lib/bundler/man/bundle-lock.1 +60 -0
- data/bundler/lib/bundler/man/bundle-lock.1.ronn +94 -0
- data/bundler/lib/bundler/man/bundle-open.1 +32 -0
- data/bundler/lib/bundler/man/bundle-open.1.ronn +27 -0
- data/bundler/lib/bundler/man/bundle-outdated.1 +100 -0
- data/bundler/lib/bundler/man/bundle-outdated.1.ronn +106 -0
- data/bundler/lib/bundler/man/bundle-platform.1 +49 -0
- data/bundler/lib/bundler/man/bundle-platform.1.ronn +49 -0
- data/bundler/lib/bundler/man/bundle-plugin.1 +55 -0
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/bundler/lib/bundler/man/bundle-pristine.1 +23 -0
- data/bundler/lib/bundler/man/bundle-pristine.1.ronn +34 -0
- data/bundler/lib/bundler/man/bundle-remove.1 +21 -0
- data/bundler/lib/bundler/man/bundle-remove.1.ronn +23 -0
- data/bundler/lib/bundler/man/bundle-show.1 +16 -0
- data/bundler/lib/bundler/man/bundle-show.1.ronn +21 -0
- data/bundler/lib/bundler/man/bundle-update.1 +275 -0
- data/bundler/lib/bundler/man/bundle-update.1.ronn +351 -0
- data/bundler/lib/bundler/man/bundle-version.1 +22 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/lib/bundler/man/bundle-viz.1 +30 -0
- data/bundler/lib/bundler/man/bundle-viz.1.ronn +32 -0
- data/bundler/lib/bundler/man/bundle.1 +102 -0
- data/bundler/lib/bundler/man/bundle.1.ronn +116 -0
- data/bundler/lib/bundler/man/gemfile.5 +470 -0
- data/bundler/lib/bundler/man/gemfile.5.ronn +552 -0
- data/bundler/lib/bundler/man/index.txt +29 -0
- data/bundler/lib/bundler/match_metadata.rb +17 -0
- data/bundler/lib/bundler/match_platform.rb +23 -0
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/mirror.rb +221 -0
- data/bundler/lib/bundler/plugin/api/source.rb +321 -0
- data/bundler/lib/bundler/plugin/api.rb +81 -0
- data/bundler/lib/bundler/plugin/dsl.rb +53 -0
- data/bundler/lib/bundler/plugin/events.rb +61 -0
- data/bundler/lib/bundler/plugin/index.rb +193 -0
- data/bundler/lib/bundler/plugin/installer/git.rb +34 -0
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +19 -0
- data/bundler/lib/bundler/plugin/installer.rb +112 -0
- data/bundler/lib/bundler/plugin/source_list.rb +31 -0
- data/bundler/lib/bundler/plugin.rb +359 -0
- data/bundler/lib/bundler/process_lock.rb +24 -0
- data/bundler/lib/bundler/remote_specification.rb +117 -0
- data/bundler/lib/bundler/resolver/base.rb +107 -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 +77 -0
- data/bundler/lib/bundler/resolver/root.rb +25 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +79 -0
- data/bundler/lib/bundler/resolver.rb +462 -0
- data/bundler/lib/bundler/retry.rb +66 -0
- data/bundler/lib/bundler/ruby_dsl.rb +53 -0
- data/bundler/lib/bundler/ruby_version.rb +131 -0
- data/bundler/lib/bundler/rubygems_ext.rb +328 -0
- data/bundler/lib/bundler/rubygems_gem_installer.rb +137 -0
- data/bundler/lib/bundler/rubygems_integration.rb +493 -0
- data/bundler/lib/bundler/runtime.rb +307 -0
- data/bundler/lib/bundler/safe_marshal.rb +31 -0
- data/bundler/lib/bundler/self_manager.rb +186 -0
- data/bundler/lib/bundler/settings/validator.rb +102 -0
- data/bundler/lib/bundler/settings.rb +588 -0
- data/bundler/lib/bundler/setup.rb +33 -0
- data/bundler/lib/bundler/shared_helpers.rb +380 -0
- data/bundler/lib/bundler/similarity_detector.rb +63 -0
- data/bundler/lib/bundler/source/gemspec.rb +18 -0
- data/bundler/lib/bundler/source/git/git_proxy.rb +455 -0
- data/bundler/lib/bundler/source/git.rb +380 -0
- data/bundler/lib/bundler/source/metadata.rb +62 -0
- data/bundler/lib/bundler/source/path/installer.rb +53 -0
- data/bundler/lib/bundler/source/path.rb +261 -0
- data/bundler/lib/bundler/source/rubygems/remote.rb +68 -0
- data/bundler/lib/bundler/source/rubygems.rb +516 -0
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/bundler/lib/bundler/source.rb +116 -0
- data/bundler/lib/bundler/source_list.rb +227 -0
- data/bundler/lib/bundler/source_map.rb +71 -0
- data/bundler/lib/bundler/spec_set.rb +247 -0
- data/bundler/lib/bundler/stub_specification.rb +119 -0
- data/bundler/lib/bundler/templates/.document +1 -0
- data/bundler/lib/bundler/templates/Executable +27 -0
- data/bundler/lib/bundler/templates/Executable.bundler +109 -0
- data/bundler/lib/bundler/templates/Executable.standalone +14 -0
- data/bundler/lib/bundler/templates/Gemfile +5 -0
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +84 -0
- data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +26 -0
- data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +45 -0
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +67 -0
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
- data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.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 +23 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +15 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +51 -0
- data/bundler/lib/bundler/templates/newgem/rspec.tt +3 -0
- 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 +11 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +15 -0
- 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/minitest/test_newgem.rb.tt +13 -0
- 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 +19 -0
- data/bundler/lib/bundler/ui/shell.rb +165 -0
- data/bundler/lib/bundler/ui/silent.rb +85 -0
- data/bundler/lib/bundler/ui.rb +9 -0
- data/bundler/lib/bundler/uri_credentials_filter.rb +43 -0
- data/bundler/lib/bundler/uri_normalizer.rb +23 -0
- data/bundler/lib/bundler/vendor/.document +1 -0
- data/bundler/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +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 +175 -0
- data/bundler/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +2694 -0
- 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 +41 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +65 -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 +1073 -0
- data/bundler/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +60 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -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 +105 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +61 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +108 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +373 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +130 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +340 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +825 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +151 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +107 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +106 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +89 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +195 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +178 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +293 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +72 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +335 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +388 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +115 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +84 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb +49 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +134 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +285 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +663 -0
- data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
- data/bundler/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +853 -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 +1588 -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 +183 -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 +4 -0
- data/bundler/lib/bundler/vendored_net_http.rb +8 -0
- data/bundler/lib/bundler/vendored_persistent.rb +11 -0
- data/bundler/lib/bundler/vendored_pub_grub.rb +4 -0
- data/bundler/lib/bundler/vendored_thor.rb +8 -0
- data/bundler/lib/bundler/vendored_timeout.rb +8 -0
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/vendored_uri.rb +4 -0
- data/bundler/lib/bundler/version.rb +13 -0
- data/bundler/lib/bundler/vlad.rb +17 -0
- data/bundler/lib/bundler/worker.rb +117 -0
- data/bundler/lib/bundler/yaml_serializer.rb +93 -0
- data/bundler/lib/bundler.rb +665 -0
- data/{test/rubygems/bogussources.rb → exe/gem} +5 -2
- data/exe/update_rubygems +38 -0
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/available_set.rb +12 -12
- data/lib/rubygems/basic_specification.rb +75 -58
- data/lib/rubygems/bundler_version_finder.rb +77 -0
- data/lib/rubygems/ci_detector.rb +75 -0
- data/lib/rubygems/command.rb +144 -71
- data/lib/rubygems/command_manager.rb +64 -27
- data/lib/rubygems/commands/build_command.rb +88 -17
- data/lib/rubygems/commands/cert_command.rb +131 -83
- data/lib/rubygems/commands/check_command.rb +30 -27
- data/lib/rubygems/commands/cleanup_command.rb +57 -40
- data/lib/rubygems/commands/contents_command.rb +37 -39
- data/lib/rubygems/commands/dependency_command.rb +53 -65
- data/lib/rubygems/commands/environment_command.rb +32 -16
- data/lib/rubygems/commands/exec_command.rb +249 -0
- data/lib/rubygems/commands/fetch_command.rb +36 -19
- data/lib/rubygems/commands/generate_index_command.rb +40 -74
- data/lib/rubygems/commands/help_command.rb +22 -22
- data/lib/rubygems/commands/info_command.rb +38 -0
- data/lib/rubygems/commands/install_command.rb +67 -143
- data/lib/rubygems/commands/list_command.rb +10 -9
- data/lib/rubygems/commands/lock_command.rb +12 -14
- data/lib/rubygems/commands/mirror_command.rb +4 -4
- data/lib/rubygems/commands/open_command.rb +28 -26
- data/lib/rubygems/commands/outdated_command.rb +6 -6
- data/lib/rubygems/commands/owner_command.rb +51 -27
- data/lib/rubygems/commands/pristine_command.rb +99 -71
- data/lib/rubygems/commands/push_command.rb +53 -46
- data/lib/rubygems/commands/query_command.rb +21 -328
- data/lib/rubygems/commands/rdoc_command.rb +33 -33
- data/lib/rubygems/commands/search_command.rb +9 -9
- data/lib/rubygems/commands/server_command.rb +15 -76
- data/lib/rubygems/commands/setup_command.rb +370 -186
- data/lib/rubygems/commands/signin_command.rb +34 -0
- data/lib/rubygems/commands/signout_command.rb +32 -0
- data/lib/rubygems/commands/sources_command.rb +57 -41
- data/lib/rubygems/commands/specification_command.rb +38 -28
- data/lib/rubygems/commands/stale_command.rb +6 -5
- data/lib/rubygems/commands/uninstall_command.rb +96 -62
- data/lib/rubygems/commands/unpack_command.rb +44 -53
- data/lib/rubygems/commands/update_command.rb +155 -99
- data/lib/rubygems/commands/which_command.rb +14 -17
- data/lib/rubygems/commands/yank_command.rb +28 -32
- data/lib/rubygems/compatibility.rb +13 -32
- data/lib/rubygems/config_file.rb +214 -119
- data/lib/rubygems/core_ext/kernel_gem.rb +10 -16
- data/lib/rubygems/core_ext/kernel_require.rb +92 -90
- data/lib/rubygems/core_ext/kernel_warn.rb +49 -0
- data/lib/rubygems/core_ext/tcpsocket_init.rb +54 -0
- data/lib/rubygems/defaults.rb +184 -54
- data/lib/rubygems/dependency.rb +75 -62
- data/lib/rubygems/dependency_installer.rb +74 -230
- data/lib/rubygems/dependency_list.rb +32 -33
- data/lib/rubygems/deprecate.rb +113 -17
- data/lib/rubygems/doctor.rb +31 -31
- data/lib/rubygems/errors.rb +51 -13
- data/lib/rubygems/exceptions.rb +65 -35
- data/lib/rubygems/ext/build_error.rb +3 -1
- data/lib/rubygems/ext/builder.rb +103 -77
- 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 +6 -9
- data/lib/rubygems/ext/ext_conf_builder.rb +40 -61
- data/lib/rubygems/ext/rake_builder.rb +18 -21
- data/lib/rubygems/ext.rb +8 -7
- data/lib/rubygems/gem_runner.rb +19 -21
- data/lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb +163 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +105 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +78 -0
- data/lib/rubygems/gemcutter_utilities.rb +246 -43
- data/lib/rubygems/install_default_message.rb +3 -3
- data/lib/rubygems/install_message.rb +3 -3
- data/lib/rubygems/install_update_options.rb +104 -98
- data/lib/rubygems/installer.rb +407 -225
- data/lib/rubygems/installer_uninstaller_utils.rb +27 -0
- data/lib/rubygems/local_remote_options.rb +29 -32
- data/lib/rubygems/name_tuple.rb +18 -23
- data/lib/rubygems/net/http.rb +3 -0
- data/lib/rubygems/net-http/LICENSE.txt +22 -0
- data/lib/rubygems/net-http/lib/net/http/backward.rb +40 -0
- data/lib/rubygems/net-http/lib/net/http/exceptions.rb +34 -0
- data/lib/rubygems/net-http/lib/net/http/generic_request.rb +414 -0
- data/lib/rubygems/net-http/lib/net/http/header.rb +981 -0
- data/lib/rubygems/net-http/lib/net/http/proxy_delta.rb +17 -0
- data/lib/rubygems/net-http/lib/net/http/request.rb +88 -0
- data/lib/rubygems/net-http/lib/net/http/requests.rb +425 -0
- data/lib/rubygems/net-http/lib/net/http/response.rb +738 -0
- data/lib/rubygems/net-http/lib/net/http/responses.rb +1174 -0
- data/lib/rubygems/net-http/lib/net/http/status.rb +84 -0
- data/lib/rubygems/net-http/lib/net/http.rb +2496 -0
- data/lib/rubygems/net-http/lib/net/https.rb +23 -0
- data/lib/rubygems/net-protocol/LICENSE.txt +22 -0
- data/lib/rubygems/net-protocol/lib/net/protocol.rb +544 -0
- 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 +2330 -0
- data/lib/rubygems/optparse.rb +3 -0
- data/lib/rubygems/package/digest_io.rb +5 -7
- data/lib/rubygems/package/file_source.rb +6 -8
- data/lib/rubygems/package/io_source.rb +6 -4
- data/lib/rubygems/package/old.rb +19 -28
- data/lib/rubygems/package/source.rb +1 -1
- data/lib/rubygems/package/tar_header.rb +114 -93
- data/lib/rubygems/package/tar_reader/entry.rb +116 -22
- data/lib/rubygems/package/tar_reader.rb +18 -40
- data/lib/rubygems/package/tar_writer.rb +42 -56
- data/lib/rubygems/package.rb +245 -145
- data/lib/rubygems/package_task.rb +8 -14
- data/lib/rubygems/path_support.rb +21 -16
- data/lib/rubygems/platform.rb +135 -74
- data/lib/rubygems/psych_tree.rb +3 -2
- data/lib/rubygems/query_utils.rb +349 -0
- data/lib/rubygems/rdoc.rb +4 -326
- data/lib/rubygems/remote_fetcher.rb +99 -181
- data/lib/rubygems/request/connection_pools.rb +31 -24
- data/lib/rubygems/request/http_pool.rb +6 -7
- data/lib/rubygems/request/https_pool.rb +2 -3
- data/lib/rubygems/request.rb +103 -53
- data/lib/rubygems/request_set/gem_dependency_api.rb +182 -190
- data/lib/rubygems/request_set/lockfile/parser.rb +42 -52
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +34 -24
- data/lib/rubygems/request_set/lockfile.rb +32 -35
- data/lib/rubygems/request_set.rb +115 -71
- data/lib/rubygems/requirement.rb +77 -68
- data/lib/rubygems/resolv/LICENSE.txt +22 -0
- data/lib/rubygems/resolv/lib/resolv.rb +3387 -0
- data/lib/rubygems/resolver/activation_request.rb +34 -61
- data/lib/rubygems/resolver/api_set/gem_parser.rb +24 -0
- data/lib/rubygems/resolver/api_set.rb +40 -32
- data/lib/rubygems/resolver/api_specification.rb +37 -18
- data/lib/rubygems/resolver/best_set.rb +15 -17
- data/lib/rubygems/resolver/composed_set.rb +9 -11
- data/lib/rubygems/resolver/conflict.rb +19 -33
- data/lib/rubygems/resolver/current_set.rb +2 -4
- data/lib/rubygems/resolver/dependency_request.rb +8 -9
- data/lib/rubygems/resolver/git_set.rb +8 -10
- data/lib/rubygems/resolver/git_specification.rb +11 -13
- data/lib/rubygems/resolver/index_set.rb +13 -15
- data/lib/rubygems/resolver/index_specification.rb +42 -11
- data/lib/rubygems/resolver/installed_specification.rb +9 -11
- data/lib/rubygems/resolver/installer_set.rb +87 -45
- data/lib/rubygems/resolver/local_specification.rb +5 -7
- data/lib/rubygems/resolver/lock_set.rb +13 -15
- data/lib/rubygems/resolver/lock_specification.rb +13 -15
- data/lib/rubygems/resolver/molinillo/LICENSE +9 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +88 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +36 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +66 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +62 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +61 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +126 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +46 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +36 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +164 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +110 -146
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +83 -9
- 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 +552 -172
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +12 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo.rb +2 -1
- data/lib/rubygems/resolver/requirement_list.rb +2 -2
- data/lib/rubygems/resolver/set.rb +3 -5
- data/lib/rubygems/resolver/source_set.rb +6 -7
- data/lib/rubygems/resolver/spec_specification.rb +16 -4
- data/lib/rubygems/resolver/specification.rb +25 -10
- data/lib/rubygems/resolver/stats.rb +1 -0
- data/lib/rubygems/resolver/vendor_set.rb +6 -8
- data/lib/rubygems/resolver/vendor_specification.rb +6 -8
- data/lib/rubygems/resolver.rb +121 -72
- data/lib/rubygems/s3_uri_signer.rb +177 -0
- data/lib/rubygems/safe_marshal/elements.rb +138 -0
- data/lib/rubygems/safe_marshal/reader.rb +306 -0
- data/lib/rubygems/safe_marshal/visitors/stream_printer.rb +31 -0
- data/lib/rubygems/safe_marshal/visitors/to_ruby.rb +385 -0
- data/lib/rubygems/safe_marshal/visitors/visitor.rb +74 -0
- data/lib/rubygems/safe_marshal.rb +74 -0
- data/lib/rubygems/safe_yaml.rb +36 -0
- data/lib/rubygems/security/policies.rb +49 -51
- data/lib/rubygems/security/policy.rb +46 -53
- data/lib/rubygems/security/signer.rb +86 -29
- data/lib/rubygems/security/trust_dir.rb +22 -24
- data/lib/rubygems/security.rb +101 -82
- data/lib/rubygems/security_option.rb +43 -0
- data/lib/rubygems/shellwords.rb +3 -0
- data/lib/rubygems/source/git.rb +40 -42
- data/lib/rubygems/source/installed.rb +5 -9
- data/lib/rubygems/source/local.rb +30 -33
- data/lib/rubygems/source/lock.rb +10 -10
- data/lib/rubygems/source/specific_file.rb +7 -9
- data/lib/rubygems/source/vendor.rb +3 -7
- data/lib/rubygems/source.rb +78 -68
- data/lib/rubygems/source_list.rb +11 -15
- data/lib/rubygems/spec_fetcher.rb +71 -83
- data/lib/rubygems/specification.rb +833 -1115
- data/lib/rubygems/specification_policy.rb +538 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +55 -57
- data/lib/rubygems/text.rb +39 -27
- data/lib/rubygems/timeout/LICENSE.txt +22 -0
- data/lib/rubygems/timeout/lib/timeout.rb +199 -0
- data/lib/rubygems/timeout.rb +3 -0
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +455 -0
- data/lib/rubygems/tsort.rb +3 -0
- data/lib/rubygems/uninstaller.rb +150 -87
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/update_suggestion.rb +56 -0
- data/lib/rubygems/uri.rb +126 -0
- data/lib/rubygems/uri_formatter.rb +4 -7
- data/lib/rubygems/user_interaction.rb +92 -146
- data/lib/rubygems/util/licenses.rb +712 -317
- data/lib/rubygems/util/list.rb +5 -2
- data/lib/rubygems/util.rb +58 -75
- data/lib/rubygems/validator.rb +26 -48
- data/lib/rubygems/version.rb +106 -56
- data/lib/rubygems/version_option.rb +22 -14
- data/lib/rubygems/yaml_serializer.rb +93 -0
- data/lib/rubygems.rb +427 -361
- data/rubygems-update.gemspec +38 -0
- data/setup.rb +13 -27
- metadata +500 -363
- data/.autotest +0 -71
- data/.document +0 -5
- data/.travis.yml +0 -46
- data/CONTRIBUTING.rdoc +0 -129
- data/CVE-2013-4287.txt +0 -35
- data/CVE-2013-4363.txt +0 -45
- data/CVE-2015-3900.txt +0 -40
- data/History.txt +0 -3105
- data/MAINTAINERS.md +0 -5
- data/POLICIES.rdoc +0 -61
- data/README.rdoc +0 -54
- data/Rakefile +0 -449
- data/UPGRADING.rdoc +0 -92
- data/appveyor.yml +0 -36
- data/bin/gem +0 -25
- data/bin/update_rubygems +0 -37
- data/lib/gauntlet_rubygems.rb +0 -51
- data/lib/rubygems/indexer.rb +0 -434
- data/lib/rubygems/installer_test_case.rb +0 -194
- data/lib/rubygems/mock_gem_ui.rb +0 -89
- data/lib/rubygems/package/tar_test_case.rb +0 -147
- data/lib/rubygems/psych_additions.rb +0 -10
- data/lib/rubygems/server.rb +0 -869
- data/lib/rubygems/source_local.rb +0 -6
- data/lib/rubygems/source_specific_file.rb +0 -5
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +0 -32
- data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/lib/rubygems/syck_hack.rb +0 -77
- data/lib/rubygems/test_case.rb +0 -1496
- data/lib/rubygems/test_utilities.rb +0 -384
- data/lib/ubygems.rb +0 -11
- data/test/rubygems/alternate_cert.pem +0 -18
- data/test/rubygems/alternate_cert_32.pem +0 -18
- data/test/rubygems/alternate_key.pem +0 -27
- data/test/rubygems/bad_rake.rb +0 -2
- data/test/rubygems/ca_cert.pem +0 -68
- data/test/rubygems/child_cert.pem +0 -18
- data/test/rubygems/child_cert_32.pem +0 -18
- data/test/rubygems/child_key.pem +0 -27
- data/test/rubygems/client.pem +0 -49
- data/test/rubygems/data/gem-private_key.pem +0 -27
- data/test/rubygems/data/gem-public_cert.pem +0 -20
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/encrypted_private_key.pem +0 -30
- data/test/rubygems/expired_cert.pem +0 -18
- data/test/rubygems/fake_certlib/openssl.rb +0 -8
- data/test/rubygems/fix_openssl_warnings.rb +0 -13
- data/test/rubygems/foo/discover.rb +0 -1
- data/test/rubygems/future_cert.pem +0 -18
- data/test/rubygems/future_cert_32.pem +0 -18
- data/test/rubygems/good_rake.rb +0 -2
- data/test/rubygems/grandchild_cert.pem +0 -18
- data/test/rubygems/grandchild_cert_32.pem +0 -18
- data/test/rubygems/grandchild_key.pem +0 -27
- data/test/rubygems/invalid_client.pem +0 -49
- data/test/rubygems/invalid_issuer_cert.pem +0 -18
- data/test/rubygems/invalid_issuer_cert_32.pem +0 -18
- data/test/rubygems/invalid_key.pem +0 -27
- data/test/rubygems/invalid_signer_cert.pem +0 -18
- data/test/rubygems/invalid_signer_cert_32.pem +0 -18
- data/test/rubygems/invalidchild_cert.pem +0 -18
- data/test/rubygems/invalidchild_cert_32.pem +0 -18
- data/test/rubygems/invalidchild_key.pem +0 -27
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +0 -3
- data/test/rubygems/plugin/load/rubygems_plugin.rb +0 -4
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +0 -3
- data/test/rubygems/private_key.pem +0 -27
- data/test/rubygems/public_cert.pem +0 -18
- data/test/rubygems/public_cert_32.pem +0 -18
- data/test/rubygems/public_key.pem +0 -9
- data/test/rubygems/rubygems/commands/crash_command.rb +0 -6
- data/test/rubygems/rubygems_plugin.rb +0 -22
- data/test/rubygems/sff/discover.rb +0 -1
- data/test/rubygems/simple_gem.rb +0 -67
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -9
- data/test/rubygems/specifications/foo-0.0.1-x86-mswin32.gemspec +0 -0
- data/test/rubygems/ssl_cert.pem +0 -19
- data/test/rubygems/ssl_key.pem +0 -15
- data/test/rubygems/test_bundled_ca.rb +0 -59
- data/test/rubygems/test_config.rb +0 -24
- data/test/rubygems/test_deprecate.rb +0 -77
- data/test/rubygems/test_gem.rb +0 -1718
- data/test/rubygems/test_gem_available_set.rb +0 -130
- data/test/rubygems/test_gem_command.rb +0 -248
- data/test/rubygems/test_gem_command_manager.rb +0 -264
- data/test/rubygems/test_gem_commands_build_command.rb +0 -121
- data/test/rubygems/test_gem_commands_cert_command.rb +0 -671
- data/test/rubygems/test_gem_commands_check_command.rb +0 -69
- data/test/rubygems/test_gem_commands_cleanup_command.rb +0 -197
- data/test/rubygems/test_gem_commands_contents_command.rb +0 -240
- data/test/rubygems/test_gem_commands_dependency_command.rb +0 -230
- data/test/rubygems/test_gem_commands_environment_command.rb +0 -154
- data/test/rubygems/test_gem_commands_fetch_command.rb +0 -127
- data/test/rubygems/test_gem_commands_generate_index_command.rb +0 -51
- data/test/rubygems/test_gem_commands_help_command.rb +0 -75
- data/test/rubygems/test_gem_commands_install_command.rb +0 -1007
- data/test/rubygems/test_gem_commands_list_command.rb +0 -34
- data/test/rubygems/test_gem_commands_lock_command.rb +0 -69
- data/test/rubygems/test_gem_commands_mirror.rb +0 -20
- data/test/rubygems/test_gem_commands_open_command.rb +0 -70
- data/test/rubygems/test_gem_commands_outdated_command.rb +0 -33
- data/test/rubygems/test_gem_commands_owner_command.rb +0 -205
- data/test/rubygems/test_gem_commands_pristine_command.rb +0 -491
- data/test/rubygems/test_gem_commands_push_command.rb +0 -330
- data/test/rubygems/test_gem_commands_query_command.rb +0 -657
- data/test/rubygems/test_gem_commands_search_command.rb +0 -18
- data/test/rubygems/test_gem_commands_server_command.rb +0 -60
- data/test/rubygems/test_gem_commands_setup_command.rb +0 -136
- data/test/rubygems/test_gem_commands_sources_command.rb +0 -249
- data/test/rubygems/test_gem_commands_specification_command.rb +0 -251
- data/test/rubygems/test_gem_commands_stale_command.rb +0 -43
- data/test/rubygems/test_gem_commands_uninstall_command.rb +0 -283
- data/test/rubygems/test_gem_commands_unpack_command.rb +0 -209
- data/test/rubygems/test_gem_commands_update_command.rb +0 -514
- data/test/rubygems/test_gem_commands_which_command.rb +0 -87
- data/test/rubygems/test_gem_commands_yank_command.rb +0 -100
- data/test/rubygems/test_gem_config_file.rb +0 -491
- data/test/rubygems/test_gem_dependency.rb +0 -362
- data/test/rubygems/test_gem_dependency_installer.rb +0 -1235
- data/test/rubygems/test_gem_dependency_list.rb +0 -260
- data/test/rubygems/test_gem_dependency_resolution_error.rb +0 -29
- data/test/rubygems/test_gem_doctor.rb +0 -169
- data/test/rubygems/test_gem_ext_builder.rb +0 -341
- data/test/rubygems/test_gem_ext_cmake_builder.rb +0 -87
- data/test/rubygems/test_gem_ext_configure_builder.rb +0 -87
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +0 -211
- data/test/rubygems/test_gem_ext_rake_builder.rb +0 -65
- data/test/rubygems/test_gem_gem_runner.rb +0 -69
- data/test/rubygems/test_gem_gemcutter_utilities.rb +0 -235
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -62
- data/test/rubygems/test_gem_indexer.rb +0 -367
- data/test/rubygems/test_gem_install_update_options.rb +0 -197
- data/test/rubygems/test_gem_installer.rb +0 -1552
- data/test/rubygems/test_gem_local_remote_options.rb +0 -134
- data/test/rubygems/test_gem_name_tuple.rb +0 -45
- data/test/rubygems/test_gem_package.rb +0 -876
- data/test/rubygems/test_gem_package_old.rb +0 -90
- data/test/rubygems/test_gem_package_tar_header.rb +0 -147
- data/test/rubygems/test_gem_package_tar_reader.rb +0 -90
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +0 -142
- data/test/rubygems/test_gem_package_tar_writer.rb +0 -264
- data/test/rubygems/test_gem_package_task.rb +0 -84
- data/test/rubygems/test_gem_path_support.rb +0 -121
- data/test/rubygems/test_gem_platform.rb +0 -308
- data/test/rubygems/test_gem_rdoc.rb +0 -270
- data/test/rubygems/test_gem_remote_fetcher.rb +0 -1051
- data/test/rubygems/test_gem_request.rb +0 -363
- data/test/rubygems/test_gem_request_connection_pools.rb +0 -130
- data/test/rubygems/test_gem_request_set.rb +0 -595
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +0 -831
- data/test/rubygems/test_gem_request_set_lockfile.rb +0 -470
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +0 -549
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +0 -306
- data/test/rubygems/test_gem_requirement.rb +0 -387
- data/test/rubygems/test_gem_resolver.rb +0 -715
- data/test/rubygems/test_gem_resolver_activation_request.rb +0 -74
- data/test/rubygems/test_gem_resolver_api_set.rb +0 -209
- data/test/rubygems/test_gem_resolver_api_specification.rb +0 -145
- data/test/rubygems/test_gem_resolver_best_set.rb +0 -138
- data/test/rubygems/test_gem_resolver_composed_set.rb +0 -46
- data/test/rubygems/test_gem_resolver_conflict.rb +0 -88
- data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -85
- data/test/rubygems/test_gem_resolver_git_set.rb +0 -190
- data/test/rubygems/test_gem_resolver_git_specification.rb +0 -114
- data/test/rubygems/test_gem_resolver_index_set.rb +0 -90
- data/test/rubygems/test_gem_resolver_index_specification.rb +0 -90
- data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -50
- data/test/rubygems/test_gem_resolver_installer_set.rb +0 -258
- data/test/rubygems/test_gem_resolver_local_specification.rb +0 -46
- data/test/rubygems/test_gem_resolver_lock_set.rb +0 -64
- data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -100
- data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -21
- data/test/rubygems/test_gem_resolver_specification.rb +0 -65
- data/test/rubygems/test_gem_resolver_vendor_set.rb +0 -84
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -84
- data/test/rubygems/test_gem_security.rb +0 -307
- data/test/rubygems/test_gem_security_policy.rb +0 -541
- data/test/rubygems/test_gem_security_signer.rb +0 -209
- data/test/rubygems/test_gem_security_trust_dir.rb +0 -101
- data/test/rubygems/test_gem_server.rb +0 -409
- data/test/rubygems/test_gem_silent_ui.rb +0 -117
- data/test/rubygems/test_gem_source.rb +0 -242
- data/test/rubygems/test_gem_source_fetch_problem.rb +0 -20
- data/test/rubygems/test_gem_source_git.rb +0 -309
- data/test/rubygems/test_gem_source_installed.rb +0 -37
- data/test/rubygems/test_gem_source_list.rb +0 -118
- data/test/rubygems/test_gem_source_local.rb +0 -107
- data/test/rubygems/test_gem_source_lock.rb +0 -115
- data/test/rubygems/test_gem_source_specific_file.rb +0 -76
- data/test/rubygems/test_gem_source_vendor.rb +0 -32
- data/test/rubygems/test_gem_spec_fetcher.rb +0 -311
- data/test/rubygems/test_gem_specification.rb +0 -3519
- data/test/rubygems/test_gem_stream_ui.rb +0 -239
- data/test/rubygems/test_gem_stub_specification.rb +0 -217
- data/test/rubygems/test_gem_text.rb +0 -77
- data/test/rubygems/test_gem_uninstaller.rb +0 -485
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -33
- data/test/rubygems/test_gem_uri_formatter.rb +0 -29
- data/test/rubygems/test_gem_util.rb +0 -40
- data/test/rubygems/test_gem_validator.rb +0 -46
- data/test/rubygems/test_gem_version.rb +0 -222
- data/test/rubygems/test_gem_version_option.rb +0 -152
- data/test/rubygems/test_kernel.rb +0 -86
- data/test/rubygems/test_require.rb +0 -322
- data/test/rubygems/wrong_key_cert.pem +0 -18
- data/test/rubygems/wrong_key_cert_32.pem +0 -18
- data/util/CL2notes +0 -56
- data/util/create_certs.rb +0 -157
- data/util/create_encrypted_key.rb +0 -17
- data/util/generate_spdx_license_list.rb +0 -51
- data/util/update_bundled_ca_certificates.rb +0 -118
@@ -1,3519 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'benchmark'
|
3
|
-
require 'rubygems/test_case'
|
4
|
-
require 'pathname'
|
5
|
-
require 'stringio'
|
6
|
-
require 'rubygems/ext'
|
7
|
-
require 'rubygems/specification'
|
8
|
-
require 'rubygems/installer'
|
9
|
-
|
10
|
-
class TestGemSpecification < Gem::TestCase
|
11
|
-
|
12
|
-
LEGACY_YAML_SPEC = <<-EOF
|
13
|
-
--- !ruby/object:Gem::Specification
|
14
|
-
rubygems_version: "1.0"
|
15
|
-
name: keyedlist
|
16
|
-
version: !ruby/object:Gem::Version
|
17
|
-
version: 0.4.0
|
18
|
-
date: 2004-03-28 15:37:49.828000 +02:00
|
19
|
-
platform:
|
20
|
-
summary: A Hash which automatically computes keys.
|
21
|
-
require_paths:
|
22
|
-
- lib
|
23
|
-
files:
|
24
|
-
- lib/keyedlist.rb
|
25
|
-
autorequire: keyedlist
|
26
|
-
author: Florian Gross
|
27
|
-
email: flgr@ccan.de
|
28
|
-
has_rdoc: true
|
29
|
-
EOF
|
30
|
-
|
31
|
-
LEGACY_RUBY_SPEC = <<-EOF
|
32
|
-
Gem::Specification.new do |s|
|
33
|
-
s.name = %q{keyedlist}
|
34
|
-
s.version = %q{0.4.0}
|
35
|
-
s.has_rdoc = true
|
36
|
-
s.summary = %q{A Hash which automatically computes keys.}
|
37
|
-
s.files = [%q{lib/keyedlist.rb}]
|
38
|
-
s.require_paths = [%q{lib}]
|
39
|
-
s.autorequire = %q{keyedlist}
|
40
|
-
s.author = %q{Florian Gross}
|
41
|
-
s.email = %q{flgr@ccan.de}
|
42
|
-
end
|
43
|
-
EOF
|
44
|
-
|
45
|
-
def make_spec_c1
|
46
|
-
@c1 = util_spec 'a', '1' do |s|
|
47
|
-
s.executable = 'exec'
|
48
|
-
s.extensions << 'ext/a/extconf.rb'
|
49
|
-
s.test_file = 'test/suite.rb'
|
50
|
-
s.requirements << 'A working computer'
|
51
|
-
s.rubyforge_project = 'example'
|
52
|
-
s.license = 'MIT'
|
53
|
-
|
54
|
-
s.add_dependency 'rake', '> 0.4'
|
55
|
-
s.add_dependency 'jabber4r', '> 0.0.0'
|
56
|
-
s.add_dependency 'pqa', ['> 0.4', '<= 0.6']
|
57
|
-
|
58
|
-
s.mark_version
|
59
|
-
s.files = %w[lib/code.rb]
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def ext_spec
|
64
|
-
@ext = util_spec 'ext', '1' do |s|
|
65
|
-
s.executable = 'exec'
|
66
|
-
s.test_file = 'test/suite.rb'
|
67
|
-
s.extensions = %w[ext/extconf.rb]
|
68
|
-
s.license = 'MIT'
|
69
|
-
|
70
|
-
s.mark_version
|
71
|
-
s.files = %w[lib/code.rb]
|
72
|
-
s.installed_by_version = v('2.2')
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def setup
|
77
|
-
super
|
78
|
-
|
79
|
-
@a1 = util_spec 'a', '1' do |s|
|
80
|
-
s.executable = 'exec'
|
81
|
-
s.test_file = 'test/suite.rb'
|
82
|
-
s.requirements << 'A working computer'
|
83
|
-
s.rubyforge_project = 'example'
|
84
|
-
s.license = 'MIT'
|
85
|
-
|
86
|
-
s.mark_version
|
87
|
-
s.files = %w[lib/code.rb]
|
88
|
-
end
|
89
|
-
|
90
|
-
@a2 = util_spec 'a', '2' do |s|
|
91
|
-
s.files = %w[lib/code.rb]
|
92
|
-
end
|
93
|
-
|
94
|
-
@a3 = util_spec 'a', '3' do |s|
|
95
|
-
s.metadata['allowed_push_host'] = "https://privategemserver.com"
|
96
|
-
end
|
97
|
-
|
98
|
-
@current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
99
|
-
|
100
|
-
load 'rubygems/syck_hack.rb'
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_self_activate
|
104
|
-
foo = util_spec 'foo', '1'
|
105
|
-
|
106
|
-
assert_activate %w[foo-1], foo
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_self_activate_ambiguous_direct
|
110
|
-
save_loaded_features do
|
111
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
112
|
-
b1 = new_spec("b", "1", { "c" => ">= 1" }, "lib/d.rb")
|
113
|
-
b2 = new_spec("b", "2", { "c" => ">= 2" }, "lib/d.rb")
|
114
|
-
c1 = new_spec "c", "1"
|
115
|
-
c2 = new_spec "c", "2"
|
116
|
-
|
117
|
-
Gem::Specification.reset
|
118
|
-
install_specs c1, c2, b1, b2, a1
|
119
|
-
|
120
|
-
a1.activate
|
121
|
-
assert_equal %w(a-1), loaded_spec_names
|
122
|
-
assert_equal ["b (> 0)"], unresolved_names
|
123
|
-
|
124
|
-
require "d"
|
125
|
-
|
126
|
-
assert_equal %w(a-1 b-2 c-2), loaded_spec_names
|
127
|
-
assert_equal [], unresolved_names
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_find_in_unresolved_tree_is_not_exponentiental
|
132
|
-
save_loaded_features do
|
133
|
-
num_of_pkg = 7
|
134
|
-
num_of_version_per_pkg = 3
|
135
|
-
packages = (0..num_of_pkg).map do |pkgi|
|
136
|
-
(0..num_of_version_per_pkg).map do |pkg_version|
|
137
|
-
deps = Hash[((pkgi + 1)..num_of_pkg).map { |deppkgi|
|
138
|
-
["pkg#{deppkgi}", ">= 0"]
|
139
|
-
}]
|
140
|
-
new_spec "pkg#{pkgi}", pkg_version.to_s, deps
|
141
|
-
end
|
142
|
-
end
|
143
|
-
base = new_spec "pkg_base", "1", {"pkg0" => ">= 0"}
|
144
|
-
|
145
|
-
Gem::Specification.reset
|
146
|
-
install_specs(*packages.flatten.reverse)
|
147
|
-
install_specs base
|
148
|
-
base.activate
|
149
|
-
|
150
|
-
tms = Benchmark.measure {
|
151
|
-
assert_raises(LoadError) { require 'no_such_file_foo' }
|
152
|
-
}
|
153
|
-
assert_operator tms.total, :<=, 10
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_self_activate_ambiguous_indirect
|
158
|
-
save_loaded_features do
|
159
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
160
|
-
b1 = new_spec "b", "1", "c" => ">= 1"
|
161
|
-
b2 = new_spec "b", "2", "c" => ">= 2"
|
162
|
-
c1 = new_spec "c", "1", nil, "lib/d.rb"
|
163
|
-
c2 = new_spec "c", "2", nil, "lib/d.rb"
|
164
|
-
|
165
|
-
install_specs c1, c2, b1, b2, a1
|
166
|
-
|
167
|
-
a1.activate
|
168
|
-
assert_equal %w(a-1), loaded_spec_names
|
169
|
-
assert_equal ["b (> 0)"], unresolved_names
|
170
|
-
|
171
|
-
require "d"
|
172
|
-
|
173
|
-
assert_equal %w(a-1 b-2 c-2), loaded_spec_names
|
174
|
-
assert_equal [], unresolved_names
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
def test_self_activate_ambiguous_indirect_conflict
|
179
|
-
save_loaded_features do
|
180
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
181
|
-
a2 = new_spec "a", "2", "b" => "> 0"
|
182
|
-
b1 = new_spec "b", "1", "c" => ">= 1"
|
183
|
-
b2 = new_spec "b", "2", "c" => ">= 2"
|
184
|
-
c1 = new_spec "c", "1", nil, "lib/d.rb"
|
185
|
-
c2 = new_spec("c", "2", { "a" => "1" }, "lib/d.rb") # conflicts with a-2
|
186
|
-
|
187
|
-
install_specs c1, b1, a1, a2, c2, b2
|
188
|
-
|
189
|
-
a2.activate
|
190
|
-
assert_equal %w(a-2), loaded_spec_names
|
191
|
-
assert_equal ["b (> 0)"], unresolved_names
|
192
|
-
|
193
|
-
require "d"
|
194
|
-
|
195
|
-
assert_equal %w(a-2 b-1 c-1), loaded_spec_names
|
196
|
-
assert_equal [], unresolved_names
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
def test_self_activate_ambiguous_unrelated
|
201
|
-
save_loaded_features do
|
202
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
203
|
-
b1 = new_spec "b", "1", "c" => ">= 1"
|
204
|
-
b2 = new_spec "b", "2", "c" => ">= 2"
|
205
|
-
c1 = new_spec "c", "1"
|
206
|
-
c2 = new_spec "c", "2"
|
207
|
-
d1 = new_spec "d", "1", nil, "lib/d.rb"
|
208
|
-
|
209
|
-
install_specs d1, c1, c2, b1, b2, a1
|
210
|
-
|
211
|
-
a1.activate
|
212
|
-
assert_equal %w(a-1), loaded_spec_names
|
213
|
-
assert_equal ["b (> 0)"], unresolved_names
|
214
|
-
|
215
|
-
require "d"
|
216
|
-
|
217
|
-
assert_equal %w(a-1 d-1), loaded_spec_names
|
218
|
-
assert_equal ["b (> 0)"], unresolved_names
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
def test_require_should_prefer_latest_gem_level1
|
223
|
-
save_loaded_features do
|
224
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
225
|
-
b1 = new_spec "b", "1", "c" => ">= 0" # unresolved
|
226
|
-
b2 = new_spec "b", "2", "c" => ">= 0"
|
227
|
-
c1 = new_spec "c", "1", nil, "lib/c.rb" # 1st level
|
228
|
-
c2 = new_spec "c", "2", nil, "lib/c.rb"
|
229
|
-
|
230
|
-
install_specs c1, c2, b1, b2, a1
|
231
|
-
|
232
|
-
a1.activate
|
233
|
-
|
234
|
-
require "c"
|
235
|
-
|
236
|
-
assert_equal %w(a-1 b-2 c-2), loaded_spec_names
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
def test_require_should_prefer_latest_gem_level2
|
241
|
-
save_loaded_features do
|
242
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
243
|
-
b1 = new_spec "b", "1", "c" => ">= 0" # unresolved
|
244
|
-
b2 = new_spec "b", "2", "c" => ">= 0"
|
245
|
-
c1 = new_spec "c", "1", "d" => ">= 0" # 1st level
|
246
|
-
c2 = new_spec "c", "2", "d" => ">= 0"
|
247
|
-
d1 = new_spec "d", "1", nil, "lib/d.rb" # 2nd level
|
248
|
-
d2 = new_spec "d", "2", nil, "lib/d.rb"
|
249
|
-
|
250
|
-
install_specs d1, d2, c1, c2, b1, b2, a1
|
251
|
-
|
252
|
-
a1.activate
|
253
|
-
|
254
|
-
require "d"
|
255
|
-
|
256
|
-
assert_equal %w(a-1 b-2 c-2 d-2), loaded_spec_names
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
def test_require_finds_in_2nd_level_indirect
|
261
|
-
save_loaded_features do
|
262
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
263
|
-
b1 = new_spec "b", "1", "c" => ">= 0" # unresolved
|
264
|
-
b2 = new_spec "b", "2", "c" => ">= 0"
|
265
|
-
c1 = new_spec "c", "1", "d" => "<= 2" # 1st level
|
266
|
-
c2 = new_spec "c", "2", "d" => "<= 2"
|
267
|
-
d1 = new_spec "d", "1", nil, "lib/d.rb" # 2nd level
|
268
|
-
d2 = new_spec "d", "2", nil, "lib/d.rb"
|
269
|
-
d3 = new_spec "d", "3", nil, "lib/d.rb"
|
270
|
-
|
271
|
-
install_specs d1, d2, d3, c1, c2, b1, b2, a1
|
272
|
-
|
273
|
-
a1.activate
|
274
|
-
|
275
|
-
require "d"
|
276
|
-
|
277
|
-
assert_equal %w(a-1 b-2 c-2 d-2), loaded_spec_names
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
def test_require_should_prefer_reachable_gems
|
282
|
-
save_loaded_features do
|
283
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
284
|
-
b1 = new_spec "b", "1", "c" => ">= 0" # unresolved
|
285
|
-
b2 = new_spec "b", "2", "c" => ">= 0"
|
286
|
-
c1 = new_spec "c", "1", "d" => "<= 2" # 1st level
|
287
|
-
c2 = new_spec "c", "2", "d" => "<= 2"
|
288
|
-
d1 = new_spec "d", "1", nil, "lib/d.rb" # 2nd level
|
289
|
-
d2 = new_spec "d", "2", nil, "lib/d.rb"
|
290
|
-
d3 = new_spec "d", "3", nil, "lib/d.rb"
|
291
|
-
e = new_spec "anti_d", "1", nil, "lib/d.rb"
|
292
|
-
|
293
|
-
install_specs d1, d2, d3, e, c1, c2, b1, b2, a1
|
294
|
-
|
295
|
-
a1.activate
|
296
|
-
|
297
|
-
require "d"
|
298
|
-
|
299
|
-
assert_equal %w(a-1 b-2 c-2 d-2), loaded_spec_names
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
def test_require_should_not_conflict
|
304
|
-
save_loaded_features do
|
305
|
-
base = new_spec "0", "1", "A" => ">= 1"
|
306
|
-
a1 = new_spec "A", "1", {"c" => ">= 2", "b" => "> 0"}, "lib/a.rb"
|
307
|
-
a2 = new_spec "A", "2", {"c" => ">= 2", "b" => "> 0"}, "lib/a.rb"
|
308
|
-
b1 = new_spec "b", "1", {"c" => "= 1"}, "lib/d.rb"
|
309
|
-
b2 = new_spec "b", "2", {"c" => "= 2"}, "lib/d.rb"
|
310
|
-
c1 = new_spec "c", "1", {}, "lib/c.rb"
|
311
|
-
c2 = new_spec "c", "2", {}, "lib/c.rb"
|
312
|
-
c3 = new_spec "c", "3", {}, "lib/c.rb"
|
313
|
-
|
314
|
-
install_specs c1, c2, c3, b1, b2, a1, a2, base
|
315
|
-
|
316
|
-
base.activate
|
317
|
-
assert_equal %w(0-1), loaded_spec_names
|
318
|
-
assert_equal ["A (>= 1)"], unresolved_names
|
319
|
-
|
320
|
-
require "d"
|
321
|
-
|
322
|
-
assert_equal %w(0-1 A-2 b-2 c-2), loaded_spec_names
|
323
|
-
assert_equal [], unresolved_names
|
324
|
-
end
|
325
|
-
end
|
326
|
-
|
327
|
-
def test_inner_clonflict_in_indirect_gems
|
328
|
-
save_loaded_features do
|
329
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
330
|
-
b1 = new_spec "b", "1", "c" => ">= 1" # unresolved
|
331
|
-
b2 = new_spec "b", "2", "c" => ">= 1", "d" => "< 3"
|
332
|
-
c1 = new_spec "c", "1", "d" => "<= 2" # 1st level
|
333
|
-
c2 = new_spec "c", "2", "d" => "<= 2"
|
334
|
-
c3 = new_spec "c", "3", "d" => "<= 3"
|
335
|
-
d1 = new_spec "d", "1", nil, "lib/d.rb" # 2nd level
|
336
|
-
d2 = new_spec "d", "2", nil, "lib/d.rb"
|
337
|
-
d3 = new_spec "d", "3", nil, "lib/d.rb"
|
338
|
-
|
339
|
-
install_specs d1, d2, d3, c1, c2, c3, b1, b2, a1
|
340
|
-
|
341
|
-
a1.activate
|
342
|
-
|
343
|
-
require "d"
|
344
|
-
|
345
|
-
assert_includes [%w(a-1 b-2 c-3 d-2),%w(a-1 b-2 d-2)], loaded_spec_names
|
346
|
-
end
|
347
|
-
end
|
348
|
-
|
349
|
-
def test_inner_clonflict_in_indirect_gems_reversed
|
350
|
-
save_loaded_features do
|
351
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
352
|
-
b1 = new_spec "b", "1", "xc" => ">= 1" # unresolved
|
353
|
-
b2 = new_spec "b", "2", "xc" => ">= 1", "d" => "< 3"
|
354
|
-
c1 = new_spec "xc", "1", "d" => "<= 3" # 1st level
|
355
|
-
c2 = new_spec "xc", "2", "d" => "<= 2"
|
356
|
-
c3 = new_spec "xc", "3", "d" => "<= 3"
|
357
|
-
d1 = new_spec "d", "1", nil, "lib/d.rb" # 2nd level
|
358
|
-
d2 = new_spec "d", "2", nil, "lib/d.rb"
|
359
|
-
d3 = new_spec "d", "3", nil, "lib/d.rb"
|
360
|
-
|
361
|
-
install_specs d1, d2, d3, c1, c2, c3, b1, b2, a1
|
362
|
-
|
363
|
-
a1.activate
|
364
|
-
|
365
|
-
require "d"
|
366
|
-
|
367
|
-
assert_includes [%w(a-1 b-2 d-2 xc-3), %w(a-1 b-2 d-2)], loaded_spec_names
|
368
|
-
end
|
369
|
-
end
|
370
|
-
|
371
|
-
##
|
372
|
-
# [A] depends on
|
373
|
-
# [C] = 1.0 depends on
|
374
|
-
# [B] = 2.0
|
375
|
-
# [B] ~> 1.0 (satisfied by 1.0)
|
376
|
-
|
377
|
-
def test_self_activate_checks_dependencies
|
378
|
-
a = util_spec 'a', '1.0'
|
379
|
-
a.add_dependency 'c', '= 1.0'
|
380
|
-
a.add_dependency 'b', '~> 1.0'
|
381
|
-
|
382
|
-
b1 = util_spec 'b', '1.0'
|
383
|
-
b2 = util_spec 'b', '2.0'
|
384
|
-
c = util_spec 'c', '1.0', 'b' => '= 2.0'
|
385
|
-
install_specs b1, b2, c, a
|
386
|
-
|
387
|
-
e = assert_raises Gem::LoadError do
|
388
|
-
assert_activate nil, a, c, "b"
|
389
|
-
end
|
390
|
-
|
391
|
-
expected = "can't satisfy 'b (~> 1.0)', already activated 'b-2.0'"
|
392
|
-
assert_equal expected, e.message
|
393
|
-
end
|
394
|
-
|
395
|
-
##
|
396
|
-
# [A] depends on
|
397
|
-
# [B] ~> 1.0 (satisfied by 1.0)
|
398
|
-
# [C] = 1.0 depends on
|
399
|
-
# [B] = 2.0
|
400
|
-
|
401
|
-
def test_self_activate_divergent
|
402
|
-
a = util_spec 'a', '1.0', 'b' => '~> 1.0', 'c' => '= 1.0'
|
403
|
-
b1 = util_spec 'b', '1.0'
|
404
|
-
b2 = util_spec 'b', '2.0'
|
405
|
-
c = util_spec 'c', '1.0', 'b' => '= 2.0'
|
406
|
-
|
407
|
-
install_specs b1, b2, c, a
|
408
|
-
|
409
|
-
e = assert_raises Gem::ConflictError do
|
410
|
-
assert_activate nil, a, c, "b"
|
411
|
-
end
|
412
|
-
|
413
|
-
assert_match(/Unable to activate c-1.0,/, e.message)
|
414
|
-
assert_match(/because b-1.0 conflicts with b .= 2.0/, e.message)
|
415
|
-
end
|
416
|
-
|
417
|
-
##
|
418
|
-
# DOC
|
419
|
-
|
420
|
-
def test_self_activate_old_required
|
421
|
-
e1, = util_spec 'e', '1', 'd' => '= 1'
|
422
|
-
@d1 = util_spec 'd', '1'
|
423
|
-
@d2 = util_spec 'd', '2'
|
424
|
-
|
425
|
-
install_specs @d1, @d2, e1
|
426
|
-
|
427
|
-
assert_activate %w[d-1 e-1], e1, "d"
|
428
|
-
end
|
429
|
-
|
430
|
-
##
|
431
|
-
# DOC
|
432
|
-
|
433
|
-
def test_self_activate_platform_alternate
|
434
|
-
@x1_m = util_spec 'x', '1' do |s|
|
435
|
-
s.platform = Gem::Platform.new %w[cpu my_platform 1]
|
436
|
-
end
|
437
|
-
|
438
|
-
@x1_o = util_spec 'x', '1' do |s|
|
439
|
-
s.platform = Gem::Platform.new %w[cpu other_platform 1]
|
440
|
-
end
|
441
|
-
|
442
|
-
@w1 = util_spec 'w', '1', 'x' => nil
|
443
|
-
|
444
|
-
util_set_arch 'cpu-my_platform1'
|
445
|
-
install_specs @x1_m, @x1_o, @w1
|
446
|
-
|
447
|
-
assert_activate %w[x-1-cpu-my_platform-1 w-1], @w1, @x1_m
|
448
|
-
end
|
449
|
-
|
450
|
-
##
|
451
|
-
# DOC
|
452
|
-
|
453
|
-
def test_self_activate_platform_bump
|
454
|
-
@y1 = util_spec 'y', '1'
|
455
|
-
|
456
|
-
@y1_1_p = util_spec 'y', '1.1' do |s|
|
457
|
-
s.platform = Gem::Platform.new %w[cpu my_platform 1]
|
458
|
-
end
|
459
|
-
|
460
|
-
@z1 = util_spec 'z', '1', 'y' => nil
|
461
|
-
install_specs @y1, @y1_1_p, @z1
|
462
|
-
|
463
|
-
assert_activate %w[y-1 z-1], @z1, @y1
|
464
|
-
end
|
465
|
-
|
466
|
-
##
|
467
|
-
# [C] depends on
|
468
|
-
# [A] = 1.a
|
469
|
-
# [B] = 1.0 depends on
|
470
|
-
# [A] >= 0 (satisfied by 1.a)
|
471
|
-
|
472
|
-
def test_self_activate_prerelease
|
473
|
-
@c1_pre = util_spec 'c', '1.a', "a" => "1.a", "b" => "1"
|
474
|
-
@a1_pre = util_spec 'a', '1.a'
|
475
|
-
@b1 = util_spec 'b', '1' do |s|
|
476
|
-
s.add_dependency 'a'
|
477
|
-
s.add_development_dependency 'aa'
|
478
|
-
end
|
479
|
-
install_specs @a1_pre, @b1, @c1_pre
|
480
|
-
|
481
|
-
assert_activate %w[a-1.a b-1 c-1.a], @c1_pre, @a1_pre, @b1
|
482
|
-
end
|
483
|
-
|
484
|
-
def test_self_activate_via_require
|
485
|
-
a1 = new_spec "a", "1", "b" => "= 1"
|
486
|
-
b1 = new_spec "b", "1", nil, "lib/b/c.rb"
|
487
|
-
b2 = new_spec "b", "2", nil, "lib/b/c.rb"
|
488
|
-
|
489
|
-
install_specs b1, b2, a1
|
490
|
-
|
491
|
-
a1.activate
|
492
|
-
save_loaded_features do
|
493
|
-
require "b/c"
|
494
|
-
end
|
495
|
-
|
496
|
-
assert_equal %w(a-1 b-1), loaded_spec_names
|
497
|
-
end
|
498
|
-
|
499
|
-
def test_self_activate_via_require_wtf
|
500
|
-
save_loaded_features do
|
501
|
-
a1 = new_spec "a", "1", "b" => "> 0", "d" => "> 0" # this
|
502
|
-
b1 = new_spec "b", "1", { "c" => ">= 1" }, "lib/b.rb"
|
503
|
-
b2 = new_spec "b", "2", { "c" => ">= 2" }, "lib/b.rb" # this
|
504
|
-
c1 = new_spec "c", "1"
|
505
|
-
c2 = new_spec "c", "2" # this
|
506
|
-
d1 = new_spec "d", "1", { "c" => "< 2" }, "lib/d.rb"
|
507
|
-
d2 = new_spec "d", "2", { "c" => "< 2" }, "lib/d.rb" # this
|
508
|
-
|
509
|
-
install_specs c1, c2, b1, b2, d1, d2, a1
|
510
|
-
|
511
|
-
a1.activate
|
512
|
-
|
513
|
-
assert_equal %w(a-1), loaded_spec_names
|
514
|
-
assert_equal ["b (> 0)", "d (> 0)"], unresolved_names
|
515
|
-
|
516
|
-
require "b"
|
517
|
-
|
518
|
-
e = assert_raises Gem::LoadError do
|
519
|
-
require "d"
|
520
|
-
end
|
521
|
-
|
522
|
-
assert_equal "unable to find a version of 'd' to activate", e.message
|
523
|
-
|
524
|
-
assert_equal %w(a-1 b-2 c-2), loaded_spec_names
|
525
|
-
assert_equal ["d (> 0)"], unresolved_names
|
526
|
-
end
|
527
|
-
end
|
528
|
-
|
529
|
-
def test_self_activate_deep_unambiguous
|
530
|
-
a1 = new_spec "a", "1", "b" => "= 1"
|
531
|
-
b1 = new_spec "b", "1", "c" => "= 1"
|
532
|
-
b2 = new_spec "b", "2", "c" => "= 2"
|
533
|
-
c1 = new_spec "c", "1"
|
534
|
-
c2 = new_spec "c", "2"
|
535
|
-
|
536
|
-
install_specs c1, c2, b1, b2, a1
|
537
|
-
|
538
|
-
a1.activate
|
539
|
-
assert_equal %w(a-1 b-1 c-1), loaded_spec_names
|
540
|
-
end
|
541
|
-
|
542
|
-
def test_self_activate_loaded
|
543
|
-
foo = util_spec 'foo', '1'
|
544
|
-
|
545
|
-
assert foo.activate
|
546
|
-
refute foo.activate
|
547
|
-
end
|
548
|
-
|
549
|
-
##
|
550
|
-
# [A] depends on
|
551
|
-
# [B] >= 1.0 (satisfied by 2.0)
|
552
|
-
# [C] depends on nothing
|
553
|
-
|
554
|
-
def test_self_activate_unrelated
|
555
|
-
a = util_spec 'a', '1.0', 'b' => '>= 1.0'
|
556
|
-
b = util_spec 'b', '1.0'
|
557
|
-
c = util_spec 'c', '1.0'
|
558
|
-
install_specs b, c, a
|
559
|
-
|
560
|
-
assert_activate %w[b-1.0 c-1.0 a-1.0], a, c, "b"
|
561
|
-
end
|
562
|
-
|
563
|
-
##
|
564
|
-
# [A] depends on
|
565
|
-
# [B] >= 1.0 (satisfied by 2.0)
|
566
|
-
# [C] = 1.0 depends on
|
567
|
-
# [B] ~> 1.0
|
568
|
-
#
|
569
|
-
# and should resolve using b-1.0
|
570
|
-
# TODO: move these to specification
|
571
|
-
|
572
|
-
def test_self_activate_over
|
573
|
-
a = util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '= 1.0'
|
574
|
-
install_specs util_spec 'b', '1.0'
|
575
|
-
install_specs util_spec 'b', '1.1'
|
576
|
-
install_specs util_spec 'b', '2.0'
|
577
|
-
install_specs util_spec 'c', '1.0', 'b' => '~> 1.0'
|
578
|
-
install_specs a
|
579
|
-
|
580
|
-
a.activate
|
581
|
-
|
582
|
-
assert_equal %w[a-1.0 c-1.0], loaded_spec_names
|
583
|
-
assert_equal ["b (>= 1.0, ~> 1.0)"], unresolved_names
|
584
|
-
end
|
585
|
-
|
586
|
-
##
|
587
|
-
# [A] depends on
|
588
|
-
# [B] ~> 1.0 (satisfied by 1.1)
|
589
|
-
# [C] = 1.0 depends on
|
590
|
-
# [B] = 1.0
|
591
|
-
#
|
592
|
-
# and should resolve using b-1.0
|
593
|
-
#
|
594
|
-
# TODO: this is not under, but over... under would require depth
|
595
|
-
# first resolve through a dependency that is later pruned.
|
596
|
-
|
597
|
-
def test_self_activate_under
|
598
|
-
a = util_spec 'a', '1.0', 'b' => '~> 1.0', 'c' => '= 1.0'
|
599
|
-
b1 = util_spec 'b', '1.0'
|
600
|
-
b1_1 = util_spec 'b', '1.1'
|
601
|
-
c = util_spec 'c', '1.0', 'b' => '= 1.0'
|
602
|
-
|
603
|
-
install_specs b1, b1_1, c, a
|
604
|
-
|
605
|
-
assert_activate %w[b-1.0 c-1.0 a-1.0], a, c, "b"
|
606
|
-
end
|
607
|
-
|
608
|
-
##
|
609
|
-
# [A1] depends on
|
610
|
-
# [B] > 0 (satisfied by 2.0)
|
611
|
-
# [B1] depends on
|
612
|
-
# [C] > 0 (satisfied by 1.0)
|
613
|
-
# [B2] depends on nothing!
|
614
|
-
# [C1] depends on nothing
|
615
|
-
|
616
|
-
def test_self_activate_dropped
|
617
|
-
a1 = util_spec 'a', '1', 'b' => nil
|
618
|
-
b1 = util_spec 'b', '1', 'c' => nil
|
619
|
-
b2 = util_spec 'b', '2'
|
620
|
-
c1 = util_spec 'c', '1'
|
621
|
-
install_specs c1, b1, b2, a1
|
622
|
-
|
623
|
-
assert_activate %w[b-2 a-1], a1, "b"
|
624
|
-
end
|
625
|
-
|
626
|
-
##
|
627
|
-
# [A] depends on
|
628
|
-
# [B] >= 1.0 (satisfied by 1.1) depends on
|
629
|
-
# [Z]
|
630
|
-
# [C] >= 1.0 depends on
|
631
|
-
# [B] = 1.0
|
632
|
-
#
|
633
|
-
# and should backtrack to resolve using b-1.0, pruning Z from the
|
634
|
-
# resolve.
|
635
|
-
|
636
|
-
def test_self_activate_raggi_the_edgecase_generator
|
637
|
-
a = util_spec 'a', '1.0', 'b' => '>= 1.0', 'c' => '>= 1.0'
|
638
|
-
b1 = util_spec 'b', '1.0'
|
639
|
-
b1_0 = util_spec 'b', '1.1', 'z' => '>= 1.0'
|
640
|
-
c = util_spec 'c', '1.0', 'b' => '= 1.0'
|
641
|
-
z = util_spec 'z', '1'
|
642
|
-
|
643
|
-
install_specs z, b1, b1_0, c, z
|
644
|
-
|
645
|
-
assert_activate %w[b-1.0 c-1.0 a-1.0], a, c, "b"
|
646
|
-
end
|
647
|
-
|
648
|
-
def test_self_activate_conflict
|
649
|
-
install_specs util_spec 'b', '1.0'
|
650
|
-
install_specs util_spec 'b', '2.0'
|
651
|
-
|
652
|
-
gem "b", "= 1.0"
|
653
|
-
|
654
|
-
assert_raises Gem::LoadError do
|
655
|
-
gem "b", "= 2.0"
|
656
|
-
end
|
657
|
-
end
|
658
|
-
|
659
|
-
def test_self_all_equals
|
660
|
-
a = new_spec "foo", "1", nil, "lib/foo.rb"
|
661
|
-
|
662
|
-
install_specs a
|
663
|
-
Gem::Specification.all = [a]
|
664
|
-
|
665
|
-
assert_equal a, Gem::Specification.find_inactive_by_path('foo')
|
666
|
-
end
|
667
|
-
|
668
|
-
def test_self_attribute_names
|
669
|
-
expected_value = %w[
|
670
|
-
authors
|
671
|
-
autorequire
|
672
|
-
bindir
|
673
|
-
cert_chain
|
674
|
-
date
|
675
|
-
dependencies
|
676
|
-
description
|
677
|
-
email
|
678
|
-
executables
|
679
|
-
extensions
|
680
|
-
extra_rdoc_files
|
681
|
-
files
|
682
|
-
homepage
|
683
|
-
licenses
|
684
|
-
metadata
|
685
|
-
name
|
686
|
-
platform
|
687
|
-
post_install_message
|
688
|
-
rdoc_options
|
689
|
-
require_paths
|
690
|
-
required_ruby_version
|
691
|
-
required_rubygems_version
|
692
|
-
requirements
|
693
|
-
rubyforge_project
|
694
|
-
rubygems_version
|
695
|
-
signing_key
|
696
|
-
specification_version
|
697
|
-
summary
|
698
|
-
test_files
|
699
|
-
version
|
700
|
-
]
|
701
|
-
|
702
|
-
actual_value = Gem::Specification.attribute_names.map { |a| a.to_s }.sort
|
703
|
-
|
704
|
-
assert_equal expected_value, actual_value
|
705
|
-
end
|
706
|
-
|
707
|
-
def test_self__load_future
|
708
|
-
spec = Gem::Specification.new
|
709
|
-
spec.name = 'a'
|
710
|
-
spec.version = '1'
|
711
|
-
spec.specification_version = @current_version + 1
|
712
|
-
|
713
|
-
new_spec = Marshal.load Marshal.dump(spec)
|
714
|
-
|
715
|
-
assert_equal 'a', new_spec.name
|
716
|
-
assert_equal Gem::Version.new(1), new_spec.version
|
717
|
-
assert_equal @current_version, new_spec.specification_version
|
718
|
-
end
|
719
|
-
|
720
|
-
def test_self_from_yaml
|
721
|
-
@a1.instance_variable_set :@specification_version, nil
|
722
|
-
|
723
|
-
spec = Gem::Specification.from_yaml @a1.to_yaml
|
724
|
-
|
725
|
-
assert_equal Gem::Specification::NONEXISTENT_SPECIFICATION_VERSION,
|
726
|
-
spec.specification_version
|
727
|
-
end
|
728
|
-
|
729
|
-
def test_self_from_yaml_syck_date_bug
|
730
|
-
# This is equivalent to (and totally valid) psych 1.0 output and
|
731
|
-
# causes parse errors on syck.
|
732
|
-
yaml = @a1.to_yaml
|
733
|
-
yaml.sub!(/^date:.*/, "date: 2011-04-26 00:00:00.000000000Z")
|
734
|
-
|
735
|
-
new_spec = with_syck do
|
736
|
-
Gem::Specification.from_yaml yaml
|
737
|
-
end
|
738
|
-
|
739
|
-
assert_kind_of Time, @a1.date
|
740
|
-
assert_kind_of Time, new_spec.date
|
741
|
-
end
|
742
|
-
|
743
|
-
def test_self_from_yaml_syck_default_key_bug
|
744
|
-
# This is equivalent to (and totally valid) psych 1.0 output and
|
745
|
-
# causes parse errors on syck.
|
746
|
-
yaml = <<-YAML
|
747
|
-
--- !ruby/object:Gem::Specification
|
748
|
-
name: posix-spawn
|
749
|
-
version: !ruby/object:Gem::Version
|
750
|
-
version: 0.3.6
|
751
|
-
prerelease:
|
752
|
-
dependencies:
|
753
|
-
- !ruby/object:Gem::Dependency
|
754
|
-
name: rake-compiler
|
755
|
-
requirement: &70243867725240 !ruby/object:Gem::Requirement
|
756
|
-
none: false
|
757
|
-
requirements:
|
758
|
-
- - =
|
759
|
-
- !ruby/object:Gem::Version
|
760
|
-
version: 0.7.6
|
761
|
-
type: :development
|
762
|
-
prerelease: false
|
763
|
-
version_requirements: *70243867725240
|
764
|
-
platform: ruby
|
765
|
-
files: []
|
766
|
-
test_files: []
|
767
|
-
bindir:
|
768
|
-
YAML
|
769
|
-
|
770
|
-
new_spec = with_syck do
|
771
|
-
Gem::Specification.from_yaml yaml
|
772
|
-
end
|
773
|
-
|
774
|
-
op = new_spec.dependencies.first.requirement.requirements.first.first
|
775
|
-
refute_kind_of YAML::Syck::DefaultKey, op
|
776
|
-
|
777
|
-
refute_match %r%DefaultKey%, new_spec.to_ruby
|
778
|
-
end
|
779
|
-
|
780
|
-
def test_self_from_yaml_cleans_up_defaultkey
|
781
|
-
yaml = <<-YAML
|
782
|
-
--- !ruby/object:Gem::Specification
|
783
|
-
name: posix-spawn
|
784
|
-
version: !ruby/object:Gem::Version
|
785
|
-
version: 0.3.6
|
786
|
-
prerelease:
|
787
|
-
dependencies:
|
788
|
-
- !ruby/object:Gem::Dependency
|
789
|
-
name: rake-compiler
|
790
|
-
requirement: &70243867725240 !ruby/object:Gem::Requirement
|
791
|
-
none: false
|
792
|
-
requirements:
|
793
|
-
- - !ruby/object:YAML::Syck::DefaultKey {}
|
794
|
-
|
795
|
-
- !ruby/object:Gem::Version
|
796
|
-
version: 0.7.6
|
797
|
-
type: :development
|
798
|
-
prerelease: false
|
799
|
-
version_requirements: *70243867725240
|
800
|
-
platform: ruby
|
801
|
-
files: []
|
802
|
-
test_files: []
|
803
|
-
bindir:
|
804
|
-
YAML
|
805
|
-
|
806
|
-
new_spec = Gem::Specification.from_yaml yaml
|
807
|
-
|
808
|
-
op = new_spec.dependencies.first.requirement.requirements.first.first
|
809
|
-
refute_kind_of YAML::Syck::DefaultKey, op
|
810
|
-
|
811
|
-
refute_match %r%DefaultKey%, new_spec.to_ruby
|
812
|
-
end
|
813
|
-
|
814
|
-
def test_self_from_yaml_cleans_up_defaultkey_from_newer_192
|
815
|
-
yaml = <<-YAML
|
816
|
-
--- !ruby/object:Gem::Specification
|
817
|
-
name: posix-spawn
|
818
|
-
version: !ruby/object:Gem::Version
|
819
|
-
version: 0.3.6
|
820
|
-
prerelease:
|
821
|
-
dependencies:
|
822
|
-
- !ruby/object:Gem::Dependency
|
823
|
-
name: rake-compiler
|
824
|
-
requirement: &70243867725240 !ruby/object:Gem::Requirement
|
825
|
-
none: false
|
826
|
-
requirements:
|
827
|
-
- - !ruby/object:Syck::DefaultKey {}
|
828
|
-
|
829
|
-
- !ruby/object:Gem::Version
|
830
|
-
version: 0.7.6
|
831
|
-
type: :development
|
832
|
-
prerelease: false
|
833
|
-
version_requirements: *70243867725240
|
834
|
-
platform: ruby
|
835
|
-
files: []
|
836
|
-
test_files: []
|
837
|
-
bindir:
|
838
|
-
YAML
|
839
|
-
|
840
|
-
new_spec = Gem::Specification.from_yaml yaml
|
841
|
-
|
842
|
-
op = new_spec.dependencies.first.requirement.requirements.first.first
|
843
|
-
refute_kind_of YAML::Syck::DefaultKey, op
|
844
|
-
|
845
|
-
refute_match %r%DefaultKey%, new_spec.to_ruby
|
846
|
-
end
|
847
|
-
|
848
|
-
def test_self_from_yaml_cleans_up_Date_objects
|
849
|
-
yaml = <<-YAML
|
850
|
-
--- !ruby/object:Gem::Specification
|
851
|
-
rubygems_version: 0.8.1
|
852
|
-
specification_version: 1
|
853
|
-
name: diff-lcs
|
854
|
-
version: !ruby/object:Gem::Version
|
855
|
-
version: 1.1.2
|
856
|
-
date: 2004-10-20
|
857
|
-
summary: Provides a list of changes that represent the difference between two sequenced collections.
|
858
|
-
require_paths:
|
859
|
-
- lib
|
860
|
-
author: Austin Ziegler
|
861
|
-
email: diff-lcs@halostatue.ca
|
862
|
-
homepage: http://rubyforge.org/projects/ruwiki/
|
863
|
-
rubyforge_project: ruwiki
|
864
|
-
description: "Test"
|
865
|
-
bindir: bin
|
866
|
-
has_rdoc: true
|
867
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
868
|
-
requirements:
|
869
|
-
-
|
870
|
-
- ">="
|
871
|
-
- !ruby/object:Gem::Version
|
872
|
-
version: 1.8.1
|
873
|
-
version:
|
874
|
-
platform: ruby
|
875
|
-
files:
|
876
|
-
- tests/00test.rb
|
877
|
-
rdoc_options:
|
878
|
-
- "--title"
|
879
|
-
- "Diff::LCS -- A Diff Algorithm"
|
880
|
-
- "--main"
|
881
|
-
- README
|
882
|
-
- "--line-numbers"
|
883
|
-
extra_rdoc_files:
|
884
|
-
- README
|
885
|
-
- ChangeLog
|
886
|
-
- Install
|
887
|
-
executables:
|
888
|
-
- ldiff
|
889
|
-
- htmldiff
|
890
|
-
extensions: []
|
891
|
-
requirements: []
|
892
|
-
dependencies: []
|
893
|
-
YAML
|
894
|
-
|
895
|
-
new_spec = Gem::Specification.from_yaml yaml
|
896
|
-
|
897
|
-
assert_kind_of Time, new_spec.date
|
898
|
-
end
|
899
|
-
|
900
|
-
def test_self_load
|
901
|
-
full_path = @a2.spec_file
|
902
|
-
write_file full_path do |io|
|
903
|
-
io.write @a2.to_ruby_for_cache
|
904
|
-
end
|
905
|
-
|
906
|
-
spec = Gem::Specification.load full_path
|
907
|
-
|
908
|
-
@a2.files.clear
|
909
|
-
|
910
|
-
assert_equal @a2, spec
|
911
|
-
end
|
912
|
-
|
913
|
-
def test_self_load_relative
|
914
|
-
open 'a-2.gemspec', 'w' do |io|
|
915
|
-
io.write @a2.to_ruby_for_cache
|
916
|
-
end
|
917
|
-
|
918
|
-
spec = Gem::Specification.load 'a-2.gemspec'
|
919
|
-
|
920
|
-
@a2.files.clear
|
921
|
-
|
922
|
-
assert_equal @a2, spec
|
923
|
-
|
924
|
-
assert_equal File.join(@tempdir, 'a-2.gemspec'), spec.loaded_from
|
925
|
-
end
|
926
|
-
|
927
|
-
def test_self_load_tainted
|
928
|
-
full_path = @a2.spec_file
|
929
|
-
write_file full_path do |io|
|
930
|
-
io.write @a2.to_ruby_for_cache
|
931
|
-
end
|
932
|
-
|
933
|
-
full_path.taint
|
934
|
-
loader = Thread.new { $SAFE = 1; Gem::Specification.load full_path }
|
935
|
-
spec = loader.value
|
936
|
-
|
937
|
-
@a2.files.clear
|
938
|
-
|
939
|
-
assert_equal @a2, spec
|
940
|
-
end
|
941
|
-
|
942
|
-
def test_self_load_escape_curly
|
943
|
-
@a2.name = 'a};raise "improper escaping";%q{'
|
944
|
-
|
945
|
-
full_path = @a2.spec_file
|
946
|
-
begin
|
947
|
-
write_file full_path do |io|
|
948
|
-
io.write @a2.to_ruby_for_cache
|
949
|
-
end
|
950
|
-
rescue Errno::EINVAL
|
951
|
-
skip "cannot create '#{full_path}' on this platform"
|
952
|
-
end
|
953
|
-
|
954
|
-
spec = Gem::Specification.load full_path
|
955
|
-
|
956
|
-
@a2.files.clear
|
957
|
-
|
958
|
-
assert_equal @a2, spec
|
959
|
-
end
|
960
|
-
|
961
|
-
def test_self_load_escape_interpolation
|
962
|
-
@a2.name = 'a#{raise %<improper escaping>}'
|
963
|
-
|
964
|
-
full_path = @a2.spec_file
|
965
|
-
begin
|
966
|
-
write_file full_path do |io|
|
967
|
-
io.write @a2.to_ruby_for_cache
|
968
|
-
end
|
969
|
-
rescue Errno::EINVAL
|
970
|
-
skip "cannot create '#{full_path}' on this platform"
|
971
|
-
end
|
972
|
-
|
973
|
-
spec = Gem::Specification.load full_path
|
974
|
-
|
975
|
-
@a2.files.clear
|
976
|
-
|
977
|
-
assert_equal @a2, spec
|
978
|
-
end
|
979
|
-
|
980
|
-
def test_self_load_escape_quote
|
981
|
-
@a2.name = 'a";raise "improper escaping";"'
|
982
|
-
|
983
|
-
full_path = @a2.spec_file
|
984
|
-
begin
|
985
|
-
write_file full_path do |io|
|
986
|
-
io.write @a2.to_ruby_for_cache
|
987
|
-
end
|
988
|
-
rescue Errno::EINVAL
|
989
|
-
skip "cannot create '#{full_path}' on this platform"
|
990
|
-
end
|
991
|
-
|
992
|
-
spec = Gem::Specification.load full_path
|
993
|
-
|
994
|
-
@a2.files.clear
|
995
|
-
|
996
|
-
assert_equal @a2, spec
|
997
|
-
end
|
998
|
-
|
999
|
-
if defined?(Encoding)
|
1000
|
-
def test_self_load_utf8_with_ascii_encoding
|
1001
|
-
int_enc = Encoding.default_internal
|
1002
|
-
silence_warnings { Encoding.default_internal = 'US-ASCII' }
|
1003
|
-
|
1004
|
-
spec2 = @a2.dup
|
1005
|
-
bin = "\u5678".dup
|
1006
|
-
spec2.authors = [bin]
|
1007
|
-
full_path = spec2.spec_file
|
1008
|
-
write_file full_path do |io|
|
1009
|
-
io.write spec2.to_ruby_for_cache.force_encoding('BINARY').sub("\\u{5678}", bin.force_encoding('BINARY'))
|
1010
|
-
end
|
1011
|
-
|
1012
|
-
spec = Gem::Specification.load full_path
|
1013
|
-
|
1014
|
-
spec2.files.clear
|
1015
|
-
|
1016
|
-
assert_equal spec2, spec
|
1017
|
-
ensure
|
1018
|
-
silence_warnings { Encoding.default_internal = int_enc }
|
1019
|
-
end
|
1020
|
-
end
|
1021
|
-
|
1022
|
-
def test_self_load_legacy_ruby
|
1023
|
-
spec = Gem::Deprecate.skip_during do
|
1024
|
-
eval LEGACY_RUBY_SPEC
|
1025
|
-
end
|
1026
|
-
assert_equal 'keyedlist', spec.name
|
1027
|
-
assert_equal '0.4.0', spec.version.to_s
|
1028
|
-
assert_equal Gem::Specification::TODAY, spec.date
|
1029
|
-
assert spec.required_ruby_version.satisfied_by?(Gem::Version.new('1'))
|
1030
|
-
assert_equal false, spec.has_unit_tests?
|
1031
|
-
end
|
1032
|
-
|
1033
|
-
def test_self_normalize_yaml_input_with_183_yaml
|
1034
|
-
input = "!ruby/object:Gem::Specification "
|
1035
|
-
assert_equal "--- #{input}", Gem::Specification.normalize_yaml_input(input)
|
1036
|
-
end
|
1037
|
-
|
1038
|
-
def test_self_normalize_yaml_input_with_non_183_yaml
|
1039
|
-
input = "--- !ruby/object:Gem::Specification "
|
1040
|
-
assert_equal input, Gem::Specification.normalize_yaml_input(input)
|
1041
|
-
end
|
1042
|
-
|
1043
|
-
def test_self_normalize_yaml_input_with_183_io
|
1044
|
-
input = "!ruby/object:Gem::Specification "
|
1045
|
-
assert_equal "--- #{input}",
|
1046
|
-
Gem::Specification.normalize_yaml_input(StringIO.new(input))
|
1047
|
-
end
|
1048
|
-
|
1049
|
-
def test_self_normalize_yaml_input_with_non_183_io
|
1050
|
-
input = "--- !ruby/object:Gem::Specification "
|
1051
|
-
assert_equal input,
|
1052
|
-
Gem::Specification.normalize_yaml_input(StringIO.new(input))
|
1053
|
-
end
|
1054
|
-
|
1055
|
-
def test_self_normalize_yaml_input_with_192_yaml
|
1056
|
-
input = "--- !ruby/object:Gem::Specification \nblah: !!null \n"
|
1057
|
-
expected = "--- !ruby/object:Gem::Specification \nblah: \n"
|
1058
|
-
|
1059
|
-
assert_equal expected, Gem::Specification.normalize_yaml_input(input)
|
1060
|
-
end
|
1061
|
-
|
1062
|
-
def test_self_outdated
|
1063
|
-
spec_fetcher do |fetcher|
|
1064
|
-
fetcher.download 'a', 4
|
1065
|
-
|
1066
|
-
fetcher.spec 'a', 3
|
1067
|
-
end
|
1068
|
-
|
1069
|
-
assert_equal %w[a], Gem::Specification.outdated
|
1070
|
-
end
|
1071
|
-
|
1072
|
-
def test_self_outdated_and_latest_remotes
|
1073
|
-
specs = spec_fetcher do |fetcher|
|
1074
|
-
fetcher.download 'a', 4
|
1075
|
-
fetcher.download 'b', 3
|
1076
|
-
|
1077
|
-
fetcher.spec 'a', '3.a'
|
1078
|
-
fetcher.spec 'b', 2
|
1079
|
-
end
|
1080
|
-
|
1081
|
-
expected = [
|
1082
|
-
[specs['a-3.a'], v(4)],
|
1083
|
-
[specs['b-2'], v(3)],
|
1084
|
-
]
|
1085
|
-
|
1086
|
-
assert_equal expected, Gem::Specification.outdated_and_latest_version.to_a
|
1087
|
-
end
|
1088
|
-
|
1089
|
-
def test_self_remove_spec
|
1090
|
-
install_specs @a1
|
1091
|
-
|
1092
|
-
assert_includes Gem::Specification.all_names, 'a-1'
|
1093
|
-
assert_includes Gem::Specification.stubs.map { |s| s.full_name }, 'a-1'
|
1094
|
-
|
1095
|
-
uninstall_gem @a1
|
1096
|
-
Gem::Specification.reset
|
1097
|
-
|
1098
|
-
refute_includes Gem::Specification.all_names, 'a-1'
|
1099
|
-
refute_includes Gem::Specification.stubs.map { |s| s.full_name }, 'a-1'
|
1100
|
-
end
|
1101
|
-
|
1102
|
-
def test_self_remove_spec_removed
|
1103
|
-
open @a1.spec_file, 'w' do |io|
|
1104
|
-
io.write @a1.to_ruby
|
1105
|
-
end
|
1106
|
-
|
1107
|
-
Gem::Specification.reset
|
1108
|
-
|
1109
|
-
FileUtils.rm @a1.spec_file # bug #698
|
1110
|
-
|
1111
|
-
Gem::Specification.reset
|
1112
|
-
|
1113
|
-
refute_includes Gem::Specification.all_names, 'a-1'
|
1114
|
-
refute_includes Gem::Specification.stubs.map { |s| s.full_name }, 'a-1'
|
1115
|
-
end
|
1116
|
-
|
1117
|
-
DATA_PATH = File.expand_path "../data", __FILE__
|
1118
|
-
|
1119
|
-
def test_handles_private_null_type
|
1120
|
-
path = File.join DATA_PATH, "null-type.gemspec.rz"
|
1121
|
-
|
1122
|
-
data = Marshal.load Gem.inflate(Gem.read_binary(path))
|
1123
|
-
|
1124
|
-
assert_equal nil, data.rubyforge_project
|
1125
|
-
end
|
1126
|
-
|
1127
|
-
def test_emits_zulu_timestamps_properly
|
1128
|
-
t = Time.utc(2012, 3, 12)
|
1129
|
-
@a2.date = t
|
1130
|
-
|
1131
|
-
yaml = with_psych { @a2.to_yaml }
|
1132
|
-
|
1133
|
-
assert_match %r!date: 2012-03-12 00:00:00\.000000000 Z!, yaml
|
1134
|
-
end if RUBY_VERSION =~ /1\.9\.2/
|
1135
|
-
|
1136
|
-
def test_initialize
|
1137
|
-
spec = Gem::Specification.new do |s|
|
1138
|
-
s.name = "blah"
|
1139
|
-
s.version = "1.3.5"
|
1140
|
-
end
|
1141
|
-
|
1142
|
-
assert_equal "blah", spec.name
|
1143
|
-
assert_equal "1.3.5", spec.version.to_s
|
1144
|
-
assert_equal Gem::Platform::RUBY, spec.platform
|
1145
|
-
assert_equal nil, spec.summary
|
1146
|
-
assert_equal [], spec.files
|
1147
|
-
|
1148
|
-
assert_equal [], spec.test_files
|
1149
|
-
assert_equal [], spec.rdoc_options
|
1150
|
-
assert_equal [], spec.extra_rdoc_files
|
1151
|
-
assert_equal [], spec.executables
|
1152
|
-
assert_equal [], spec.extensions
|
1153
|
-
assert_equal [], spec.requirements
|
1154
|
-
assert_equal [], spec.dependencies
|
1155
|
-
assert_equal 'bin', spec.bindir
|
1156
|
-
assert_equal '>= 0', spec.required_ruby_version.to_s
|
1157
|
-
assert_equal '>= 0', spec.required_rubygems_version.to_s
|
1158
|
-
end
|
1159
|
-
|
1160
|
-
def test_initialize_future
|
1161
|
-
version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + 1
|
1162
|
-
spec = Gem::Specification.new do |s|
|
1163
|
-
s.name = "blah"
|
1164
|
-
s.version = "1.3.5"
|
1165
|
-
|
1166
|
-
s.specification_version = version
|
1167
|
-
|
1168
|
-
s.new_unknown_attribute = "a value"
|
1169
|
-
end
|
1170
|
-
|
1171
|
-
assert_equal "blah", spec.name
|
1172
|
-
assert_equal "1.3.5", spec.version.to_s
|
1173
|
-
end
|
1174
|
-
|
1175
|
-
def test_initialize_copy
|
1176
|
-
spec = Gem::Specification.new do |s|
|
1177
|
-
s.name = "blah"
|
1178
|
-
s.version = "1.3.5"
|
1179
|
-
s.summary = 'summary'
|
1180
|
-
s.description = 'description'
|
1181
|
-
s.authors = 'author a', 'author b'
|
1182
|
-
s.licenses = 'BSD-2-Clause'
|
1183
|
-
s.files = 'lib/file.rb'
|
1184
|
-
s.test_files = 'test/file.rb'
|
1185
|
-
s.rdoc_options = '--foo'
|
1186
|
-
s.extra_rdoc_files = 'README.txt'
|
1187
|
-
s.executables = 'exec'
|
1188
|
-
s.extensions = 'ext/extconf.rb'
|
1189
|
-
s.requirements = 'requirement'
|
1190
|
-
s.add_dependency 'some_gem'
|
1191
|
-
end
|
1192
|
-
|
1193
|
-
new_spec = spec.dup
|
1194
|
-
|
1195
|
-
assert_equal "blah", spec.name
|
1196
|
-
assert_same spec.name, new_spec.name
|
1197
|
-
|
1198
|
-
assert_equal "1.3.5", spec.version.to_s
|
1199
|
-
assert_same spec.version, new_spec.version
|
1200
|
-
|
1201
|
-
assert_equal Gem::Platform::RUBY, spec.platform
|
1202
|
-
assert_same spec.platform, new_spec.platform
|
1203
|
-
|
1204
|
-
assert_equal 'summary', spec.summary
|
1205
|
-
assert_same spec.summary, new_spec.summary
|
1206
|
-
|
1207
|
-
assert_equal %w[README.txt bin/exec ext/extconf.rb lib/file.rb
|
1208
|
-
test/file.rb].sort,
|
1209
|
-
spec.files
|
1210
|
-
refute_same spec.files, new_spec.files, 'files'
|
1211
|
-
|
1212
|
-
assert_equal %w[test/file.rb], spec.test_files
|
1213
|
-
refute_same spec.test_files, new_spec.test_files, 'test_files'
|
1214
|
-
|
1215
|
-
assert_equal %w[--foo], spec.rdoc_options
|
1216
|
-
refute_same spec.rdoc_options, new_spec.rdoc_options, 'rdoc_options'
|
1217
|
-
|
1218
|
-
assert_equal %w[README.txt], spec.extra_rdoc_files
|
1219
|
-
refute_same spec.extra_rdoc_files, new_spec.extra_rdoc_files,
|
1220
|
-
'extra_rdoc_files'
|
1221
|
-
|
1222
|
-
assert_equal %w[exec], spec.executables
|
1223
|
-
refute_same spec.executables, new_spec.executables, 'executables'
|
1224
|
-
|
1225
|
-
assert_equal %w[ext/extconf.rb], spec.extensions
|
1226
|
-
refute_same spec.extensions, new_spec.extensions, 'extensions'
|
1227
|
-
|
1228
|
-
assert_equal %w[requirement], spec.requirements
|
1229
|
-
refute_same spec.requirements, new_spec.requirements, 'requirements'
|
1230
|
-
|
1231
|
-
assert_equal [Gem::Dependency.new('some_gem', Gem::Requirement.default)],
|
1232
|
-
spec.dependencies
|
1233
|
-
refute_same spec.dependencies, new_spec.dependencies, 'dependencies'
|
1234
|
-
|
1235
|
-
assert_equal 'bin', spec.bindir
|
1236
|
-
assert_same spec.bindir, new_spec.bindir
|
1237
|
-
|
1238
|
-
assert_equal '>= 0', spec.required_ruby_version.to_s
|
1239
|
-
assert_same spec.required_ruby_version, new_spec.required_ruby_version
|
1240
|
-
|
1241
|
-
assert_equal '>= 0', spec.required_rubygems_version.to_s
|
1242
|
-
assert_same spec.required_rubygems_version,
|
1243
|
-
new_spec.required_rubygems_version
|
1244
|
-
end
|
1245
|
-
|
1246
|
-
def test_initialize_copy_broken
|
1247
|
-
spec = Gem::Specification.new do |s|
|
1248
|
-
s.name = 'a'
|
1249
|
-
s.version = '1'
|
1250
|
-
end
|
1251
|
-
|
1252
|
-
spec.instance_variable_set :@licenses, :blah
|
1253
|
-
spec.loaded_from = '/path/to/file'
|
1254
|
-
|
1255
|
-
e = assert_raises Gem::FormatException do
|
1256
|
-
spec.dup
|
1257
|
-
end
|
1258
|
-
|
1259
|
-
assert_equal 'a-1 has an invalid value for @licenses', e.message
|
1260
|
-
assert_equal '/path/to/file', e.file_path
|
1261
|
-
end
|
1262
|
-
|
1263
|
-
def test__dump
|
1264
|
-
@a2.platform = Gem::Platform.local
|
1265
|
-
@a2.instance_variable_set :@original_platform, 'old_platform'
|
1266
|
-
|
1267
|
-
data = Marshal.dump @a2
|
1268
|
-
|
1269
|
-
same_spec = Marshal.load data
|
1270
|
-
|
1271
|
-
assert_equal 'old_platform', same_spec.original_platform
|
1272
|
-
end
|
1273
|
-
|
1274
|
-
def test_activate
|
1275
|
-
@a2.activate
|
1276
|
-
|
1277
|
-
assert @a2.activated?
|
1278
|
-
end
|
1279
|
-
|
1280
|
-
def test_add_dependency_with_type
|
1281
|
-
gem = util_spec "awesome", "1.0" do |awesome|
|
1282
|
-
awesome.add_dependency true
|
1283
|
-
awesome.add_dependency :gem_name
|
1284
|
-
end
|
1285
|
-
|
1286
|
-
assert_equal %w[true gem_name], gem.dependencies.map { |dep| dep.name }
|
1287
|
-
end
|
1288
|
-
|
1289
|
-
def test_add_dependency_from_existing_dependency
|
1290
|
-
dep = Gem::Dependency.new("existing_dep", Gem::Requirement.new('> 1'), :runtime)
|
1291
|
-
spec = Gem::Specification.new { |s| s.add_dependency dep }
|
1292
|
-
assert_equal dep, spec.dependencies.first
|
1293
|
-
end
|
1294
|
-
|
1295
|
-
def test_add_dependency_with_type_explicit
|
1296
|
-
gem = util_spec "awesome", "1.0" do |awesome|
|
1297
|
-
awesome.add_development_dependency "monkey"
|
1298
|
-
end
|
1299
|
-
|
1300
|
-
monkey = gem.dependencies.detect { |d| d.name == "monkey" }
|
1301
|
-
assert_equal(:development, monkey.type)
|
1302
|
-
end
|
1303
|
-
|
1304
|
-
def test_author
|
1305
|
-
assert_equal 'A User', @a1.author
|
1306
|
-
end
|
1307
|
-
|
1308
|
-
def test_authors
|
1309
|
-
assert_equal ['A User'], @a1.authors
|
1310
|
-
end
|
1311
|
-
|
1312
|
-
def test_bindir_equals
|
1313
|
-
@a1.bindir = 'apps'
|
1314
|
-
|
1315
|
-
assert_equal 'apps', @a1.bindir
|
1316
|
-
end
|
1317
|
-
|
1318
|
-
def test_bindir_equals_nil
|
1319
|
-
@a2.bindir = nil
|
1320
|
-
@a2.executable = 'app'
|
1321
|
-
|
1322
|
-
assert_equal nil, @a2.bindir
|
1323
|
-
assert_equal %w[app lib/code.rb].sort, @a2.files
|
1324
|
-
end
|
1325
|
-
|
1326
|
-
def test_extensions_equals_nil
|
1327
|
-
@a2.instance_variable_set(:@extensions, nil)
|
1328
|
-
assert_equal nil, @a2.instance_variable_get(:@extensions)
|
1329
|
-
assert_equal %w[lib/code.rb], @a2.files
|
1330
|
-
end
|
1331
|
-
|
1332
|
-
def test_test_files_equals_nil
|
1333
|
-
@a2.instance_variable_set(:@test_files, nil)
|
1334
|
-
assert_equal nil, @a2.instance_variable_get(:@test_files)
|
1335
|
-
assert_equal %w[lib/code.rb], @a2.files
|
1336
|
-
end
|
1337
|
-
|
1338
|
-
def test_executables_equals_nil
|
1339
|
-
@a2.instance_variable_set(:@executables, nil)
|
1340
|
-
assert_equal nil, @a2.instance_variable_get(:@executables)
|
1341
|
-
assert_equal %w[lib/code.rb], @a2.files
|
1342
|
-
end
|
1343
|
-
|
1344
|
-
def test_extra_rdoc_files_equals_nil
|
1345
|
-
@a2.instance_variable_set(:@extra_rdoc_files, nil)
|
1346
|
-
assert_equal nil, @a2.instance_variable_get(:@extra_rdoc_files)
|
1347
|
-
assert_equal %w[lib/code.rb], @a2.files
|
1348
|
-
end
|
1349
|
-
|
1350
|
-
def test_build_args
|
1351
|
-
ext_spec
|
1352
|
-
|
1353
|
-
assert_empty @ext.build_args
|
1354
|
-
|
1355
|
-
open @ext.build_info_file, 'w' do |io|
|
1356
|
-
io.puts
|
1357
|
-
end
|
1358
|
-
|
1359
|
-
assert_empty @ext.build_args
|
1360
|
-
|
1361
|
-
open @ext.build_info_file, 'w' do |io|
|
1362
|
-
io.puts '--with-foo-dir=wherever'
|
1363
|
-
end
|
1364
|
-
|
1365
|
-
assert_equal %w[--with-foo-dir=wherever], @ext.build_args
|
1366
|
-
end
|
1367
|
-
|
1368
|
-
def test_build_extensions
|
1369
|
-
ext_spec
|
1370
|
-
|
1371
|
-
refute_path_exists @ext.extension_dir, 'sanity check'
|
1372
|
-
refute_empty @ext.extensions, 'sanity check'
|
1373
|
-
|
1374
|
-
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1375
|
-
FileUtils.mkdir_p File.dirname extconf_rb
|
1376
|
-
|
1377
|
-
open extconf_rb, 'w' do |f|
|
1378
|
-
f.write <<-'RUBY'
|
1379
|
-
open 'Makefile', 'w' do |f|
|
1380
|
-
f.puts "clean:\n\techo clean"
|
1381
|
-
f.puts "default:\n\techo built"
|
1382
|
-
f.puts "install:\n\techo installed"
|
1383
|
-
end
|
1384
|
-
RUBY
|
1385
|
-
end
|
1386
|
-
|
1387
|
-
@ext.build_extensions
|
1388
|
-
|
1389
|
-
assert_path_exists @ext.extension_dir
|
1390
|
-
end
|
1391
|
-
|
1392
|
-
def test_default_spec_stub_is_marked_default
|
1393
|
-
default = new_default_spec 'default', 2
|
1394
|
-
install_default_gems default
|
1395
|
-
|
1396
|
-
stub = Gem::Specification.stubs.find { |s| s.name == 'default' }
|
1397
|
-
assert_predicate stub, :default_gem?
|
1398
|
-
|
1399
|
-
stub = Gem::Specification.find_all_by_name('default').first
|
1400
|
-
assert_predicate stub, :default_gem?
|
1401
|
-
end
|
1402
|
-
|
1403
|
-
def test_build_extensions_built
|
1404
|
-
ext_spec
|
1405
|
-
|
1406
|
-
refute_empty @ext.extensions, 'sanity check'
|
1407
|
-
|
1408
|
-
gem_build_complete =
|
1409
|
-
File.join @ext.extension_dir, 'gem.build_complete'
|
1410
|
-
|
1411
|
-
FileUtils.mkdir_p @ext.extension_dir
|
1412
|
-
FileUtils.touch gem_build_complete
|
1413
|
-
|
1414
|
-
@ext.build_extensions
|
1415
|
-
|
1416
|
-
gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
|
1417
|
-
refute_path_exists gem_make_out
|
1418
|
-
end
|
1419
|
-
|
1420
|
-
def test_build_extensions_default_gem
|
1421
|
-
spec = new_default_spec 'default', 1
|
1422
|
-
spec.extensions << 'extconf.rb'
|
1423
|
-
|
1424
|
-
extconf_rb = File.join spec.gem_dir, spec.extensions.first
|
1425
|
-
FileUtils.mkdir_p File.dirname extconf_rb
|
1426
|
-
|
1427
|
-
open extconf_rb, 'w' do |f|
|
1428
|
-
f.write <<-'RUBY'
|
1429
|
-
open 'Makefile', 'w' do |f|
|
1430
|
-
f.puts "default:\n\techo built"
|
1431
|
-
f.puts "install:\n\techo installed"
|
1432
|
-
end
|
1433
|
-
RUBY
|
1434
|
-
end
|
1435
|
-
|
1436
|
-
spec.build_extensions
|
1437
|
-
|
1438
|
-
refute_path_exists spec.extension_dir
|
1439
|
-
end
|
1440
|
-
|
1441
|
-
def test_build_extensions_error
|
1442
|
-
ext_spec
|
1443
|
-
|
1444
|
-
refute_empty @ext.extensions, 'sanity check'
|
1445
|
-
|
1446
|
-
assert_raises Gem::Ext::BuildError do
|
1447
|
-
@ext.build_extensions
|
1448
|
-
end
|
1449
|
-
end
|
1450
|
-
|
1451
|
-
def test_build_extensions_extensions_dir_unwritable
|
1452
|
-
skip 'chmod not supported' if Gem.win_platform?
|
1453
|
-
|
1454
|
-
ext_spec
|
1455
|
-
|
1456
|
-
refute_empty @ext.extensions, 'sanity check'
|
1457
|
-
|
1458
|
-
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1459
|
-
FileUtils.mkdir_p File.dirname extconf_rb
|
1460
|
-
|
1461
|
-
open extconf_rb, 'w' do |f|
|
1462
|
-
f.write <<-'RUBY'
|
1463
|
-
open 'Makefile', 'w' do |f|
|
1464
|
-
f.puts "clean:\n\techo clean"
|
1465
|
-
f.puts "default:\n\techo built"
|
1466
|
-
f.puts "install:\n\techo installed"
|
1467
|
-
end
|
1468
|
-
RUBY
|
1469
|
-
end
|
1470
|
-
|
1471
|
-
FileUtils.mkdir_p File.join @ext.base_dir, 'extensions'
|
1472
|
-
FileUtils.chmod 0555, @ext.base_dir
|
1473
|
-
FileUtils.chmod 0555, File.join(@ext.base_dir, 'extensions')
|
1474
|
-
|
1475
|
-
@ext.build_extensions
|
1476
|
-
refute_path_exists @ext.extension_dir
|
1477
|
-
ensure
|
1478
|
-
unless ($DEBUG or win_platform?) then
|
1479
|
-
FileUtils.chmod 0755, File.join(@ext.base_dir, 'extensions')
|
1480
|
-
FileUtils.chmod 0755, @ext.base_dir
|
1481
|
-
end
|
1482
|
-
end
|
1483
|
-
|
1484
|
-
def test_build_extensions_no_extensions_dir_unwritable
|
1485
|
-
skip 'chmod not supported' if Gem.win_platform?
|
1486
|
-
|
1487
|
-
ext_spec
|
1488
|
-
|
1489
|
-
refute_empty @ext.extensions, 'sanity check'
|
1490
|
-
|
1491
|
-
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1492
|
-
FileUtils.mkdir_p File.dirname extconf_rb
|
1493
|
-
|
1494
|
-
open extconf_rb, 'w' do |f|
|
1495
|
-
f.write <<-'RUBY'
|
1496
|
-
open 'Makefile', 'w' do |f|
|
1497
|
-
f.puts "clean:\n\techo clean"
|
1498
|
-
f.puts "default:\n\techo built"
|
1499
|
-
f.puts "install:\n\techo installed"
|
1500
|
-
end
|
1501
|
-
RUBY
|
1502
|
-
end
|
1503
|
-
|
1504
|
-
FileUtils.rm_r File.join @gemhome, 'extensions'
|
1505
|
-
FileUtils.chmod 0555, @gemhome
|
1506
|
-
|
1507
|
-
@ext.build_extensions
|
1508
|
-
|
1509
|
-
gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
|
1510
|
-
refute_path_exists gem_make_out
|
1511
|
-
ensure
|
1512
|
-
FileUtils.chmod 0755, @gemhome
|
1513
|
-
end
|
1514
|
-
|
1515
|
-
def test_build_extensions_none
|
1516
|
-
refute_path_exists @a1.extension_dir, 'sanity check'
|
1517
|
-
assert_empty @a1.extensions, 'sanity check'
|
1518
|
-
|
1519
|
-
@a1.build_extensions
|
1520
|
-
|
1521
|
-
refute_path_exists @a1.extension_dir
|
1522
|
-
end
|
1523
|
-
|
1524
|
-
def test_build_extensions_old
|
1525
|
-
ext_spec
|
1526
|
-
|
1527
|
-
refute_empty @ext.extensions, 'sanity check'
|
1528
|
-
|
1529
|
-
@ext.installed_by_version = v(0)
|
1530
|
-
|
1531
|
-
@ext.build_extensions
|
1532
|
-
|
1533
|
-
gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
|
1534
|
-
refute_path_exists gem_make_out
|
1535
|
-
end
|
1536
|
-
|
1537
|
-
def test_build_extensions_preview
|
1538
|
-
ext_spec
|
1539
|
-
|
1540
|
-
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
1541
|
-
FileUtils.mkdir_p File.dirname extconf_rb
|
1542
|
-
|
1543
|
-
open extconf_rb, 'w' do |f|
|
1544
|
-
f.write <<-'RUBY'
|
1545
|
-
open 'Makefile', 'w' do |f|
|
1546
|
-
f.puts "clean:\n\techo clean"
|
1547
|
-
f.puts "default:\n\techo built"
|
1548
|
-
f.puts "install:\n\techo installed"
|
1549
|
-
end
|
1550
|
-
RUBY
|
1551
|
-
end
|
1552
|
-
|
1553
|
-
refute_empty @ext.extensions, 'sanity check'
|
1554
|
-
|
1555
|
-
@ext.installed_by_version = v('2.2.0.preview.2')
|
1556
|
-
|
1557
|
-
@ext.build_extensions
|
1558
|
-
|
1559
|
-
gem_make_out = File.join @ext.extension_dir, 'gem_make.out'
|
1560
|
-
assert_path_exists gem_make_out
|
1561
|
-
end
|
1562
|
-
|
1563
|
-
def test_contains_requirable_file_eh
|
1564
|
-
code_rb = File.join @a1.gem_dir, 'lib', 'code.rb'
|
1565
|
-
FileUtils.mkdir_p File.dirname code_rb
|
1566
|
-
FileUtils.touch code_rb
|
1567
|
-
|
1568
|
-
assert @a1.contains_requirable_file? 'code'
|
1569
|
-
end
|
1570
|
-
|
1571
|
-
def test_contains_requirable_file_eh_extension
|
1572
|
-
ext_spec
|
1573
|
-
|
1574
|
-
_, err = capture_io do
|
1575
|
-
refute @ext.contains_requirable_file? 'nonexistent'
|
1576
|
-
end
|
1577
|
-
|
1578
|
-
expected = "Ignoring ext-1 because its extensions are not built. " +
|
1579
|
-
"Try: gem pristine ext --version 1\n"
|
1580
|
-
|
1581
|
-
assert_equal expected, err
|
1582
|
-
end
|
1583
|
-
|
1584
|
-
def test_date
|
1585
|
-
assert_equal Gem::Specification::TODAY, @a1.date
|
1586
|
-
end
|
1587
|
-
|
1588
|
-
def test_date_equals_date
|
1589
|
-
@a1.date = Date.new(2003, 9, 17)
|
1590
|
-
assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date
|
1591
|
-
end
|
1592
|
-
|
1593
|
-
def test_date_equals_string
|
1594
|
-
@a1.date = '2003-09-17'
|
1595
|
-
assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date
|
1596
|
-
end
|
1597
|
-
|
1598
|
-
def test_date_equals_string_bad
|
1599
|
-
assert_raises Gem::InvalidSpecificationException do
|
1600
|
-
@a1.date = '9/11/2003'
|
1601
|
-
end
|
1602
|
-
end
|
1603
|
-
|
1604
|
-
def test_date_equals_time
|
1605
|
-
@a1.date = Time.local(2003, 9, 17, 0,0,0)
|
1606
|
-
assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date
|
1607
|
-
end
|
1608
|
-
|
1609
|
-
def test_date_equals_time_local
|
1610
|
-
@a1.date = Time.local(2003, 9, 17, 19,50,0) # may not pass in utc >= +4
|
1611
|
-
assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date
|
1612
|
-
end
|
1613
|
-
|
1614
|
-
def test_date_equals_time_utc
|
1615
|
-
@a1.date = Time.utc(2003, 9, 17, 19,50,0)
|
1616
|
-
assert_equal Time.utc(2003, 9, 17, 0,0,0), @a1.date
|
1617
|
-
end
|
1618
|
-
|
1619
|
-
def test_date_tolerates_hour_sec_zulu
|
1620
|
-
@a1.date = "2012-01-12 11:22:33.4444444 Z"
|
1621
|
-
assert_equal Time.utc(2012,01,12,0,0,0), @a1.date
|
1622
|
-
end
|
1623
|
-
|
1624
|
-
def test_date_tolerates_hour_sec_and_timezone
|
1625
|
-
@a1.date = "2012-01-12 11:22:33.4444444 +02:33"
|
1626
|
-
assert_equal Time.utc(2012,01,12,0,0,0), @a1.date
|
1627
|
-
end
|
1628
|
-
|
1629
|
-
def test_dependencies
|
1630
|
-
util_setup_deps
|
1631
|
-
assert_equal [@bonobo, @monkey], @gem.dependencies
|
1632
|
-
end
|
1633
|
-
|
1634
|
-
def test_dependent_gems
|
1635
|
-
util_setup_deps
|
1636
|
-
|
1637
|
-
assert_empty @gem.dependent_gems
|
1638
|
-
|
1639
|
-
bonobo = util_spec 'bonobo', 1
|
1640
|
-
install_gem bonobo
|
1641
|
-
install_gem @gem
|
1642
|
-
|
1643
|
-
expected = [
|
1644
|
-
[@gem, @bonobo, [bonobo]],
|
1645
|
-
]
|
1646
|
-
|
1647
|
-
assert_equal expected, bonobo.dependent_gems
|
1648
|
-
end
|
1649
|
-
|
1650
|
-
def test_doc_dir
|
1651
|
-
assert_equal File.join(@gemhome, 'doc', 'a-1'), @a1.doc_dir
|
1652
|
-
end
|
1653
|
-
|
1654
|
-
def test_doc_dir_type
|
1655
|
-
assert_equal File.join(@gemhome, 'doc', 'a-1', 'ri'), @a1.doc_dir('ri')
|
1656
|
-
end
|
1657
|
-
|
1658
|
-
def test_runtime_dependencies
|
1659
|
-
util_setup_deps
|
1660
|
-
assert_equal [@bonobo], @gem.runtime_dependencies
|
1661
|
-
end
|
1662
|
-
|
1663
|
-
def test_development_dependencies
|
1664
|
-
util_setup_deps
|
1665
|
-
assert_equal [@monkey], @gem.development_dependencies
|
1666
|
-
end
|
1667
|
-
|
1668
|
-
def test_description
|
1669
|
-
assert_equal 'This is a test description', @a1.description
|
1670
|
-
end
|
1671
|
-
|
1672
|
-
def test_eql_eh
|
1673
|
-
g1 = new_spec 'gem', 1
|
1674
|
-
g2 = new_spec 'gem', 1
|
1675
|
-
|
1676
|
-
assert_equal g1, g2
|
1677
|
-
assert_equal g1.hash, g2.hash
|
1678
|
-
assert_equal true, g1.eql?(g2)
|
1679
|
-
end
|
1680
|
-
|
1681
|
-
def test_eql_eh_extensions
|
1682
|
-
spec = @a1.dup
|
1683
|
-
spec.extensions = 'xx'
|
1684
|
-
|
1685
|
-
refute_operator @a1, :eql?, spec
|
1686
|
-
refute_operator spec, :eql?, @a1
|
1687
|
-
end
|
1688
|
-
|
1689
|
-
def test_executables
|
1690
|
-
@a1.executable = 'app'
|
1691
|
-
assert_equal %w[app], @a1.executables
|
1692
|
-
end
|
1693
|
-
|
1694
|
-
def test_executable_equals
|
1695
|
-
@a2.executable = 'app'
|
1696
|
-
assert_equal 'app', @a2.executable
|
1697
|
-
assert_equal %w[bin/app lib/code.rb].sort, @a2.files
|
1698
|
-
end
|
1699
|
-
|
1700
|
-
def test_extensions
|
1701
|
-
assert_equal ['ext/extconf.rb'], ext_spec.extensions
|
1702
|
-
end
|
1703
|
-
|
1704
|
-
def test_extension_dir
|
1705
|
-
enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] =
|
1706
|
-
RbConfig::CONFIG['ENABLE_SHARED'], 'no'
|
1707
|
-
|
1708
|
-
ext_spec
|
1709
|
-
|
1710
|
-
refute_empty @ext.extensions
|
1711
|
-
|
1712
|
-
expected =
|
1713
|
-
File.join(@ext.base_dir, 'extensions', Gem::Platform.local.to_s,
|
1714
|
-
"#{Gem.ruby_api_version}-static", @ext.full_name)
|
1715
|
-
|
1716
|
-
assert_equal expected, @ext.extension_dir
|
1717
|
-
ensure
|
1718
|
-
RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
|
1719
|
-
end
|
1720
|
-
|
1721
|
-
def test_extension_dir_override
|
1722
|
-
enable_shared, RbConfig::CONFIG['ENABLE_SHARED'] =
|
1723
|
-
RbConfig::CONFIG['ENABLE_SHARED'], 'no'
|
1724
|
-
|
1725
|
-
class << Gem
|
1726
|
-
alias orig_default_ext_dir_for default_ext_dir_for
|
1727
|
-
|
1728
|
-
remove_method :default_ext_dir_for
|
1729
|
-
|
1730
|
-
def Gem.default_ext_dir_for(base_dir)
|
1731
|
-
'elsewhere'
|
1732
|
-
end
|
1733
|
-
end
|
1734
|
-
|
1735
|
-
ext_spec
|
1736
|
-
|
1737
|
-
refute_empty @ext.extensions
|
1738
|
-
|
1739
|
-
expected = File.join @tempdir, 'elsewhere', @ext.full_name
|
1740
|
-
|
1741
|
-
assert_equal expected, @ext.extension_dir
|
1742
|
-
ensure
|
1743
|
-
RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
|
1744
|
-
|
1745
|
-
class << Gem
|
1746
|
-
remove_method :default_ext_dir_for
|
1747
|
-
|
1748
|
-
alias default_ext_dir_for orig_default_ext_dir_for
|
1749
|
-
end
|
1750
|
-
end
|
1751
|
-
|
1752
|
-
def test_files
|
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)
|
1758
|
-
|
1759
|
-
expected = %w[
|
1760
|
-
bin/common
|
1761
|
-
bin/executables
|
1762
|
-
extensions
|
1763
|
-
extra_rdoc_files
|
1764
|
-
files
|
1765
|
-
test_files
|
1766
|
-
]
|
1767
|
-
assert_equal expected, @a1.files
|
1768
|
-
end
|
1769
|
-
|
1770
|
-
def test_files_append
|
1771
|
-
@a1.files = %w(files bin/common)
|
1772
|
-
@a1.test_files = %w(test_files bin/common)
|
1773
|
-
@a1.executables = %w(executables common)
|
1774
|
-
@a1.extra_rdoc_files = %w(extra_rdoc_files bin/common)
|
1775
|
-
@a1.extensions = %w(extensions bin/common)
|
1776
|
-
|
1777
|
-
expected = %w[
|
1778
|
-
bin/common
|
1779
|
-
bin/executables
|
1780
|
-
extensions
|
1781
|
-
extra_rdoc_files
|
1782
|
-
files
|
1783
|
-
test_files
|
1784
|
-
]
|
1785
|
-
assert_equal expected, @a1.files
|
1786
|
-
|
1787
|
-
@a1.files << "generated_file.c"
|
1788
|
-
|
1789
|
-
expected << "generated_file.c"
|
1790
|
-
expected.sort!
|
1791
|
-
|
1792
|
-
assert_equal expected, @a1.files
|
1793
|
-
end
|
1794
|
-
|
1795
|
-
def test_files_duplicate
|
1796
|
-
@a2.files = %w[a b c d b]
|
1797
|
-
@a2.extra_rdoc_files = %w[x y z x]
|
1798
|
-
@a2.normalize
|
1799
|
-
|
1800
|
-
assert_equal %w[a b c d x y z], @a2.files
|
1801
|
-
assert_equal %w[x y z], @a2.extra_rdoc_files
|
1802
|
-
end
|
1803
|
-
|
1804
|
-
def test_files_extra_rdoc_files
|
1805
|
-
@a2.files = %w[a b c d]
|
1806
|
-
@a2.extra_rdoc_files = %w[x y z]
|
1807
|
-
@a2.normalize
|
1808
|
-
assert_equal %w[a b c d x y z], @a2.files
|
1809
|
-
end
|
1810
|
-
|
1811
|
-
def test_files_non_array
|
1812
|
-
@a1.files = "F"
|
1813
|
-
@a1.test_files = "TF"
|
1814
|
-
@a1.executables = "X"
|
1815
|
-
@a1.extra_rdoc_files = "ERF"
|
1816
|
-
@a1.extensions = "E"
|
1817
|
-
|
1818
|
-
assert_equal %w[E ERF F TF bin/X], @a1.files
|
1819
|
-
end
|
1820
|
-
|
1821
|
-
def test_files_non_array_pathological
|
1822
|
-
@a1.instance_variable_set :@files, "F"
|
1823
|
-
@a1.instance_variable_set :@test_files, "TF"
|
1824
|
-
@a1.instance_variable_set :@extra_rdoc_files, "ERF"
|
1825
|
-
@a1.instance_variable_set :@extensions, "E"
|
1826
|
-
@a1.instance_variable_set :@executables, "X"
|
1827
|
-
|
1828
|
-
assert_equal %w[E ERF F TF bin/X], @a1.files
|
1829
|
-
assert_kind_of Integer, @a1.hash
|
1830
|
-
end
|
1831
|
-
|
1832
|
-
def test_for_cache
|
1833
|
-
@a2.add_runtime_dependency 'b', '1'
|
1834
|
-
@a2.dependencies.first.instance_variable_set :@type, nil
|
1835
|
-
@a2.required_rubygems_version = Gem::Requirement.new '> 0'
|
1836
|
-
@a2.test_files = %w[test/test_b.rb]
|
1837
|
-
|
1838
|
-
refute_empty @a2.files
|
1839
|
-
refute_empty @a2.test_files
|
1840
|
-
|
1841
|
-
spec = @a2.for_cache
|
1842
|
-
|
1843
|
-
assert_empty spec.files
|
1844
|
-
assert_empty spec.test_files
|
1845
|
-
|
1846
|
-
refute_empty @a2.files
|
1847
|
-
refute_empty @a2.test_files
|
1848
|
-
end
|
1849
|
-
|
1850
|
-
def test_full_gem_path
|
1851
|
-
assert_equal File.join(@gemhome, 'gems', @a1.full_name), @a1.full_gem_path
|
1852
|
-
|
1853
|
-
@a1.original_platform = 'mswin32'
|
1854
|
-
|
1855
|
-
assert_equal File.join(@gemhome, 'gems', @a1.original_name),
|
1856
|
-
@a1.full_gem_path
|
1857
|
-
end
|
1858
|
-
|
1859
|
-
def test_full_gem_path_double_slash
|
1860
|
-
gemhome = @gemhome.to_s.sub(/\w\//, '\&/')
|
1861
|
-
@a1.loaded_from = File.join gemhome, "specifications", @a1.spec_name
|
1862
|
-
|
1863
|
-
expected = File.join @gemhome, "gems", @a1.full_name
|
1864
|
-
assert_equal expected, @a1.full_gem_path
|
1865
|
-
end
|
1866
|
-
|
1867
|
-
def test_full_name
|
1868
|
-
assert_equal 'a-1', @a1.full_name
|
1869
|
-
|
1870
|
-
@a1 = Gem::Specification.new "a", 1
|
1871
|
-
@a1.platform = Gem::Platform.new ['universal', 'darwin', nil]
|
1872
|
-
assert_equal 'a-1-universal-darwin', @a1.full_name
|
1873
|
-
|
1874
|
-
@a1 = Gem::Specification.new "a", 1
|
1875
|
-
@a1.instance_variable_set :@new_platform, 'mswin32'
|
1876
|
-
assert_equal 'a-1-mswin32', @a1.full_name, 'legacy'
|
1877
|
-
|
1878
|
-
return if win_platform?
|
1879
|
-
|
1880
|
-
@a1 = Gem::Specification.new "a", 1
|
1881
|
-
@a1.platform = 'current'
|
1882
|
-
assert_equal 'a-1-x86-darwin-8', @a1.full_name
|
1883
|
-
end
|
1884
|
-
|
1885
|
-
def test_full_name_windows
|
1886
|
-
test_cases = {
|
1887
|
-
'i386-mswin32' => 'a-1-x86-mswin32-60',
|
1888
|
-
'i386-mswin32_80' => 'a-1-x86-mswin32-80',
|
1889
|
-
'i386-mingw32' => 'a-1-x86-mingw32'
|
1890
|
-
}
|
1891
|
-
|
1892
|
-
test_cases.each do |arch, expected|
|
1893
|
-
@a1 = Gem::Specification.new "a", 1
|
1894
|
-
util_set_arch arch
|
1895
|
-
@a1.platform = 'current'
|
1896
|
-
assert_equal expected, @a1.full_name
|
1897
|
-
end
|
1898
|
-
end
|
1899
|
-
|
1900
|
-
def test_gem_build_complete_path
|
1901
|
-
expected = File.join @a1.extension_dir, 'gem.build_complete'
|
1902
|
-
assert_equal expected, @a1.gem_build_complete_path
|
1903
|
-
end
|
1904
|
-
|
1905
|
-
def test_hash
|
1906
|
-
assert_equal @a1.hash, @a1.hash
|
1907
|
-
assert_equal @a1.hash, @a1.dup.hash
|
1908
|
-
refute_equal @a1.hash, @a2.hash
|
1909
|
-
end
|
1910
|
-
|
1911
|
-
def test_installed_by_version
|
1912
|
-
assert_equal v(0), @a1.installed_by_version
|
1913
|
-
|
1914
|
-
@a1.installed_by_version = Gem.rubygems_version
|
1915
|
-
|
1916
|
-
assert_equal Gem.rubygems_version, @a1.installed_by_version
|
1917
|
-
end
|
1918
|
-
|
1919
|
-
def test_base_dir
|
1920
|
-
assert_equal @gemhome, @a1.base_dir
|
1921
|
-
end
|
1922
|
-
|
1923
|
-
def test_base_dir_not_loaded
|
1924
|
-
@a1.instance_variable_set :@loaded_from, nil
|
1925
|
-
|
1926
|
-
assert_equal Gem.dir, @a1.base_dir
|
1927
|
-
end
|
1928
|
-
|
1929
|
-
def test_base_dir_default
|
1930
|
-
default_dir =
|
1931
|
-
File.join Gem::Specification.default_specifications_dir, @a1.spec_name
|
1932
|
-
|
1933
|
-
@a1.instance_variable_set :@loaded_from, default_dir
|
1934
|
-
|
1935
|
-
assert_equal Gem.default_dir, @a1.base_dir
|
1936
|
-
end
|
1937
|
-
|
1938
|
-
def test_lib_files
|
1939
|
-
@a1.files = %w[lib/foo.rb Rakefile]
|
1940
|
-
|
1941
|
-
assert_equal %w[lib/foo.rb], @a1.lib_files
|
1942
|
-
end
|
1943
|
-
|
1944
|
-
def test_license
|
1945
|
-
assert_equal 'MIT', @a1.license
|
1946
|
-
end
|
1947
|
-
|
1948
|
-
def test_licenses
|
1949
|
-
assert_equal ['MIT'], @a1.licenses
|
1950
|
-
end
|
1951
|
-
|
1952
|
-
def test_name
|
1953
|
-
assert_equal 'a', @a1.name
|
1954
|
-
end
|
1955
|
-
|
1956
|
-
def test_original_name
|
1957
|
-
assert_equal 'a-1', @a1.full_name
|
1958
|
-
|
1959
|
-
@a1.platform = 'i386-linux'
|
1960
|
-
@a1.instance_variable_set :@original_platform, 'i386-linux'
|
1961
|
-
assert_equal 'a-1-i386-linux', @a1.original_name
|
1962
|
-
end
|
1963
|
-
|
1964
|
-
def test_platform
|
1965
|
-
assert_equal Gem::Platform::RUBY, @a1.platform
|
1966
|
-
end
|
1967
|
-
|
1968
|
-
def test_platform_change_reset_full_name
|
1969
|
-
orig_full_name = @a1.full_name
|
1970
|
-
|
1971
|
-
@a1.platform = "universal-unknown"
|
1972
|
-
refute_equal orig_full_name, @a1.full_name
|
1973
|
-
end
|
1974
|
-
|
1975
|
-
def test_platform_change_reset_cache_file
|
1976
|
-
orig_cache_file = @a1.cache_file
|
1977
|
-
|
1978
|
-
@a1.platform = "universal-unknown"
|
1979
|
-
refute_equal orig_cache_file, @a1.cache_file
|
1980
|
-
end
|
1981
|
-
|
1982
|
-
def test_platform_equals
|
1983
|
-
@a1.platform = nil
|
1984
|
-
assert_equal Gem::Platform::RUBY, @a1.platform
|
1985
|
-
|
1986
|
-
@a1.platform = Gem::Platform::RUBY
|
1987
|
-
assert_equal Gem::Platform::RUBY, @a1.platform
|
1988
|
-
|
1989
|
-
test_cases = {
|
1990
|
-
'i386-mswin32' => ['x86', 'mswin32', '60'],
|
1991
|
-
'i386-mswin32_80' => ['x86', 'mswin32', '80'],
|
1992
|
-
'i386-mingw32' => ['x86', 'mingw32', nil ],
|
1993
|
-
'x86-darwin8' => ['x86', 'darwin', '8' ],
|
1994
|
-
}
|
1995
|
-
|
1996
|
-
test_cases.each do |arch, expected|
|
1997
|
-
util_set_arch arch
|
1998
|
-
@a1.platform = Gem::Platform::CURRENT
|
1999
|
-
assert_equal Gem::Platform.new(expected), @a1.platform
|
2000
|
-
end
|
2001
|
-
end
|
2002
|
-
|
2003
|
-
def test_platform_equals_current
|
2004
|
-
@a1.platform = Gem::Platform::CURRENT
|
2005
|
-
assert_equal Gem::Platform.local, @a1.platform
|
2006
|
-
assert_equal Gem::Platform.local.to_s, @a1.original_platform
|
2007
|
-
end
|
2008
|
-
|
2009
|
-
def test_platform_equals_legacy
|
2010
|
-
@a1.platform = 'mswin32'
|
2011
|
-
assert_equal Gem::Platform.new('x86-mswin32'), @a1.platform
|
2012
|
-
|
2013
|
-
@a1.platform = 'i586-linux'
|
2014
|
-
assert_equal Gem::Platform.new('x86-linux'), @a1.platform
|
2015
|
-
|
2016
|
-
@a1.platform = 'powerpc-darwin'
|
2017
|
-
assert_equal Gem::Platform.new('ppc-darwin'), @a1.platform
|
2018
|
-
end
|
2019
|
-
|
2020
|
-
def test_prerelease_spec_adds_required_rubygems_version
|
2021
|
-
@prerelease = util_spec('tardis', '2.2.0.a')
|
2022
|
-
refute @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new('1.3.1'))
|
2023
|
-
assert @prerelease.required_rubygems_version.satisfied_by?(Gem::Version.new('1.4.0'))
|
2024
|
-
end
|
2025
|
-
|
2026
|
-
def test_require_paths
|
2027
|
-
enable_shared 'no' do
|
2028
|
-
ext_spec
|
2029
|
-
|
2030
|
-
@ext.require_paths = 'lib'
|
2031
|
-
|
2032
|
-
assert_equal [@ext.extension_dir, 'lib'], @ext.require_paths
|
2033
|
-
end
|
2034
|
-
end
|
2035
|
-
|
2036
|
-
def test_require_paths_default_ext_dir_for
|
2037
|
-
class << Gem
|
2038
|
-
send :alias_method, :orig_default_ext_dir_for, :default_ext_dir_for
|
2039
|
-
|
2040
|
-
remove_method :default_ext_dir_for
|
2041
|
-
end
|
2042
|
-
|
2043
|
-
def Gem.default_ext_dir_for base_dir
|
2044
|
-
'/foo'
|
2045
|
-
end
|
2046
|
-
|
2047
|
-
enable_shared 'no' do
|
2048
|
-
ext_spec
|
2049
|
-
|
2050
|
-
@ext.require_paths = 'lib'
|
2051
|
-
|
2052
|
-
assert_equal [File.expand_path('/foo/ext-1'), 'lib'], @ext.require_paths
|
2053
|
-
end
|
2054
|
-
ensure
|
2055
|
-
class << Gem
|
2056
|
-
send :remove_method, :default_ext_dir_for
|
2057
|
-
send :alias_method, :default_ext_dir_for, :orig_default_ext_dir_for
|
2058
|
-
send :remove_method, :orig_default_ext_dir_for
|
2059
|
-
end
|
2060
|
-
end
|
2061
|
-
|
2062
|
-
def test_source
|
2063
|
-
assert_kind_of Gem::Source::Installed, @a1.source
|
2064
|
-
end
|
2065
|
-
|
2066
|
-
def test_source_paths
|
2067
|
-
ext_spec
|
2068
|
-
|
2069
|
-
@ext.require_paths = %w[lib ext foo]
|
2070
|
-
@ext.extensions << 'bar/baz'
|
2071
|
-
|
2072
|
-
expected = %w[
|
2073
|
-
lib
|
2074
|
-
ext
|
2075
|
-
foo
|
2076
|
-
bar
|
2077
|
-
]
|
2078
|
-
|
2079
|
-
assert_equal expected, @ext.source_paths
|
2080
|
-
end
|
2081
|
-
|
2082
|
-
def test_full_require_paths
|
2083
|
-
ext_spec
|
2084
|
-
|
2085
|
-
@ext.require_paths = 'lib'
|
2086
|
-
|
2087
|
-
expected = [
|
2088
|
-
File.join(@gemhome, 'gems', @ext.original_name, 'lib'),
|
2089
|
-
@ext.extension_dir,
|
2090
|
-
]
|
2091
|
-
|
2092
|
-
assert_equal expected, @ext.full_require_paths
|
2093
|
-
end
|
2094
|
-
|
2095
|
-
def test_to_fullpath
|
2096
|
-
ext_spec
|
2097
|
-
|
2098
|
-
@ext.require_paths = 'lib'
|
2099
|
-
|
2100
|
-
dir = File.join(@gemhome, 'gems', @ext.original_name, 'lib')
|
2101
|
-
expected_rb = File.join(dir, 'code.rb')
|
2102
|
-
FileUtils.mkdir_p dir
|
2103
|
-
FileUtils.touch expected_rb
|
2104
|
-
|
2105
|
-
dir = @ext.extension_dir
|
2106
|
-
ext = RbConfig::CONFIG["DLEXT"]
|
2107
|
-
expected_so = File.join(dir, "ext.#{ext}")
|
2108
|
-
FileUtils.mkdir_p dir
|
2109
|
-
FileUtils.touch expected_so
|
2110
|
-
|
2111
|
-
assert_nil @ext.to_fullpath("code")
|
2112
|
-
assert_nil @ext.to_fullpath("code.rb")
|
2113
|
-
assert_nil @ext.to_fullpath("code.#{ext}")
|
2114
|
-
|
2115
|
-
assert_nil @ext.to_fullpath("ext")
|
2116
|
-
assert_nil @ext.to_fullpath("ext.rb")
|
2117
|
-
assert_nil @ext.to_fullpath("ext.#{ext}")
|
2118
|
-
|
2119
|
-
@ext.activate
|
2120
|
-
|
2121
|
-
assert_equal expected_rb, @ext.to_fullpath("code")
|
2122
|
-
assert_equal expected_rb, @ext.to_fullpath("code.rb")
|
2123
|
-
assert_nil @ext.to_fullpath("code.#{ext}")
|
2124
|
-
|
2125
|
-
assert_equal expected_so, @ext.to_fullpath("ext")
|
2126
|
-
assert_nil @ext.to_fullpath("ext.rb")
|
2127
|
-
assert_equal expected_so, @ext.to_fullpath("ext.#{ext}")
|
2128
|
-
|
2129
|
-
assert_nil @ext.to_fullpath("notexist")
|
2130
|
-
end
|
2131
|
-
|
2132
|
-
def test_fullpath_return_rb_extension_file_when_exist_the_same_name_file
|
2133
|
-
ext_spec
|
2134
|
-
|
2135
|
-
@ext.require_paths = 'lib'
|
2136
|
-
|
2137
|
-
dir = File.join(@gemhome, 'gems', @ext.original_name, 'lib')
|
2138
|
-
expected_rb = File.join(dir, 'code.rb')
|
2139
|
-
FileUtils.mkdir_p dir
|
2140
|
-
FileUtils.touch expected_rb
|
2141
|
-
|
2142
|
-
dir = @ext.extension_dir
|
2143
|
-
ext = RbConfig::CONFIG["DLEXT"]
|
2144
|
-
expected_so = File.join(dir, "code.#{ext}")
|
2145
|
-
FileUtils.mkdir_p dir
|
2146
|
-
FileUtils.touch expected_so
|
2147
|
-
|
2148
|
-
@ext.activate
|
2149
|
-
|
2150
|
-
assert_equal expected_rb, @ext.to_fullpath("code")
|
2151
|
-
end
|
2152
|
-
|
2153
|
-
def test_require_already_activated
|
2154
|
-
save_loaded_features do
|
2155
|
-
a1 = new_spec "a", "1", nil, "lib/d.rb"
|
2156
|
-
|
2157
|
-
install_specs a1 # , a2, b1, b2, c1, c2
|
2158
|
-
|
2159
|
-
a1.activate
|
2160
|
-
assert_equal %w(a-1), loaded_spec_names
|
2161
|
-
assert_equal [], unresolved_names
|
2162
|
-
|
2163
|
-
assert require "d"
|
2164
|
-
|
2165
|
-
assert_equal %w(a-1), loaded_spec_names
|
2166
|
-
assert_equal [], unresolved_names
|
2167
|
-
end
|
2168
|
-
end
|
2169
|
-
|
2170
|
-
def test_require_already_activated_indirect_conflict
|
2171
|
-
save_loaded_features do
|
2172
|
-
a1 = new_spec "a", "1", "b" => "> 0"
|
2173
|
-
a2 = new_spec "a", "2", "b" => "> 0"
|
2174
|
-
b1 = new_spec "b", "1", "c" => ">= 1"
|
2175
|
-
b2 = new_spec "b", "2", "c" => ">= 2"
|
2176
|
-
c1 = new_spec "c", "1", nil, "lib/d.rb"
|
2177
|
-
c2 = new_spec("c", "2", { "a" => "1" }, "lib/d.rb") # conflicts with a-2
|
2178
|
-
|
2179
|
-
install_specs c1, b1, a1, a2, c2, b2
|
2180
|
-
|
2181
|
-
a1.activate
|
2182
|
-
c1.activate
|
2183
|
-
assert_equal %w(a-1 c-1), loaded_spec_names
|
2184
|
-
assert_equal ["b (> 0)"], unresolved_names
|
2185
|
-
|
2186
|
-
assert require "d"
|
2187
|
-
|
2188
|
-
assert_equal %w(a-1 c-1), loaded_spec_names
|
2189
|
-
assert_equal ["b (> 0)"], unresolved_names
|
2190
|
-
end
|
2191
|
-
end
|
2192
|
-
|
2193
|
-
def test_requirements
|
2194
|
-
assert_equal ['A working computer'], @a1.requirements
|
2195
|
-
end
|
2196
|
-
|
2197
|
-
def test_allowed_push_host
|
2198
|
-
assert_equal nil, @a1.metadata['allowed_push_host']
|
2199
|
-
assert_equal 'https://privategemserver.com', @a3.metadata['allowed_push_host']
|
2200
|
-
end
|
2201
|
-
|
2202
|
-
def test_runtime_dependencies_legacy
|
2203
|
-
make_spec_c1
|
2204
|
-
# legacy gems don't have a type
|
2205
|
-
@c1.runtime_dependencies.each do |dep|
|
2206
|
-
dep.instance_variable_set :@type, nil
|
2207
|
-
end
|
2208
|
-
|
2209
|
-
expected = %w[rake jabber4r pqa]
|
2210
|
-
|
2211
|
-
assert_equal expected, @c1.runtime_dependencies.map { |d| d.name }
|
2212
|
-
end
|
2213
|
-
|
2214
|
-
def test_spaceship_name
|
2215
|
-
s1 = new_spec 'a', '1'
|
2216
|
-
s2 = new_spec 'b', '1'
|
2217
|
-
|
2218
|
-
assert_equal(-1, (s1 <=> s2))
|
2219
|
-
assert_equal( 0, (s1 <=> s1))
|
2220
|
-
assert_equal( 1, (s2 <=> s1))
|
2221
|
-
end
|
2222
|
-
|
2223
|
-
def test_spaceship_platform
|
2224
|
-
s1 = new_spec 'a', '1'
|
2225
|
-
s2 = new_spec 'a', '1' do |s|
|
2226
|
-
s.platform = Gem::Platform.new 'x86-my_platform1'
|
2227
|
-
end
|
2228
|
-
|
2229
|
-
assert_equal( -1, (s1 <=> s2))
|
2230
|
-
assert_equal( 0, (s1 <=> s1))
|
2231
|
-
assert_equal( 1, (s2 <=> s1))
|
2232
|
-
end
|
2233
|
-
|
2234
|
-
def test_spaceship_version
|
2235
|
-
s1 = new_spec 'a', '1'
|
2236
|
-
s2 = new_spec 'a', '2'
|
2237
|
-
|
2238
|
-
assert_equal( -1, (s1 <=> s2))
|
2239
|
-
assert_equal( 0, (s1 <=> s1))
|
2240
|
-
assert_equal( 1, (s2 <=> s1))
|
2241
|
-
end
|
2242
|
-
|
2243
|
-
def test_spec_file
|
2244
|
-
assert_equal File.join(@gemhome, 'specifications', 'a-1.gemspec'),
|
2245
|
-
@a1.spec_file
|
2246
|
-
end
|
2247
|
-
|
2248
|
-
def test_spec_name
|
2249
|
-
assert_equal 'a-1.gemspec', @a1.spec_name
|
2250
|
-
end
|
2251
|
-
|
2252
|
-
def test_summary
|
2253
|
-
assert_equal 'this is a summary', @a1.summary
|
2254
|
-
end
|
2255
|
-
|
2256
|
-
def test_test_files
|
2257
|
-
@a1.test_file = 'test/suite.rb'
|
2258
|
-
assert_equal ['test/suite.rb'], @a1.test_files
|
2259
|
-
end
|
2260
|
-
|
2261
|
-
def test_runtime_predicate_true
|
2262
|
-
@a2.add_runtime_dependency 'b', '1'
|
2263
|
-
assert_predicate @a2.dependencies.first, :runtime?
|
2264
|
-
|
2265
|
-
@a2.dependencies.first.instance_variable_set :@type, nil
|
2266
|
-
assert_predicate @a2.dependencies.first, :runtime?
|
2267
|
-
end
|
2268
|
-
|
2269
|
-
def test_runtime_predicate_false
|
2270
|
-
@a2.add_development_dependency 'b', '1'
|
2271
|
-
refute_predicate @a2.dependencies.first, :runtime?
|
2272
|
-
end
|
2273
|
-
|
2274
|
-
def test_to_ruby
|
2275
|
-
@a2.add_runtime_dependency 'b', '1'
|
2276
|
-
@a2.dependencies.first.instance_variable_set :@type, nil
|
2277
|
-
@a2.required_rubygems_version = Gem::Requirement.new '> 0'
|
2278
|
-
@a2.require_paths << 'other'
|
2279
|
-
|
2280
|
-
ruby_code = @a2.to_ruby
|
2281
|
-
|
2282
|
-
expected = <<-SPEC
|
2283
|
-
# -*- encoding: utf-8 -*-
|
2284
|
-
# stub: a 2 ruby lib\0other
|
2285
|
-
|
2286
|
-
Gem::Specification.new do |s|
|
2287
|
-
s.name = "a".freeze
|
2288
|
-
s.version = "2"
|
2289
|
-
|
2290
|
-
s.required_rubygems_version = Gem::Requirement.new(\"> 0\".freeze) if s.respond_to? :required_rubygems_version=
|
2291
|
-
s.require_paths = ["lib".freeze, "other".freeze]
|
2292
|
-
s.authors = ["A User".freeze]
|
2293
|
-
s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}"
|
2294
|
-
s.description = "This is a test description".freeze
|
2295
|
-
s.email = "example@example.com".freeze
|
2296
|
-
s.files = ["lib/code.rb".freeze]
|
2297
|
-
s.homepage = "http://example.com".freeze
|
2298
|
-
s.rubygems_version = "#{Gem::VERSION}".freeze
|
2299
|
-
s.summary = "this is a summary".freeze
|
2300
|
-
|
2301
|
-
if s.respond_to? :specification_version then
|
2302
|
-
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
|
2303
|
-
|
2304
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
2305
|
-
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
2306
|
-
else
|
2307
|
-
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
2308
|
-
end
|
2309
|
-
else
|
2310
|
-
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
2311
|
-
end
|
2312
|
-
end
|
2313
|
-
SPEC
|
2314
|
-
|
2315
|
-
assert_equal expected, ruby_code
|
2316
|
-
|
2317
|
-
same_spec = eval ruby_code
|
2318
|
-
|
2319
|
-
assert_equal @a2, same_spec
|
2320
|
-
end
|
2321
|
-
|
2322
|
-
def test_to_ruby_for_cache
|
2323
|
-
@a2.add_runtime_dependency 'b', '1'
|
2324
|
-
@a2.dependencies.first.instance_variable_set :@type, nil
|
2325
|
-
@a2.required_rubygems_version = Gem::Requirement.new '> 0'
|
2326
|
-
@a2.installed_by_version = Gem.rubygems_version
|
2327
|
-
|
2328
|
-
# cached specs do not have spec.files populated:
|
2329
|
-
ruby_code = @a2.to_ruby_for_cache
|
2330
|
-
|
2331
|
-
expected = <<-SPEC
|
2332
|
-
# -*- encoding: utf-8 -*-
|
2333
|
-
# stub: a 2 ruby lib
|
2334
|
-
|
2335
|
-
Gem::Specification.new do |s|
|
2336
|
-
s.name = "a".freeze
|
2337
|
-
s.version = "2"
|
2338
|
-
|
2339
|
-
s.required_rubygems_version = Gem::Requirement.new(\"> 0\".freeze) if s.respond_to? :required_rubygems_version=
|
2340
|
-
s.require_paths = ["lib".freeze]
|
2341
|
-
s.authors = ["A User".freeze]
|
2342
|
-
s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}"
|
2343
|
-
s.description = "This is a test description".freeze
|
2344
|
-
s.email = "example@example.com".freeze
|
2345
|
-
s.homepage = "http://example.com".freeze
|
2346
|
-
s.rubygems_version = "#{Gem::VERSION}".freeze
|
2347
|
-
s.summary = "this is a summary".freeze
|
2348
|
-
|
2349
|
-
s.installed_by_version = "#{Gem::VERSION}" if s.respond_to? :installed_by_version
|
2350
|
-
|
2351
|
-
if s.respond_to? :specification_version then
|
2352
|
-
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
|
2353
|
-
|
2354
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
2355
|
-
s.add_runtime_dependency(%q<b>.freeze, [\"= 1\"])
|
2356
|
-
else
|
2357
|
-
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
2358
|
-
end
|
2359
|
-
else
|
2360
|
-
s.add_dependency(%q<b>.freeze, [\"= 1\"])
|
2361
|
-
end
|
2362
|
-
end
|
2363
|
-
SPEC
|
2364
|
-
|
2365
|
-
assert_equal expected, ruby_code
|
2366
|
-
|
2367
|
-
same_spec = eval ruby_code
|
2368
|
-
|
2369
|
-
# cached specs do not have spec.files populated:
|
2370
|
-
@a2.files = []
|
2371
|
-
assert_equal @a2, same_spec
|
2372
|
-
end
|
2373
|
-
|
2374
|
-
def test_to_ruby_fancy
|
2375
|
-
make_spec_c1
|
2376
|
-
|
2377
|
-
@c1.platform = Gem::Platform.local
|
2378
|
-
ruby_code = @c1.to_ruby
|
2379
|
-
|
2380
|
-
local = Gem::Platform.local
|
2381
|
-
expected_platform = "[#{local.cpu.inspect}, #{local.os.inspect}, #{local.version.inspect}]"
|
2382
|
-
stub_require_paths =
|
2383
|
-
@c1.instance_variable_get(:@require_paths).join "\u0000"
|
2384
|
-
extensions = @c1.extensions.join "\u0000"
|
2385
|
-
|
2386
|
-
expected = <<-SPEC
|
2387
|
-
# -*- encoding: utf-8 -*-
|
2388
|
-
# stub: a 1 #{win_platform? ? "x86-mswin32-60" : "x86-darwin-8"} #{stub_require_paths}
|
2389
|
-
# stub: #{extensions}
|
2390
|
-
|
2391
|
-
Gem::Specification.new do |s|
|
2392
|
-
s.name = "a".freeze
|
2393
|
-
s.version = "1"
|
2394
|
-
s.platform = Gem::Platform.new(#{expected_platform})
|
2395
|
-
|
2396
|
-
s.required_rubygems_version = Gem::Requirement.new(\">= 0\".freeze) if s.respond_to? :required_rubygems_version=
|
2397
|
-
s.require_paths = ["lib".freeze]
|
2398
|
-
s.authors = ["A User".freeze]
|
2399
|
-
s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}"
|
2400
|
-
s.description = "This is a test description".freeze
|
2401
|
-
s.email = "example@example.com".freeze
|
2402
|
-
s.executables = ["exec".freeze]
|
2403
|
-
s.extensions = ["ext/a/extconf.rb".freeze]
|
2404
|
-
s.files = ["bin/exec".freeze, "ext/a/extconf.rb".freeze, "lib/code.rb".freeze, "test/suite.rb".freeze]
|
2405
|
-
s.homepage = "http://example.com".freeze
|
2406
|
-
s.licenses = ["MIT".freeze]
|
2407
|
-
s.requirements = ["A working computer".freeze]
|
2408
|
-
s.rubyforge_project = "example".freeze
|
2409
|
-
s.rubygems_version = "#{Gem::VERSION}".freeze
|
2410
|
-
s.summary = "this is a summary".freeze
|
2411
|
-
s.test_files = ["test/suite.rb".freeze]
|
2412
|
-
|
2413
|
-
if s.respond_to? :specification_version then
|
2414
|
-
s.specification_version = 4
|
2415
|
-
|
2416
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
2417
|
-
s.add_runtime_dependency(%q<rake>.freeze, [\"> 0.4\"])
|
2418
|
-
s.add_runtime_dependency(%q<jabber4r>.freeze, [\"> 0.0.0\"])
|
2419
|
-
s.add_runtime_dependency(%q<pqa>.freeze, [\"<= 0.6\", \"> 0.4\"])
|
2420
|
-
else
|
2421
|
-
s.add_dependency(%q<rake>.freeze, [\"> 0.4\"])
|
2422
|
-
s.add_dependency(%q<jabber4r>.freeze, [\"> 0.0.0\"])
|
2423
|
-
s.add_dependency(%q<pqa>.freeze, [\"<= 0.6\", \"> 0.4\"])
|
2424
|
-
end
|
2425
|
-
else
|
2426
|
-
s.add_dependency(%q<rake>.freeze, [\"> 0.4\"])
|
2427
|
-
s.add_dependency(%q<jabber4r>.freeze, [\"> 0.0.0\"])
|
2428
|
-
s.add_dependency(%q<pqa>.freeze, [\"<= 0.6\", \"> 0.4\"])
|
2429
|
-
end
|
2430
|
-
end
|
2431
|
-
SPEC
|
2432
|
-
|
2433
|
-
assert_equal expected, ruby_code
|
2434
|
-
|
2435
|
-
same_spec = eval ruby_code
|
2436
|
-
|
2437
|
-
assert_equal @c1, same_spec
|
2438
|
-
end
|
2439
|
-
|
2440
|
-
def test_to_ruby_legacy
|
2441
|
-
gemspec1 = Gem::Deprecate.skip_during do
|
2442
|
-
eval LEGACY_RUBY_SPEC
|
2443
|
-
end
|
2444
|
-
ruby_code = gemspec1.to_ruby
|
2445
|
-
gemspec2 = eval ruby_code
|
2446
|
-
|
2447
|
-
assert_equal gemspec1, gemspec2
|
2448
|
-
end
|
2449
|
-
|
2450
|
-
def test_to_ruby_nested_hash
|
2451
|
-
metadata = {}
|
2452
|
-
metadata[metadata] = metadata
|
2453
|
-
|
2454
|
-
@a2.metadata = metadata
|
2455
|
-
|
2456
|
-
ruby = @a2.to_ruby
|
2457
|
-
|
2458
|
-
assert_match %r%^ s\.metadata = \{ "%, ruby
|
2459
|
-
end
|
2460
|
-
|
2461
|
-
def test_to_ruby_platform
|
2462
|
-
@a2.platform = Gem::Platform.local
|
2463
|
-
@a2.instance_variable_set :@original_platform, 'old_platform'
|
2464
|
-
|
2465
|
-
ruby_code = @a2.to_ruby
|
2466
|
-
|
2467
|
-
same_spec = eval ruby_code
|
2468
|
-
|
2469
|
-
assert_equal 'old_platform', same_spec.original_platform
|
2470
|
-
end
|
2471
|
-
|
2472
|
-
def test_to_yaml
|
2473
|
-
yaml_str = @a1.to_yaml
|
2474
|
-
|
2475
|
-
refute_match '!!null', yaml_str
|
2476
|
-
|
2477
|
-
same_spec = Gem::Specification.from_yaml(yaml_str)
|
2478
|
-
|
2479
|
-
assert_equal @a1, same_spec
|
2480
|
-
end
|
2481
|
-
|
2482
|
-
def test_to_yaml_fancy
|
2483
|
-
@a1.platform = Gem::Platform.local
|
2484
|
-
yaml_str = @a1.to_yaml
|
2485
|
-
|
2486
|
-
same_spec = Gem::Specification.from_yaml(yaml_str)
|
2487
|
-
|
2488
|
-
assert_equal Gem::Platform.local, same_spec.platform
|
2489
|
-
|
2490
|
-
assert_equal @a1, same_spec
|
2491
|
-
end
|
2492
|
-
|
2493
|
-
def test_to_yaml_platform_empty_string
|
2494
|
-
@a1.instance_variable_set :@original_platform, ''
|
2495
|
-
|
2496
|
-
assert_match %r|^platform: ruby$|, @a1.to_yaml
|
2497
|
-
end
|
2498
|
-
|
2499
|
-
def test_to_yaml_platform_legacy
|
2500
|
-
@a1.platform = 'powerpc-darwin7.9.0'
|
2501
|
-
@a1.instance_variable_set :@original_platform, 'powerpc-darwin7.9.0'
|
2502
|
-
|
2503
|
-
yaml_str = @a1.to_yaml
|
2504
|
-
|
2505
|
-
same_spec = YAML.load yaml_str
|
2506
|
-
|
2507
|
-
assert_equal Gem::Platform.new('powerpc-darwin7'), same_spec.platform
|
2508
|
-
assert_equal 'powerpc-darwin7.9.0', same_spec.original_platform
|
2509
|
-
end
|
2510
|
-
|
2511
|
-
def test_to_yaml_platform_nil
|
2512
|
-
@a1.instance_variable_set :@original_platform, nil
|
2513
|
-
|
2514
|
-
assert_match %r|^platform: ruby$|, @a1.to_yaml
|
2515
|
-
end
|
2516
|
-
|
2517
|
-
def test_validate
|
2518
|
-
util_setup_validate
|
2519
|
-
|
2520
|
-
Dir.chdir @tempdir do
|
2521
|
-
assert @a1.validate
|
2522
|
-
end
|
2523
|
-
end
|
2524
|
-
|
2525
|
-
def x s; s.gsub(/xxx/, ''); end
|
2526
|
-
def w; x "WARxxxNING"; end
|
2527
|
-
def t; x "TOxxxDO"; end
|
2528
|
-
def f; x "FxxxIXME"; end
|
2529
|
-
|
2530
|
-
def test_validate_authors
|
2531
|
-
util_setup_validate
|
2532
|
-
|
2533
|
-
Dir.chdir @tempdir do
|
2534
|
-
@a1.authors = [""]
|
2535
|
-
|
2536
|
-
use_ui @ui do
|
2537
|
-
@a1.validate
|
2538
|
-
end
|
2539
|
-
|
2540
|
-
assert_match "#{w}: no author specified\n", @ui.error, 'error'
|
2541
|
-
|
2542
|
-
@a1.authors = [Object.new]
|
2543
|
-
|
2544
|
-
assert_equal [], @a1.authors
|
2545
|
-
|
2546
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2547
|
-
@a1.validate
|
2548
|
-
end
|
2549
|
-
|
2550
|
-
assert_equal "authors may not be empty", e.message
|
2551
|
-
|
2552
|
-
@a1.authors = ["#{f} (who is writing this software)"]
|
2553
|
-
|
2554
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2555
|
-
@a1.validate
|
2556
|
-
end
|
2557
|
-
|
2558
|
-
assert_equal %{"#{f}" or "#{t}" is not an author}, e.message
|
2559
|
-
|
2560
|
-
@a1.authors = ["#{t} (who is writing this software)"]
|
2561
|
-
|
2562
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2563
|
-
@a1.validate
|
2564
|
-
end
|
2565
|
-
|
2566
|
-
assert_equal %{"#{f}" or "#{t}" is not an author}, e.message
|
2567
|
-
end
|
2568
|
-
end
|
2569
|
-
|
2570
|
-
def test_validate_autorequire
|
2571
|
-
util_setup_validate
|
2572
|
-
|
2573
|
-
Dir.chdir @tempdir do
|
2574
|
-
@a1.autorequire = 'code'
|
2575
|
-
|
2576
|
-
use_ui @ui do
|
2577
|
-
@a1.validate
|
2578
|
-
end
|
2579
|
-
|
2580
|
-
assert_match "#{w}: deprecated autorequire specified\n",
|
2581
|
-
@ui.error, 'error'
|
2582
|
-
end
|
2583
|
-
end
|
2584
|
-
|
2585
|
-
def test_validate_dependencies
|
2586
|
-
util_setup_validate
|
2587
|
-
|
2588
|
-
Dir.chdir @tempdir do
|
2589
|
-
@a1.add_runtime_dependency 'b', '>= 1.0.rc1'
|
2590
|
-
@a1.add_development_dependency 'c', '>= 2.0.rc2'
|
2591
|
-
@a1.add_runtime_dependency 'd', '~> 1.2.3'
|
2592
|
-
@a1.add_runtime_dependency 'e', '~> 1.2.3.4'
|
2593
|
-
@a1.add_runtime_dependency 'g', '~> 1.2.3', '>= 1.2.3.4'
|
2594
|
-
@a1.add_runtime_dependency 'h', '>= 1.2.3', '<= 2'
|
2595
|
-
@a1.add_runtime_dependency 'i', '>= 1.2'
|
2596
|
-
@a1.add_runtime_dependency 'j', '>= 1.2.3'
|
2597
|
-
@a1.add_runtime_dependency 'k', '> 1.2'
|
2598
|
-
@a1.add_runtime_dependency 'l', '> 1.2.3'
|
2599
|
-
@a1.add_runtime_dependency 'm', '~> 2.1.0'
|
2600
|
-
@a1.add_runtime_dependency 'n', '~> 0.1.0'
|
2601
|
-
|
2602
|
-
use_ui @ui do
|
2603
|
-
@a1.validate
|
2604
|
-
end
|
2605
|
-
|
2606
|
-
expected = <<-EXPECTED
|
2607
|
-
#{w}: prerelease dependency on b (>= 1.0.rc1) is not recommended
|
2608
|
-
#{w}: prerelease dependency on c (>= 2.0.rc2, development) is not recommended
|
2609
|
-
#{w}: pessimistic dependency on d (~> 1.2.3) may be overly strict
|
2610
|
-
if d is semantically versioned, use:
|
2611
|
-
add_runtime_dependency 'd', '~> 1.2', '>= 1.2.3'
|
2612
|
-
#{w}: pessimistic dependency on e (~> 1.2.3.4) may be overly strict
|
2613
|
-
if e is semantically versioned, use:
|
2614
|
-
add_runtime_dependency 'e', '~> 1.2', '>= 1.2.3.4'
|
2615
|
-
#{w}: open-ended dependency on i (>= 1.2) is not recommended
|
2616
|
-
if i is semantically versioned, use:
|
2617
|
-
add_runtime_dependency 'i', '~> 1.2'
|
2618
|
-
#{w}: open-ended dependency on j (>= 1.2.3) is not recommended
|
2619
|
-
if j is semantically versioned, use:
|
2620
|
-
add_runtime_dependency 'j', '~> 1.2', '>= 1.2.3'
|
2621
|
-
#{w}: open-ended dependency on k (> 1.2) is not recommended
|
2622
|
-
if k is semantically versioned, use:
|
2623
|
-
add_runtime_dependency 'k', '~> 1.2', '> 1.2'
|
2624
|
-
#{w}: open-ended dependency on l (> 1.2.3) is not recommended
|
2625
|
-
if l is semantically versioned, use:
|
2626
|
-
add_runtime_dependency 'l', '~> 1.2', '> 1.2.3'
|
2627
|
-
#{w}: pessimistic dependency on m (~> 2.1.0) may be overly strict
|
2628
|
-
if m is semantically versioned, use:
|
2629
|
-
add_runtime_dependency 'm', '~> 2.1', '>= 2.1.0'
|
2630
|
-
#{w}: See http://guides.rubygems.org/specification-reference/ for help
|
2631
|
-
EXPECTED
|
2632
|
-
|
2633
|
-
assert_equal expected, @ui.error, 'warning'
|
2634
|
-
end
|
2635
|
-
end
|
2636
|
-
|
2637
|
-
def test_validate_dependencies_duplicates
|
2638
|
-
util_setup_validate
|
2639
|
-
|
2640
|
-
Dir.chdir @tempdir do
|
2641
|
-
@a1.add_runtime_dependency 'b', '~> 1.2'
|
2642
|
-
@a1.add_runtime_dependency 'b', '>= 1.2.3'
|
2643
|
-
@a1.add_development_dependency 'c', '~> 1.2'
|
2644
|
-
@a1.add_development_dependency 'c', '>= 1.2.3'
|
2645
|
-
|
2646
|
-
use_ui @ui do
|
2647
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2648
|
-
@a1.validate
|
2649
|
-
end
|
2650
|
-
|
2651
|
-
expected = <<-EXPECTED
|
2652
|
-
duplicate dependency on b (>= 1.2.3), (~> 1.2) use:
|
2653
|
-
add_runtime_dependency 'b', '>= 1.2.3', '~> 1.2'
|
2654
|
-
duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
|
2655
|
-
add_development_dependency 'c', '>= 1.2.3', '~> 1.2'
|
2656
|
-
EXPECTED
|
2657
|
-
|
2658
|
-
assert_equal expected, e.message
|
2659
|
-
end
|
2660
|
-
|
2661
|
-
assert_equal <<-EXPECTED, @ui.error
|
2662
|
-
#{w}: See http://guides.rubygems.org/specification-reference/ for help
|
2663
|
-
EXPECTED
|
2664
|
-
end
|
2665
|
-
end
|
2666
|
-
|
2667
|
-
def test_validate_dependencies_allowed_duplicates
|
2668
|
-
util_setup_validate
|
2669
|
-
|
2670
|
-
Dir.chdir @tempdir do
|
2671
|
-
@a1.add_runtime_dependency 'b', '~> 1.2'
|
2672
|
-
@a1.add_development_dependency 'b', '= 1.2.3'
|
2673
|
-
|
2674
|
-
use_ui @ui do
|
2675
|
-
@a1.validate
|
2676
|
-
end
|
2677
|
-
|
2678
|
-
assert_equal '', @ui.error, 'warning'
|
2679
|
-
end
|
2680
|
-
end
|
2681
|
-
|
2682
|
-
def test_validate_prerelease_dependencies_with_prerelease_version
|
2683
|
-
util_setup_validate
|
2684
|
-
|
2685
|
-
Dir.chdir @tempdir do
|
2686
|
-
@a1.version = '1.0.0.beta.1'
|
2687
|
-
@a1.add_runtime_dependency 'b', '~> 1.2.0.beta.1'
|
2688
|
-
|
2689
|
-
use_ui @ui do
|
2690
|
-
@a1.validate
|
2691
|
-
end
|
2692
|
-
|
2693
|
-
assert_equal '', @ui.error, 'warning'
|
2694
|
-
end
|
2695
|
-
end
|
2696
|
-
|
2697
|
-
def test_validate_description
|
2698
|
-
util_setup_validate
|
2699
|
-
|
2700
|
-
Dir.chdir @tempdir do
|
2701
|
-
@a1.description = ''
|
2702
|
-
|
2703
|
-
use_ui @ui do
|
2704
|
-
@a1.validate
|
2705
|
-
end
|
2706
|
-
|
2707
|
-
@ui = Gem::MockGemUi.new
|
2708
|
-
@a1.summary = "this is my summary"
|
2709
|
-
@a1.description = @a1.summary
|
2710
|
-
|
2711
|
-
use_ui @ui do
|
2712
|
-
@a1.validate
|
2713
|
-
end
|
2714
|
-
|
2715
|
-
assert_match "#{w}: description and summary are identical\n",
|
2716
|
-
@ui.error, "error"
|
2717
|
-
|
2718
|
-
@a1.description = "#{f} (describe your package)"
|
2719
|
-
|
2720
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2721
|
-
@a1.validate
|
2722
|
-
end
|
2723
|
-
|
2724
|
-
assert_equal %{"#{f}" or "#{t}" is not a description}, e.message
|
2725
|
-
|
2726
|
-
@a1.description = "#{t} (describe your package)"
|
2727
|
-
|
2728
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2729
|
-
@a1.validate
|
2730
|
-
end
|
2731
|
-
|
2732
|
-
assert_equal %{"#{f}" or "#{t}" is not a description}, e.message
|
2733
|
-
end
|
2734
|
-
end
|
2735
|
-
|
2736
|
-
def test_validate_email
|
2737
|
-
util_setup_validate
|
2738
|
-
|
2739
|
-
Dir.chdir @tempdir do
|
2740
|
-
@a1.email = ""
|
2741
|
-
|
2742
|
-
use_ui @ui do
|
2743
|
-
@a1.validate
|
2744
|
-
end
|
2745
|
-
|
2746
|
-
assert_match "#{w}: no email specified\n", @ui.error, "error"
|
2747
|
-
|
2748
|
-
@a1.email = "FIxxxXME (your e-mail)".sub(/xxx/, "")
|
2749
|
-
|
2750
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2751
|
-
@a1.validate
|
2752
|
-
end
|
2753
|
-
|
2754
|
-
assert_equal %{"#{f}" or "#{t}" is not an email}, e.message
|
2755
|
-
|
2756
|
-
@a1.email = "#{t} (your e-mail)"
|
2757
|
-
|
2758
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2759
|
-
@a1.validate
|
2760
|
-
end
|
2761
|
-
|
2762
|
-
assert_equal %{"#{f}" or "#{t}" is not an email}, e.message
|
2763
|
-
end
|
2764
|
-
end
|
2765
|
-
|
2766
|
-
def test_validate_empty
|
2767
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2768
|
-
Gem::Specification.new.validate
|
2769
|
-
end
|
2770
|
-
|
2771
|
-
assert_equal 'missing value for attribute name', e.message
|
2772
|
-
end
|
2773
|
-
|
2774
|
-
def test_validate_error
|
2775
|
-
assert_raises Gem::InvalidSpecificationException do
|
2776
|
-
use_ui @ui do
|
2777
|
-
Gem::Specification.new.validate
|
2778
|
-
end
|
2779
|
-
end
|
2780
|
-
|
2781
|
-
assert_match 'See http://guides.rubygems.org/specification-reference/ for help', @ui.error
|
2782
|
-
end
|
2783
|
-
|
2784
|
-
def test_validate_executables
|
2785
|
-
util_setup_validate
|
2786
|
-
|
2787
|
-
FileUtils.mkdir_p File.join(@tempdir, 'bin')
|
2788
|
-
File.open File.join(@tempdir, 'bin', 'exec'), 'w' do end
|
2789
|
-
FileUtils.mkdir_p File.join(@tempdir, 'exec')
|
2790
|
-
|
2791
|
-
use_ui @ui do
|
2792
|
-
Dir.chdir @tempdir do
|
2793
|
-
assert @a1.validate
|
2794
|
-
end
|
2795
|
-
end
|
2796
|
-
|
2797
|
-
assert_equal %w[exec], @a1.executables
|
2798
|
-
|
2799
|
-
assert_equal '', @ui.output, 'output'
|
2800
|
-
assert_match "#{w}: bin/exec is missing #! line\n", @ui.error, 'error'
|
2801
|
-
end
|
2802
|
-
|
2803
|
-
def test_validate_empty_require_paths
|
2804
|
-
if win_platform? then
|
2805
|
-
skip 'test_validate_empty_require_paths skipped on MS Windows (symlink)'
|
2806
|
-
else
|
2807
|
-
util_setup_validate
|
2808
|
-
|
2809
|
-
@a1.require_paths = []
|
2810
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2811
|
-
@a1.validate
|
2812
|
-
end
|
2813
|
-
|
2814
|
-
assert_equal 'specification must have at least one require_path',
|
2815
|
-
e.message
|
2816
|
-
end
|
2817
|
-
end
|
2818
|
-
|
2819
|
-
def test_validate_files
|
2820
|
-
skip 'test_validate_files skipped on MS Windows (symlink)' if win_platform?
|
2821
|
-
util_setup_validate
|
2822
|
-
|
2823
|
-
@a1.files += ['lib', 'lib2']
|
2824
|
-
@a1.extensions << 'ext/a/extconf.rb'
|
2825
|
-
|
2826
|
-
Dir.chdir @tempdir do
|
2827
|
-
FileUtils.ln_s 'lib/code.rb', 'lib2' unless vc_windows?
|
2828
|
-
|
2829
|
-
use_ui @ui do
|
2830
|
-
@a1.validate
|
2831
|
-
end
|
2832
|
-
|
2833
|
-
assert_match 'WARNING: lib2 is a symlink, which is not supported on all platforms', @ui.error
|
2834
|
-
end
|
2835
|
-
|
2836
|
-
assert_equal %w[bin/exec ext/a/extconf.rb lib/code.rb lib2 test/suite.rb].sort,
|
2837
|
-
@a1.files
|
2838
|
-
end
|
2839
|
-
|
2840
|
-
def test_validate_files_recursive
|
2841
|
-
util_setup_validate
|
2842
|
-
FileUtils.touch @a1.file_name
|
2843
|
-
|
2844
|
-
@a1.files = [@a1.file_name]
|
2845
|
-
|
2846
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2847
|
-
@a1.validate
|
2848
|
-
end
|
2849
|
-
|
2850
|
-
assert_equal "#{@a1.full_name} contains itself (#{@a1.file_name}), check your files list",
|
2851
|
-
e.message
|
2852
|
-
end
|
2853
|
-
|
2854
|
-
def test_validate_homepage
|
2855
|
-
util_setup_validate
|
2856
|
-
|
2857
|
-
Dir.chdir @tempdir do
|
2858
|
-
@a1.homepage = nil
|
2859
|
-
|
2860
|
-
use_ui @ui do
|
2861
|
-
@a1.validate
|
2862
|
-
end
|
2863
|
-
|
2864
|
-
assert_match "#{w}: no homepage specified\n", @ui.error, 'error'
|
2865
|
-
|
2866
|
-
@ui = Gem::MockGemUi.new
|
2867
|
-
|
2868
|
-
@a1.homepage = ''
|
2869
|
-
|
2870
|
-
use_ui @ui do
|
2871
|
-
@a1.validate
|
2872
|
-
end
|
2873
|
-
|
2874
|
-
assert_match "#{w}: no homepage specified\n", @ui.error, 'error'
|
2875
|
-
|
2876
|
-
@a1.homepage = 'over at my cool site'
|
2877
|
-
|
2878
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2879
|
-
@a1.validate
|
2880
|
-
end
|
2881
|
-
|
2882
|
-
assert_equal '"over at my cool site" is not a URI', e.message
|
2883
|
-
end
|
2884
|
-
end
|
2885
|
-
|
2886
|
-
def test_validate_license
|
2887
|
-
util_setup_validate
|
2888
|
-
|
2889
|
-
use_ui @ui do
|
2890
|
-
@a1.licenses.clear
|
2891
|
-
@a1.validate
|
2892
|
-
end
|
2893
|
-
|
2894
|
-
assert_match <<-warning, @ui.error
|
2895
|
-
WARNING: licenses is empty, but is recommended. Use a license identifier from
|
2896
|
-
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
2897
|
-
warning
|
2898
|
-
end
|
2899
|
-
|
2900
|
-
def test_validate_license_values
|
2901
|
-
util_setup_validate
|
2902
|
-
|
2903
|
-
use_ui @ui do
|
2904
|
-
@a1.licenses = ['BSD']
|
2905
|
-
@a1.validate
|
2906
|
-
end
|
2907
|
-
|
2908
|
-
assert_match <<-warning, @ui.error
|
2909
|
-
WARNING: license value 'BSD' is invalid. Use a license identifier from
|
2910
|
-
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
2911
|
-
warning
|
2912
|
-
end
|
2913
|
-
|
2914
|
-
def test_validate_license_values_plus
|
2915
|
-
util_setup_validate
|
2916
|
-
|
2917
|
-
use_ui @ui do
|
2918
|
-
@a1.licenses = ['GPL-2.0+']
|
2919
|
-
@a1.validate
|
2920
|
-
end
|
2921
|
-
|
2922
|
-
assert_empty @ui.error
|
2923
|
-
end
|
2924
|
-
|
2925
|
-
def test_validate_license_values_with
|
2926
|
-
util_setup_validate
|
2927
|
-
|
2928
|
-
use_ui @ui do
|
2929
|
-
@a1.licenses = ['GPL-2.0+ WITH Autoconf-exception-2.0']
|
2930
|
-
@a1.validate
|
2931
|
-
end
|
2932
|
-
|
2933
|
-
assert_empty @ui.error
|
2934
|
-
end
|
2935
|
-
|
2936
|
-
def test_validate_license_with_nonsense_suffix
|
2937
|
-
util_setup_validate
|
2938
|
-
|
2939
|
-
use_ui @ui do
|
2940
|
-
@a1.licenses = ['GPL-2.0+ FOO', 'GPL-2.0 FOO']
|
2941
|
-
@a1.validate
|
2942
|
-
end
|
2943
|
-
|
2944
|
-
assert_match <<-warning, @ui.error
|
2945
|
-
WARNING: license value 'GPL-2.0+ FOO' is invalid. Use a license identifier from
|
2946
|
-
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
2947
|
-
warning
|
2948
|
-
assert_match <<-warning, @ui.error
|
2949
|
-
WARNING: license value 'GPL-2.0 FOO' is invalid. Use a license identifier from
|
2950
|
-
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
2951
|
-
warning
|
2952
|
-
end
|
2953
|
-
|
2954
|
-
def test_validate_license_gives_suggestions
|
2955
|
-
util_setup_validate
|
2956
|
-
|
2957
|
-
use_ui @ui do
|
2958
|
-
@a1.licenses = ['ruby']
|
2959
|
-
@a1.validate
|
2960
|
-
end
|
2961
|
-
|
2962
|
-
assert_match <<-warning, @ui.error
|
2963
|
-
WARNING: license value 'ruby' is invalid. Use a license identifier from
|
2964
|
-
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
|
2965
|
-
Did you mean 'Ruby'?
|
2966
|
-
warning
|
2967
|
-
end
|
2968
|
-
|
2969
|
-
def test_validate_name
|
2970
|
-
util_setup_validate
|
2971
|
-
|
2972
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2973
|
-
@a1.name = :json
|
2974
|
-
@a1.validate
|
2975
|
-
end
|
2976
|
-
|
2977
|
-
assert_equal 'invalid value for attribute name: ":json"', e.message
|
2978
|
-
end
|
2979
|
-
|
2980
|
-
def test_validate_non_nil
|
2981
|
-
util_setup_validate
|
2982
|
-
|
2983
|
-
Dir.chdir @tempdir do
|
2984
|
-
assert @a1.validate
|
2985
|
-
|
2986
|
-
Gem::Specification.non_nil_attributes.each do |name|
|
2987
|
-
next if name == :files # set by #normalize
|
2988
|
-
spec = @a1.dup
|
2989
|
-
spec.instance_variable_set "@#{name}", nil
|
2990
|
-
|
2991
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
2992
|
-
spec.validate
|
2993
|
-
end
|
2994
|
-
|
2995
|
-
assert_match %r%^#{name}%, e.message
|
2996
|
-
end
|
2997
|
-
end
|
2998
|
-
end
|
2999
|
-
|
3000
|
-
def test_validate_permissions
|
3001
|
-
skip 'chmod not supported' if Gem.win_platform?
|
3002
|
-
|
3003
|
-
util_setup_validate
|
3004
|
-
|
3005
|
-
Dir.chdir @tempdir do
|
3006
|
-
File.chmod 0640, File.join('lib', 'code.rb')
|
3007
|
-
File.chmod 0640, File.join('bin', 'exec')
|
3008
|
-
|
3009
|
-
use_ui @ui do
|
3010
|
-
@a1.validate
|
3011
|
-
end
|
3012
|
-
|
3013
|
-
assert_match "#{w}: lib/code.rb is not world-readable\n", @ui.error
|
3014
|
-
assert_match "#{w}: bin/exec is not world-readable\n", @ui.error
|
3015
|
-
assert_match "#{w}: bin/exec is not executable\n", @ui.error
|
3016
|
-
end
|
3017
|
-
end
|
3018
|
-
|
3019
|
-
def test_validate_permissions_of_missing_file_non_packaging
|
3020
|
-
skip 'chmod not supported' if Gem.win_platform?
|
3021
|
-
|
3022
|
-
util_setup_validate
|
3023
|
-
|
3024
|
-
Dir.chdir @tempdir do
|
3025
|
-
File.delete File.join('lib', 'code.rb')
|
3026
|
-
|
3027
|
-
use_ui @ui do
|
3028
|
-
assert @a1.validate(false)
|
3029
|
-
end
|
3030
|
-
end
|
3031
|
-
end
|
3032
|
-
|
3033
|
-
def test_validate_platform_legacy
|
3034
|
-
util_setup_validate
|
3035
|
-
|
3036
|
-
Dir.chdir @tempdir do
|
3037
|
-
@a1.platform = 'mswin32'
|
3038
|
-
assert @a1.validate
|
3039
|
-
|
3040
|
-
@a1.platform = 'i586-linux'
|
3041
|
-
assert @a1.validate
|
3042
|
-
|
3043
|
-
@a1.platform = 'powerpc-darwin'
|
3044
|
-
assert @a1.validate
|
3045
|
-
end
|
3046
|
-
end
|
3047
|
-
|
3048
|
-
def test_validate_rubygems_version
|
3049
|
-
util_setup_validate
|
3050
|
-
|
3051
|
-
@a1.rubygems_version = "3"
|
3052
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
3053
|
-
@a1.validate
|
3054
|
-
end
|
3055
|
-
|
3056
|
-
assert_equal "expected RubyGems version #{Gem::VERSION}, was 3",
|
3057
|
-
e.message
|
3058
|
-
end
|
3059
|
-
|
3060
|
-
def test_validate_specification_version
|
3061
|
-
util_setup_validate
|
3062
|
-
|
3063
|
-
Dir.chdir @tempdir do
|
3064
|
-
@a1.specification_version = '1.0'
|
3065
|
-
|
3066
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
3067
|
-
use_ui @ui do
|
3068
|
-
@a1.validate
|
3069
|
-
end
|
3070
|
-
end
|
3071
|
-
|
3072
|
-
err = 'specification_version must be a Fixnum (did you mean version?)'
|
3073
|
-
assert_equal err, e.message
|
3074
|
-
end
|
3075
|
-
end
|
3076
|
-
|
3077
|
-
def test_validate_summary
|
3078
|
-
util_setup_validate
|
3079
|
-
|
3080
|
-
Dir.chdir @tempdir do
|
3081
|
-
@a1.summary = ''
|
3082
|
-
|
3083
|
-
use_ui @ui do
|
3084
|
-
@a1.validate
|
3085
|
-
end
|
3086
|
-
|
3087
|
-
assert_match "#{w}: no summary specified\n", @ui.error, 'error'
|
3088
|
-
|
3089
|
-
@a1.summary = "#{f} (describe your package)"
|
3090
|
-
|
3091
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
3092
|
-
@a1.validate
|
3093
|
-
end
|
3094
|
-
|
3095
|
-
assert_equal %{"#{f}" or "#{t}" is not a summary}, e.message
|
3096
|
-
|
3097
|
-
@a1.summary = "#{t} (describe your package)"
|
3098
|
-
|
3099
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
3100
|
-
@a1.validate
|
3101
|
-
end
|
3102
|
-
|
3103
|
-
assert_equal %{"#{f}" or "#{t}" is not a summary}, e.message
|
3104
|
-
end
|
3105
|
-
end
|
3106
|
-
|
3107
|
-
def test_validate_warning
|
3108
|
-
util_setup_validate
|
3109
|
-
|
3110
|
-
use_ui @ui do
|
3111
|
-
@a1.licenses.clear
|
3112
|
-
@a1.validate
|
3113
|
-
end
|
3114
|
-
|
3115
|
-
assert_match 'See http://guides.rubygems.org/specification-reference/ for help', @ui.error
|
3116
|
-
end
|
3117
|
-
|
3118
|
-
def test_version
|
3119
|
-
assert_equal Gem::Version.new('1'), @a1.version
|
3120
|
-
end
|
3121
|
-
|
3122
|
-
def test_version_change_reset_full_name
|
3123
|
-
orig_full_name = @a1.full_name
|
3124
|
-
|
3125
|
-
@a1.version = "2"
|
3126
|
-
|
3127
|
-
refute_equal orig_full_name, @a1.full_name
|
3128
|
-
end
|
3129
|
-
|
3130
|
-
def test_version_change_reset_cache_file
|
3131
|
-
orig_cache_file = @a1.cache_file
|
3132
|
-
|
3133
|
-
@a1.version = "2"
|
3134
|
-
|
3135
|
-
refute_equal orig_cache_file, @a1.cache_file
|
3136
|
-
end
|
3137
|
-
|
3138
|
-
def test__load_fixes_Date_objects
|
3139
|
-
spec = new_spec "a", 1
|
3140
|
-
spec.instance_variable_set :@date, Date.today
|
3141
|
-
|
3142
|
-
spec = Marshal.load Marshal.dump(spec)
|
3143
|
-
|
3144
|
-
assert_kind_of Time, spec.date
|
3145
|
-
end
|
3146
|
-
|
3147
|
-
def test_load_errors_contain_filename
|
3148
|
-
specfile = Tempfile.new(self.class.name.downcase)
|
3149
|
-
specfile.write "raise 'boom'"
|
3150
|
-
specfile.close
|
3151
|
-
begin
|
3152
|
-
capture_io do
|
3153
|
-
Gem::Specification.load(specfile.path)
|
3154
|
-
end
|
3155
|
-
rescue => e
|
3156
|
-
name_rexp = Regexp.new(Regexp.escape(specfile.path))
|
3157
|
-
assert e.backtrace.grep(name_rexp).any?
|
3158
|
-
end
|
3159
|
-
ensure
|
3160
|
-
specfile.delete
|
3161
|
-
end
|
3162
|
-
|
3163
|
-
##
|
3164
|
-
# KEEP p-1-x86-darwin-8
|
3165
|
-
# KEEP p-1
|
3166
|
-
# KEEP c-1.2
|
3167
|
-
# KEEP a_evil-9
|
3168
|
-
# a-1
|
3169
|
-
# a-1-x86-my_platform-1
|
3170
|
-
# KEEP a-2
|
3171
|
-
# a-2-x86-other_platform-1
|
3172
|
-
# KEEP a-2-x86-my_platform-1
|
3173
|
-
# a-3.a
|
3174
|
-
# KEEP a-3-x86-other_platform-1
|
3175
|
-
|
3176
|
-
def test_latest_specs
|
3177
|
-
spec_fetcher do |fetcher|
|
3178
|
-
fetcher.spec 'a', 1 do |s|
|
3179
|
-
s.platform = Gem::Platform.new 'x86-my_platform1'
|
3180
|
-
end
|
3181
|
-
|
3182
|
-
fetcher.spec 'a', 2
|
3183
|
-
|
3184
|
-
fetcher.spec 'a', 2 do |s|
|
3185
|
-
s.platform = Gem::Platform.new 'x86-my_platform1'
|
3186
|
-
end
|
3187
|
-
|
3188
|
-
fetcher.spec 'a', 2 do |s|
|
3189
|
-
s.platform = Gem::Platform.new 'x86-other_platform1'
|
3190
|
-
end
|
3191
|
-
|
3192
|
-
fetcher.spec 'a', 3 do |s|
|
3193
|
-
s.platform = Gem::Platform.new 'x86-other_platform1'
|
3194
|
-
end
|
3195
|
-
end
|
3196
|
-
|
3197
|
-
expected = %W[
|
3198
|
-
a-2
|
3199
|
-
a-2-x86-my_platform-1
|
3200
|
-
a-3-x86-other_platform-1
|
3201
|
-
]
|
3202
|
-
|
3203
|
-
latest_specs = Gem::Specification.latest_specs.map(&:full_name).sort
|
3204
|
-
|
3205
|
-
assert_equal expected, latest_specs
|
3206
|
-
end
|
3207
|
-
|
3208
|
-
def test_metadata_validates_ok
|
3209
|
-
util_setup_validate
|
3210
|
-
|
3211
|
-
Dir.chdir @tempdir do
|
3212
|
-
@m1 = quick_gem 'm', '1' do |s|
|
3213
|
-
s.files = %w[lib/code.rb]
|
3214
|
-
s.metadata = { 'one' => "two", 'two' => "three" }
|
3215
|
-
end
|
3216
|
-
|
3217
|
-
use_ui @ui do
|
3218
|
-
@m1.validate
|
3219
|
-
end
|
3220
|
-
end
|
3221
|
-
end
|
3222
|
-
|
3223
|
-
def test_metadata_key_type_validation_fails
|
3224
|
-
util_setup_validate
|
3225
|
-
|
3226
|
-
Dir.chdir @tempdir do
|
3227
|
-
@m2 = quick_gem 'm', '2' do |s|
|
3228
|
-
s.files = %w[lib/code.rb]
|
3229
|
-
s.metadata = { 1 => "fail" }
|
3230
|
-
end
|
3231
|
-
|
3232
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
3233
|
-
@m2.validate
|
3234
|
-
end
|
3235
|
-
|
3236
|
-
assert_equal "metadata keys must be a String", e.message
|
3237
|
-
end
|
3238
|
-
end
|
3239
|
-
|
3240
|
-
def test_metadata_key_size_validation_fails
|
3241
|
-
util_setup_validate
|
3242
|
-
|
3243
|
-
Dir.chdir @tempdir do
|
3244
|
-
@m2 = quick_gem 'm', '2' do |s|
|
3245
|
-
s.files = %w[lib/code.rb]
|
3246
|
-
s.metadata = { ("x" * 129) => "fail" }
|
3247
|
-
end
|
3248
|
-
|
3249
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
3250
|
-
@m2.validate
|
3251
|
-
end
|
3252
|
-
|
3253
|
-
assert_equal "metadata key too large (129 > 128)", e.message
|
3254
|
-
end
|
3255
|
-
end
|
3256
|
-
|
3257
|
-
def test_metadata_value_type_validation_fails
|
3258
|
-
util_setup_validate
|
3259
|
-
|
3260
|
-
Dir.chdir @tempdir do
|
3261
|
-
@m2 = quick_gem 'm', '2' do |s|
|
3262
|
-
s.files = %w[lib/code.rb]
|
3263
|
-
s.metadata = { 'fail' => [] }
|
3264
|
-
end
|
3265
|
-
|
3266
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
3267
|
-
@m2.validate
|
3268
|
-
end
|
3269
|
-
|
3270
|
-
assert_equal "metadata values must be a String", e.message
|
3271
|
-
end
|
3272
|
-
end
|
3273
|
-
|
3274
|
-
def test_metadata_value_size_validation_fails
|
3275
|
-
util_setup_validate
|
3276
|
-
|
3277
|
-
Dir.chdir @tempdir do
|
3278
|
-
@m2 = quick_gem 'm', '2' do |s|
|
3279
|
-
s.files = %w[lib/code.rb]
|
3280
|
-
s.metadata = { 'fail' => ("x" * 1025) }
|
3281
|
-
end
|
3282
|
-
|
3283
|
-
e = assert_raises Gem::InvalidSpecificationException do
|
3284
|
-
@m2.validate
|
3285
|
-
end
|
3286
|
-
|
3287
|
-
assert_equal "metadata value too large (1025 > 1024)", e.message
|
3288
|
-
end
|
3289
|
-
end
|
3290
|
-
|
3291
|
-
def test_metadata_specs
|
3292
|
-
valid_ruby_spec = <<-EOF
|
3293
|
-
# -*- encoding: utf-8 -*-
|
3294
|
-
# stub: m 1 ruby lib
|
3295
|
-
|
3296
|
-
Gem::Specification.new do |s|
|
3297
|
-
s.name = "m".freeze
|
3298
|
-
s.version = "1"
|
3299
|
-
|
3300
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
3301
|
-
s.metadata = { "one" => "two", "two" => "three" } if s.respond_to? :metadata=
|
3302
|
-
s.require_paths = ["lib".freeze]
|
3303
|
-
s.authors = ["A User".freeze]
|
3304
|
-
s.date = "#{Gem::Specification::TODAY.strftime("%Y-%m-%d")}"
|
3305
|
-
s.description = "This is a test description".freeze
|
3306
|
-
s.email = "example@example.com".freeze
|
3307
|
-
s.files = ["lib/code.rb".freeze]
|
3308
|
-
s.homepage = "http://example.com".freeze
|
3309
|
-
s.rubygems_version = "#{Gem::VERSION}".freeze
|
3310
|
-
s.summary = "this is a summary".freeze
|
3311
|
-
end
|
3312
|
-
EOF
|
3313
|
-
|
3314
|
-
@m1 = quick_gem 'm', '1' do |s|
|
3315
|
-
s.files = %w[lib/code.rb]
|
3316
|
-
s.metadata = { 'one' => "two", 'two' => "three" }
|
3317
|
-
end
|
3318
|
-
|
3319
|
-
assert_equal @m1.to_ruby, valid_ruby_spec
|
3320
|
-
end
|
3321
|
-
|
3322
|
-
def test_missing_extensions_eh
|
3323
|
-
ext_spec
|
3324
|
-
|
3325
|
-
assert @ext.missing_extensions?
|
3326
|
-
|
3327
|
-
extconf_rb = File.join @ext.gem_dir, @ext.extensions.first
|
3328
|
-
FileUtils.mkdir_p File.dirname extconf_rb
|
3329
|
-
|
3330
|
-
open extconf_rb, 'w' do |f|
|
3331
|
-
f.write <<-'RUBY'
|
3332
|
-
open 'Makefile', 'w' do |f|
|
3333
|
-
f.puts "clean:\n\techo clean"
|
3334
|
-
f.puts "default:\n\techo built"
|
3335
|
-
f.puts "install:\n\techo installed"
|
3336
|
-
end
|
3337
|
-
RUBY
|
3338
|
-
end
|
3339
|
-
|
3340
|
-
@ext.build_extensions
|
3341
|
-
|
3342
|
-
refute @ext.missing_extensions?
|
3343
|
-
end
|
3344
|
-
|
3345
|
-
def test_missing_extensions_eh_default_gem
|
3346
|
-
spec = new_default_spec 'default', 1
|
3347
|
-
spec.extensions << 'extconf.rb'
|
3348
|
-
|
3349
|
-
refute spec.missing_extensions?
|
3350
|
-
end
|
3351
|
-
|
3352
|
-
def test_missing_extensions_eh_legacy
|
3353
|
-
ext_spec
|
3354
|
-
|
3355
|
-
@ext.installed_by_version = v '2.2.0.preview.2'
|
3356
|
-
|
3357
|
-
assert @ext.missing_extensions?
|
3358
|
-
|
3359
|
-
@ext.installed_by_version = v '2.2.0.preview.1'
|
3360
|
-
|
3361
|
-
refute @ext.missing_extensions?
|
3362
|
-
end
|
3363
|
-
|
3364
|
-
def test_missing_extensions_eh_none
|
3365
|
-
refute @a1.missing_extensions?
|
3366
|
-
end
|
3367
|
-
|
3368
|
-
def test_find_by_name
|
3369
|
-
install_specs util_spec "a"
|
3370
|
-
install_specs util_spec "a", 1
|
3371
|
-
|
3372
|
-
assert Gem::Specification.find_by_name "a"
|
3373
|
-
assert Gem::Specification.find_by_name "a", "1"
|
3374
|
-
assert Gem::Specification.find_by_name "a", ">1"
|
3375
|
-
|
3376
|
-
assert_raises Gem::LoadError do
|
3377
|
-
Gem::Specification.find_by_name "monkeys"
|
3378
|
-
end
|
3379
|
-
end
|
3380
|
-
|
3381
|
-
def test_find_by_name_prerelease
|
3382
|
-
b = util_spec "b", "2.a"
|
3383
|
-
|
3384
|
-
b.activate
|
3385
|
-
|
3386
|
-
install_specs b
|
3387
|
-
|
3388
|
-
assert Gem::Specification.find_by_name "b"
|
3389
|
-
|
3390
|
-
assert_raises Gem::LoadError do
|
3391
|
-
Gem::Specification.find_by_name "b", "1"
|
3392
|
-
end
|
3393
|
-
|
3394
|
-
assert Gem::Specification.find_by_name "b", ">1"
|
3395
|
-
end
|
3396
|
-
|
3397
|
-
def test_find_by_path
|
3398
|
-
a = new_spec "foo", "1", nil, "lib/foo.rb"
|
3399
|
-
|
3400
|
-
install_specs a
|
3401
|
-
|
3402
|
-
assert_equal a, Gem::Specification.find_by_path('foo')
|
3403
|
-
a.activate
|
3404
|
-
assert_equal a, Gem::Specification.find_by_path('foo')
|
3405
|
-
end
|
3406
|
-
|
3407
|
-
def test_find_inactive_by_path
|
3408
|
-
a = new_spec "foo", "1", nil, "lib/foo.rb"
|
3409
|
-
|
3410
|
-
install_specs a
|
3411
|
-
|
3412
|
-
assert_equal a, Gem::Specification.find_inactive_by_path('foo')
|
3413
|
-
a.activate
|
3414
|
-
assert_equal nil, Gem::Specification.find_inactive_by_path('foo')
|
3415
|
-
end
|
3416
|
-
|
3417
|
-
def test_load_default_gem
|
3418
|
-
Gem::Specification.reset
|
3419
|
-
assert_equal [], Gem::Specification.map(&:full_name)
|
3420
|
-
|
3421
|
-
default_gem_spec = new_default_spec("default", "2.0.0.0",
|
3422
|
-
nil, "default/gem.rb")
|
3423
|
-
spec_path = File.join(@default_spec_dir, default_gem_spec.spec_name)
|
3424
|
-
write_file(spec_path) do |file|
|
3425
|
-
file.print(default_gem_spec.to_ruby)
|
3426
|
-
end
|
3427
|
-
Gem::Specification.reset
|
3428
|
-
assert_equal ["default-2.0.0.0"], Gem::Specification.map(&:full_name)
|
3429
|
-
end
|
3430
|
-
|
3431
|
-
def test_detect_bundled_gem_in_old_ruby
|
3432
|
-
util_set_RUBY_VERSION '1.9.3', 551
|
3433
|
-
|
3434
|
-
spec = new_spec 'bigdecimal', '1.1.0' do |s|
|
3435
|
-
s.summary = "This bigdecimal is bundled with Ruby"
|
3436
|
-
end
|
3437
|
-
|
3438
|
-
assert spec.bundled_gem_in_old_ruby?
|
3439
|
-
ensure
|
3440
|
-
util_restore_RUBY_VERSION
|
3441
|
-
end
|
3442
|
-
|
3443
|
-
def util_setup_deps
|
3444
|
-
@gem = util_spec "awesome", "1.0" do |awesome|
|
3445
|
-
awesome.add_runtime_dependency "bonobo", []
|
3446
|
-
awesome.add_development_dependency "monkey", []
|
3447
|
-
end
|
3448
|
-
|
3449
|
-
@bonobo = Gem::Dependency.new("bonobo", [])
|
3450
|
-
@monkey = Gem::Dependency.new("monkey", [], :development)
|
3451
|
-
end
|
3452
|
-
|
3453
|
-
def util_setup_validate
|
3454
|
-
Dir.chdir @tempdir do
|
3455
|
-
FileUtils.mkdir_p File.join("ext", "a")
|
3456
|
-
FileUtils.mkdir_p "lib"
|
3457
|
-
FileUtils.mkdir_p "test"
|
3458
|
-
FileUtils.mkdir_p "bin"
|
3459
|
-
|
3460
|
-
FileUtils.touch File.join("ext", "a", "extconf.rb")
|
3461
|
-
FileUtils.touch File.join("lib", "code.rb")
|
3462
|
-
FileUtils.touch File.join("test", "suite.rb")
|
3463
|
-
|
3464
|
-
File.open "bin/exec", "w", 0755 do |fp|
|
3465
|
-
fp.puts "#!#{Gem.ruby}"
|
3466
|
-
end
|
3467
|
-
end
|
3468
|
-
end
|
3469
|
-
|
3470
|
-
def with_syck
|
3471
|
-
begin
|
3472
|
-
verbose, $VERBOSE = $VERBOSE, nil
|
3473
|
-
require "yaml"
|
3474
|
-
old_engine = YAML::ENGINE.yamler
|
3475
|
-
YAML::ENGINE.yamler = 'syck'
|
3476
|
-
load 'rubygems/syck_hack.rb'
|
3477
|
-
rescue NameError
|
3478
|
-
# probably on 1.8, ignore
|
3479
|
-
ensure
|
3480
|
-
$VERBOSE = verbose
|
3481
|
-
end
|
3482
|
-
|
3483
|
-
yield
|
3484
|
-
ensure
|
3485
|
-
begin
|
3486
|
-
YAML::ENGINE.yamler = old_engine
|
3487
|
-
load 'rubygems/syck_hack.rb'
|
3488
|
-
rescue NameError
|
3489
|
-
# ignore
|
3490
|
-
end
|
3491
|
-
end
|
3492
|
-
|
3493
|
-
def with_psych
|
3494
|
-
begin
|
3495
|
-
require "yaml"
|
3496
|
-
old_engine = YAML::ENGINE.yamler
|
3497
|
-
YAML::ENGINE.yamler = 'psych'
|
3498
|
-
load 'rubygems/syck_hack.rb'
|
3499
|
-
rescue NameError
|
3500
|
-
# probably on 1.8, ignore
|
3501
|
-
end
|
3502
|
-
|
3503
|
-
yield
|
3504
|
-
ensure
|
3505
|
-
begin
|
3506
|
-
YAML::ENGINE.yamler = old_engine
|
3507
|
-
load 'rubygems/syck_hack.rb'
|
3508
|
-
rescue NameError
|
3509
|
-
# ignore
|
3510
|
-
end
|
3511
|
-
end
|
3512
|
-
|
3513
|
-
def silence_warnings
|
3514
|
-
old_verbose, $VERBOSE = $VERBOSE, false
|
3515
|
-
yield
|
3516
|
-
ensure
|
3517
|
-
$VERBOSE = old_verbose
|
3518
|
-
end
|
3519
|
-
end
|