rubygems-update 2.6.14 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +10 -7
- data/CONTRIBUTING.rdoc +53 -54
- data/History.txt +173 -9
- data/Manifest.txt +39 -11
- data/POLICIES.rdoc +3 -3
- data/README.md +72 -0
- data/Rakefile +30 -5
- data/appveyor.yml +29 -1
- data/bin/gem +1 -1
- data/bin/update_rubygems +2 -2
- data/bundler/CHANGELOG.md +269 -9
- data/bundler/CODE_OF_CONDUCT.md +1 -1
- data/bundler/CONTRIBUTING.md +10 -29
- data/bundler/README.md +22 -10
- data/bundler/exe/bundle +5 -7
- data/bundler/exe/bundle_ruby +4 -3
- data/bundler/lib/bundler.rb +94 -74
- data/bundler/lib/bundler/build_metadata.rb +36 -0
- data/bundler/lib/bundler/capistrano.rb +5 -0
- data/bundler/lib/bundler/cli.rb +229 -66
- data/bundler/lib/bundler/cli/add.rb +25 -0
- data/bundler/lib/bundler/cli/binstubs.rb +9 -7
- data/bundler/lib/bundler/cli/cache.rb +5 -4
- data/bundler/lib/bundler/cli/check.rb +3 -5
- data/bundler/lib/bundler/cli/clean.rb +5 -6
- data/bundler/lib/bundler/cli/common.rb +18 -2
- data/bundler/lib/bundler/cli/config.rb +26 -7
- data/bundler/lib/bundler/cli/console.rb +2 -1
- data/bundler/lib/bundler/cli/doctor.rb +1 -0
- data/bundler/lib/bundler/cli/exec.rb +3 -2
- data/bundler/lib/bundler/cli/gem.rb +36 -15
- data/bundler/lib/bundler/cli/info.rb +50 -0
- data/bundler/lib/bundler/cli/init.rb +20 -7
- data/bundler/lib/bundler/cli/inject.rb +13 -4
- data/bundler/lib/bundler/cli/install.rb +61 -77
- data/bundler/lib/bundler/cli/issue.rb +40 -0
- data/bundler/lib/bundler/cli/list.rb +22 -0
- data/bundler/lib/bundler/cli/lock.rb +4 -2
- data/bundler/lib/bundler/cli/open.rb +2 -2
- data/bundler/lib/bundler/cli/outdated.rb +30 -28
- data/bundler/lib/bundler/cli/package.rb +9 -6
- data/bundler/lib/bundler/cli/platform.rb +1 -0
- data/bundler/lib/bundler/cli/plugin.rb +1 -0
- data/bundler/lib/bundler/cli/pristine.rb +43 -0
- data/bundler/lib/bundler/cli/show.rb +1 -1
- data/bundler/lib/bundler/cli/update.rb +32 -11
- data/bundler/lib/bundler/cli/viz.rb +5 -1
- data/bundler/lib/bundler/compact_index_client.rb +1 -0
- data/bundler/lib/bundler/compact_index_client/cache.rb +1 -2
- data/bundler/lib/bundler/compact_index_client/updater.rb +26 -7
- data/bundler/lib/bundler/compatibility_guard.rb +14 -0
- data/bundler/lib/bundler/constants.rb +1 -0
- data/bundler/lib/bundler/current_ruby.rb +8 -7
- data/bundler/lib/bundler/definition.rb +231 -159
- data/bundler/lib/bundler/dep_proxy.rb +2 -0
- data/bundler/lib/bundler/dependency.rb +6 -7
- data/bundler/lib/bundler/deployment.rb +1 -1
- data/bundler/lib/bundler/deprecate.rb +14 -3
- data/bundler/lib/bundler/dsl.rb +103 -62
- data/bundler/lib/bundler/endpoint_specification.rb +12 -2
- data/bundler/lib/bundler/env.rb +97 -36
- data/bundler/lib/bundler/environment_preserver.rb +27 -6
- data/bundler/lib/bundler/errors.rb +3 -1
- data/bundler/lib/bundler/feature_flag.rb +39 -4
- data/bundler/lib/bundler/fetcher.rb +15 -8
- data/bundler/lib/bundler/fetcher/base.rb +1 -0
- data/bundler/lib/bundler/fetcher/compact_index.rb +2 -12
- data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
- data/bundler/lib/bundler/fetcher/downloader.rb +4 -2
- data/bundler/lib/bundler/fetcher/index.rb +1 -0
- data/bundler/lib/bundler/friendly_errors.rb +5 -2
- data/bundler/lib/bundler/gem_helper.rb +23 -9
- data/bundler/lib/bundler/gem_helpers.rb +1 -0
- data/bundler/lib/bundler/gem_remote_fetcher.rb +1 -0
- data/bundler/lib/bundler/gem_tasks.rb +1 -0
- data/bundler/lib/bundler/gem_version_promoter.rb +1 -0
- data/bundler/lib/bundler/gemdeps.rb +1 -0
- data/bundler/lib/bundler/graph.rb +1 -0
- data/bundler/lib/bundler/index.rb +19 -11
- data/bundler/lib/bundler/injector.rb +51 -27
- data/bundler/lib/bundler/inline.rb +10 -10
- data/bundler/lib/bundler/installer.rb +104 -50
- data/bundler/lib/bundler/installer/gem_installer.rb +5 -2
- data/bundler/lib/bundler/installer/parallel_installer.rb +91 -42
- data/bundler/lib/bundler/installer/standalone.rb +1 -0
- data/bundler/lib/bundler/lazy_specification.rb +17 -4
- data/bundler/lib/bundler/lockfile_generator.rb +95 -0
- data/bundler/lib/bundler/lockfile_parser.rb +49 -35
- data/bundler/lib/bundler/match_platform.rb +1 -0
- data/bundler/lib/bundler/mirror.rb +8 -3
- data/bundler/lib/bundler/plugin.rb +6 -1
- data/bundler/lib/bundler/plugin/api/source.rb +16 -3
- data/bundler/lib/bundler/plugin/index.rb +2 -0
- data/bundler/lib/bundler/plugin/installer.rb +7 -6
- data/bundler/lib/bundler/plugin/source_list.rb +7 -8
- data/bundler/lib/bundler/process_lock.rb +24 -0
- data/bundler/lib/bundler/psyched_yaml.rb +10 -0
- data/bundler/lib/bundler/remote_specification.rb +25 -1
- data/bundler/lib/bundler/resolver.rb +171 -192
- data/bundler/lib/bundler/resolver/spec_group.rb +111 -0
- data/bundler/lib/bundler/retry.rb +1 -0
- data/bundler/lib/bundler/ruby_dsl.rb +1 -0
- data/bundler/lib/bundler/ruby_version.rb +6 -1
- data/bundler/lib/bundler/rubygems_ext.rb +18 -8
- data/bundler/lib/bundler/rubygems_gem_installer.rb +25 -2
- data/bundler/lib/bundler/rubygems_integration.rb +157 -66
- data/bundler/lib/bundler/runtime.rb +28 -18
- data/bundler/lib/bundler/settings.rb +202 -87
- data/bundler/lib/bundler/settings/validator.rb +79 -0
- data/bundler/lib/bundler/setup.rb +4 -7
- data/bundler/lib/bundler/shared_helpers.rb +129 -25
- data/bundler/lib/bundler/similarity_detector.rb +1 -0
- data/bundler/lib/bundler/source.rb +53 -1
- data/bundler/lib/bundler/source/gemspec.rb +1 -0
- data/bundler/lib/bundler/source/git.rb +49 -21
- data/bundler/lib/bundler/source/git/git_proxy.rb +17 -12
- data/bundler/lib/bundler/source/metadata.rb +63 -0
- data/bundler/lib/bundler/source/path.rb +38 -17
- data/bundler/lib/bundler/source/path/installer.rb +4 -2
- data/bundler/lib/bundler/source/rubygems.rb +154 -82
- data/bundler/lib/bundler/source/rubygems/remote.rb +8 -1
- data/bundler/lib/bundler/source_list.rb +75 -15
- data/bundler/lib/bundler/spec_set.rb +34 -21
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
- data/bundler/lib/bundler/stub_specification.rb +86 -2
- data/bundler/lib/bundler/templates/Executable +5 -1
- data/bundler/lib/bundler/templates/Executable.bundler +105 -0
- data/bundler/lib/bundler/templates/Executable.standalone +5 -5
- data/bundler/lib/bundler/templates/Gemfile +3 -0
- data/bundler/lib/bundler/templates/gems.rb +8 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -2
- data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/README.md.tt +14 -8
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +5 -5
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +0 -1
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +6 -6
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -10
- data/bundler/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
- data/bundler/lib/bundler/ui.rb +1 -0
- data/bundler/lib/bundler/ui/rg_proxy.rb +1 -0
- data/bundler/lib/bundler/ui/shell.rb +24 -10
- data/bundler/lib/bundler/ui/silent.rb +12 -1
- data/bundler/lib/bundler/uri_credentials_filter.rb +1 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +16 -5
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +10 -2
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +5 -4
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -6
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +501 -138
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +3 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +46 -21
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +24 -22
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +2 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +66 -18
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +17 -15
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +55 -32
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +13 -11
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +13 -13
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +42 -21
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -10
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +31 -29
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +49 -33
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendored_fileutils.rb +9 -0
- data/bundler/lib/bundler/vendored_molinillo.rb +1 -0
- data/bundler/lib/bundler/vendored_persistent.rb +35 -0
- data/bundler/lib/bundler/vendored_thor.rb +6 -2
- data/bundler/lib/bundler/version.rb +19 -2
- data/bundler/lib/bundler/version_ranges.rb +76 -0
- data/bundler/lib/bundler/vlad.rb +5 -0
- data/bundler/lib/bundler/worker.rb +3 -1
- data/bundler/lib/bundler/yaml_serializer.rb +3 -3
- data/bundler/man/bundle-add.ronn +29 -0
- data/bundler/man/bundle-binstubs.ronn +14 -0
- data/bundler/man/bundle-check.ronn +26 -0
- data/bundler/man/bundle-clean.ronn +18 -0
- data/bundler/man/bundle-config.ronn +180 -60
- data/bundler/man/bundle-exec.ronn +7 -0
- data/bundler/man/bundle-gem.ronn +3 -2
- data/bundler/man/bundle-info.ronn +17 -0
- data/bundler/man/bundle-init.ronn +18 -0
- data/bundler/man/bundle-inject.ronn +22 -0
- data/bundler/man/bundle-install.ronn +32 -32
- data/bundler/man/bundle-list.ronn +15 -0
- data/bundler/man/bundle-open.ronn +19 -0
- data/bundler/man/bundle-outdated.ronn +1 -1
- data/bundler/man/bundle-package.ronn +5 -0
- data/bundler/man/bundle-pristine.ronn +34 -0
- data/bundler/man/bundle-show.ronn +20 -0
- data/bundler/man/bundle-update.ronn +6 -3
- data/bundler/man/bundle-viz.ronn +30 -0
- data/bundler/man/bundle.ronn +11 -20
- data/bundler/man/gemfile.5.ronn +55 -64
- data/lib/rubygems.rb +79 -36
- data/lib/rubygems/basic_specification.rb +8 -4
- data/lib/rubygems/bundler_version_finder.rb +112 -0
- data/lib/rubygems/command.rb +1 -1
- data/lib/rubygems/command_manager.rb +3 -1
- data/lib/rubygems/commands/cert_command.rb +31 -6
- data/lib/rubygems/commands/cleanup_command.rb +1 -1
- data/lib/rubygems/commands/help_command.rb +1 -1
- data/lib/rubygems/commands/owner_command.rb +3 -1
- data/lib/rubygems/commands/pristine_command.rb +11 -8
- data/lib/rubygems/commands/push_command.rb +2 -1
- data/lib/rubygems/commands/query_command.rb +13 -14
- data/lib/rubygems/commands/setup_command.rb +124 -69
- data/lib/rubygems/commands/signin_command.rb +33 -0
- data/lib/rubygems/commands/signout_command.rb +33 -0
- data/lib/rubygems/commands/uninstall_command.rb +4 -3
- data/lib/rubygems/commands/unpack_command.rb +16 -4
- data/lib/rubygems/commands/update_command.rb +1 -1
- data/lib/rubygems/commands/which_command.rb +1 -1
- data/lib/rubygems/commands/yank_command.rb +4 -11
- data/lib/rubygems/config_file.rb +13 -24
- data/lib/rubygems/core_ext/kernel_require.rb +10 -9
- data/lib/rubygems/dependency.rb +2 -0
- data/lib/rubygems/dependency_installer.rb +4 -0
- data/lib/rubygems/errors.rb +3 -0
- data/lib/rubygems/exceptions.rb +6 -0
- data/lib/rubygems/ext/builder.rb +1 -1
- data/lib/rubygems/ext/ext_conf_builder.rb +2 -4
- data/lib/rubygems/ext/rake_builder.rb +1 -1
- data/lib/rubygems/gem_runner.rb +5 -1
- data/lib/rubygems/install_update_options.rb +5 -28
- data/lib/rubygems/installer.rb +12 -7
- data/lib/rubygems/installer_test_case.rb +6 -3
- data/lib/rubygems/package/old.rb +1 -1
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/request_set.rb +20 -3
- data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
- data/lib/rubygems/requirement.rb +5 -1
- data/lib/rubygems/resolver.rb +24 -3
- data/lib/rubygems/resolver/installer_set.rb +4 -6
- data/lib/rubygems/safe_yaml.rb +4 -1
- data/lib/rubygems/security.rb +10 -3
- data/lib/rubygems/security_option.rb +43 -0
- data/lib/rubygems/server.rb +4 -12
- data/lib/rubygems/source.rb +7 -4
- data/lib/rubygems/source/git.rb +2 -1
- data/lib/rubygems/source/local.rb +38 -35
- data/lib/rubygems/source/lock.rb +4 -1
- data/lib/rubygems/source_local.rb +3 -1
- data/lib/rubygems/source_specific_file.rb +3 -2
- data/lib/rubygems/spec_fetcher.rb +7 -3
- data/lib/rubygems/specification.rb +281 -231
- data/lib/rubygems/stub_specification.rb +2 -3
- data/lib/rubygems/test_case.rb +14 -1
- data/lib/rubygems/user_interaction.rb +15 -13
- data/lib/rubygems/util.rb +6 -17
- data/lib/rubygems/version.rb +17 -3
- data/lib/rubygems/version_option.rb +6 -1
- data/setup.rb +1 -1
- data/test/rubygems/private3072_key.pem +40 -0
- data/test/rubygems/public3072_cert.pem +25 -0
- data/test/rubygems/test_config.rb +1 -1
- data/test/rubygems/test_gem.rb +72 -14
- data/test/rubygems/test_gem_bundler_version_finder.rb +125 -0
- data/test/rubygems/test_gem_command.rb +1 -1
- data/test/rubygems/test_gem_commands_build_command.rb +27 -1
- data/test/rubygems/test_gem_commands_cert_command.rb +64 -0
- data/test/rubygems/test_gem_commands_install_command.rb +35 -2
- data/test/rubygems/test_gem_commands_pristine_command.rb +1 -1
- data/test/rubygems/test_gem_commands_query_command.rb +19 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +17 -0
- data/test/rubygems/test_gem_commands_signin_command.rb +95 -0
- data/test/rubygems/test_gem_commands_signout_command.rb +37 -0
- data/test/rubygems/test_gem_commands_sources_command.rb +1 -1
- data/test/rubygems/test_gem_commands_uninstall_command.rb +12 -0
- data/test/rubygems/test_gem_commands_update_command.rb +1 -1
- data/test/rubygems/test_gem_commands_which_command.rb +3 -3
- data/test/rubygems/test_gem_dependency.rb +28 -0
- data/test/rubygems/test_gem_ext_builder.rb +2 -2
- data/test/rubygems/test_gem_ext_rake_builder.rb +2 -2
- data/test/rubygems/test_gem_install_update_options.rb +2 -1
- data/test/rubygems/test_gem_installer.rb +29 -27
- data/test/rubygems/test_gem_package.rb +5 -5
- data/test/rubygems/test_gem_remote_fetcher.rb +2 -2
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +3 -3
- data/test/rubygems/test_gem_requirement.rb +6 -0
- data/test/rubygems/test_gem_resolver.rb +26 -0
- data/test/rubygems/test_gem_resolver_conflict.rb +1 -1
- data/test/rubygems/test_gem_security.rb +5 -0
- data/test/rubygems/test_gem_security_policy.rb +24 -24
- data/test/rubygems/test_gem_security_signer.rb +6 -6
- data/test/rubygems/test_gem_security_trust_dir.rb +2 -2
- data/test/rubygems/test_gem_server.rb +18 -1
- data/test/rubygems/test_gem_source.rb +9 -0
- data/test/rubygems/test_gem_spec_fetcher.rb +20 -0
- data/test/rubygems/test_gem_specification.rb +85 -10
- data/test/rubygems/test_gem_stream_ui.rb +6 -6
- data/test/rubygems/test_gem_stub_specification.rb +19 -1
- data/test/rubygems/test_gem_util.rb +1 -0
- data/test/rubygems/test_gem_version.rb +28 -7
- data/test/rubygems/test_gem_version_option.rb +15 -0
- data/test/rubygems/test_kernel.rb +30 -0
- data/test/rubygems/test_require.rb +44 -0
- metadata +47 -46
- data/README.rdoc +0 -54
- data/bundler/DEVELOPMENT.md +0 -150
- data/bundler/ISSUES.md +0 -117
- data/bundler/lib/bundler/postit_trampoline.rb +0 -73
- data/bundler/lib/bundler/vendor/postit/lib/postit.rb +0 -15
- data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
- data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
- data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
- data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
- data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
- data/bundler/man/index.txt +0 -8
@@ -0,0 +1,125 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'rubygems/test_case'
|
3
|
+
|
4
|
+
class TestGemBundlerVersionFinder < Gem::TestCase
|
5
|
+
def setup
|
6
|
+
@argv = ARGV.dup
|
7
|
+
@env = ENV.to_hash.clone
|
8
|
+
ENV.delete("BUNDLER_VERSION")
|
9
|
+
@dollar_0 = $0
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
ARGV.replace @argv
|
14
|
+
ENV.replace @env
|
15
|
+
$0 = @dollar_0
|
16
|
+
end
|
17
|
+
|
18
|
+
def bvf
|
19
|
+
Gem::BundlerVersionFinder
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_bundler_version_defaults_to_nil
|
23
|
+
assert_nil bvf.bundler_version
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_bundler_version_with_env_var
|
27
|
+
ENV["BUNDLER_VERSION"] = "1.1.1.1"
|
28
|
+
assert_equal v("1.1.1.1"), bvf.bundler_version
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_bundler_version_with_bundle_update_bundler
|
32
|
+
ARGV.replace %w[update --bundler]
|
33
|
+
assert_nil bvf.bundler_version
|
34
|
+
$0 = "/foo/bar/bundle"
|
35
|
+
assert_nil bvf.bundler_version
|
36
|
+
ARGV.replace %w[update --bundler=1.1.1.1 gem_name]
|
37
|
+
assert_equal v("1.1.1.1"), bvf.bundler_version
|
38
|
+
ARGV.replace %w[update --bundler 1.1.1.1 gem_name]
|
39
|
+
assert_equal v("1.1.1.1"), bvf.bundler_version
|
40
|
+
ARGV.replace %w[update --bundler\ 1.1.1.1 gem_name]
|
41
|
+
assert_equal v("1.1.1.1"), bvf.bundler_version
|
42
|
+
ARGV.replace %w[update --bundler\ 1.1.1.2 --bundler --bundler 1.1.1.1 gem_name]
|
43
|
+
assert_equal v("1.1.1.1"), bvf.bundler_version
|
44
|
+
$0 = "other"
|
45
|
+
assert_nil bvf.bundler_version
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_bundler_version_with_lockfile
|
49
|
+
bvf.stub(:lockfile_contents, [nil, ""]) do
|
50
|
+
assert_nil bvf.bundler_version
|
51
|
+
end
|
52
|
+
bvf.stub(:lockfile_contents, [nil, "\n\nBUNDLED WITH\n 1.1.1.1\n"]) do
|
53
|
+
assert_equal v("1.1.1.1"), bvf.bundler_version
|
54
|
+
end
|
55
|
+
bvf.stub(:lockfile_contents, [nil, "\n\nBUNDLED WITH\n fjdkslfjdkslfjsldk\n"]) do
|
56
|
+
assert_nil bvf.bundler_version
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_bundler_version_with_reason
|
61
|
+
assert_nil bvf.bundler_version_with_reason
|
62
|
+
bvf.stub(:lockfile_contents, [nil, "\n\nBUNDLED WITH\n 1.1.1.1\n"]) do
|
63
|
+
assert_equal ["1.1.1.1", "your lockfile"], bvf.bundler_version_with_reason
|
64
|
+
|
65
|
+
$0 = "bundle"
|
66
|
+
ARGV.replace %w[update --bundler]
|
67
|
+
assert_nil bvf.bundler_version_with_reason
|
68
|
+
ARGV.replace %w[update --bundler=1.1.1.2]
|
69
|
+
assert_equal ["1.1.1.2", "`bundle update --bundler`"], bvf.bundler_version_with_reason
|
70
|
+
|
71
|
+
ENV["BUNDLER_VERSION"] = "1.1.1.3"
|
72
|
+
assert_equal ["1.1.1.3", "`$BUNDLER_VERSION`"], bvf.bundler_version_with_reason
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_compatible
|
77
|
+
assert bvf.compatible?(util_spec("foo"))
|
78
|
+
assert bvf.compatible?(util_spec("bundler", 1.1))
|
79
|
+
|
80
|
+
bvf.stub(:bundler_version, v("1.1.1.1")) do
|
81
|
+
assert bvf.compatible?(util_spec("foo"))
|
82
|
+
assert bvf.compatible?(util_spec("bundler", "1.1.1.1"))
|
83
|
+
assert bvf.compatible?(util_spec("bundler", "1.1.1.a"))
|
84
|
+
assert bvf.compatible?(util_spec("bundler", "1.999"))
|
85
|
+
refute bvf.compatible?(util_spec("bundler", "2.999"))
|
86
|
+
end
|
87
|
+
|
88
|
+
bvf.stub(:bundler_version, v("2.1.1.1")) do
|
89
|
+
assert bvf.compatible?(util_spec("foo"))
|
90
|
+
assert bvf.compatible?(util_spec("bundler", "2.1.1.1"))
|
91
|
+
refute bvf.compatible?(util_spec("bundler", "2.1.1.a"))
|
92
|
+
refute bvf.compatible?(util_spec("bundler", "1.999"))
|
93
|
+
refute bvf.compatible?(util_spec("bundler", "2.999"))
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_filter
|
98
|
+
versions = %w[1 1.0 1.0.1.1 2.a 3 3.0]
|
99
|
+
specs = versions.map { |v| util_spec("bundler", v) }
|
100
|
+
|
101
|
+
assert_equal %w[1 1.0 1.0.1.1 2.a 3 3.0], util_filter_specs(specs).map(&:version).map(&:to_s)
|
102
|
+
|
103
|
+
bvf.stub(:bundler_version, v("2.1.1.1")) do
|
104
|
+
assert_empty util_filter_specs(specs).map(&:version).map(&:to_s)
|
105
|
+
end
|
106
|
+
bvf.stub(:bundler_version, v("1.1.1.1")) do
|
107
|
+
assert_equal %w[1 1.0 1.0.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
|
108
|
+
end
|
109
|
+
bvf.stub(:bundler_version, v("1")) do
|
110
|
+
assert_equal %w[1 1.0 1.0.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
|
111
|
+
end
|
112
|
+
bvf.stub(:bundler_version, v("2.a")) do
|
113
|
+
assert_equal %w[2.a], util_filter_specs(specs).map(&:version).map(&:to_s)
|
114
|
+
end
|
115
|
+
bvf.stub(:bundler_version, v("3")) do
|
116
|
+
assert_equal %w[3 3.0], util_filter_specs(specs).map(&:version).map(&:to_s)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def util_filter_specs(specs)
|
121
|
+
specs = specs.dup
|
122
|
+
bvf.filter!(specs)
|
123
|
+
specs
|
124
|
+
end
|
125
|
+
end
|
@@ -170,7 +170,7 @@ class TestGemCommand < Gem::TestCase
|
|
170
170
|
@cmd.add_option('-f', '--file FILE', 'File option') do |value, options|
|
171
171
|
options[:help] = true
|
172
172
|
end
|
173
|
-
@cmd.add_option('--silent', 'Silence
|
173
|
+
@cmd.add_option('--silent', 'Silence RubyGems output') do |value, options|
|
174
174
|
options[:silent] = true
|
175
175
|
end
|
176
176
|
assert @cmd.handles?(['-x'])
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
# frozen_string_literal: true
|
2
3
|
require 'rubygems/test_case'
|
3
4
|
require 'rubygems/commands/build_command'
|
@@ -117,5 +118,30 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|
117
118
|
util_test_build_gem @gem, gemspec_file, false
|
118
119
|
end
|
119
120
|
|
120
|
-
|
121
|
+
CERT_FILE = cert_path 'public3072'
|
122
|
+
SIGNING_KEY = key_path 'private3072'
|
123
|
+
|
124
|
+
def test_build_signed_gem
|
125
|
+
trust_dir = Gem::Security.trust_dir
|
126
|
+
|
127
|
+
spec = util_spec 'some_gem' do |s|
|
128
|
+
s.signing_key = SIGNING_KEY
|
129
|
+
s.cert_chain = [CERT_FILE]
|
130
|
+
end
|
131
|
+
|
132
|
+
gemspec_file = File.join(@tempdir, spec.spec_name)
|
133
|
+
|
134
|
+
File.open gemspec_file, 'w' do |gs|
|
135
|
+
gs.write spec.to_ruby
|
136
|
+
end
|
137
|
+
|
138
|
+
util_test_build_gem spec, gemspec_file
|
139
|
+
|
140
|
+
trust_dir.trust_cert OpenSSL::X509::Certificate.new(File.read(CERT_FILE))
|
121
141
|
|
142
|
+
gem = Gem::Package.new(File.join(@tempdir, spec.file_name),
|
143
|
+
Gem::Security::HighSecurity)
|
144
|
+
assert gem.verify
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
@@ -130,6 +130,70 @@ Added '/CN=alternate/DC=example'
|
|
130
130
|
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
|
131
131
|
end
|
132
132
|
|
133
|
+
def test_execute_build_bad_email_address
|
134
|
+
passphrase = 'Foo bar'
|
135
|
+
email = "nobody@"
|
136
|
+
|
137
|
+
@cmd.handle_options %W[--build #{email}]
|
138
|
+
|
139
|
+
@build_ui = Gem::MockGemUi.new "#{passphrase}\n#{passphrase}"
|
140
|
+
|
141
|
+
use_ui @build_ui do
|
142
|
+
|
143
|
+
e = assert_raises Gem::CommandLineError do
|
144
|
+
@cmd.execute
|
145
|
+
end
|
146
|
+
|
147
|
+
assert_equal "Invalid email address #{email}",
|
148
|
+
e.message
|
149
|
+
|
150
|
+
refute_path_exists File.join(@tempdir, 'gem-private_key.pem')
|
151
|
+
refute_path_exists File.join(@tempdir, 'gem-public_cert.pem')
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_execute_build_expiration_days
|
156
|
+
passphrase = 'Foo bar'
|
157
|
+
|
158
|
+
@cmd.handle_options %W[
|
159
|
+
--build nobody@example.com
|
160
|
+
--days 26
|
161
|
+
]
|
162
|
+
|
163
|
+
@build_ui = Gem::MockGemUi.new "#{passphrase}\n#{passphrase}"
|
164
|
+
|
165
|
+
use_ui @build_ui do
|
166
|
+
@cmd.execute
|
167
|
+
end
|
168
|
+
|
169
|
+
output = @build_ui.output.squeeze("\n").split "\n"
|
170
|
+
|
171
|
+
assert_equal "Passphrase for your Private Key: ",
|
172
|
+
output.shift
|
173
|
+
assert_equal "Please repeat the passphrase for your Private Key: ",
|
174
|
+
output.shift
|
175
|
+
assert_equal "Certificate: #{File.join @tempdir, 'gem-public_cert.pem'}",
|
176
|
+
output.shift
|
177
|
+
assert_equal "Private Key: #{File.join @tempdir, 'gem-private_key.pem'}",
|
178
|
+
output.shift
|
179
|
+
|
180
|
+
assert_equal "Don't forget to move the key file to somewhere private!",
|
181
|
+
output.shift
|
182
|
+
|
183
|
+
assert_empty output
|
184
|
+
assert_empty @build_ui.error
|
185
|
+
|
186
|
+
assert_path_exists File.join(@tempdir, 'gem-private_key.pem')
|
187
|
+
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
|
188
|
+
|
189
|
+
pem = File.read("#{@tempdir}/gem-public_cert.pem")
|
190
|
+
cert = OpenSSL::X509::Certificate.new(pem)
|
191
|
+
|
192
|
+
test = (cert.not_after - cert.not_before).to_i / (24 * 60 * 60)
|
193
|
+
assert_equal(test, 26)
|
194
|
+
|
195
|
+
end
|
196
|
+
|
133
197
|
def test_execute_build_bad_passphrase_confirmation
|
134
198
|
passphrase = 'Foo bar'
|
135
199
|
passphrase_confirmation = 'Fu bar'
|
@@ -96,6 +96,39 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
96
96
|
assert_match "1 gem installed", @ui.output
|
97
97
|
end
|
98
98
|
|
99
|
+
def test_execute_local_transitive_prerelease
|
100
|
+
specs = spec_fetcher do |fetcher|
|
101
|
+
fetcher.download 'a', 2, 'b' => "2.a", 'c' => '3'
|
102
|
+
fetcher.download 'b', '2.a'
|
103
|
+
fetcher.download 'c', '3'
|
104
|
+
end
|
105
|
+
|
106
|
+
@cmd.options[:domain] = :local
|
107
|
+
|
108
|
+
FileUtils.mv specs['a-2'].cache_file, @tempdir
|
109
|
+
FileUtils.mv specs['b-2.a'].cache_file, @tempdir
|
110
|
+
FileUtils.mv specs['c-3'].cache_file, @tempdir
|
111
|
+
|
112
|
+
@cmd.options[:args] = %w[a]
|
113
|
+
|
114
|
+
use_ui @ui do
|
115
|
+
orig_dir = Dir.pwd
|
116
|
+
begin
|
117
|
+
Dir.chdir @tempdir
|
118
|
+
FileUtils.rm_r [@gemhome, "gems"]
|
119
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
120
|
+
@cmd.execute
|
121
|
+
end
|
122
|
+
ensure
|
123
|
+
Dir.chdir orig_dir
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
assert_equal %w[a-2 b-2.a c-3], @cmd.installed_specs.map { |spec| spec.full_name }.sort
|
128
|
+
|
129
|
+
assert_match "3 gems installed", @ui.output
|
130
|
+
end
|
131
|
+
|
99
132
|
def test_execute_no_user_install
|
100
133
|
skip 'skipped on MS Windows (chmod has no effect)' if win_platform?
|
101
134
|
|
@@ -588,7 +621,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
588
621
|
done_installing = true
|
589
622
|
end
|
590
623
|
|
591
|
-
spec =
|
624
|
+
spec = util_spec 'a', 2
|
592
625
|
|
593
626
|
util_build_gem spec
|
594
627
|
|
@@ -616,7 +649,7 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
616
649
|
end
|
617
650
|
|
618
651
|
def test_install_gem_ignore_dependencies_specific_file
|
619
|
-
spec =
|
652
|
+
spec = util_spec 'a', 2
|
620
653
|
|
621
654
|
util_build_gem spec
|
622
655
|
|
@@ -145,7 +145,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
145
145
|
out = @ui.output.split "\n"
|
146
146
|
|
147
147
|
assert_equal 'Restoring gems to pristine condition...', out.shift
|
148
|
-
assert_equal 'Building native extensions.
|
148
|
+
assert_equal 'Building native extensions. This could take a while...',
|
149
149
|
out.shift
|
150
150
|
assert_equal "Restored #{a.full_name}", out.shift
|
151
151
|
assert_empty out, out.inspect
|
@@ -637,6 +637,25 @@ EOF
|
|
637
637
|
assert_equal expected, @ui.output
|
638
638
|
end
|
639
639
|
|
640
|
+
def test_execute_show_default_gems_with_platform
|
641
|
+
a1 = new_default_spec 'a', 1
|
642
|
+
a1.platform = 'java'
|
643
|
+
install_default_specs a1
|
644
|
+
|
645
|
+
use_ui @ui do
|
646
|
+
@cmd.execute
|
647
|
+
end
|
648
|
+
|
649
|
+
expected = <<-EOF
|
650
|
+
|
651
|
+
*** LOCAL GEMS ***
|
652
|
+
|
653
|
+
a (default: 1 java)
|
654
|
+
EOF
|
655
|
+
|
656
|
+
assert_equal expected, @ui.output
|
657
|
+
end
|
658
|
+
|
640
659
|
def test_execute_default_details
|
641
660
|
spec_fetcher do |fetcher|
|
642
661
|
fetcher.spec 'a', 2
|
@@ -20,6 +20,13 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
20
20
|
open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
|
21
21
|
open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
|
22
22
|
open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io| io.puts 'PEM' end
|
23
|
+
|
24
|
+
FileUtils.mkdir_p 'bundler/exe'
|
25
|
+
FileUtils.mkdir_p 'bundler/lib/bundler'
|
26
|
+
|
27
|
+
open 'bundler/exe/bundle', 'w' do |io| io.puts '# bundle' end
|
28
|
+
open 'bundler/lib/bundler.rb', 'w' do |io| io.puts '# bundler.rb' end
|
29
|
+
open 'bundler/lib/bundler/b.rb', 'w' do |io| io.puts '# b.rb' end
|
23
30
|
end
|
24
31
|
|
25
32
|
def test_pem_files_in
|
@@ -40,12 +47,18 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
40
47
|
|
41
48
|
assert_path_exists File.join(dir, 'rubygems.rb')
|
42
49
|
assert_path_exists File.join(dir, 'rubygems/ssl_certs/rubygems.org/foo.pem')
|
50
|
+
|
51
|
+
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
52
|
+
assert_path_exists File.join(dir, 'bundler.rb')
|
53
|
+
assert_path_exists File.join(dir, 'bundler/b.rb')
|
54
|
+
end
|
43
55
|
end
|
44
56
|
end
|
45
57
|
|
46
58
|
def test_remove_old_lib_files
|
47
59
|
lib = File.join @install_dir, 'lib'
|
48
60
|
lib_rubygems = File.join lib, 'rubygems'
|
61
|
+
lib_bundler = File.join lib, 'bundler'
|
49
62
|
lib_rubygems_defaults = File.join lib_rubygems, 'defaults'
|
50
63
|
|
51
64
|
securerandom_rb = File.join lib, 'securerandom.rb'
|
@@ -55,13 +68,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
55
68
|
|
56
69
|
old_builder_rb = File.join lib_rubygems, 'builder.rb'
|
57
70
|
old_format_rb = File.join lib_rubygems, 'format.rb'
|
71
|
+
old_bundler_c_rb = File.join lib_bundler, 'c.rb'
|
58
72
|
|
59
73
|
FileUtils.mkdir_p lib_rubygems_defaults
|
74
|
+
FileUtils.mkdir_p lib_bundler
|
60
75
|
|
61
76
|
open securerandom_rb, 'w' do |io| io.puts '# securerandom.rb' end
|
62
77
|
|
63
78
|
open old_builder_rb, 'w' do |io| io.puts '# builder.rb' end
|
64
79
|
open old_format_rb, 'w' do |io| io.puts '# format.rb' end
|
80
|
+
open old_bundler_c_rb, 'w' do |io| io.puts '# c.rb' end
|
65
81
|
|
66
82
|
open engine_defaults_rb, 'w' do |io| io.puts '# jruby.rb' end
|
67
83
|
open os_defaults_rb, 'w' do |io| io.puts '# operating_system.rb' end
|
@@ -70,6 +86,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
70
86
|
|
71
87
|
refute_path_exists old_builder_rb
|
72
88
|
refute_path_exists old_format_rb
|
89
|
+
refute_path_exists old_bundler_c_rb if Gem::USE_BUNDLER_FOR_GEMDEPS
|
73
90
|
|
74
91
|
assert_path_exists securerandom_rb
|
75
92
|
assert_path_exists engine_defaults_rb
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'rubygems/test_case'
|
3
|
+
require 'rubygems/commands/signin_command'
|
4
|
+
require 'rubygems/installer'
|
5
|
+
|
6
|
+
class TestGemCommandsSigninCommand < Gem::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
super
|
10
|
+
|
11
|
+
Gem.configuration.rubygems_api_key = nil
|
12
|
+
Gem.configuration.api_keys.clear
|
13
|
+
|
14
|
+
@cmd = Gem::Commands::SigninCommand.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
credentials_path = Gem.configuration.credentials_path
|
19
|
+
File.delete(credentials_path) if File.exist?(credentials_path)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_execute_when_not_already_signed_in
|
24
|
+
sign_in_ui = util_capture() { @cmd.execute }
|
25
|
+
assert_match %r{Signed in.}, sign_in_ui.output
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_execute_when_already_signed_in_with_same_host
|
29
|
+
host = 'http://some-gemcutter-compatible-host.org'
|
30
|
+
sign_in_ui = util_capture(nil, host) { @cmd.execute }
|
31
|
+
old_credentials = YAML.load_file Gem.configuration.credentials_path
|
32
|
+
|
33
|
+
sign_in_ui = util_capture(nil, host) { @cmd.execute }
|
34
|
+
new_credentials = YAML.load_file Gem.configuration.credentials_path
|
35
|
+
|
36
|
+
assert_equal old_credentials[host], new_credentials[host]
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_execute_when_already_signed_in_with_different_host
|
40
|
+
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf04045xxxx'
|
41
|
+
sign_in_ui = util_capture(nil, nil, api_key) { @cmd.execute }
|
42
|
+
host = 'http://some-gemcutter-compatible-host.org'
|
43
|
+
sign_in_ui = util_capture(nil, host, api_key) { @cmd.execute }
|
44
|
+
credentials = YAML.load_file Gem.configuration.credentials_path
|
45
|
+
|
46
|
+
assert_equal credentials[:rubygems_api_key], api_key
|
47
|
+
|
48
|
+
assert_equal credentials[host], nil
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_execute_with_host_supplied
|
52
|
+
host = 'http://some-gemcutter-compatible-host.org'
|
53
|
+
|
54
|
+
sign_in_ui = util_capture(nil, host) { @cmd.execute }
|
55
|
+
assert_match %r{Enter your #{host} credentials.}, sign_in_ui.output
|
56
|
+
assert_match %r{Signed in.}, sign_in_ui.output
|
57
|
+
|
58
|
+
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
59
|
+
credentials = YAML.load_file Gem.configuration.credentials_path
|
60
|
+
assert_equal api_key, credentials[host]
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_execute_with_valid_creds_set_for_default_host
|
64
|
+
util_capture {@cmd.execute}
|
65
|
+
|
66
|
+
api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
67
|
+
credentials = YAML.load_file Gem.configuration.credentials_path
|
68
|
+
|
69
|
+
assert_equal api_key, credentials[:rubygems_api_key]
|
70
|
+
end
|
71
|
+
|
72
|
+
# Utility method to capture IO/UI within the block passed
|
73
|
+
|
74
|
+
def util_capture ui_stub = nil, host = nil, api_key = nil
|
75
|
+
api_key ||= 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
|
76
|
+
response = [api_key, 200, 'OK']
|
77
|
+
email = 'you@example.com'
|
78
|
+
password = 'secret'
|
79
|
+
fetcher = Gem::FakeFetcher.new
|
80
|
+
|
81
|
+
# Set the expected response for the Web-API supplied
|
82
|
+
ENV['RUBYGEMS_HOST'] = host || Gem::DEFAULT_HOST
|
83
|
+
data_key = "#{ENV['RUBYGEMS_HOST']}/api/v1/api_key"
|
84
|
+
fetcher.data[data_key] = response
|
85
|
+
Gem::RemoteFetcher.fetcher = fetcher
|
86
|
+
|
87
|
+
sign_in_ui = ui_stub || Gem::MockGemUi.new("#{email}\n#{password}\n")
|
88
|
+
|
89
|
+
use_ui sign_in_ui do
|
90
|
+
yield
|
91
|
+
end
|
92
|
+
|
93
|
+
sign_in_ui
|
94
|
+
end
|
95
|
+
end
|