rubygems-update 3.0.6 → 3.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{History.txt → CHANGELOG.md} +1100 -436
- data/CODE_OF_CONDUCT.md +55 -19
- data/CONTRIBUTING.md +37 -10
- data/MAINTAINERS.txt +1 -6
- data/Manifest.txt +104 -64
- data/POLICIES.md +6 -12
- data/README.md +6 -6
- data/Rakefile +121 -111
- data/bin/gem +0 -6
- data/bin/update_rubygems +2 -2
- data/bundler/CHANGELOG.md +1788 -1251
- data/bundler/LICENSE.md +18 -19
- data/bundler/README.md +9 -10
- data/bundler/UPGRADING.md +215 -0
- data/bundler/bundler.gemspec +9 -26
- data/bundler/exe/bundle +22 -3
- data/bundler/lib/bundler.rb +233 -94
- data/bundler/lib/bundler/build_metadata.rb +5 -13
- data/bundler/lib/bundler/capistrano.rb +4 -4
- data/bundler/lib/bundler/cli.rb +221 -148
- data/bundler/lib/bundler/cli/add.rb +28 -16
- data/bundler/lib/bundler/cli/binstubs.rb +6 -2
- data/bundler/lib/bundler/cli/cache.rb +24 -17
- data/bundler/lib/bundler/cli/clean.rb +1 -1
- data/bundler/lib/bundler/cli/common.rb +25 -12
- data/bundler/lib/bundler/cli/config.rb +161 -86
- data/bundler/lib/bundler/cli/console.rb +1 -1
- data/bundler/lib/bundler/cli/doctor.rb +5 -5
- data/bundler/lib/bundler/cli/exec.rb +8 -20
- data/bundler/lib/bundler/cli/fund.rb +36 -0
- data/bundler/lib/bundler/cli/gem.rb +125 -32
- data/bundler/lib/bundler/cli/info.rb +29 -6
- data/bundler/lib/bundler/cli/init.rb +2 -2
- data/bundler/lib/bundler/cli/inject.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +27 -23
- data/bundler/lib/bundler/cli/issue.rb +5 -5
- data/bundler/lib/bundler/cli/list.rb +12 -10
- data/bundler/lib/bundler/cli/open.rb +10 -6
- data/bundler/lib/bundler/cli/outdated.rb +134 -109
- data/bundler/lib/bundler/cli/plugin.rb +19 -2
- data/bundler/lib/bundler/cli/pristine.rb +6 -1
- data/bundler/lib/bundler/cli/show.rb +2 -2
- data/bundler/lib/bundler/cli/update.rb +34 -12
- data/bundler/lib/bundler/compact_index_client.rb +26 -10
- data/bundler/lib/bundler/compact_index_client/cache.rb +6 -14
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +8 -20
- data/bundler/lib/bundler/current_ruby.rb +9 -7
- data/bundler/lib/bundler/definition.rb +133 -132
- data/bundler/lib/bundler/dep_proxy.rb +16 -9
- data/bundler/lib/bundler/dependency.rb +19 -14
- data/bundler/lib/bundler/deployment.rb +1 -1
- data/bundler/lib/bundler/dsl.rb +54 -71
- data/bundler/lib/bundler/endpoint_specification.rb +1 -1
- data/bundler/lib/bundler/env.rb +9 -14
- data/bundler/lib/bundler/environment_preserver.rb +26 -3
- data/bundler/lib/bundler/errors.rb +1 -0
- data/bundler/lib/bundler/feature_flag.rb +19 -34
- data/bundler/lib/bundler/fetcher.rb +19 -16
- data/bundler/lib/bundler/fetcher/base.rb +1 -1
- data/bundler/lib/bundler/fetcher/compact_index.rb +27 -13
- data/bundler/lib/bundler/fetcher/dependency.rb +1 -1
- data/bundler/lib/bundler/fetcher/downloader.rb +6 -3
- data/bundler/lib/bundler/fetcher/index.rb +8 -7
- data/bundler/lib/bundler/friendly_errors.rb +27 -19
- data/bundler/lib/bundler/gem_helper.rb +68 -37
- data/bundler/lib/bundler/gem_helpers.rb +38 -29
- data/bundler/lib/bundler/gem_tasks.rb +1 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +5 -5
- data/bundler/lib/bundler/graph.rb +3 -3
- data/bundler/lib/bundler/index.rb +12 -7
- data/bundler/lib/bundler/injector.rb +32 -12
- data/bundler/lib/bundler/inline.rb +41 -30
- data/bundler/lib/bundler/installer.rb +41 -60
- data/bundler/lib/bundler/installer/gem_installer.rb +8 -4
- data/bundler/lib/bundler/installer/parallel_installer.rb +20 -26
- data/bundler/lib/bundler/installer/standalone.rb +18 -4
- data/bundler/lib/bundler/lazy_specification.rb +41 -27
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/lockfile_parser.rb +16 -33
- data/bundler/lib/bundler/{ssl_certs → man}/.document +0 -0
- data/bundler/lib/bundler/man/bundle-add.1 +66 -0
- data/bundler/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +42 -0
- data/bundler/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/bundler/lib/bundler/man/bundle-cache.1 +55 -0
- data/bundler/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
- data/bundler/lib/bundler/man/bundle-check.1 +31 -0
- data/bundler/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-clean.1 +24 -0
- data/bundler/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-config.1 +488 -0
- data/bundler/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +59 -67
- data/bundler/lib/bundler/man/bundle-doctor.1 +44 -0
- data/bundler/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-exec.1 +165 -0
- data/bundler/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +102 -0
- data/bundler/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +30 -7
- data/bundler/lib/bundler/man/bundle-info.1 +20 -0
- data/bundler/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-init.1 +25 -0
- data/bundler/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +33 -0
- data/bundler/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-install.1 +338 -0
- data/bundler/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
- data/bundler/lib/bundler/man/bundle-list.1 +50 -0
- data/bundler/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/bundler/lib/bundler/man/bundle-lock.1 +84 -0
- data/bundler/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-open.1 +32 -0
- data/bundler/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-outdated.1 +155 -0
- data/bundler/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-platform.1 +61 -0
- data/bundler/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-pristine.1 +34 -0
- data/bundler/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-remove.1 +31 -0
- data/bundler/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-show.1 +23 -0
- data/bundler/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle-update.1 +394 -0
- data/bundler/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +3 -3
- data/bundler/lib/bundler/man/bundle-viz.1 +39 -0
- data/bundler/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
- data/bundler/lib/bundler/man/bundle.1 +136 -0
- data/bundler/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +2 -2
- data/bundler/lib/bundler/man/gemfile.5 +686 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5.ronn +16 -20
- data/bundler/lib/bundler/man/index.txt +25 -0
- data/bundler/lib/bundler/match_platform.rb +1 -1
- data/bundler/lib/bundler/mirror.rb +5 -5
- data/bundler/lib/bundler/plugin.rb +75 -36
- data/bundler/lib/bundler/plugin/api.rb +1 -1
- data/bundler/lib/bundler/plugin/api/source.rb +12 -7
- data/bundler/lib/bundler/plugin/dsl.rb +1 -1
- data/bundler/lib/bundler/plugin/index.rb +24 -4
- data/bundler/lib/bundler/plugin/installer.rb +33 -22
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +1 -1
- data/bundler/lib/bundler/plugin/source_list.rb +5 -1
- data/bundler/lib/bundler/psyched_yaml.rb +0 -15
- data/bundler/lib/bundler/remote_specification.rb +5 -4
- data/bundler/lib/bundler/resolver.rb +191 -87
- data/bundler/lib/bundler/resolver/spec_group.rb +76 -48
- data/bundler/lib/bundler/retry.rb +3 -3
- data/bundler/lib/bundler/ruby_version.rb +5 -20
- data/bundler/lib/bundler/rubygems_ext.rb +76 -72
- data/bundler/lib/bundler/rubygems_gem_installer.rb +47 -13
- data/bundler/lib/bundler/rubygems_integration.rb +159 -444
- data/bundler/lib/bundler/runtime.rb +6 -23
- data/bundler/lib/bundler/settings.rb +67 -93
- data/bundler/lib/bundler/setup.rb +11 -12
- data/bundler/lib/bundler/shared_helpers.rb +54 -80
- data/bundler/lib/bundler/similarity_detector.rb +3 -3
- data/bundler/lib/bundler/source.rb +12 -6
- data/bundler/lib/bundler/source/git.rb +47 -38
- data/bundler/lib/bundler/source/git/git_proxy.rb +101 -102
- data/bundler/lib/bundler/source/metadata.rb +7 -6
- data/bundler/lib/bundler/source/path.rb +20 -11
- data/bundler/lib/bundler/source/path/installer.rb +10 -10
- data/bundler/lib/bundler/source/rubygems.rb +56 -29
- data/bundler/lib/bundler/source/rubygems/remote.rb +3 -4
- data/bundler/lib/bundler/source_list.rb +32 -30
- data/bundler/lib/bundler/spec_set.rb +37 -25
- data/bundler/lib/bundler/stub_specification.rb +40 -34
- data/bundler/lib/bundler/templates/Executable.bundler +23 -14
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +16 -2
- data/bundler/lib/bundler/templates/newgem/README.md.tt +7 -5
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +19 -5
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/bundler/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +18 -0
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +18 -31
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/bundler/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
- data/bundler/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -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/templates/newgem/travis.yml.tt +0 -1
- data/bundler/lib/bundler/ui.rb +3 -3
- data/bundler/lib/bundler/ui/rg_proxy.rb +1 -1
- data/bundler/lib/bundler/ui/shell.rb +7 -11
- data/bundler/lib/bundler/uri_credentials_filter.rb +10 -4
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +36 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +20 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +21 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +65 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +88 -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 +21 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/bundler/lib/bundler/vendored_fileutils.rb +1 -6
- data/bundler/lib/bundler/vendored_molinillo.rb +1 -1
- data/bundler/lib/bundler/vendored_persistent.rb +7 -12
- data/bundler/lib/bundler/vendored_thor.rb +2 -2
- data/bundler/lib/bundler/vendored_tmpdir.rb +4 -0
- data/bundler/lib/bundler/vendored_uri.rb +4 -0
- data/bundler/lib/bundler/version.rb +1 -20
- data/bundler/lib/bundler/version_ranges.rb +51 -5
- data/bundler/lib/bundler/vlad.rb +2 -2
- data/bundler/lib/bundler/worker.rb +2 -4
- data/bundler/lib/bundler/yaml_serializer.rb +3 -4
- data/lib/rubygems.rb +198 -222
- data/lib/rubygems/available_set.rb +4 -5
- data/lib/rubygems/basic_specification.rb +32 -19
- data/lib/rubygems/bundler_version_finder.rb +19 -9
- data/lib/rubygems/command.rb +73 -21
- data/lib/rubygems/command_manager.rb +5 -12
- data/lib/rubygems/commands/build_command.rb +51 -18
- data/lib/rubygems/commands/cert_command.rb +2 -11
- data/lib/rubygems/commands/check_command.rb +0 -2
- data/lib/rubygems/commands/cleanup_command.rb +17 -13
- data/lib/rubygems/commands/contents_command.rb +7 -9
- data/lib/rubygems/commands/dependency_command.rb +9 -10
- data/lib/rubygems/commands/environment_command.rb +1 -6
- data/lib/rubygems/commands/fetch_command.rb +2 -4
- data/lib/rubygems/commands/generate_index_command.rb +3 -2
- data/lib/rubygems/commands/help_command.rb +4 -4
- data/lib/rubygems/commands/info_command.rb +9 -4
- data/lib/rubygems/commands/install_command.rb +12 -54
- data/lib/rubygems/commands/list_command.rb +8 -7
- data/lib/rubygems/commands/lock_command.rb +3 -5
- data/lib/rubygems/commands/mirror_command.rb +0 -1
- data/lib/rubygems/commands/open_command.rb +1 -4
- data/lib/rubygems/commands/outdated_command.rb +0 -1
- data/lib/rubygems/commands/owner_command.rb +10 -10
- data/lib/rubygems/commands/pristine_command.rb +13 -9
- data/lib/rubygems/commands/push_command.rb +12 -51
- data/lib/rubygems/commands/query_command.rb +14 -330
- data/lib/rubygems/commands/rdoc_command.rb +0 -1
- data/lib/rubygems/commands/search_command.rb +7 -7
- data/lib/rubygems/commands/server_command.rb +3 -1
- data/lib/rubygems/commands/setup_command.rb +143 -101
- data/lib/rubygems/commands/signin_command.rb +0 -1
- data/lib/rubygems/commands/signout_command.rb +0 -2
- data/lib/rubygems/commands/sources_command.rb +22 -6
- data/lib/rubygems/commands/specification_command.rb +8 -3
- data/lib/rubygems/commands/stale_command.rb +1 -1
- data/lib/rubygems/commands/uninstall_command.rb +2 -3
- data/lib/rubygems/commands/unpack_command.rb +3 -32
- data/lib/rubygems/commands/update_command.rb +73 -28
- data/lib/rubygems/commands/which_command.rb +0 -1
- data/lib/rubygems/commands/yank_command.rb +10 -7
- data/lib/rubygems/compatibility.rb +4 -4
- data/lib/rubygems/config_file.rb +48 -27
- data/lib/rubygems/core_ext/kernel_gem.rb +7 -6
- data/lib/rubygems/core_ext/kernel_require.rb +44 -6
- data/lib/rubygems/core_ext/kernel_warn.rb +22 -13
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/defaults.rb +110 -23
- data/lib/rubygems/dependency.rb +28 -14
- data/lib/rubygems/dependency_installer.rb +11 -166
- data/lib/rubygems/dependency_list.rb +17 -18
- data/lib/rubygems/deprecate.rb +51 -6
- data/lib/rubygems/doctor.rb +4 -4
- data/lib/rubygems/errors.rb +5 -7
- data/lib/rubygems/exceptions.rb +2 -24
- data/lib/rubygems/ext.rb +6 -6
- data/lib/rubygems/ext/build_error.rb +2 -0
- data/lib/rubygems/ext/builder.rb +45 -82
- data/lib/rubygems/ext/cmake_builder.rb +6 -7
- data/lib/rubygems/ext/configure_builder.rb +5 -8
- data/lib/rubygems/ext/ext_conf_builder.rb +27 -23
- data/lib/rubygems/ext/rake_builder.rb +4 -6
- data/lib/rubygems/gem_runner.rb +3 -10
- data/lib/rubygems/gemcutter_utilities.rb +111 -37
- data/lib/rubygems/indexer.rb +9 -26
- data/lib/rubygems/install_update_options.rb +7 -7
- data/lib/rubygems/installer.rb +91 -98
- data/lib/rubygems/installer_test_case.rb +104 -42
- data/lib/rubygems/installer_uninstaller_utils.rb +29 -0
- data/lib/rubygems/local_remote_options.rb +1 -1
- data/lib/rubygems/mock_gem_ui.rb +1 -4
- data/lib/rubygems/name_tuple.rb +4 -7
- data/lib/rubygems/openssl.rb +7 -0
- data/lib/rubygems/package.rb +49 -32
- data/lib/rubygems/package/digest_io.rb +0 -2
- data/lib/rubygems/package/file_source.rb +0 -2
- data/lib/rubygems/package/io_source.rb +0 -2
- data/lib/rubygems/package/old.rb +1 -3
- data/lib/rubygems/package/tar_header.rb +4 -6
- data/lib/rubygems/package/tar_reader.rb +15 -12
- data/lib/rubygems/package/tar_reader/entry.rb +0 -3
- data/lib/rubygems/package/tar_test_case.rb +2 -4
- data/lib/rubygems/package/tar_writer.rb +6 -16
- data/lib/rubygems/package_task.rb +1 -7
- data/lib/rubygems/path_support.rb +2 -2
- data/lib/rubygems/platform.rb +22 -16
- data/lib/rubygems/query_utils.rb +353 -0
- data/lib/rubygems/rdoc.rb +0 -12
- data/lib/rubygems/remote_fetcher.rb +33 -59
- data/lib/rubygems/request.rb +11 -14
- data/lib/rubygems/request/connection_pools.rb +3 -7
- data/lib/rubygems/request/http_pool.rb +0 -1
- data/lib/rubygems/request_set.rb +10 -23
- data/lib/rubygems/request_set/gem_dependency_api.rb +9 -11
- data/lib/rubygems/request_set/lockfile.rb +13 -12
- data/lib/rubygems/request_set/lockfile/parser.rb +2 -2
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +1 -1
- data/lib/rubygems/requirement.rb +36 -35
- data/lib/rubygems/resolver.rb +20 -16
- data/lib/rubygems/resolver/activation_request.rb +27 -51
- data/lib/rubygems/resolver/api_set.rb +31 -24
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_specification.rb +24 -10
- data/lib/rubygems/resolver/best_set.rb +4 -6
- data/lib/rubygems/resolver/composed_set.rb +3 -5
- data/lib/rubygems/resolver/conflict.rb +2 -9
- data/lib/rubygems/resolver/current_set.rb +0 -2
- data/lib/rubygems/resolver/dependency_request.rb +1 -3
- data/lib/rubygems/resolver/git_set.rb +0 -2
- data/lib/rubygems/resolver/git_specification.rb +0 -2
- data/lib/rubygems/resolver/index_set.rb +1 -3
- data/lib/rubygems/resolver/index_specification.rb +32 -2
- data/lib/rubygems/resolver/installed_specification.rb +0 -2
- data/lib/rubygems/resolver/installer_set.rb +63 -16
- data/lib/rubygems/resolver/local_specification.rb +0 -2
- data/lib/rubygems/resolver/lock_set.rb +3 -5
- data/lib/rubygems/resolver/lock_specification.rb +2 -4
- data/lib/rubygems/resolver/molinillo/lib/molinillo.rb +6 -5
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +8 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +39 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +7 -6
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +4 -3
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +51 -12
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +76 -8
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +12 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +510 -165
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb +3 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/rubygems/resolver/requirement_list.rb +0 -1
- data/lib/rubygems/resolver/set.rb +0 -2
- data/lib/rubygems/resolver/source_set.rb +0 -2
- data/lib/rubygems/resolver/spec_specification.rb +14 -2
- data/lib/rubygems/resolver/specification.rb +13 -2
- data/lib/rubygems/resolver/vendor_set.rb +0 -2
- data/lib/rubygems/resolver/vendor_specification.rb +0 -2
- data/lib/rubygems/s3_uri_signer.rb +15 -13
- data/lib/rubygems/safe_yaml.rb +4 -4
- data/lib/rubygems/security.rb +27 -34
- data/lib/rubygems/security/policy.rb +4 -8
- data/lib/rubygems/security/signer.rb +8 -9
- data/lib/rubygems/security/trust_dir.rb +1 -3
- data/lib/rubygems/server.rb +20 -16
- data/lib/rubygems/source.rb +30 -13
- data/lib/rubygems/source/git.rb +7 -8
- data/lib/rubygems/source/installed.rb +0 -2
- data/lib/rubygems/source/local.rb +2 -4
- data/lib/rubygems/source/lock.rb +0 -2
- data/lib/rubygems/source/specific_file.rb +0 -2
- data/lib/rubygems/source/vendor.rb +0 -2
- data/lib/rubygems/source_list.rb +6 -6
- data/lib/rubygems/spec_fetcher.rb +22 -34
- data/lib/rubygems/specification.rb +207 -278
- data/lib/rubygems/specification_policy.rb +135 -57
- data/{bundler/lib/bundler/ssl_certs/index.rubygems.org → lib/rubygems/ssl_certs/rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +4 -5
- data/lib/rubygems/test_case.rb +221 -341
- data/lib/rubygems/test_utilities.rb +22 -18
- data/lib/rubygems/text.rb +2 -3
- data/lib/rubygems/uninstaller.rb +49 -30
- data/lib/rubygems/uri_formatter.rb +2 -4
- data/lib/rubygems/uri_parser.rb +34 -0
- data/lib/rubygems/uri_parsing.rb +23 -0
- data/lib/rubygems/user_interaction.rb +3 -20
- data/lib/rubygems/util.rb +20 -44
- data/lib/rubygems/util/licenses.rb +400 -400
- data/lib/rubygems/validator.rb +9 -31
- data/lib/rubygems/version.rb +29 -21
- data/lib/rubygems/version_option.rb +6 -0
- data/rubygems-update.gemspec +4 -11
- data/setup.rb +2 -7
- data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
- data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
- data/test/rubygems/rubygems/commands/crash_command.rb +0 -2
- data/test/rubygems/rubygems_plugin.rb +0 -2
- data/test/rubygems/specifications/bar-0.0.2.gemspec +0 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +12 -0
- data/test/rubygems/test_bundled_ca.rb +42 -45
- data/test/rubygems/test_config.rb +0 -2
- data/test/rubygems/test_deprecate.rb +41 -5
- data/test/rubygems/test_gem.rb +405 -236
- data/test/rubygems/test_gem_available_set.rb +5 -6
- data/test/rubygems/test_gem_bundler_version_finder.rb +20 -2
- data/test/rubygems/test_gem_command.rb +144 -9
- data/test/rubygems/test_gem_command_manager.rb +40 -17
- data/test/rubygems/test_gem_commands_build_command.rb +386 -13
- data/test/rubygems/test_gem_commands_cert_command.rb +18 -6
- data/test/rubygems/test_gem_commands_check_command.rb +0 -2
- data/test/rubygems/test_gem_commands_cleanup_command.rb +35 -10
- data/test/rubygems/test_gem_commands_contents_command.rb +50 -19
- data/test/rubygems/test_gem_commands_dependency_command.rb +1 -3
- data/test/rubygems/test_gem_commands_environment_command.rb +21 -33
- data/test/rubygems/test_gem_commands_fetch_command.rb +0 -2
- data/test/rubygems/test_gem_commands_generate_index_command.rb +32 -2
- data/test/rubygems/test_gem_commands_help_command.rb +16 -8
- data/test/rubygems/test_gem_commands_info_command.rb +6 -7
- data/test/rubygems/test_gem_commands_install_command.rb +368 -34
- data/test/rubygems/test_gem_commands_list_command.rb +0 -2
- data/test/rubygems/test_gem_commands_lock_command.rb +0 -2
- data/test/rubygems/test_gem_commands_mirror.rb +1 -2
- data/test/rubygems/test_gem_commands_open_command.rb +4 -6
- data/test/rubygems/test_gem_commands_outdated_command.rb +18 -1
- data/test/rubygems/test_gem_commands_owner_command.rb +62 -9
- data/test/rubygems/test_gem_commands_pristine_command.rb +148 -16
- data/test/rubygems/test_gem_commands_push_command.rb +94 -21
- data/test/rubygems/test_gem_commands_query_command.rb +35 -10
- data/test/rubygems/test_gem_commands_search_command.rb +0 -2
- data/test/rubygems/test_gem_commands_server_command.rb +6 -4
- data/test/rubygems/test_gem_commands_setup_command.rb +228 -128
- data/test/rubygems/test_gem_commands_signin_command.rb +36 -11
- data/test/rubygems/test_gem_commands_signout_command.rb +0 -7
- data/test/rubygems/test_gem_commands_sources_command.rb +193 -9
- data/test/rubygems/test_gem_commands_specification_command.rb +46 -20
- data/test/rubygems/test_gem_commands_stale_command.rb +0 -2
- data/test/rubygems/test_gem_commands_uninstall_command.rb +108 -52
- data/test/rubygems/test_gem_commands_unpack_command.rb +0 -2
- data/test/rubygems/test_gem_commands_update_command.rb +201 -29
- data/test/rubygems/test_gem_commands_which_command.rb +3 -5
- data/test/rubygems/test_gem_commands_yank_command.rb +86 -5
- data/test/rubygems/test_gem_config_file.rb +25 -13
- data/test/rubygems/test_gem_dependency.rb +6 -2
- data/test/rubygems/test_gem_dependency_installer.rb +169 -252
- data/test/rubygems/test_gem_dependency_list.rb +31 -26
- data/test/rubygems/test_gem_dependency_resolution_error.rb +1 -3
- data/test/rubygems/test_gem_doctor.rb +28 -2
- data/test/rubygems/test_gem_ext_builder.rb +51 -44
- data/test/rubygems/test_gem_ext_cmake_builder.rb +16 -23
- data/test/rubygems/test_gem_ext_configure_builder.rb +6 -14
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -29
- data/test/rubygems/test_gem_ext_rake_builder.rb +39 -22
- data/test/rubygems/test_gem_gem_runner.rb +47 -2
- data/test/rubygems/test_gem_gemcutter_utilities.rb +16 -13
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +0 -2
- data/test/rubygems/test_gem_indexer.rb +40 -55
- data/test/rubygems/test_gem_install_update_options.rb +45 -21
- data/test/rubygems/test_gem_installer.rb +661 -338
- data/test/rubygems/test_gem_local_remote_options.rb +0 -2
- data/test/rubygems/test_gem_name_tuple.rb +0 -2
- data/test/rubygems/test_gem_package.rb +132 -45
- data/test/rubygems/test_gem_package_old.rb +56 -55
- data/test/rubygems/test_gem_package_tar_header.rb +18 -1
- data/test/rubygems/test_gem_package_tar_reader.rb +0 -2
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +6 -7
- data/test/rubygems/test_gem_package_tar_writer.rb +20 -12
- data/test/rubygems/test_gem_package_task.rb +46 -13
- data/test/rubygems/test_gem_path_support.rb +17 -13
- data/test/rubygems/test_gem_platform.rb +74 -7
- data/test/rubygems/test_gem_rdoc.rb +0 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +223 -209
- data/test/rubygems/test_gem_request.rb +30 -19
- data/test/rubygems/test_gem_request_connection_pools.rb +2 -2
- data/test/rubygems/test_gem_request_set.rb +104 -29
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +4 -6
- data/test/rubygems/test_gem_request_set_lockfile.rb +4 -5
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +9 -10
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +118 -118
- data/test/rubygems/test_gem_requirement.rb +50 -4
- data/test/rubygems/test_gem_resolver.rb +73 -31
- data/test/rubygems/test_gem_resolver_activation_request.rb +3 -34
- data/test/rubygems/test_gem_resolver_api_set.rb +60 -59
- data/test/rubygems/test_gem_resolver_api_specification.rb +3 -5
- data/test/rubygems/test_gem_resolver_best_set.rb +27 -6
- data/test/rubygems/test_gem_resolver_composed_set.rb +0 -2
- data/test/rubygems/test_gem_resolver_conflict.rb +1 -7
- data/test/rubygems/test_gem_resolver_dependency_request.rb +0 -2
- data/test/rubygems/test_gem_resolver_git_set.rb +0 -2
- data/test/rubygems/test_gem_resolver_git_specification.rb +1 -2
- data/test/rubygems/test_gem_resolver_index_set.rb +2 -4
- data/test/rubygems/test_gem_resolver_index_specification.rb +7 -4
- data/test/rubygems/test_gem_resolver_installed_specification.rb +0 -3
- data/test/rubygems/test_gem_resolver_installer_set.rb +10 -10
- data/test/rubygems/test_gem_resolver_local_specification.rb +0 -2
- data/test/rubygems/test_gem_resolver_lock_set.rb +3 -5
- data/test/rubygems/test_gem_resolver_lock_specification.rb +0 -2
- data/test/rubygems/test_gem_resolver_requirement_list.rb +0 -2
- data/test/rubygems/test_gem_resolver_specification.rb +0 -2
- data/test/rubygems/test_gem_resolver_vendor_set.rb +1 -3
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +0 -2
- data/test/rubygems/test_gem_security.rb +27 -25
- data/test/rubygems/test_gem_security_policy.rb +7 -12
- data/test/rubygems/test_gem_security_signer.rb +11 -12
- data/test/rubygems/test_gem_security_trust_dir.rb +4 -6
- data/test/rubygems/test_gem_server.rb +13 -12
- data/test/rubygems/test_gem_silent_ui.rb +0 -1
- data/test/rubygems/test_gem_source.rb +32 -17
- data/test/rubygems/test_gem_source_fetch_problem.rb +0 -1
- data/test/rubygems/test_gem_source_git.rb +12 -18
- data/test/rubygems/test_gem_source_installed.rb +11 -13
- data/test/rubygems/test_gem_source_list.rb +1 -1
- data/test/rubygems/test_gem_source_local.rb +8 -9
- data/test/rubygems/test_gem_source_lock.rb +17 -19
- data/test/rubygems/test_gem_source_specific_file.rb +9 -10
- data/test/rubygems/test_gem_source_subpath_problem.rb +49 -0
- data/test/rubygems/test_gem_source_vendor.rb +7 -9
- data/test/rubygems/test_gem_spec_fetcher.rb +11 -4
- data/test/rubygems/test_gem_specification.rb +363 -245
- data/test/rubygems/test_gem_stream_ui.rb +3 -1
- data/test/rubygems/test_gem_stub_specification.rb +6 -7
- data/test/rubygems/test_gem_text.rb +1 -2
- data/test/rubygems/test_gem_uninstaller.rb +165 -22
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +0 -2
- data/test/rubygems/test_gem_uri_formatter.rb +0 -2
- data/test/rubygems/test_gem_util.rb +17 -15
- data/test/rubygems/test_gem_validator.rb +4 -7
- data/test/rubygems/test_gem_version.rb +23 -10
- data/test/rubygems/test_gem_version_option.rb +1 -3
- data/test/rubygems/test_kernel.rb +25 -9
- data/test/rubygems/test_project_sanity.rb +20 -0
- data/test/rubygems/test_remote_fetch_error.rb +1 -2
- data/test/rubygems/test_require.rb +394 -56
- data/test/test_changelog_generator.rb +17 -0
- metadata +109 -155
- data/.rubocop.yml +0 -67
- data/.travis.yml +0 -38
- data/appveyor.yml +0 -43
- data/bundler/CODE_OF_CONDUCT.md +0 -42
- data/bundler/CONTRIBUTING.md +0 -17
- data/bundler/exe/bundle_ruby +0 -60
- data/bundler/lib/bundler/cli/package.rb +0 -49
- data/bundler/lib/bundler/compatibility_guard.rb +0 -14
- data/bundler/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/lib/rubygems/source_local.rb +0 -7
- data/lib/rubygems/source_specific_file.rb +0 -6
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/ubygems.rb +0 -14
- data/util/CL2notes +0 -55
- data/util/ci +0 -82
- data/util/cops/deprecations.rb +0 -52
- data/util/create_certs.rb +0 -171
- data/util/create_certs.sh +0 -27
- data/util/create_encrypted_key.rb +0 -16
- data/util/generate_spdx_license_list.rb +0 -61
- data/util/patch_with_prs.rb +0 -77
- data/util/rubocop +0 -8
- data/util/update_bundled_ca_certificates.rb +0 -139
- data/util/update_changelog.rb +0 -67
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'rubygems/test_case'
|
3
3
|
|
4
4
|
class TestGemImpossibleDependenciesError < Gem::TestCase
|
5
|
-
|
6
5
|
def test_message_conflict
|
7
6
|
request = dependency_request dep('net-ssh', '>= 2.0.13'), 'rye', '0.9.8'
|
8
7
|
|
@@ -57,5 +56,4 @@ rye-0.9.8 requires net-ssh (>= 2.0.13) but it conflicted:
|
|
57
56
|
|
58
57
|
assert_equal expected, error.message
|
59
58
|
end
|
60
|
-
|
61
59
|
end
|
@@ -2,16 +2,10 @@
|
|
2
2
|
require 'rubygems/test_case'
|
3
3
|
require 'rubygems/indexer'
|
4
4
|
|
5
|
-
unless defined?(Builder::XChar)
|
6
|
-
warn "Gem::Indexer tests are being skipped. Install builder gem." if $VERBOSE
|
7
|
-
end
|
8
|
-
|
9
5
|
class TestGemIndexer < Gem::TestCase
|
10
|
-
|
11
6
|
def setup
|
12
7
|
super
|
13
8
|
|
14
|
-
util_clear_gems
|
15
9
|
util_make_gems
|
16
10
|
|
17
11
|
@d2_0 = util_spec 'd', '2.0' do |s|
|
@@ -28,30 +22,23 @@ class TestGemIndexer < Gem::TestCase
|
|
28
22
|
@default = new_default_spec 'default', 2
|
29
23
|
install_default_gems @default
|
30
24
|
|
31
|
-
@
|
25
|
+
@indexerdir = File.join(@tempdir, 'indexer')
|
32
26
|
|
33
|
-
gems = File.join(@
|
27
|
+
gems = File.join(@indexerdir, 'gems')
|
34
28
|
FileUtils.mkdir_p gems
|
35
29
|
FileUtils.mv Dir[File.join(@gemhome, "cache", '*.gem')], gems
|
36
30
|
|
37
|
-
@indexer = Gem::Indexer.new(@
|
38
|
-
end
|
39
|
-
|
40
|
-
def teardown
|
41
|
-
super
|
42
|
-
|
43
|
-
util_clear_gems
|
44
|
-
util_clear_default_gems
|
31
|
+
@indexer = Gem::Indexer.new(@indexerdir)
|
45
32
|
end
|
46
33
|
|
47
34
|
def test_initialize
|
48
|
-
assert_equal @
|
35
|
+
assert_equal @indexerdir, @indexer.dest_directory
|
49
36
|
assert_match %r{#{Dir.mktmpdir('gem_generate_index').match(/.*-/)}}, @indexer.directory
|
50
37
|
|
51
|
-
indexer = Gem::Indexer.new @
|
38
|
+
indexer = Gem::Indexer.new @indexerdir
|
52
39
|
assert indexer.build_modern
|
53
40
|
|
54
|
-
indexer = Gem::Indexer.new @
|
41
|
+
indexer = Gem::Indexer.new @indexerdir, :build_modern => true
|
55
42
|
assert indexer.build_modern
|
56
43
|
end
|
57
44
|
|
@@ -100,7 +87,7 @@ class TestGemIndexer < Gem::TestCase
|
|
100
87
|
@indexer.generate_index
|
101
88
|
end
|
102
89
|
|
103
|
-
quickdir = File.join @
|
90
|
+
quickdir = File.join @indexerdir, 'quick'
|
104
91
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
105
92
|
|
106
93
|
assert_directory_exists quickdir
|
@@ -111,11 +98,11 @@ class TestGemIndexer < Gem::TestCase
|
|
111
98
|
|
112
99
|
refute_indexed marshal_quickdir, File.basename(@c1_2.spec_file)
|
113
100
|
|
114
|
-
assert_indexed @
|
115
|
-
assert_indexed @
|
101
|
+
assert_indexed @indexerdir, "specs.#{@marshal_version}"
|
102
|
+
assert_indexed @indexerdir, "specs.#{@marshal_version}.gz"
|
116
103
|
|
117
|
-
assert_indexed @
|
118
|
-
assert_indexed @
|
104
|
+
assert_indexed @indexerdir, "latest_specs.#{@marshal_version}"
|
105
|
+
assert_indexed @indexerdir, "latest_specs.#{@marshal_version}.gz"
|
119
106
|
end
|
120
107
|
|
121
108
|
def test_generate_index_modern
|
@@ -125,12 +112,12 @@ class TestGemIndexer < Gem::TestCase
|
|
125
112
|
@indexer.generate_index
|
126
113
|
end
|
127
114
|
|
128
|
-
refute_indexed @
|
129
|
-
refute_indexed @
|
130
|
-
refute_indexed @
|
131
|
-
refute_indexed @
|
115
|
+
refute_indexed @indexerdir, 'yaml'
|
116
|
+
refute_indexed @indexerdir, 'yaml.Z'
|
117
|
+
refute_indexed @indexerdir, "Marshal.#{@marshal_version}"
|
118
|
+
refute_indexed @indexerdir, "Marshal.#{@marshal_version}.Z"
|
132
119
|
|
133
|
-
quickdir = File.join @
|
120
|
+
quickdir = File.join @indexerdir, 'quick'
|
134
121
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
135
122
|
|
136
123
|
assert_directory_exists quickdir, 'quickdir should be directory'
|
@@ -156,11 +143,11 @@ class TestGemIndexer < Gem::TestCase
|
|
156
143
|
refute_indexed quickdir, "#{File.basename(@c1_2.spec_file)}"
|
157
144
|
refute_indexed marshal_quickdir, "#{File.basename(@c1_2.spec_file)}"
|
158
145
|
|
159
|
-
assert_indexed @
|
160
|
-
assert_indexed @
|
146
|
+
assert_indexed @indexerdir, "specs.#{@marshal_version}"
|
147
|
+
assert_indexed @indexerdir, "specs.#{@marshal_version}.gz"
|
161
148
|
|
162
|
-
assert_indexed @
|
163
|
-
assert_indexed @
|
149
|
+
assert_indexed @indexerdir, "latest_specs.#{@marshal_version}"
|
150
|
+
assert_indexed @indexerdir, "latest_specs.#{@marshal_version}.gz"
|
164
151
|
end
|
165
152
|
|
166
153
|
def test_generate_index_modern_back_to_back
|
@@ -170,13 +157,13 @@ class TestGemIndexer < Gem::TestCase
|
|
170
157
|
@indexer.generate_index
|
171
158
|
end
|
172
159
|
|
173
|
-
@indexer = Gem::Indexer.new @
|
160
|
+
@indexer = Gem::Indexer.new @indexerdir
|
174
161
|
@indexer.build_modern = true
|
175
162
|
|
176
163
|
use_ui @ui do
|
177
164
|
@indexer.generate_index
|
178
165
|
end
|
179
|
-
quickdir = File.join @
|
166
|
+
quickdir = File.join @indexerdir, 'quick'
|
180
167
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
181
168
|
|
182
169
|
assert_directory_exists quickdir
|
@@ -185,11 +172,11 @@ class TestGemIndexer < Gem::TestCase
|
|
185
172
|
assert_indexed marshal_quickdir, "#{File.basename(@a1.spec_file)}.rz"
|
186
173
|
assert_indexed marshal_quickdir, "#{File.basename(@a2.spec_file)}.rz"
|
187
174
|
|
188
|
-
assert_indexed @
|
189
|
-
assert_indexed @
|
175
|
+
assert_indexed @indexerdir, "specs.#{@marshal_version}"
|
176
|
+
assert_indexed @indexerdir, "specs.#{@marshal_version}.gz"
|
190
177
|
|
191
|
-
assert_indexed @
|
192
|
-
assert_indexed @
|
178
|
+
assert_indexed @indexerdir, "latest_specs.#{@marshal_version}"
|
179
|
+
assert_indexed @indexerdir, "latest_specs.#{@marshal_version}.gz"
|
193
180
|
end
|
194
181
|
|
195
182
|
def test_generate_index_ui
|
@@ -197,15 +184,15 @@ class TestGemIndexer < Gem::TestCase
|
|
197
184
|
@indexer.generate_index
|
198
185
|
end
|
199
186
|
|
200
|
-
assert_match %r
|
201
|
-
assert_match %r
|
187
|
+
assert_match %r{^\.\.\.\.\.\.\.\.\.\.\.\.$}, @ui.output
|
188
|
+
assert_match %r{^Generating Marshal quick index gemspecs for 12 gems$},
|
202
189
|
@ui.output
|
203
|
-
assert_match %r
|
204
|
-
assert_match %r
|
205
|
-
assert_match %r
|
206
|
-
assert_match %r
|
207
|
-
assert_match %r
|
208
|
-
assert_match %r
|
190
|
+
assert_match %r{^Complete$}, @ui.output
|
191
|
+
assert_match %r{^Generating specs index$}, @ui.output
|
192
|
+
assert_match %r{^Generating latest specs index$}, @ui.output
|
193
|
+
assert_match %r{^Generating prerelease specs index$}, @ui.output
|
194
|
+
assert_match %r{^Complete$}, @ui.output
|
195
|
+
assert_match %r{^Compressing indices$}, @ui.output
|
209
196
|
|
210
197
|
assert_equal '', @ui.error
|
211
198
|
end
|
@@ -215,7 +202,7 @@ class TestGemIndexer < Gem::TestCase
|
|
215
202
|
@indexer.generate_index
|
216
203
|
end
|
217
204
|
|
218
|
-
specs_path = File.join @
|
205
|
+
specs_path = File.join @indexerdir, "specs.#{@marshal_version}"
|
219
206
|
|
220
207
|
specs_dump = Gem.read_binary specs_path
|
221
208
|
specs = Marshal.load specs_dump
|
@@ -252,7 +239,7 @@ class TestGemIndexer < Gem::TestCase
|
|
252
239
|
@indexer.generate_index
|
253
240
|
end
|
254
241
|
|
255
|
-
latest_specs_path = File.join @
|
242
|
+
latest_specs_path = File.join @indexerdir, "latest_specs.#{@marshal_version}"
|
256
243
|
|
257
244
|
latest_specs_dump = Gem.read_binary latest_specs_path
|
258
245
|
latest_specs = Marshal.load latest_specs_dump
|
@@ -282,7 +269,7 @@ class TestGemIndexer < Gem::TestCase
|
|
282
269
|
@indexer.generate_index
|
283
270
|
end
|
284
271
|
|
285
|
-
prerelease_specs_path = File.join @
|
272
|
+
prerelease_specs_path = File.join @indexerdir, "prerelease_specs.#{@marshal_version}"
|
286
273
|
|
287
274
|
prerelease_specs_dump = Gem.read_binary prerelease_specs_path
|
288
275
|
prerelease_specs = Marshal.load prerelease_specs_dump
|
@@ -306,13 +293,12 @@ class TestGemIndexer < Gem::TestCase
|
|
306
293
|
util_remove_gem sys_gem
|
307
294
|
end
|
308
295
|
|
309
|
-
|
310
296
|
def test_update_index
|
311
297
|
use_ui @ui do
|
312
298
|
@indexer.generate_index
|
313
299
|
end
|
314
300
|
|
315
|
-
quickdir = File.join @
|
301
|
+
quickdir = File.join @indexerdir, 'quick'
|
316
302
|
marshal_quickdir = File.join quickdir, "Marshal.#{@marshal_version}"
|
317
303
|
|
318
304
|
assert_directory_exists quickdir
|
@@ -326,7 +312,7 @@ class TestGemIndexer < Gem::TestCase
|
|
326
312
|
util_build_gem @d2_1_a
|
327
313
|
@d2_1_a_tuple = [@d2_1_a.name, @d2_1_a.version, @d2_1_a.original_platform]
|
328
314
|
|
329
|
-
gems = File.join @
|
315
|
+
gems = File.join @indexerdir, 'gems'
|
330
316
|
|
331
317
|
FileUtils.mv @d2_1.cache_file, gems
|
332
318
|
FileUtils.mv @d2_1_a.cache_file, gems
|
@@ -368,5 +354,4 @@ class TestGemIndexer < Gem::TestCase
|
|
368
354
|
file = File.join dir, name
|
369
355
|
refute File.exist?(file), "#{file} exists"
|
370
356
|
end
|
371
|
-
|
372
|
-
end if defined?(Builder::XChar)
|
357
|
+
end
|
@@ -5,7 +5,6 @@ require 'rubygems/command'
|
|
5
5
|
require 'rubygems/dependency_installer'
|
6
6
|
|
7
7
|
class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
8
|
-
|
9
8
|
def setup
|
10
9
|
super
|
11
10
|
|
@@ -26,11 +25,12 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|
26
25
|
-f
|
27
26
|
-i /install_to
|
28
27
|
-w
|
29
|
-
--vendor
|
30
28
|
--post-install-message
|
31
29
|
]
|
32
30
|
|
33
|
-
args.concat %w[
|
31
|
+
args.concat %w[--vendor] unless Gem.java_platform?
|
32
|
+
|
33
|
+
args.concat %w[-P HighSecurity] if Gem::HAVE_OPENSSL
|
34
34
|
|
35
35
|
assert @cmd.handles?(args)
|
36
36
|
end
|
@@ -92,7 +92,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def test_security_policy
|
95
|
-
skip 'openssl is missing' unless
|
95
|
+
skip 'openssl is missing' unless Gem::HAVE_OPENSSL
|
96
96
|
|
97
97
|
@cmd.handle_options %w[-P HighSecurity]
|
98
98
|
|
@@ -100,7 +100,7 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def test_security_policy_unknown
|
103
|
-
skip 'openssl is missing' unless
|
103
|
+
skip 'openssl is missing' unless Gem::HAVE_OPENSSL
|
104
104
|
|
105
105
|
@cmd.add_install_update_options
|
106
106
|
|
@@ -111,6 +111,13 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def test_user_install_enabled
|
114
|
+
@spec = quick_gem 'a' do |spec|
|
115
|
+
util_make_exec spec
|
116
|
+
end
|
117
|
+
|
118
|
+
util_build_gem @spec
|
119
|
+
@gem = @spec.cache_file
|
120
|
+
|
114
121
|
@cmd.handle_options %w[--user-install]
|
115
122
|
|
116
123
|
assert @cmd.options[:user_install]
|
@@ -122,6 +129,13 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|
122
129
|
end
|
123
130
|
|
124
131
|
def test_user_install_disabled_read_only
|
132
|
+
@spec = quick_gem 'a' do |spec|
|
133
|
+
util_make_exec spec
|
134
|
+
end
|
135
|
+
|
136
|
+
util_build_gem @spec
|
137
|
+
@gem = @spec.cache_file
|
138
|
+
|
125
139
|
if win_platform?
|
126
140
|
skip('test_user_install_disabled_read_only test skipped on MS Windows')
|
127
141
|
elsif Process.uid.zero?
|
@@ -145,28 +159,26 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|
145
159
|
end
|
146
160
|
|
147
161
|
def test_vendor
|
148
|
-
@
|
162
|
+
vendordir(File.join(@tempdir, 'vendor')) do
|
163
|
+
@cmd.handle_options %w[--vendor]
|
149
164
|
|
150
|
-
|
151
|
-
|
165
|
+
assert @cmd.options[:vendor]
|
166
|
+
assert_equal Gem.vendor_dir, @cmd.options[:install_dir]
|
167
|
+
end
|
152
168
|
end
|
153
169
|
|
154
170
|
def test_vendor_missing
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
@cmd.handle_options %w[--vendor]
|
160
|
-
end
|
161
|
-
|
162
|
-
assert_equal 'invalid option: --vendor your platform is not supported',
|
163
|
-
e.message
|
171
|
+
vendordir(nil) do
|
172
|
+
e = assert_raises OptionParser::InvalidOption do
|
173
|
+
@cmd.handle_options %w[--vendor]
|
174
|
+
end
|
164
175
|
|
165
|
-
|
166
|
-
|
176
|
+
assert_equal 'invalid option: --vendor your platform is not supported',
|
177
|
+
e.message
|
167
178
|
|
168
|
-
|
169
|
-
|
179
|
+
refute @cmd.options[:vendor]
|
180
|
+
refute @cmd.options[:install_dir]
|
181
|
+
end
|
170
182
|
end
|
171
183
|
|
172
184
|
def test_post_install_message_no
|
@@ -180,4 +192,16 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
|
|
180
192
|
|
181
193
|
assert_equal true, @cmd.options[:post_install_message]
|
182
194
|
end
|
195
|
+
|
196
|
+
def test_minimal_deps_no
|
197
|
+
@cmd.handle_options %w[--no-minimal-deps]
|
198
|
+
|
199
|
+
assert_equal false, @cmd.options[:minimal_deps]
|
200
|
+
end
|
201
|
+
|
202
|
+
def test_minimal_deps
|
203
|
+
@cmd.handle_options %w[--minimal-deps]
|
204
|
+
|
205
|
+
assert_equal true, @cmd.options[:minimal_deps]
|
206
|
+
end
|
183
207
|
end
|
@@ -2,30 +2,10 @@
|
|
2
2
|
require 'rubygems/installer_test_case'
|
3
3
|
|
4
4
|
class TestGemInstaller < Gem::InstallerTestCase
|
5
|
-
@@symlink_supported = nil
|
6
|
-
|
7
|
-
def symlink_supported?
|
8
|
-
if @@symlink_supported.nil?
|
9
|
-
begin
|
10
|
-
File.symlink("", "")
|
11
|
-
rescue Errno::ENOENT, Errno::EEXIST
|
12
|
-
@@symlink_supported = true
|
13
|
-
rescue NotImplementedError, SystemCallError
|
14
|
-
@@symlink_supported = false
|
15
|
-
end
|
16
|
-
end
|
17
|
-
@@symlink_supported
|
18
|
-
end
|
19
|
-
|
20
5
|
def setup
|
21
6
|
super
|
22
7
|
common_installer_setup
|
23
8
|
|
24
|
-
if (self.class.method_defined?(:__name__) ? __name__ : name) =~ /\Atest_install(_|\Z)/
|
25
|
-
FileUtils.rm_r @spec.gem_dir
|
26
|
-
FileUtils.rm_r @user_spec.gem_dir
|
27
|
-
end
|
28
|
-
|
29
9
|
@config = Gem.configuration
|
30
10
|
end
|
31
11
|
|
@@ -38,6 +18,8 @@ class TestGemInstaller < Gem::InstallerTestCase
|
|
38
18
|
end
|
39
19
|
|
40
20
|
def test_app_script_text
|
21
|
+
installer = setup_base_installer
|
22
|
+
|
41
23
|
util_make_exec @spec, ''
|
42
24
|
|
43
25
|
expected = <<-EOF
|
@@ -70,12 +52,14 @@ load Gem.bin_path("a", "executable", version)
|
|
70
52
|
end
|
71
53
|
EOF
|
72
54
|
|
73
|
-
wrapper =
|
55
|
+
wrapper = installer.app_script_text 'executable'
|
74
56
|
assert_equal expected, wrapper
|
75
57
|
end
|
76
58
|
|
77
59
|
def test_check_executable_overwrite
|
78
|
-
|
60
|
+
installer = setup_base_installer
|
61
|
+
|
62
|
+
installer.generate_bin
|
79
63
|
|
80
64
|
@spec = Gem::Specification.new do |s|
|
81
65
|
s.files = ['lib/code.rb']
|
@@ -87,49 +71,40 @@ end
|
|
87
71
|
end
|
88
72
|
|
89
73
|
util_make_exec
|
90
|
-
|
91
|
-
|
92
|
-
|
74
|
+
installer.gem_dir = @spec.gem_dir
|
75
|
+
installer.wrappers = true
|
76
|
+
installer.generate_bin
|
93
77
|
|
94
78
|
installed_exec = File.join util_inst_bindir, 'executable'
|
95
79
|
assert_path_exists installed_exec
|
96
80
|
|
97
81
|
wrapper = File.read installed_exec
|
98
|
-
assert_match %r
|
82
|
+
assert_match %r{generated by RubyGems}, wrapper
|
99
83
|
end
|
100
84
|
|
101
85
|
def test_check_executable_overwrite_default_bin_dir
|
102
|
-
|
103
|
-
orig_RUBY_FRAMEWORK_VERSION = RUBY_FRAMEWORK_VERSION
|
104
|
-
Object.send :remove_const, :RUBY_FRAMEWORK_VERSION
|
105
|
-
end
|
106
|
-
orig_bindir = RbConfig::CONFIG['bindir']
|
107
|
-
RbConfig::CONFIG['bindir'] = Gem.bindir
|
86
|
+
installer = setup_base_installer(false)
|
108
87
|
|
109
|
-
|
88
|
+
bindir(Gem.bindir) do
|
89
|
+
util_conflict_executable false
|
110
90
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
91
|
+
ui = Gem::MockGemUi.new "n\n"
|
92
|
+
use_ui ui do
|
93
|
+
e = assert_raises Gem::InstallError do
|
94
|
+
installer.generate_bin
|
95
|
+
end
|
116
96
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
ensure
|
122
|
-
Object.const_set :RUBY_FRAMEWORK_VERSION, orig_RUBY_FRAMEWORK_VERSION if
|
123
|
-
orig_RUBY_FRAMEWORK_VERSION
|
124
|
-
if orig_bindir
|
125
|
-
RbConfig::CONFIG['bindir'] = orig_bindir
|
126
|
-
else
|
127
|
-
RbConfig::CONFIG.delete 'bindir'
|
97
|
+
conflicted = File.join @gemhome, 'bin', 'executable'
|
98
|
+
assert_match %r{\A"executable" from a conflicts with (?:#{Regexp.quote(conflicted)}|installed executable from conflict)\z},
|
99
|
+
e.message
|
100
|
+
end
|
128
101
|
end
|
129
102
|
end
|
130
103
|
|
131
104
|
def test_check_executable_overwrite_format_executable
|
132
|
-
|
105
|
+
installer = setup_base_installer
|
106
|
+
|
107
|
+
installer.generate_bin
|
133
108
|
|
134
109
|
@spec = Gem::Specification.new do |s|
|
135
110
|
s.files = ['lib/code.rb']
|
@@ -152,29 +127,31 @@ gem 'other', version
|
|
152
127
|
|
153
128
|
util_make_exec
|
154
129
|
Gem::Installer.exec_format = 'foo-%s-bar'
|
155
|
-
|
156
|
-
|
157
|
-
|
130
|
+
installer.gem_dir = @spec.gem_dir
|
131
|
+
installer.wrappers = true
|
132
|
+
installer.format_executable = true
|
158
133
|
|
159
|
-
|
134
|
+
installer.generate_bin # should not raise
|
160
135
|
|
161
136
|
installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
|
162
137
|
assert_path_exists installed_exec
|
163
138
|
|
164
139
|
wrapper = File.read installed_exec
|
165
|
-
assert_match %r
|
140
|
+
assert_match %r{generated by RubyGems}, wrapper
|
166
141
|
ensure
|
167
142
|
Gem::Installer.exec_format = nil
|
168
143
|
end
|
169
144
|
|
170
145
|
def test_check_executable_overwrite_other_gem
|
146
|
+
installer = setup_base_installer(false)
|
147
|
+
|
171
148
|
util_conflict_executable true
|
172
149
|
|
173
150
|
ui = Gem::MockGemUi.new "n\n"
|
174
151
|
|
175
152
|
use_ui ui do
|
176
153
|
e = assert_raises Gem::InstallError do
|
177
|
-
|
154
|
+
installer.generate_bin
|
178
155
|
end
|
179
156
|
|
180
157
|
assert_equal '"executable" from a conflicts with installed executable from conflict',
|
@@ -183,44 +160,60 @@ gem 'other', version
|
|
183
160
|
end
|
184
161
|
|
185
162
|
def test_check_executable_overwrite_other_gem_force
|
163
|
+
installer = setup_base_installer
|
164
|
+
|
186
165
|
util_conflict_executable true
|
187
|
-
|
188
|
-
|
166
|
+
installer.wrappers = true
|
167
|
+
installer.force = true
|
189
168
|
|
190
|
-
|
169
|
+
installer.generate_bin
|
191
170
|
|
192
171
|
installed_exec = File.join util_inst_bindir, 'executable'
|
193
172
|
assert_path_exists installed_exec
|
194
173
|
|
195
174
|
wrapper = File.read installed_exec
|
196
|
-
assert_match %r
|
175
|
+
assert_match %r{generated by RubyGems}, wrapper
|
197
176
|
end
|
198
177
|
|
199
178
|
def test_check_executable_overwrite_other_non_gem
|
179
|
+
installer = setup_base_installer
|
180
|
+
|
200
181
|
util_conflict_executable false
|
201
|
-
|
182
|
+
installer.wrappers = true
|
202
183
|
|
203
|
-
|
184
|
+
installer.generate_bin
|
204
185
|
|
205
186
|
installed_exec = File.join util_inst_bindir, 'executable'
|
206
187
|
assert_path_exists installed_exec
|
207
188
|
|
208
189
|
wrapper = File.read installed_exec
|
209
|
-
assert_match %r
|
190
|
+
assert_match %r{generated by RubyGems}, wrapper
|
210
191
|
end unless Gem.win_platform?
|
211
192
|
|
212
193
|
def test_check_that_user_bin_dir_is_in_path
|
213
|
-
|
194
|
+
installer = setup_base_installer
|
195
|
+
|
196
|
+
bin_dir = installer.bin_dir
|
214
197
|
|
215
198
|
if Gem.win_platform?
|
216
|
-
bin_dir = bin_dir.downcase
|
199
|
+
bin_dir = bin_dir.downcase
|
217
200
|
end
|
218
201
|
|
219
202
|
orig_PATH, ENV['PATH'] =
|
220
203
|
ENV['PATH'], [ENV['PATH'], bin_dir].join(File::PATH_SEPARATOR)
|
221
204
|
|
222
205
|
use_ui @ui do
|
223
|
-
|
206
|
+
installer.check_that_user_bin_dir_is_in_path
|
207
|
+
end
|
208
|
+
|
209
|
+
assert_empty @ui.error
|
210
|
+
|
211
|
+
return unless win_platform?
|
212
|
+
|
213
|
+
ENV['PATH'] = [orig_PATH, bin_dir.tr(File::SEPARATOR, File::ALT_SEPARATOR)].join(File::PATH_SEPARATOR)
|
214
|
+
|
215
|
+
use_ui @ui do
|
216
|
+
installer.check_that_user_bin_dir_is_in_path
|
224
217
|
end
|
225
218
|
|
226
219
|
assert_empty @ui.error
|
@@ -234,10 +227,11 @@ gem 'other', version
|
|
234
227
|
orig_PATH, ENV['PATH'] =
|
235
228
|
ENV['PATH'], [ENV['PATH'], '~/bin'].join(File::PATH_SEPARATOR)
|
236
229
|
|
237
|
-
|
230
|
+
installer = setup_base_installer
|
231
|
+
installer.bin_dir.replace File.join @userhome, 'bin'
|
238
232
|
|
239
233
|
use_ui @ui do
|
240
|
-
|
234
|
+
installer.check_that_user_bin_dir_is_in_path
|
241
235
|
end
|
242
236
|
|
243
237
|
assert_empty @ui.error
|
@@ -246,28 +240,32 @@ gem 'other', version
|
|
246
240
|
end
|
247
241
|
|
248
242
|
def test_check_that_user_bin_dir_is_in_path_not_in_path
|
243
|
+
installer = setup_base_installer
|
244
|
+
|
249
245
|
use_ui @ui do
|
250
|
-
|
246
|
+
installer.check_that_user_bin_dir_is_in_path
|
251
247
|
end
|
252
248
|
|
253
|
-
expected =
|
249
|
+
expected = installer.bin_dir
|
254
250
|
|
255
251
|
if Gem.win_platform?
|
256
|
-
expected = expected.downcase
|
252
|
+
expected = expected.downcase
|
257
253
|
end
|
258
254
|
|
259
255
|
assert_match expected, @ui.error
|
260
256
|
end
|
261
257
|
|
262
258
|
def test_ensure_dependency
|
259
|
+
installer = setup_base_installer
|
260
|
+
|
263
261
|
util_spec 'a'
|
264
262
|
|
265
263
|
dep = Gem::Dependency.new 'a', '>= 2'
|
266
|
-
assert
|
264
|
+
assert installer.ensure_dependency(@spec, dep)
|
267
265
|
|
268
266
|
dep = Gem::Dependency.new 'b', '> 2'
|
269
267
|
e = assert_raises Gem::InstallError do
|
270
|
-
|
268
|
+
installer.ensure_dependency @spec, dep
|
271
269
|
end
|
272
270
|
|
273
271
|
assert_equal 'a requires b (> 2)', e.message
|
@@ -289,7 +287,7 @@ gem 'other', version
|
|
289
287
|
end
|
290
288
|
|
291
289
|
def test_ensure_loadable_spec_security_policy
|
292
|
-
skip 'openssl is missing' unless
|
290
|
+
skip 'openssl is missing' unless Gem::HAVE_OPENSSL
|
293
291
|
|
294
292
|
_, a_gem = util_gem 'a', 2 do |s|
|
295
293
|
s.add_dependency 'garbage ~> 5'
|
@@ -304,34 +302,38 @@ gem 'other', version
|
|
304
302
|
end
|
305
303
|
|
306
304
|
def test_extract_files
|
307
|
-
|
305
|
+
installer = setup_base_installer
|
306
|
+
|
307
|
+
installer.extract_files
|
308
308
|
|
309
309
|
assert_path_exists File.join @spec.gem_dir, 'bin/executable'
|
310
310
|
end
|
311
311
|
|
312
312
|
def test_generate_bin_bindir
|
313
|
-
|
313
|
+
installer = setup_base_installer
|
314
|
+
|
315
|
+
installer.wrappers = true
|
314
316
|
|
315
317
|
@spec.executables = %w[executable]
|
316
318
|
@spec.bindir = 'bin'
|
317
319
|
|
318
|
-
exec_file =
|
320
|
+
exec_file = installer.formatted_program_filename 'executable'
|
319
321
|
exec_path = File.join @spec.gem_dir, exec_file
|
320
322
|
File.open exec_path, 'w' do |f|
|
321
323
|
f.puts '#!/usr/bin/ruby'
|
322
324
|
end
|
323
325
|
|
324
|
-
|
326
|
+
installer.gem_dir = @spec.gem_dir
|
325
327
|
|
326
|
-
|
328
|
+
installer.generate_bin
|
327
329
|
|
328
|
-
assert_directory_exists
|
330
|
+
assert_directory_exists util_inst_bindir
|
329
331
|
installed_exec = File.join(util_inst_bindir, 'executable')
|
330
332
|
assert_path_exists installed_exec
|
331
333
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
332
334
|
|
333
335
|
wrapper = File.read installed_exec
|
334
|
-
assert_match %r
|
336
|
+
assert_match %r{generated by RubyGems}, wrapper
|
335
337
|
end
|
336
338
|
|
337
339
|
def test_generate_bin_bindir_with_user_install_warning
|
@@ -343,7 +345,7 @@ gem 'other', version
|
|
343
345
|
|
344
346
|
options = {
|
345
347
|
:bin_dir => bin_dir,
|
346
|
-
:install_dir => "/non/existent"
|
348
|
+
:install_dir => "/non/existent",
|
347
349
|
}
|
348
350
|
|
349
351
|
inst = Gem::Installer.at '', options
|
@@ -361,28 +363,32 @@ gem 'other', version
|
|
361
363
|
end
|
362
364
|
|
363
365
|
def test_generate_bin_script
|
364
|
-
|
366
|
+
installer = setup_base_installer
|
367
|
+
|
368
|
+
installer.wrappers = true
|
365
369
|
util_make_exec
|
366
|
-
|
370
|
+
installer.gem_dir = @spec.gem_dir
|
367
371
|
|
368
|
-
|
372
|
+
installer.generate_bin
|
369
373
|
assert_directory_exists util_inst_bindir
|
370
374
|
installed_exec = File.join util_inst_bindir, 'executable'
|
371
375
|
assert_path_exists installed_exec
|
372
376
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
373
377
|
|
374
378
|
wrapper = File.read installed_exec
|
375
|
-
assert_match %r
|
379
|
+
assert_match %r{generated by RubyGems}, wrapper
|
376
380
|
end
|
377
381
|
|
378
382
|
def test_generate_bin_script_format
|
379
|
-
|
380
|
-
|
383
|
+
installer = setup_base_installer
|
384
|
+
|
385
|
+
installer.format_executable = true
|
386
|
+
installer.wrappers = true
|
381
387
|
util_make_exec
|
382
|
-
|
388
|
+
installer.gem_dir = @spec.gem_dir
|
383
389
|
|
384
390
|
Gem::Installer.exec_format = 'foo-%s-bar'
|
385
|
-
|
391
|
+
installer.generate_bin
|
386
392
|
assert_directory_exists util_inst_bindir
|
387
393
|
installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
|
388
394
|
assert_path_exists installed_exec
|
@@ -391,12 +397,14 @@ gem 'other', version
|
|
391
397
|
end
|
392
398
|
|
393
399
|
def test_generate_bin_script_format_disabled
|
394
|
-
|
400
|
+
installer = setup_base_installer
|
401
|
+
|
402
|
+
installer.wrappers = true
|
395
403
|
util_make_exec
|
396
|
-
|
404
|
+
installer.gem_dir = @spec.gem_dir
|
397
405
|
|
398
406
|
Gem::Installer.exec_format = 'foo-%s-bar'
|
399
|
-
|
407
|
+
installer.generate_bin
|
400
408
|
assert_directory_exists util_inst_bindir
|
401
409
|
installed_exec = File.join util_inst_bindir, 'executable'
|
402
410
|
assert_path_exists installed_exec
|
@@ -405,7 +413,9 @@ gem 'other', version
|
|
405
413
|
end
|
406
414
|
|
407
415
|
def test_generate_bin_script_install_dir
|
408
|
-
|
416
|
+
installer = setup_base_installer
|
417
|
+
|
418
|
+
installer.wrappers = true
|
409
419
|
|
410
420
|
gem_dir = File.join("#{@gemhome}2", "gems", @spec.full_name)
|
411
421
|
gem_bindir = File.join gem_dir, 'bin'
|
@@ -414,31 +424,35 @@ gem 'other', version
|
|
414
424
|
f.puts "#!/bin/ruby"
|
415
425
|
end
|
416
426
|
|
417
|
-
|
418
|
-
|
419
|
-
|
427
|
+
installer.gem_home = "#{@gemhome}2"
|
428
|
+
installer.gem_dir = gem_dir
|
429
|
+
installer.bin_dir = File.join "#{@gemhome}2", 'bin'
|
420
430
|
|
421
|
-
|
431
|
+
installer.generate_bin
|
422
432
|
|
423
433
|
installed_exec = File.join("#{@gemhome}2", "bin", 'executable')
|
424
434
|
assert_path_exists installed_exec
|
425
435
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
426
436
|
|
427
437
|
wrapper = File.read installed_exec
|
428
|
-
assert_match %r
|
438
|
+
assert_match %r{generated by RubyGems}, wrapper
|
429
439
|
end
|
430
440
|
|
431
441
|
def test_generate_bin_script_no_execs
|
432
|
-
|
442
|
+
installer = setup_base_installer
|
433
443
|
|
434
|
-
|
435
|
-
|
444
|
+
installer = util_execless
|
445
|
+
|
446
|
+
installer.wrappers = true
|
447
|
+
installer.generate_bin
|
436
448
|
|
437
449
|
refute_path_exists util_inst_bindir, 'bin dir was created when not needed'
|
438
450
|
end
|
439
451
|
|
440
452
|
def test_generate_bin_script_no_perms
|
441
|
-
|
453
|
+
installer = setup_base_installer
|
454
|
+
|
455
|
+
installer.wrappers = true
|
442
456
|
util_make_exec
|
443
457
|
|
444
458
|
Dir.mkdir util_inst_bindir
|
@@ -451,7 +465,7 @@ gem 'other', version
|
|
451
465
|
FileUtils.chmod 0000, util_inst_bindir
|
452
466
|
|
453
467
|
assert_raises Gem::FilePermissionError do
|
454
|
-
|
468
|
+
installer.generate_bin
|
455
469
|
end
|
456
470
|
end
|
457
471
|
ensure
|
@@ -459,7 +473,9 @@ gem 'other', version
|
|
459
473
|
end
|
460
474
|
|
461
475
|
def test_generate_bin_script_no_shebang
|
462
|
-
|
476
|
+
installer = setup_base_installer
|
477
|
+
|
478
|
+
installer.wrappers = true
|
463
479
|
@spec.executables = %w[executable]
|
464
480
|
|
465
481
|
gem_dir = File.join @gemhome, 'gems', @spec.full_name
|
@@ -469,22 +485,24 @@ gem 'other', version
|
|
469
485
|
f.puts "blah blah blah"
|
470
486
|
end
|
471
487
|
|
472
|
-
|
488
|
+
installer.generate_bin
|
473
489
|
|
474
490
|
installed_exec = File.join @gemhome, 'bin', 'executable'
|
475
491
|
assert_path_exists installed_exec
|
476
492
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
477
493
|
|
478
494
|
wrapper = File.read installed_exec
|
479
|
-
assert_match %r
|
495
|
+
assert_match %r{generated by RubyGems}, wrapper
|
480
496
|
# HACK some gems don't have #! in their executables, restore 2008/06
|
481
497
|
#assert_no_match %r|generated by RubyGems|, wrapper
|
482
498
|
end
|
483
499
|
|
484
500
|
def test_generate_bin_script_wrappers
|
485
|
-
|
501
|
+
installer = setup_base_installer
|
502
|
+
|
503
|
+
installer.wrappers = true
|
486
504
|
util_make_exec
|
487
|
-
|
505
|
+
installer.gem_dir = @spec.gem_dir
|
488
506
|
installed_exec = File.join(util_inst_bindir, 'executable')
|
489
507
|
|
490
508
|
real_exec = File.join @spec.gem_dir, 'bin', 'executable'
|
@@ -495,25 +513,27 @@ gem 'other', version
|
|
495
513
|
FileUtils.ln_s real_exec, installed_exec
|
496
514
|
end
|
497
515
|
|
498
|
-
|
516
|
+
installer.generate_bin
|
499
517
|
assert_directory_exists util_inst_bindir
|
500
518
|
assert_path_exists installed_exec
|
501
519
|
assert_equal mask, File.stat(installed_exec).mode unless win_platform?
|
502
520
|
|
503
|
-
assert_match %r
|
521
|
+
assert_match %r{generated by RubyGems}, File.read(installed_exec)
|
504
522
|
|
505
|
-
refute_match %r
|
523
|
+
refute_match %r{generated by RubyGems}, File.read(real_exec),
|
506
524
|
'real executable overwritten'
|
507
525
|
end
|
508
526
|
|
509
527
|
def test_generate_bin_symlink
|
510
|
-
|
528
|
+
skip "Symlinks not supported or not enabled" unless symlink_supported?
|
511
529
|
|
512
|
-
|
530
|
+
installer = setup_base_installer
|
531
|
+
|
532
|
+
installer.wrappers = false
|
513
533
|
util_make_exec
|
514
|
-
|
534
|
+
installer.gem_dir = @spec.gem_dir
|
515
535
|
|
516
|
-
|
536
|
+
installer.generate_bin
|
517
537
|
assert_directory_exists util_inst_bindir
|
518
538
|
installed_exec = File.join util_inst_bindir, 'executable'
|
519
539
|
assert_equal true, File.symlink?(installed_exec)
|
@@ -522,18 +542,22 @@ gem 'other', version
|
|
522
542
|
end
|
523
543
|
|
524
544
|
def test_generate_bin_symlink_no_execs
|
525
|
-
|
545
|
+
installer = setup_base_installer
|
526
546
|
|
527
|
-
|
528
|
-
|
547
|
+
installer = util_execless
|
548
|
+
|
549
|
+
installer.wrappers = false
|
550
|
+
installer.generate_bin
|
529
551
|
|
530
552
|
refute_path_exists util_inst_bindir
|
531
553
|
end
|
532
554
|
|
533
555
|
def test_generate_bin_symlink_no_perms
|
534
|
-
|
556
|
+
installer = setup_base_installer
|
557
|
+
|
558
|
+
installer.wrappers = false
|
535
559
|
util_make_exec
|
536
|
-
|
560
|
+
installer.gem_dir = @spec.gem_dir
|
537
561
|
|
538
562
|
Dir.mkdir util_inst_bindir
|
539
563
|
|
@@ -545,7 +569,7 @@ gem 'other', version
|
|
545
569
|
FileUtils.chmod 0000, util_inst_bindir
|
546
570
|
|
547
571
|
assert_raises Gem::FilePermissionError do
|
548
|
-
|
572
|
+
installer.generate_bin
|
549
573
|
end
|
550
574
|
end
|
551
575
|
ensure
|
@@ -553,13 +577,15 @@ gem 'other', version
|
|
553
577
|
end
|
554
578
|
|
555
579
|
def test_generate_bin_symlink_update_newer
|
556
|
-
|
580
|
+
skip "Symlinks not supported or not enabled" unless symlink_supported?
|
581
|
+
|
582
|
+
installer = setup_base_installer
|
557
583
|
|
558
|
-
|
584
|
+
installer.wrappers = false
|
559
585
|
util_make_exec
|
560
|
-
|
586
|
+
installer.gem_dir = @spec.gem_dir
|
561
587
|
|
562
|
-
|
588
|
+
installer.generate_bin
|
563
589
|
installed_exec = File.join(util_inst_bindir, 'executable')
|
564
590
|
assert_equal(File.join(@spec.gem_dir, 'bin', 'executable'),
|
565
591
|
File.readlink(installed_exec))
|
@@ -574,8 +600,8 @@ gem 'other', version
|
|
574
600
|
end
|
575
601
|
|
576
602
|
util_make_exec
|
577
|
-
|
578
|
-
|
603
|
+
installer.gem_dir = @spec.gem_dir
|
604
|
+
installer.generate_bin
|
579
605
|
installed_exec = File.join(util_inst_bindir, 'executable')
|
580
606
|
assert_equal(@spec.bin_file('executable'),
|
581
607
|
File.readlink(installed_exec),
|
@@ -583,13 +609,15 @@ gem 'other', version
|
|
583
609
|
end
|
584
610
|
|
585
611
|
def test_generate_bin_symlink_update_older
|
586
|
-
|
612
|
+
skip "Symlinks not supported or not enabled" unless symlink_supported?
|
613
|
+
|
614
|
+
installer = setup_base_installer
|
587
615
|
|
588
|
-
|
616
|
+
installer.wrappers = false
|
589
617
|
util_make_exec
|
590
|
-
|
618
|
+
installer.gem_dir = @spec.gem_dir
|
591
619
|
|
592
|
-
|
620
|
+
installer.generate_bin
|
593
621
|
installed_exec = File.join(util_inst_bindir, 'executable')
|
594
622
|
assert_equal(File.join(@spec.gem_dir, 'bin', 'executable'),
|
595
623
|
File.readlink(installed_exec))
|
@@ -606,10 +634,10 @@ gem 'other', version
|
|
606
634
|
util_make_exec
|
607
635
|
one = @spec.dup
|
608
636
|
one.version = 1
|
609
|
-
|
610
|
-
|
637
|
+
installer = Gem::Installer.for_spec spec
|
638
|
+
installer.gem_dir = one.gem_dir
|
611
639
|
|
612
|
-
|
640
|
+
installer.generate_bin
|
613
641
|
|
614
642
|
installed_exec = File.join util_inst_bindir, 'executable'
|
615
643
|
expected = File.join @spec.gem_dir, 'bin', 'executable'
|
@@ -619,13 +647,15 @@ gem 'other', version
|
|
619
647
|
end
|
620
648
|
|
621
649
|
def test_generate_bin_symlink_update_remove_wrapper
|
622
|
-
|
650
|
+
skip "Symlinks not supported or not enabled" unless symlink_supported?
|
623
651
|
|
624
|
-
|
652
|
+
installer = setup_base_installer
|
653
|
+
|
654
|
+
installer.wrappers = true
|
625
655
|
util_make_exec
|
626
|
-
|
656
|
+
installer.gem_dir = @spec.gem_dir
|
627
657
|
|
628
|
-
|
658
|
+
installer.generate_bin
|
629
659
|
|
630
660
|
installed_exec = File.join util_inst_bindir, 'executable'
|
631
661
|
assert_path_exists installed_exec
|
@@ -641,10 +671,10 @@ gem 'other', version
|
|
641
671
|
util_make_exec
|
642
672
|
|
643
673
|
util_installer @spec, @gemhome
|
644
|
-
|
645
|
-
|
674
|
+
installer.wrappers = false
|
675
|
+
installer.gem_dir = @spec.gem_dir
|
646
676
|
|
647
|
-
|
677
|
+
installer.generate_bin
|
648
678
|
|
649
679
|
installed_exec = File.join util_inst_bindir, 'executable'
|
650
680
|
assert_equal(@spec.bin_file('executable'),
|
@@ -658,12 +688,15 @@ gem 'other', version
|
|
658
688
|
old_alt_separator = File::ALT_SEPARATOR
|
659
689
|
File.__send__(:remove_const, :ALT_SEPARATOR)
|
660
690
|
File.const_set(:ALT_SEPARATOR, '\\')
|
661
|
-
|
691
|
+
|
692
|
+
installer = setup_base_installer
|
693
|
+
|
694
|
+
installer.wrappers = false
|
662
695
|
util_make_exec
|
663
|
-
|
696
|
+
installer.gem_dir = @spec.gem_dir
|
664
697
|
|
665
698
|
use_ui @ui do
|
666
|
-
|
699
|
+
installer.generate_bin
|
667
700
|
end
|
668
701
|
|
669
702
|
assert_directory_exists util_inst_bindir
|
@@ -687,21 +720,169 @@ gem 'other', version
|
|
687
720
|
end
|
688
721
|
|
689
722
|
def test_generate_bin_uses_default_shebang
|
690
|
-
|
723
|
+
skip "Symlinks not supported or not enabled" unless symlink_supported?
|
691
724
|
|
692
|
-
|
725
|
+
installer = setup_base_installer
|
726
|
+
|
727
|
+
installer.wrappers = true
|
693
728
|
util_make_exec
|
694
729
|
|
695
|
-
|
730
|
+
installer.generate_bin
|
696
731
|
|
697
732
|
default_shebang = Gem.ruby
|
698
|
-
shebang_line = open("#{@gemhome}/bin/executable") {
|
733
|
+
shebang_line = open("#{@gemhome}/bin/executable") {|f| f.readlines.first }
|
699
734
|
assert_match(/\A#!/, shebang_line)
|
700
735
|
assert_match(/#{default_shebang}/, shebang_line)
|
701
736
|
end
|
702
737
|
|
738
|
+
def test_generate_plugins
|
739
|
+
installer = util_setup_installer do |spec|
|
740
|
+
write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
|
741
|
+
io.write "puts __FILE__"
|
742
|
+
end
|
743
|
+
|
744
|
+
spec.files += %w[lib/rubygems_plugin.rb]
|
745
|
+
end
|
746
|
+
|
747
|
+
build_rake_in do
|
748
|
+
installer.install
|
749
|
+
end
|
750
|
+
|
751
|
+
plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
|
752
|
+
|
753
|
+
FileUtils.rm plugin_path
|
754
|
+
|
755
|
+
installer.generate_plugins
|
756
|
+
|
757
|
+
assert File.exist?(plugin_path), 'plugin not written'
|
758
|
+
end
|
759
|
+
|
760
|
+
def test_generate_plugins_with_install_dir
|
761
|
+
spec = quick_gem 'a' do |s|
|
762
|
+
write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
|
763
|
+
io.write "puts __FILE__"
|
764
|
+
end
|
765
|
+
|
766
|
+
s.files += %w[lib/rubygems_plugin.rb]
|
767
|
+
end
|
768
|
+
|
769
|
+
util_build_gem spec
|
770
|
+
|
771
|
+
plugin_path = File.join "#{@gemhome}2", 'plugins', 'a_plugin.rb'
|
772
|
+
installer = util_installer spec, "#{@gemhome}2"
|
773
|
+
|
774
|
+
assert_equal spec, installer.install
|
775
|
+
|
776
|
+
assert File.exist?(plugin_path), 'plugin not written to install_dir'
|
777
|
+
end
|
778
|
+
|
779
|
+
def test_generate_plugins_with_user_install
|
780
|
+
spec = quick_gem 'a' do |s|
|
781
|
+
write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
|
782
|
+
io.write "puts __FILE__"
|
783
|
+
end
|
784
|
+
|
785
|
+
s.files += %w[lib/rubygems_plugin.rb]
|
786
|
+
end
|
787
|
+
|
788
|
+
util_build_gem spec
|
789
|
+
|
790
|
+
File.chmod(0555, Gem.plugindir)
|
791
|
+
system_path = File.join(Gem.plugindir, 'a_plugin.rb')
|
792
|
+
user_path = File.join(Gem.plugindir(Gem.user_dir), 'a_plugin.rb')
|
793
|
+
installer = util_installer spec, Gem.dir, :user
|
794
|
+
|
795
|
+
assert_equal spec, installer.install
|
796
|
+
|
797
|
+
assert !File.exist?(system_path), 'plugin incorrectly written to system plugins_dir'
|
798
|
+
assert File.exist?(user_path), 'plugin not written to user plugins_dir'
|
799
|
+
end
|
800
|
+
|
801
|
+
def test_generate_plugins_with_build_root
|
802
|
+
spec = quick_gem 'a' do |s|
|
803
|
+
write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
|
804
|
+
io.write "puts __FILE__"
|
805
|
+
end
|
806
|
+
|
807
|
+
s.files += %w[lib/rubygems_plugin.rb]
|
808
|
+
end
|
809
|
+
|
810
|
+
util_build_gem spec
|
811
|
+
|
812
|
+
File.chmod(0555, Gem.plugindir)
|
813
|
+
system_path = File.join(Gem.plugindir, 'a_plugin.rb')
|
814
|
+
|
815
|
+
build_root = File.join(@tempdir, 'build_root')
|
816
|
+
build_root_path = File.join(build_root, Gem.plugindir.gsub(/^[a-zA-Z]:/, ''), 'a_plugin.rb')
|
817
|
+
|
818
|
+
installer = Gem::Installer.at spec.cache_file, :build_root => build_root
|
819
|
+
|
820
|
+
assert_equal spec, installer.install
|
821
|
+
|
822
|
+
assert !File.exist?(system_path), 'plugin written incorrect written to system plugins_dir'
|
823
|
+
assert File.exist?(build_root_path), 'plugin not written to build_root'
|
824
|
+
|
825
|
+
refute_includes File.read(build_root_path), build_root
|
826
|
+
end
|
827
|
+
|
828
|
+
def test_keeps_plugins_up_to_date
|
829
|
+
# NOTE: version a-2 is already installed by setup hooks
|
830
|
+
|
831
|
+
write_file File.join(@tempdir, 'lib', 'rubygems_plugin.rb') do |io|
|
832
|
+
io.write "puts __FILE__"
|
833
|
+
end
|
834
|
+
|
835
|
+
build_rake_in do
|
836
|
+
util_setup_installer do |spec|
|
837
|
+
spec.version = '1'
|
838
|
+
spec.files += %w[lib/rubygems_plugin.rb]
|
839
|
+
end.install
|
840
|
+
|
841
|
+
plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
|
842
|
+
refute File.exist?(plugin_path), 'old version installed while newer version without plugin also installed, but plugin written'
|
843
|
+
|
844
|
+
util_setup_installer do |spec|
|
845
|
+
spec.version = '2'
|
846
|
+
spec.files += %w[lib/rubygems_plugin.rb]
|
847
|
+
end.install
|
848
|
+
|
849
|
+
plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
|
850
|
+
assert File.exist?(plugin_path), 'latest version reinstalled, but plugin not written'
|
851
|
+
assert_match %r{\Arequire.*a-2/lib/rubygems_plugin\.rb}, File.read(plugin_path), 'written plugin has incorrect content'
|
852
|
+
|
853
|
+
util_setup_installer do |spec|
|
854
|
+
spec.version = '3'
|
855
|
+
spec.files += %w[lib/rubygems_plugin.rb]
|
856
|
+
end.install
|
857
|
+
|
858
|
+
plugin_path = File.join Gem.plugindir, 'a_plugin.rb'
|
859
|
+
assert File.exist?(plugin_path), 'latest version installed, but plugin removed'
|
860
|
+
assert_match %r{\Arequire.*a-3/lib/rubygems_plugin\.rb}, File.read(plugin_path), 'written plugin has incorrect content'
|
861
|
+
|
862
|
+
util_setup_installer do |spec|
|
863
|
+
spec.version = '4'
|
864
|
+
end.install
|
865
|
+
|
866
|
+
refute File.exist?(plugin_path), 'new version installed without a plugin while older version with a plugin installed, but plugin not removed'
|
867
|
+
end
|
868
|
+
end
|
869
|
+
|
870
|
+
def test_generates_plugins_dir_under_install_dir_if_not_there
|
871
|
+
Gem.use_paths "#{@gemhome}2" # Set GEM_HOME to an uninitialized repo
|
872
|
+
|
873
|
+
@spec = util_spec 'a'
|
874
|
+
|
875
|
+
path = Gem::Package.build @spec
|
876
|
+
|
877
|
+
installer = Gem::Installer.at path, :install_dir => "#{@gemhome}3"
|
878
|
+
assert_equal @spec, installer.install
|
879
|
+
end
|
880
|
+
|
703
881
|
def test_initialize
|
704
|
-
spec = util_spec 'a' do |s|
|
882
|
+
spec = util_spec 'a' do |s|
|
883
|
+
s.platform = Gem::Platform.new 'mswin32'
|
884
|
+
end
|
885
|
+
|
705
886
|
gem = File.join @tempdir, spec.file_name
|
706
887
|
|
707
888
|
Dir.mkdir util_inst_bindir
|
@@ -715,6 +896,8 @@ gem 'other', version
|
|
715
896
|
end
|
716
897
|
|
717
898
|
def test_initialize_user_install
|
899
|
+
@gem = setup_base_gem
|
900
|
+
|
718
901
|
installer = Gem::Installer.at @gem, :user_install => true
|
719
902
|
|
720
903
|
assert_equal File.join(Gem.user_dir, 'gems', @spec.full_name),
|
@@ -723,6 +906,8 @@ gem 'other', version
|
|
723
906
|
end
|
724
907
|
|
725
908
|
def test_initialize_user_install_bin_dir
|
909
|
+
@gem = setup_base_gem
|
910
|
+
|
726
911
|
installer =
|
727
912
|
Gem::Installer.at @gem, :user_install => true, :bin_dir => @tempdir
|
728
913
|
|
@@ -732,9 +917,7 @@ gem 'other', version
|
|
732
917
|
end
|
733
918
|
|
734
919
|
def test_install
|
735
|
-
|
736
|
-
util_setup_gem
|
737
|
-
util_clear_gems
|
920
|
+
installer = util_setup_installer
|
738
921
|
|
739
922
|
gemdir = File.join @gemhome, 'gems', @spec.full_name
|
740
923
|
cache_file = File.join @gemhome, 'cache', @spec.file_name
|
@@ -764,7 +947,7 @@ gem 'other', version
|
|
764
947
|
@newspec = nil
|
765
948
|
build_rake_in do
|
766
949
|
use_ui @ui do
|
767
|
-
@newspec =
|
950
|
+
@newspec = installer.install
|
768
951
|
end
|
769
952
|
end
|
770
953
|
|
@@ -782,29 +965,25 @@ gem 'other', version
|
|
782
965
|
|
783
966
|
assert_path_exists rakefile
|
784
967
|
|
785
|
-
spec_file = File.join(@gemhome, 'specifications', @spec.spec_name)
|
786
|
-
|
787
968
|
assert_equal spec_file, @newspec.loaded_from
|
788
969
|
assert_path_exists spec_file
|
789
970
|
|
790
|
-
assert_same
|
791
|
-
assert_same
|
792
|
-
assert_same
|
971
|
+
assert_same installer, @post_build_hook_arg
|
972
|
+
assert_same installer, @post_install_hook_arg
|
973
|
+
assert_same installer, @pre_install_hook_arg
|
793
974
|
end
|
794
975
|
|
795
976
|
def test_install_creates_working_binstub
|
796
|
-
|
797
|
-
util_setup_gem
|
798
|
-
util_clear_gems
|
977
|
+
installer = util_setup_installer
|
799
978
|
|
800
|
-
|
979
|
+
installer.wrappers = true
|
801
980
|
|
802
981
|
gemdir = File.join @gemhome, 'gems', @spec.full_name
|
803
982
|
|
804
983
|
@newspec = nil
|
805
984
|
build_rake_in do
|
806
985
|
use_ui @ui do
|
807
|
-
@newspec =
|
986
|
+
@newspec = installer.install
|
808
987
|
end
|
809
988
|
end
|
810
989
|
|
@@ -818,11 +997,10 @@ gem 'other', version
|
|
818
997
|
end
|
819
998
|
|
820
999
|
def test_conflicting_binstubs
|
821
|
-
|
822
|
-
util_clear_gems
|
1000
|
+
@gem = setup_base_gem
|
823
1001
|
|
824
1002
|
# build old version that has a bin file
|
825
|
-
util_setup_gem do |spec|
|
1003
|
+
installer = util_setup_gem do |spec|
|
826
1004
|
File.open File.join('bin', 'executable'), 'w' do |f|
|
827
1005
|
f.puts "require 'code'"
|
828
1006
|
end
|
@@ -831,17 +1009,17 @@ gem 'other', version
|
|
831
1009
|
end
|
832
1010
|
end
|
833
1011
|
|
834
|
-
|
1012
|
+
installer.wrappers = true
|
835
1013
|
build_rake_in do
|
836
1014
|
use_ui @ui do
|
837
|
-
@newspec =
|
1015
|
+
@newspec = installer.install
|
838
1016
|
end
|
839
1017
|
end
|
840
1018
|
|
841
|
-
old_bin_file = File.join
|
1019
|
+
old_bin_file = File.join installer.bin_dir, 'executable'
|
842
1020
|
|
843
1021
|
# build new version that doesn't have a bin file
|
844
|
-
util_setup_gem do |spec|
|
1022
|
+
installer = util_setup_gem do |spec|
|
845
1023
|
FileUtils.rm File.join('bin', 'executable')
|
846
1024
|
spec.files.delete File.join('bin', 'executable')
|
847
1025
|
spec.executables.delete 'executable'
|
@@ -853,7 +1031,7 @@ gem 'other', version
|
|
853
1031
|
|
854
1032
|
build_rake_in do
|
855
1033
|
use_ui @ui do
|
856
|
-
@newspec =
|
1034
|
+
@newspec = installer.install
|
857
1035
|
end
|
858
1036
|
end
|
859
1037
|
|
@@ -867,16 +1045,14 @@ gem 'other', version
|
|
867
1045
|
end
|
868
1046
|
|
869
1047
|
def test_install_creates_binstub_that_understand_version
|
870
|
-
|
871
|
-
util_setup_gem
|
872
|
-
util_clear_gems
|
1048
|
+
installer = util_setup_installer
|
873
1049
|
|
874
|
-
|
1050
|
+
installer.wrappers = true
|
875
1051
|
|
876
1052
|
@newspec = nil
|
877
1053
|
build_rake_in do
|
878
1054
|
use_ui @ui do
|
879
|
-
@newspec =
|
1055
|
+
@newspec = installer.install
|
880
1056
|
end
|
881
1057
|
end
|
882
1058
|
|
@@ -897,17 +1073,47 @@ gem 'other', version
|
|
897
1073
|
assert_includes(e.message, "can't find gem a (= 3.0)")
|
898
1074
|
end
|
899
1075
|
|
900
|
-
def
|
901
|
-
|
902
|
-
|
1076
|
+
def test_install_creates_binstub_that_prefers_user_installed_gem_to_default
|
1077
|
+
default_spec = new_default_spec('default', '2', nil, 'exe/executable')
|
1078
|
+
default_spec.executables = 'executable'
|
1079
|
+
install_default_gems default_spec
|
1080
|
+
|
1081
|
+
exe = File.join @gemhome, 'bin', 'executable'
|
1082
|
+
|
1083
|
+
assert_path_exists exe, "default gem's executable not installed"
|
1084
|
+
|
1085
|
+
installer = util_setup_installer do |spec|
|
1086
|
+
spec.name = 'default'
|
1087
|
+
spec.version = '2'
|
1088
|
+
end
|
1089
|
+
|
903
1090
|
util_clear_gems
|
904
1091
|
|
905
|
-
|
1092
|
+
installer.wrappers = true
|
1093
|
+
|
1094
|
+
@newspec = nil
|
1095
|
+
build_rake_in do
|
1096
|
+
use_ui @ui do
|
1097
|
+
@newspec = installer.install
|
1098
|
+
end
|
1099
|
+
end
|
1100
|
+
|
1101
|
+
e = assert_raises RuntimeError do
|
1102
|
+
instance_eval File.read(exe)
|
1103
|
+
end
|
1104
|
+
|
1105
|
+
assert_equal(e.message, "ran executable")
|
1106
|
+
end
|
1107
|
+
|
1108
|
+
def test_install_creates_binstub_that_dont_trust_encoding
|
1109
|
+
installer = util_setup_installer
|
1110
|
+
|
1111
|
+
installer.wrappers = true
|
906
1112
|
|
907
1113
|
@newspec = nil
|
908
1114
|
build_rake_in do
|
909
1115
|
use_ui @ui do
|
910
|
-
@newspec =
|
1116
|
+
@newspec = installer.install
|
911
1117
|
end
|
912
1118
|
end
|
913
1119
|
|
@@ -930,33 +1136,35 @@ gem 'other', version
|
|
930
1136
|
end
|
931
1137
|
|
932
1138
|
def test_install_with_no_prior_files
|
933
|
-
|
934
|
-
util_clear_gems
|
1139
|
+
installer = util_setup_installer
|
935
1140
|
|
936
|
-
util_setup_gem
|
937
1141
|
build_rake_in do
|
938
1142
|
use_ui @ui do
|
939
|
-
assert_equal @spec,
|
1143
|
+
assert_equal @spec, installer.install
|
940
1144
|
end
|
941
1145
|
end
|
942
1146
|
|
943
1147
|
gemdir = File.join(@gemhome, 'gems', @spec.full_name)
|
944
1148
|
assert_path_exists File.join gemdir, 'lib', 'code.rb'
|
945
1149
|
|
946
|
-
|
1150
|
+
installer = util_setup_installer
|
1151
|
+
|
947
1152
|
# Morph spec to have lib/other.rb instead of code.rb and recreate
|
948
1153
|
@spec.files = File.join('lib', 'other.rb')
|
949
1154
|
Dir.chdir @tempdir do
|
950
|
-
File.open File.join('lib', 'other.rb'), 'w' do |f|
|
1155
|
+
File.open File.join('lib', 'other.rb'), 'w' do |f|
|
1156
|
+
f.puts '1'
|
1157
|
+
end
|
1158
|
+
|
951
1159
|
use_ui ui do
|
952
1160
|
FileUtils.rm @gem
|
953
1161
|
Gem::Package.build @spec
|
954
1162
|
end
|
955
1163
|
end
|
956
|
-
|
1164
|
+
installer = Gem::Installer.at @gem, :force => true
|
957
1165
|
build_rake_in do
|
958
1166
|
use_ui @ui do
|
959
|
-
assert_equal @spec,
|
1167
|
+
assert_equal @spec, installer.install
|
960
1168
|
end
|
961
1169
|
end
|
962
1170
|
|
@@ -966,22 +1174,37 @@ gem 'other', version
|
|
966
1174
|
end
|
967
1175
|
|
968
1176
|
def test_install_force
|
1177
|
+
_, missing_dep_gem = util_gem 'missing_dep', '1' do |s|
|
1178
|
+
s.add_dependency 'doesnt_exist', '1'
|
1179
|
+
end
|
1180
|
+
|
969
1181
|
use_ui @ui do
|
970
|
-
installer = Gem::Installer.at
|
1182
|
+
installer = Gem::Installer.at missing_dep_gem, :force => true
|
971
1183
|
installer.install
|
972
1184
|
end
|
973
1185
|
|
974
|
-
gem_dir = File.join(@gemhome, 'gems', '
|
1186
|
+
gem_dir = File.join(@gemhome, 'gems', 'missing_dep-1')
|
975
1187
|
assert_path_exists gem_dir
|
976
1188
|
end
|
977
1189
|
|
1190
|
+
def test_install_build_root
|
1191
|
+
build_root = File.join(@tempdir, 'build_root')
|
1192
|
+
|
1193
|
+
@gem = setup_base_gem
|
1194
|
+
installer = Gem::Installer.at @gem, :build_root => build_root
|
1195
|
+
|
1196
|
+
assert_equal @spec, installer.install
|
1197
|
+
end
|
1198
|
+
|
978
1199
|
def test_install_missing_dirs
|
1200
|
+
installer = setup_base_installer
|
1201
|
+
|
979
1202
|
FileUtils.rm_f File.join(Gem.dir, 'cache')
|
980
1203
|
FileUtils.rm_f File.join(Gem.dir, 'doc')
|
981
1204
|
FileUtils.rm_f File.join(Gem.dir, 'specifications')
|
982
1205
|
|
983
1206
|
use_ui @ui do
|
984
|
-
|
1207
|
+
installer.install
|
985
1208
|
end
|
986
1209
|
|
987
1210
|
assert_directory_exists File.join(Gem.dir, 'cache')
|
@@ -993,7 +1216,7 @@ gem 'other', version
|
|
993
1216
|
end
|
994
1217
|
|
995
1218
|
def test_install_post_build_false
|
996
|
-
|
1219
|
+
installer = setup_base_installer
|
997
1220
|
|
998
1221
|
Gem.post_build do
|
999
1222
|
false
|
@@ -1001,7 +1224,7 @@ gem 'other', version
|
|
1001
1224
|
|
1002
1225
|
use_ui @ui do
|
1003
1226
|
e = assert_raises Gem::InstallError do
|
1004
|
-
|
1227
|
+
installer.install
|
1005
1228
|
end
|
1006
1229
|
|
1007
1230
|
location = "#{__FILE__}:#{__LINE__ - 9}"
|
@@ -1017,14 +1240,14 @@ gem 'other', version
|
|
1017
1240
|
end
|
1018
1241
|
|
1019
1242
|
def test_install_post_build_nil
|
1020
|
-
|
1243
|
+
installer = setup_base_installer
|
1021
1244
|
|
1022
1245
|
Gem.post_build do
|
1023
1246
|
nil
|
1024
1247
|
end
|
1025
1248
|
|
1026
1249
|
use_ui @ui do
|
1027
|
-
|
1250
|
+
installer.install
|
1028
1251
|
end
|
1029
1252
|
|
1030
1253
|
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
|
@@ -1035,7 +1258,7 @@ gem 'other', version
|
|
1035
1258
|
end
|
1036
1259
|
|
1037
1260
|
def test_install_pre_install_false
|
1038
|
-
|
1261
|
+
installer = setup_base_installer
|
1039
1262
|
|
1040
1263
|
Gem.pre_install do
|
1041
1264
|
false
|
@@ -1043,7 +1266,7 @@ gem 'other', version
|
|
1043
1266
|
|
1044
1267
|
use_ui @ui do
|
1045
1268
|
e = assert_raises Gem::InstallError do
|
1046
|
-
|
1269
|
+
installer.install
|
1047
1270
|
end
|
1048
1271
|
|
1049
1272
|
location = "#{__FILE__}:#{__LINE__ - 9}"
|
@@ -1056,14 +1279,14 @@ gem 'other', version
|
|
1056
1279
|
end
|
1057
1280
|
|
1058
1281
|
def test_install_pre_install_nil
|
1059
|
-
|
1282
|
+
installer = setup_base_installer
|
1060
1283
|
|
1061
1284
|
Gem.pre_install do
|
1062
1285
|
nil
|
1063
1286
|
end
|
1064
1287
|
|
1065
1288
|
use_ui @ui do
|
1066
|
-
|
1289
|
+
installer.install
|
1067
1290
|
end
|
1068
1291
|
|
1069
1292
|
spec_file = File.join @gemhome, 'specifications', @spec.spec_name
|
@@ -1071,34 +1294,37 @@ gem 'other', version
|
|
1071
1294
|
end
|
1072
1295
|
|
1073
1296
|
def test_install_with_message
|
1297
|
+
@spec = setup_base_spec
|
1074
1298
|
@spec.post_install_message = 'I am a shiny gem!'
|
1075
1299
|
|
1076
1300
|
use_ui @ui do
|
1077
1301
|
path = Gem::Package.build @spec
|
1078
1302
|
|
1079
|
-
|
1080
|
-
|
1303
|
+
installer = Gem::Installer.at path
|
1304
|
+
installer.install
|
1081
1305
|
end
|
1082
1306
|
|
1083
|
-
assert_match %r
|
1307
|
+
assert_match %r{I am a shiny gem!}, @ui.output
|
1084
1308
|
end
|
1085
1309
|
|
1086
1310
|
def test_install_with_skipped_message
|
1311
|
+
@spec = setup_base_spec
|
1087
1312
|
@spec.post_install_message = 'I am a shiny gem!'
|
1088
1313
|
|
1089
1314
|
use_ui @ui do
|
1090
1315
|
path = Gem::Package.build @spec
|
1091
1316
|
|
1092
|
-
|
1093
|
-
|
1317
|
+
installer = Gem::Installer.at path, :post_install_message => false
|
1318
|
+
installer.install
|
1094
1319
|
end
|
1095
1320
|
|
1096
|
-
refute_match %r
|
1321
|
+
refute_match %r{I am a shiny gem!}, @ui.output
|
1097
1322
|
end
|
1098
1323
|
|
1099
1324
|
def test_install_extension_dir
|
1100
1325
|
gemhome2 = "#{@gemhome}2"
|
1101
1326
|
|
1327
|
+
@spec = setup_base_spec
|
1102
1328
|
@spec.extensions << "extconf.rb"
|
1103
1329
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1104
1330
|
io.write <<-RUBY
|
@@ -1122,6 +1348,8 @@ gem 'other', version
|
|
1122
1348
|
end
|
1123
1349
|
|
1124
1350
|
def test_install_extension_dir_is_removed_on_reinstall
|
1351
|
+
@spec = setup_base_spec
|
1352
|
+
|
1125
1353
|
@spec.extensions << "extconf.rb"
|
1126
1354
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1127
1355
|
io.write <<-RUBY
|
@@ -1149,7 +1377,7 @@ gem 'other', version
|
|
1149
1377
|
|
1150
1378
|
# reinstall the gem, this is also the same as pristine
|
1151
1379
|
use_ui @ui do
|
1152
|
-
installer = Gem::Installer.at path
|
1380
|
+
installer = Gem::Installer.at path, :force => true
|
1153
1381
|
installer.install
|
1154
1382
|
end
|
1155
1383
|
|
@@ -1157,6 +1385,7 @@ gem 'other', version
|
|
1157
1385
|
end
|
1158
1386
|
|
1159
1387
|
def test_install_user_extension_dir
|
1388
|
+
@spec = setup_base_spec
|
1160
1389
|
@spec.extensions << "extconf.rb"
|
1161
1390
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1162
1391
|
io.write <<-RUBY
|
@@ -1186,6 +1415,9 @@ gem 'other', version
|
|
1186
1415
|
end
|
1187
1416
|
|
1188
1417
|
def test_find_lib_file_after_install
|
1418
|
+
skip "extensions don't quite work on jruby" if Gem.java_platform?
|
1419
|
+
|
1420
|
+
@spec = setup_base_spec
|
1189
1421
|
@spec.extensions << "extconf.rb"
|
1190
1422
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1191
1423
|
io.write <<-RUBY
|
@@ -1222,13 +1454,16 @@ gem 'other', version
|
|
1222
1454
|
installer.install
|
1223
1455
|
end
|
1224
1456
|
|
1225
|
-
expected = File.join @spec.full_require_paths.find {
|
1457
|
+
expected = File.join @spec.full_require_paths.find {|path|
|
1226
1458
|
File.exist? File.join path, 'b.rb'
|
1227
1459
|
}, 'b.rb'
|
1228
1460
|
assert_equal expected, @spec.matches_for_glob('b.rb').first
|
1229
1461
|
end
|
1230
1462
|
|
1231
1463
|
def test_install_extension_and_script
|
1464
|
+
skip "Makefile creation crashes on jruby" if Gem.java_platform?
|
1465
|
+
|
1466
|
+
@spec = setup_base_spec
|
1232
1467
|
@spec.extensions << "extconf.rb"
|
1233
1468
|
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1234
1469
|
io.write <<-RUBY
|
@@ -1259,14 +1494,17 @@ gem 'other', version
|
|
1259
1494
|
use_ui @ui do
|
1260
1495
|
path = Gem::Package.build @spec
|
1261
1496
|
|
1262
|
-
|
1263
|
-
|
1497
|
+
installer = Gem::Installer.at path
|
1498
|
+
installer.install
|
1264
1499
|
end
|
1265
1500
|
assert_path_exists File.join @spec.gem_dir, rb
|
1266
1501
|
assert_path_exists File.join @spec.gem_dir, rb2
|
1267
1502
|
end
|
1268
1503
|
|
1269
1504
|
def test_install_extension_flat
|
1505
|
+
skip "extensions don't quite work on jruby" if Gem.java_platform?
|
1506
|
+
|
1507
|
+
@spec = setup_base_spec
|
1270
1508
|
@spec.require_paths = ["."]
|
1271
1509
|
|
1272
1510
|
@spec.extensions << "extconf.rb"
|
@@ -1284,17 +1522,17 @@ gem 'other', version
|
|
1284
1522
|
end
|
1285
1523
|
|
1286
1524
|
# empty depend file for no auto dependencies
|
1287
|
-
@spec.files += %W
|
1525
|
+
@spec.files += %W[depend #{@spec.name}.c].each do |file|
|
1288
1526
|
write_file File.join(@tempdir, file)
|
1289
|
-
|
1527
|
+
end
|
1290
1528
|
|
1291
1529
|
so = File.join(@spec.gem_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
|
1292
1530
|
refute_path_exists so
|
1293
1531
|
use_ui @ui do
|
1294
1532
|
path = Gem::Package.build @spec
|
1295
1533
|
|
1296
|
-
|
1297
|
-
|
1534
|
+
installer = Gem::Installer.at path
|
1535
|
+
installer.install
|
1298
1536
|
end
|
1299
1537
|
assert_path_exists so
|
1300
1538
|
rescue
|
@@ -1313,49 +1551,57 @@ gem 'other', version
|
|
1313
1551
|
end
|
1314
1552
|
|
1315
1553
|
def test_installation_satisfies_dependency_eh
|
1554
|
+
installer = setup_base_installer
|
1555
|
+
|
1316
1556
|
util_spec 'a'
|
1317
1557
|
|
1318
1558
|
dep = Gem::Dependency.new 'a', '>= 2'
|
1319
|
-
assert
|
1559
|
+
assert installer.installation_satisfies_dependency?(dep)
|
1320
1560
|
|
1321
1561
|
dep = Gem::Dependency.new 'a', '> 2'
|
1322
|
-
refute
|
1562
|
+
refute installer.installation_satisfies_dependency?(dep)
|
1323
1563
|
end
|
1324
1564
|
|
1325
1565
|
def test_installation_satisfies_dependency_eh_development
|
1326
|
-
|
1327
|
-
|
1566
|
+
installer = setup_base_installer
|
1567
|
+
installer.options[:development] = true
|
1568
|
+
installer.options[:dev_shallow] = true
|
1328
1569
|
|
1329
1570
|
util_spec 'a'
|
1330
1571
|
|
1331
1572
|
dep = Gem::Dependency.new 'a', :development
|
1332
|
-
assert
|
1573
|
+
assert installer.installation_satisfies_dependency?(dep)
|
1333
1574
|
end
|
1334
1575
|
|
1335
1576
|
def test_pre_install_checks_dependencies
|
1577
|
+
installer = setup_base_installer
|
1336
1578
|
@spec.add_dependency 'b', '> 5'
|
1337
|
-
util_setup_gem
|
1579
|
+
installer = util_setup_gem
|
1580
|
+
installer.force = false
|
1338
1581
|
|
1339
1582
|
use_ui @ui do
|
1340
1583
|
assert_raises Gem::InstallError do
|
1341
|
-
|
1584
|
+
installer.install
|
1342
1585
|
end
|
1343
1586
|
end
|
1344
1587
|
end
|
1345
1588
|
|
1346
1589
|
def test_pre_install_checks_dependencies_ignore
|
1590
|
+
installer = util_setup_installer
|
1347
1591
|
@spec.add_dependency 'b', '> 5'
|
1348
|
-
|
1592
|
+
installer.ignore_dependencies = true
|
1349
1593
|
|
1350
1594
|
build_rake_in do
|
1351
1595
|
use_ui @ui do
|
1352
|
-
assert
|
1596
|
+
assert installer.pre_install_checks
|
1353
1597
|
end
|
1354
1598
|
end
|
1355
1599
|
end
|
1356
1600
|
|
1357
1601
|
def test_pre_install_checks_dependencies_install_dir
|
1358
1602
|
gemhome2 = "#{@gemhome}2"
|
1603
|
+
|
1604
|
+
@gem = setup_base_gem
|
1359
1605
|
@spec.add_dependency 'd'
|
1360
1606
|
|
1361
1607
|
quick_gem 'd', 2
|
@@ -1380,54 +1626,6 @@ gem 'other', version
|
|
1380
1626
|
end
|
1381
1627
|
end
|
1382
1628
|
|
1383
|
-
def test_pre_install_checks_ruby_version
|
1384
|
-
use_ui @ui do
|
1385
|
-
installer = Gem::Installer.at old_ruby_required('= 1.4.6')
|
1386
|
-
e = assert_raises Gem::RuntimeRequirementNotMetError do
|
1387
|
-
installer.pre_install_checks
|
1388
|
-
end
|
1389
|
-
rv = Gem.ruby_version
|
1390
|
-
assert_equal "old_ruby_required requires Ruby version = 1.4.6. The current ruby version is #{rv}.",
|
1391
|
-
e.message
|
1392
|
-
end
|
1393
|
-
end
|
1394
|
-
|
1395
|
-
def test_pre_install_checks_ruby_version_with_prereleases
|
1396
|
-
util_set_RUBY_VERSION '2.6.0', -1, '63539', 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
|
1397
|
-
|
1398
|
-
installer = Gem::Installer.at old_ruby_required('>= 2.6.0.preview2')
|
1399
|
-
assert installer.pre_install_checks
|
1400
|
-
|
1401
|
-
installer = Gem::Installer.at old_ruby_required('> 2.6.0.preview2')
|
1402
|
-
e = assert_raises Gem::RuntimeRequirementNotMetError do
|
1403
|
-
assert installer.pre_install_checks
|
1404
|
-
end
|
1405
|
-
assert_equal "old_ruby_required requires Ruby version > 2.6.0.preview2. The current ruby version is 2.6.0.preview2.",
|
1406
|
-
e.message
|
1407
|
-
ensure
|
1408
|
-
util_restore_RUBY_VERSION
|
1409
|
-
end
|
1410
|
-
|
1411
|
-
def test_pre_install_checks_wrong_rubygems_version
|
1412
|
-
spec = util_spec 'old_rubygems_required', '1' do |s|
|
1413
|
-
s.required_rubygems_version = '< 0'
|
1414
|
-
end
|
1415
|
-
|
1416
|
-
util_build_gem spec
|
1417
|
-
|
1418
|
-
gem = File.join(@gemhome, 'cache', spec.file_name)
|
1419
|
-
|
1420
|
-
use_ui @ui do
|
1421
|
-
@installer = Gem::Installer.at gem
|
1422
|
-
e = assert_raises Gem::RuntimeRequirementNotMetError do
|
1423
|
-
@installer.pre_install_checks
|
1424
|
-
end
|
1425
|
-
rgv = Gem::VERSION
|
1426
|
-
assert_equal "old_rubygems_required requires RubyGems version < 0. The current RubyGems version is #{rgv}. " +
|
1427
|
-
"Try 'gem update --system' to update RubyGems itself.", e.message
|
1428
|
-
end
|
1429
|
-
end
|
1430
|
-
|
1431
1629
|
def test_pre_install_checks_malicious_name
|
1432
1630
|
spec = util_spec '../malicious', '1'
|
1433
1631
|
def spec.full_name # so the spec is buildable
|
@@ -1440,9 +1638,9 @@ gem 'other', version
|
|
1440
1638
|
gem = File.join(@gemhome, 'cache', spec.file_name)
|
1441
1639
|
|
1442
1640
|
use_ui @ui do
|
1443
|
-
|
1641
|
+
installer = Gem::Installer.at gem
|
1444
1642
|
e = assert_raises Gem::InstallError do
|
1445
|
-
|
1643
|
+
installer.pre_install_checks
|
1446
1644
|
end
|
1447
1645
|
assert_equal '#<Gem::Specification name=../malicious version=1> has an invalid name', e.message
|
1448
1646
|
end
|
@@ -1460,9 +1658,9 @@ gem 'other', version
|
|
1460
1658
|
gem = File.join(@gemhome, 'cache', spec.file_name)
|
1461
1659
|
|
1462
1660
|
use_ui @ui do
|
1463
|
-
|
1661
|
+
installer = Gem::Installer.at gem
|
1464
1662
|
e = assert_raises Gem::InstallError do
|
1465
|
-
|
1663
|
+
installer.pre_install_checks
|
1466
1664
|
end
|
1467
1665
|
assert_equal "#<Gem::Specification name=malicious\n::Object.const_set(:FROM_EVAL, true)# version=1> has an invalid name", e.message
|
1468
1666
|
end
|
@@ -1482,9 +1680,9 @@ gem 'other', version
|
|
1482
1680
|
gem = File.join(@gemhome, 'cache', spec.file_name)
|
1483
1681
|
|
1484
1682
|
use_ui @ui do
|
1485
|
-
|
1683
|
+
installer = Gem::Installer.at gem
|
1486
1684
|
e = assert_raises Gem::InstallError do
|
1487
|
-
|
1685
|
+
installer.pre_install_checks
|
1488
1686
|
end
|
1489
1687
|
assert_equal "#<Gem::Specification name=malicious version=1> has an invalid require_paths", e.message
|
1490
1688
|
end
|
@@ -1505,9 +1703,9 @@ gem 'other', version
|
|
1505
1703
|
gem = File.join(@gemhome, 'cache', spec.file_name)
|
1506
1704
|
|
1507
1705
|
use_ui @ui do
|
1508
|
-
|
1706
|
+
installer = Gem::Installer.at gem
|
1509
1707
|
e = assert_raises Gem::InstallError do
|
1510
|
-
|
1708
|
+
installer.pre_install_checks
|
1511
1709
|
end
|
1512
1710
|
assert_equal "#<Gem::Specification name=malicious version=1> has an invalid extensions", e.message
|
1513
1711
|
end
|
@@ -1526,9 +1724,9 @@ gem 'other', version
|
|
1526
1724
|
gem = File.join(@gemhome, 'cache', spec.file_name)
|
1527
1725
|
|
1528
1726
|
use_ui @ui do
|
1529
|
-
|
1727
|
+
installer = Gem::Installer.at gem
|
1530
1728
|
e = assert_raises Gem::InstallError do
|
1531
|
-
|
1729
|
+
installer.pre_install_checks
|
1532
1730
|
end
|
1533
1731
|
assert_equal "#<Gem::Specification name=malicious version=1> has an invalid specification_version", e.message
|
1534
1732
|
end
|
@@ -1547,131 +1745,171 @@ gem 'other', version
|
|
1547
1745
|
gem = File.join(@gemhome, 'cache', spec.file_name)
|
1548
1746
|
|
1549
1747
|
use_ui @ui do
|
1550
|
-
|
1551
|
-
|
1748
|
+
installer = Gem::Installer.at gem
|
1749
|
+
installer.ignore_dependencies = true
|
1552
1750
|
e = assert_raises Gem::InstallError do
|
1553
|
-
|
1751
|
+
installer.pre_install_checks
|
1554
1752
|
end
|
1555
1753
|
assert_equal "#<Gem::Specification name=malicious version=1> has an invalid dependencies", e.message
|
1556
1754
|
end
|
1557
1755
|
end
|
1558
1756
|
|
1559
1757
|
def test_shebang
|
1758
|
+
installer = setup_base_installer
|
1759
|
+
|
1560
1760
|
util_make_exec @spec, "#!/usr/bin/ruby"
|
1561
1761
|
|
1562
|
-
shebang =
|
1762
|
+
shebang = installer.shebang 'executable'
|
1563
1763
|
|
1564
1764
|
assert_equal "#!#{Gem.ruby}", shebang
|
1565
1765
|
end
|
1566
1766
|
|
1567
1767
|
def test_process_options
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1768
|
+
installer = setup_base_installer
|
1769
|
+
|
1770
|
+
assert_nil installer.build_root
|
1771
|
+
assert_equal File.join(@gemhome, 'bin'), installer.bin_dir
|
1772
|
+
assert_equal @gemhome, installer.gem_home
|
1571
1773
|
end
|
1572
1774
|
|
1573
1775
|
def test_process_options_build_root
|
1574
1776
|
build_root = File.join @tempdir, 'build_root'
|
1777
|
+
bin_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'bin')
|
1778
|
+
gem_home = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ''))
|
1779
|
+
plugins_dir = File.join(build_root, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'plugins')
|
1780
|
+
|
1781
|
+
@gem = setup_base_gem
|
1782
|
+
installer = use_ui(@ui) { Gem::Installer.at @gem, :build_root => build_root }
|
1575
1783
|
|
1576
|
-
|
1784
|
+
assert_equal build_root, installer.build_root
|
1785
|
+
assert_equal bin_dir, installer.bin_dir
|
1786
|
+
assert_equal gem_home, installer.gem_home
|
1577
1787
|
|
1578
|
-
|
1579
|
-
|
1580
|
-
assert_equal
|
1788
|
+
errors = @ui.error.split("\n")
|
1789
|
+
|
1790
|
+
assert_equal "WARNING: You build with buildroot.", errors.shift
|
1791
|
+
assert_equal " Build root: #{build_root}", errors.shift
|
1792
|
+
assert_equal " Bin dir: #{bin_dir}", errors.shift
|
1793
|
+
assert_equal " Gem home: #{gem_home}", errors.shift
|
1794
|
+
assert_equal " Plugins dir: #{plugins_dir}", errors.shift
|
1581
1795
|
end
|
1582
1796
|
|
1583
1797
|
def test_shebang_arguments
|
1798
|
+
installer = setup_base_installer
|
1799
|
+
|
1584
1800
|
util_make_exec @spec, "#!/usr/bin/ruby -ws"
|
1585
1801
|
|
1586
|
-
shebang =
|
1802
|
+
shebang = installer.shebang 'executable'
|
1587
1803
|
|
1588
1804
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1589
1805
|
end
|
1590
1806
|
|
1591
1807
|
def test_shebang_empty
|
1808
|
+
installer = setup_base_installer
|
1809
|
+
|
1592
1810
|
util_make_exec @spec, ''
|
1593
1811
|
|
1594
|
-
shebang =
|
1812
|
+
shebang = installer.shebang 'executable'
|
1595
1813
|
assert_equal "#!#{Gem.ruby}", shebang
|
1596
1814
|
end
|
1597
1815
|
|
1598
1816
|
def test_shebang_env
|
1817
|
+
installer = setup_base_installer
|
1818
|
+
|
1599
1819
|
util_make_exec @spec, "#!/usr/bin/env ruby"
|
1600
1820
|
|
1601
|
-
shebang =
|
1821
|
+
shebang = installer.shebang 'executable'
|
1602
1822
|
|
1603
1823
|
assert_equal "#!#{Gem.ruby}", shebang
|
1604
1824
|
end
|
1605
1825
|
|
1606
1826
|
def test_shebang_env_arguments
|
1827
|
+
installer = setup_base_installer
|
1828
|
+
|
1607
1829
|
util_make_exec @spec, "#!/usr/bin/env ruby -ws"
|
1608
1830
|
|
1609
|
-
shebang =
|
1831
|
+
shebang = installer.shebang 'executable'
|
1610
1832
|
|
1611
1833
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1612
1834
|
end
|
1613
1835
|
|
1614
1836
|
def test_shebang_env_shebang
|
1837
|
+
installer = setup_base_installer
|
1838
|
+
|
1615
1839
|
util_make_exec @spec, ''
|
1616
|
-
|
1840
|
+
installer.env_shebang = true
|
1617
1841
|
|
1618
|
-
shebang =
|
1842
|
+
shebang = installer.shebang 'executable'
|
1619
1843
|
|
1620
|
-
|
1844
|
+
bin_env = get_bin_env
|
1621
1845
|
|
1622
|
-
assert_equal("#!#{
|
1846
|
+
assert_equal("#!#{bin_env} #{RbConfig::CONFIG['ruby_install_name']}",
|
1623
1847
|
shebang)
|
1624
1848
|
end
|
1625
1849
|
|
1626
1850
|
def test_shebang_nested
|
1851
|
+
installer = setup_base_installer
|
1852
|
+
|
1627
1853
|
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby"
|
1628
1854
|
|
1629
|
-
shebang =
|
1855
|
+
shebang = installer.shebang 'executable'
|
1630
1856
|
|
1631
1857
|
assert_equal "#!#{Gem.ruby}", shebang
|
1632
1858
|
end
|
1633
1859
|
|
1634
1860
|
def test_shebang_nested_arguments
|
1861
|
+
installer = setup_base_installer
|
1862
|
+
|
1635
1863
|
util_make_exec @spec, "#!/opt/local/ruby/bin/ruby -ws"
|
1636
1864
|
|
1637
|
-
shebang =
|
1865
|
+
shebang = installer.shebang 'executable'
|
1638
1866
|
|
1639
1867
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1640
1868
|
end
|
1641
1869
|
|
1642
1870
|
def test_shebang_version
|
1871
|
+
installer = setup_base_installer
|
1872
|
+
|
1643
1873
|
util_make_exec @spec, "#!/usr/bin/ruby18"
|
1644
1874
|
|
1645
|
-
shebang =
|
1875
|
+
shebang = installer.shebang 'executable'
|
1646
1876
|
|
1647
1877
|
assert_equal "#!#{Gem.ruby}", shebang
|
1648
1878
|
end
|
1649
1879
|
|
1650
1880
|
def test_shebang_version_arguments
|
1881
|
+
installer = setup_base_installer
|
1882
|
+
|
1651
1883
|
util_make_exec @spec, "#!/usr/bin/ruby18 -ws"
|
1652
1884
|
|
1653
|
-
shebang =
|
1885
|
+
shebang = installer.shebang 'executable'
|
1654
1886
|
|
1655
1887
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1656
1888
|
end
|
1657
1889
|
|
1658
1890
|
def test_shebang_version_env
|
1891
|
+
installer = setup_base_installer
|
1892
|
+
|
1659
1893
|
util_make_exec @spec, "#!/usr/bin/env ruby18"
|
1660
1894
|
|
1661
|
-
shebang =
|
1895
|
+
shebang = installer.shebang 'executable'
|
1662
1896
|
|
1663
1897
|
assert_equal "#!#{Gem.ruby}", shebang
|
1664
1898
|
end
|
1665
1899
|
|
1666
1900
|
def test_shebang_version_env_arguments
|
1901
|
+
installer = setup_base_installer
|
1902
|
+
|
1667
1903
|
util_make_exec @spec, "#!/usr/bin/env ruby18 -ws"
|
1668
1904
|
|
1669
|
-
shebang =
|
1905
|
+
shebang = installer.shebang 'executable'
|
1670
1906
|
|
1671
1907
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
1672
1908
|
end
|
1673
1909
|
|
1674
1910
|
def test_shebang_custom
|
1911
|
+
installer = setup_base_installer
|
1912
|
+
|
1675
1913
|
conf = Gem::ConfigFile.new []
|
1676
1914
|
conf[:custom_shebang] = 'test'
|
1677
1915
|
|
@@ -1679,13 +1917,23 @@ gem 'other', version
|
|
1679
1917
|
|
1680
1918
|
util_make_exec @spec, "#!/usr/bin/ruby"
|
1681
1919
|
|
1682
|
-
shebang =
|
1920
|
+
shebang = installer.shebang 'executable'
|
1683
1921
|
|
1684
1922
|
assert_equal "#!test", shebang
|
1685
1923
|
end
|
1686
1924
|
|
1925
|
+
def get_bin_env
|
1926
|
+
if win_platform?
|
1927
|
+
""
|
1928
|
+
else
|
1929
|
+
%w[/usr/bin/env /bin/env].find {|f| File.executable?(f) }
|
1930
|
+
end
|
1931
|
+
end
|
1932
|
+
|
1687
1933
|
def test_shebang_custom_with_expands
|
1688
|
-
|
1934
|
+
installer = setup_base_installer
|
1935
|
+
|
1936
|
+
bin_env = get_bin_env
|
1689
1937
|
conf = Gem::ConfigFile.new []
|
1690
1938
|
conf[:custom_shebang] = '1 $env 2 $ruby 3 $exec 4 $name'
|
1691
1939
|
|
@@ -1693,13 +1941,15 @@ gem 'other', version
|
|
1693
1941
|
|
1694
1942
|
util_make_exec @spec, "#!/usr/bin/ruby"
|
1695
1943
|
|
1696
|
-
shebang =
|
1944
|
+
shebang = installer.shebang 'executable'
|
1697
1945
|
|
1698
1946
|
assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} 3 executable 4 a", shebang
|
1699
1947
|
end
|
1700
1948
|
|
1701
1949
|
def test_shebang_custom_with_expands_and_arguments
|
1702
|
-
|
1950
|
+
installer = setup_base_installer
|
1951
|
+
|
1952
|
+
bin_env = get_bin_env
|
1703
1953
|
conf = Gem::ConfigFile.new []
|
1704
1954
|
conf[:custom_shebang] = '1 $env 2 $ruby 3 $exec'
|
1705
1955
|
|
@@ -1707,30 +1957,34 @@ gem 'other', version
|
|
1707
1957
|
|
1708
1958
|
util_make_exec @spec, "#!/usr/bin/ruby -ws"
|
1709
1959
|
|
1710
|
-
shebang =
|
1960
|
+
shebang = installer.shebang 'executable'
|
1711
1961
|
|
1712
1962
|
assert_equal "#!1 #{bin_env} 2 #{Gem.ruby} -ws 3 executable", shebang
|
1713
1963
|
end
|
1714
1964
|
|
1715
1965
|
def test_unpack
|
1716
|
-
|
1966
|
+
installer = util_setup_installer
|
1717
1967
|
|
1718
1968
|
dest = File.join @gemhome, 'gems', @spec.full_name
|
1719
1969
|
|
1720
|
-
|
1970
|
+
Gem::Deprecate.skip_during do
|
1971
|
+
installer.unpack dest
|
1972
|
+
end
|
1721
1973
|
|
1722
1974
|
assert_path_exists File.join dest, 'lib', 'code.rb'
|
1723
1975
|
assert_path_exists File.join dest, 'bin', 'executable'
|
1724
1976
|
end
|
1725
1977
|
|
1726
1978
|
def test_write_build_info_file
|
1979
|
+
installer = setup_base_installer
|
1980
|
+
|
1727
1981
|
refute_path_exists @spec.build_info_file
|
1728
1982
|
|
1729
|
-
|
1983
|
+
installer.build_args = %w[
|
1730
1984
|
--with-libyaml-dir /usr/local/Cellar/libyaml/0.1.4
|
1731
1985
|
]
|
1732
1986
|
|
1733
|
-
|
1987
|
+
installer.write_build_info_file
|
1734
1988
|
|
1735
1989
|
assert_path_exists @spec.build_info_file
|
1736
1990
|
|
@@ -1740,14 +1994,17 @@ gem 'other', version
|
|
1740
1994
|
end
|
1741
1995
|
|
1742
1996
|
def test_write_build_info_file_empty
|
1997
|
+
installer = setup_base_installer
|
1998
|
+
|
1743
1999
|
refute_path_exists @spec.build_info_file
|
1744
2000
|
|
1745
|
-
|
2001
|
+
installer.write_build_info_file
|
1746
2002
|
|
1747
2003
|
refute_path_exists @spec.build_info_file
|
1748
2004
|
end
|
1749
2005
|
|
1750
2006
|
def test_write_build_info_file_install_dir
|
2007
|
+
@gem = setup_base_gem
|
1751
2008
|
installer = Gem::Installer.at @gem, :install_dir => "#{@gemhome}2"
|
1752
2009
|
|
1753
2010
|
installer.build_args = %w[
|
@@ -1762,6 +2019,7 @@ gem 'other', version
|
|
1762
2019
|
end
|
1763
2020
|
|
1764
2021
|
def test_write_cache_file
|
2022
|
+
@gem = setup_base_gem
|
1765
2023
|
cache_file = File.join @gemhome, 'cache', @spec.file_name
|
1766
2024
|
gem = File.join @gemhome, @spec.file_name
|
1767
2025
|
|
@@ -1777,13 +2035,14 @@ gem 'other', version
|
|
1777
2035
|
end
|
1778
2036
|
|
1779
2037
|
def test_write_spec
|
2038
|
+
@spec = setup_base_spec
|
1780
2039
|
FileUtils.rm @spec.spec_file
|
1781
2040
|
refute_path_exists @spec.spec_file
|
1782
2041
|
|
1783
|
-
|
1784
|
-
|
2042
|
+
installer = Gem::Installer.for_spec @spec
|
2043
|
+
installer.gem_home = @gemhome
|
1785
2044
|
|
1786
|
-
|
2045
|
+
installer.write_spec
|
1787
2046
|
|
1788
2047
|
assert_path_exists @spec.spec_file
|
1789
2048
|
|
@@ -1795,15 +2054,16 @@ gem 'other', version
|
|
1795
2054
|
end
|
1796
2055
|
|
1797
2056
|
def test_write_spec_writes_cached_spec
|
2057
|
+
@spec = setup_base_spec
|
1798
2058
|
FileUtils.rm @spec.spec_file
|
1799
2059
|
refute_path_exists @spec.spec_file
|
1800
2060
|
|
1801
2061
|
@spec.files = %w[a.rb b.rb c.rb]
|
1802
2062
|
|
1803
|
-
|
1804
|
-
|
2063
|
+
installer = Gem::Installer.for_spec @spec
|
2064
|
+
installer.gem_home = @gemhome
|
1805
2065
|
|
1806
|
-
|
2066
|
+
installer.write_spec
|
1807
2067
|
|
1808
2068
|
# cached specs have no file manifest:
|
1809
2069
|
@spec.files = []
|
@@ -1812,7 +2072,9 @@ gem 'other', version
|
|
1812
2072
|
end
|
1813
2073
|
|
1814
2074
|
def test_dir
|
1815
|
-
|
2075
|
+
installer = setup_base_installer
|
2076
|
+
|
2077
|
+
assert_match %r{/gemhome/gems/a-2$}, installer.dir
|
1816
2078
|
end
|
1817
2079
|
|
1818
2080
|
def test_default_gem_loaded_from
|
@@ -1822,15 +2084,17 @@ gem 'other', version
|
|
1822
2084
|
assert_predicate spec, :default_gem?
|
1823
2085
|
end
|
1824
2086
|
|
1825
|
-
def
|
2087
|
+
def test_default_gem_without_wrappers
|
2088
|
+
installer = setup_base_installer
|
2089
|
+
|
1826
2090
|
FileUtils.rm_f File.join(Gem.dir, 'specifications')
|
1827
2091
|
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
2092
|
+
installer.wrappers = false
|
2093
|
+
installer.options[:install_as_default] = true
|
2094
|
+
installer.gem_dir = @spec.gem_dir
|
1831
2095
|
|
1832
2096
|
use_ui @ui do
|
1833
|
-
|
2097
|
+
installer.install
|
1834
2098
|
end
|
1835
2099
|
|
1836
2100
|
assert_directory_exists File.join(@spec.gem_dir, 'bin')
|
@@ -1843,11 +2107,43 @@ gem 'other', version
|
|
1843
2107
|
default_spec = eval File.read File.join(Gem.default_dir, 'specifications', 'default', 'a-2.gemspec')
|
1844
2108
|
assert_equal Gem::Version.new("2"), default_spec.version
|
1845
2109
|
assert_equal ['bin/executable'], default_spec.files
|
2110
|
+
|
2111
|
+
assert_directory_exists util_inst_bindir
|
2112
|
+
|
2113
|
+
installed_exec = File.join util_inst_bindir, 'executable'
|
2114
|
+
assert_path_exists installed_exec
|
2115
|
+
|
2116
|
+
wrapper = File.read installed_exec
|
2117
|
+
|
2118
|
+
if symlink_supported?
|
2119
|
+
refute_match %r{generated by RubyGems}, wrapper
|
2120
|
+
else # when symlink not supported, it warns and fallbacks back to installing wrapper
|
2121
|
+
assert_match %r{Unable to use symlinks, installing wrapper}, @ui.error
|
2122
|
+
assert_match %r{generated by RubyGems}, wrapper
|
2123
|
+
end
|
1846
2124
|
end
|
1847
2125
|
|
1848
|
-
def
|
1849
|
-
|
2126
|
+
def test_default_gem_with_wrappers
|
2127
|
+
installer = setup_base_installer
|
2128
|
+
|
2129
|
+
installer.wrappers = true
|
2130
|
+
installer.options[:install_as_default] = true
|
2131
|
+
installer.gem_dir = @spec.gem_dir
|
2132
|
+
|
2133
|
+
use_ui @ui do
|
2134
|
+
installer.install
|
2135
|
+
end
|
2136
|
+
|
2137
|
+
assert_directory_exists util_inst_bindir
|
2138
|
+
|
2139
|
+
installed_exec = File.join util_inst_bindir, 'executable'
|
2140
|
+
assert_path_exists installed_exec
|
2141
|
+
|
2142
|
+
wrapper = File.read installed_exec
|
2143
|
+
assert_match %r{generated by RubyGems}, wrapper
|
2144
|
+
end
|
1850
2145
|
|
2146
|
+
def test_default_gem_with_exe_as_bindir
|
1851
2147
|
@spec = quick_gem 'c' do |spec|
|
1852
2148
|
util_make_exec spec, '#!/usr/bin/ruby', 'exe'
|
1853
2149
|
end
|
@@ -1877,21 +2173,48 @@ gem 'other', version
|
|
1877
2173
|
assert_equal ['exe/executable'], default_spec.files
|
1878
2174
|
end
|
1879
2175
|
|
1880
|
-
def
|
1881
|
-
|
1882
|
-
|
2176
|
+
def test_default_gem_to_specific_install_dir
|
2177
|
+
@gem = setup_base_gem
|
2178
|
+
installer = util_installer @spec, "#{@gemhome}2"
|
2179
|
+
installer.options[:install_as_default] = true
|
2180
|
+
|
2181
|
+
use_ui @ui do
|
2182
|
+
installer.install
|
1883
2183
|
end
|
1884
2184
|
|
1885
|
-
|
2185
|
+
assert_directory_exists File.join("#{@gemhome}2", 'specifications')
|
2186
|
+
assert_directory_exists File.join("#{@gemhome}2", 'specifications', 'default')
|
1886
2187
|
|
1887
|
-
|
2188
|
+
default_spec = eval File.read File.join("#{@gemhome}2", 'specifications', 'default', 'a-2.gemspec')
|
2189
|
+
assert_equal Gem::Version.new("2"), default_spec.version
|
2190
|
+
assert_equal ['bin/executable'], default_spec.files
|
2191
|
+
end
|
2192
|
+
|
2193
|
+
def test_package_attribute
|
2194
|
+
gem = quick_gem 'c' do |spec|
|
2195
|
+
util_make_exec spec, '#!/usr/bin/ruby', 'exe'
|
2196
|
+
end
|
2197
|
+
|
2198
|
+
installer = util_installer(gem, @gemhome)
|
2199
|
+
assert_respond_to(installer, :package)
|
2200
|
+
assert_kind_of(Gem::Package, installer.package)
|
2201
|
+
end
|
2202
|
+
|
2203
|
+
def test_gem_attribute
|
2204
|
+
gem = quick_gem 'c' do |spec|
|
2205
|
+
util_make_exec spec, '#!/usr/bin/ruby', 'exe'
|
2206
|
+
end
|
2207
|
+
|
2208
|
+
installer = util_installer(gem, @gemhome)
|
2209
|
+
assert_respond_to(installer, :gem)
|
2210
|
+
assert_kind_of(String, installer.gem)
|
1888
2211
|
end
|
1889
2212
|
|
1890
2213
|
def util_execless
|
1891
2214
|
@spec = util_spec 'z'
|
1892
2215
|
util_build_gem @spec
|
1893
2216
|
|
1894
|
-
|
2217
|
+
util_installer @spec, @gemhome
|
1895
2218
|
end
|
1896
2219
|
|
1897
2220
|
def util_conflict_executable(wrappers)
|
@@ -1907,6 +2230,6 @@ gem 'other', version
|
|
1907
2230
|
end
|
1908
2231
|
|
1909
2232
|
def mask
|
1910
|
-
0100755
|
2233
|
+
0100755
|
1911
2234
|
end
|
1912
2235
|
end
|