rubygems-update 3.5.5 → 3.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +606 -1
- data/CODE_OF_CONDUCT.md +79 -28
- data/Manifest.txt +114 -73
- data/README.md +16 -11
- data/bundler/CHANGELOG.md +506 -6
- data/bundler/README.md +2 -2
- data/bundler/bundler.gemspec +2 -2
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/checksum.rb +22 -12
- data/bundler/lib/bundler/cli/add.rb +3 -1
- data/bundler/lib/bundler/cli/binstubs.rb +1 -1
- data/bundler/lib/bundler/cli/check.rb +3 -3
- data/bundler/lib/bundler/cli/console.rb +8 -10
- data/bundler/lib/bundler/cli/doctor/diagnose.rb +167 -0
- data/bundler/lib/bundler/cli/doctor/ssl.rb +249 -0
- data/bundler/lib/bundler/cli/doctor.rb +27 -151
- data/bundler/lib/bundler/cli/exec.rb +1 -0
- data/bundler/lib/bundler/cli/fund.rb +1 -1
- data/bundler/lib/bundler/cli/gem.rb +13 -17
- data/bundler/lib/bundler/cli/info.rb +6 -6
- data/bundler/lib/bundler/cli/inject.rb +3 -3
- data/bundler/lib/bundler/cli/install.rb +14 -5
- data/bundler/lib/bundler/cli/issue.rb +3 -3
- data/bundler/lib/bundler/cli/lock.rb +32 -11
- data/bundler/lib/bundler/cli/outdated.rb +22 -22
- data/bundler/lib/bundler/cli/plugin.rb +3 -2
- data/bundler/lib/bundler/cli/pristine.rb +1 -1
- data/bundler/lib/bundler/cli/show.rb +3 -3
- data/bundler/lib/bundler/cli.rb +51 -107
- data/bundler/lib/bundler/compact_index_client/cache.rb +48 -73
- data/bundler/lib/bundler/compact_index_client/cache_file.rb +0 -5
- data/bundler/lib/bundler/compact_index_client/parser.rb +84 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +2 -12
- data/bundler/lib/bundler/compact_index_client.rb +51 -80
- data/bundler/lib/bundler/constants.rb +8 -1
- data/bundler/lib/bundler/current_ruby.rb +23 -33
- data/bundler/lib/bundler/definition.rb +485 -313
- data/bundler/lib/bundler/dependency.rb +92 -46
- data/bundler/lib/bundler/dsl.rb +135 -101
- data/bundler/lib/bundler/endpoint_specification.rb +30 -3
- data/bundler/lib/bundler/env.rb +1 -1
- data/bundler/lib/bundler/environment_preserver.rb +5 -23
- data/bundler/lib/bundler/errors.rb +53 -5
- data/bundler/lib/bundler/feature_flag.rb +3 -6
- data/bundler/lib/bundler/fetcher/compact_index.rb +16 -25
- data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
- data/bundler/lib/bundler/fetcher.rb +14 -7
- data/bundler/lib/bundler/force_platform.rb +0 -2
- data/bundler/lib/bundler/friendly_errors.rb +1 -1
- data/bundler/lib/bundler/gem_helper.rb +1 -1
- data/bundler/lib/bundler/gem_helpers.rb +36 -19
- data/bundler/lib/bundler/gem_version_promoter.rb +42 -40
- data/bundler/lib/bundler/injector.rb +14 -16
- data/bundler/lib/bundler/inline.rb +42 -17
- data/bundler/lib/bundler/installer/gem_installer.rb +4 -3
- data/bundler/lib/bundler/installer/parallel_installer.rb +3 -2
- data/bundler/lib/bundler/installer/standalone.rb +2 -5
- data/bundler/lib/bundler/installer.rb +17 -41
- data/bundler/lib/bundler/lazy_specification.rb +117 -46
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/lockfile_parser.rb +18 -7
- data/bundler/lib/bundler/man/bundle-add.1 +44 -27
- data/bundler/lib/bundler/man/bundle-add.1.ronn +52 -23
- data/bundler/lib/bundler/man/bundle-binstubs.1 +9 -6
- data/bundler/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
- data/bundler/lib/bundler/man/bundle-cache.1 +32 -4
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +31 -2
- data/bundler/lib/bundler/man/bundle-check.1 +7 -5
- data/bundler/lib/bundler/man/bundle-check.1.ronn +7 -2
- data/bundler/lib/bundler/man/bundle-clean.1 +3 -3
- data/bundler/lib/bundler/man/bundle-config.1 +11 -15
- data/bundler/lib/bundler/man/bundle-config.1.ronn +12 -15
- data/bundler/lib/bundler/man/bundle-console.1 +4 -6
- data/bundler/lib/bundler/man/bundle-console.1.ronn +2 -7
- data/bundler/lib/bundler/man/bundle-doctor.1 +4 -4
- data/bundler/lib/bundler/man/bundle-doctor.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-env.1 +9 -0
- data/bundler/lib/bundler/man/bundle-env.1.ronn +10 -0
- data/bundler/lib/bundler/man/bundle-exec.1 +9 -6
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +6 -3
- data/bundler/lib/bundler/man/bundle-fund.1 +22 -0
- data/bundler/lib/bundler/man/bundle-fund.1.ronn +25 -0
- data/bundler/lib/bundler/man/bundle-gem.1 +25 -7
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +38 -6
- data/bundler/lib/bundler/man/bundle-help.1 +3 -3
- data/bundler/lib/bundler/man/bundle-info.1 +7 -4
- data/bundler/lib/bundler/man/bundle-info.1.ronn +6 -2
- data/bundler/lib/bundler/man/bundle-init.1 +5 -5
- data/bundler/lib/bundler/man/bundle-init.1.ronn +3 -2
- data/bundler/lib/bundler/man/bundle-inject.1 +12 -4
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +9 -1
- data/bundler/lib/bundler/man/bundle-install.1 +19 -16
- data/bundler/lib/bundler/man/bundle-install.1.ronn +24 -20
- data/bundler/lib/bundler/man/bundle-issue.1 +45 -0
- data/bundler/lib/bundler/man/bundle-issue.1.ronn +37 -0
- data/bundler/lib/bundler/man/bundle-licenses.1 +9 -0
- data/bundler/lib/bundler/man/bundle-licenses.1.ronn +10 -0
- data/bundler/lib/bundler/man/bundle-list.1 +3 -3
- data/bundler/lib/bundler/man/bundle-list.1.ronn +4 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +23 -8
- data/bundler/lib/bundler/man/bundle-lock.1.ronn +25 -4
- data/bundler/lib/bundler/man/bundle-open.1 +4 -4
- data/bundler/lib/bundler/man/bundle-open.1.ronn +2 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +10 -7
- data/bundler/lib/bundler/man/bundle-outdated.1.ronn +8 -4
- data/bundler/lib/bundler/man/bundle-platform.1 +3 -3
- data/bundler/lib/bundler/man/bundle-plugin.1 +9 -6
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +7 -3
- data/bundler/lib/bundler/man/bundle-pristine.1 +3 -3
- data/bundler/lib/bundler/man/bundle-pristine.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +3 -3
- data/bundler/lib/bundler/man/bundle-remove.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +7 -4
- data/bundler/lib/bundler/man/bundle-show.1.ronn +4 -0
- data/bundler/lib/bundler/man/bundle-update.1 +15 -9
- data/bundler/lib/bundler/man/bundle-update.1.ronn +14 -6
- data/bundler/lib/bundler/man/bundle-version.1 +3 -3
- data/bundler/lib/bundler/man/bundle-viz.1 +6 -6
- data/bundler/lib/bundler/man/bundle-viz.1.ronn +7 -3
- data/bundler/lib/bundler/man/bundle.1 +3 -3
- data/bundler/lib/bundler/man/gemfile.5 +7 -5
- data/bundler/lib/bundler/man/gemfile.5.ronn +8 -2
- data/bundler/lib/bundler/man/index.txt +4 -0
- data/bundler/lib/bundler/match_metadata.rb +13 -0
- data/bundler/lib/bundler/materialization.rb +59 -0
- data/bundler/lib/bundler/mirror.rb +3 -3
- data/bundler/lib/bundler/plugin/api/source.rb +5 -4
- data/bundler/lib/bundler/plugin/events.rb +24 -0
- data/bundler/lib/bundler/plugin/index.rb +5 -1
- data/bundler/lib/bundler/plugin/installer/path.rb +26 -0
- data/bundler/lib/bundler/plugin/installer.rb +37 -17
- data/bundler/lib/bundler/plugin/source_list.rb +4 -4
- data/bundler/lib/bundler/plugin.rb +21 -2
- data/bundler/lib/bundler/process_lock.rb +10 -14
- data/bundler/lib/bundler/remote_specification.rb +6 -1
- data/bundler/lib/bundler/resolver/base.rb +14 -3
- data/bundler/lib/bundler/resolver/candidate.rb +18 -27
- data/bundler/lib/bundler/resolver/package.rb +20 -3
- data/bundler/lib/bundler/resolver/spec_group.rb +22 -27
- data/bundler/lib/bundler/resolver/strategy.rb +40 -0
- data/bundler/lib/bundler/resolver.rb +114 -50
- data/bundler/lib/bundler/retry.rb +1 -1
- data/bundler/lib/bundler/ruby_dsl.rb +12 -3
- data/bundler/lib/bundler/ruby_version.rb +7 -1
- data/bundler/lib/bundler/rubygems_ext.rb +282 -125
- data/bundler/lib/bundler/rubygems_gem_installer.rb +40 -5
- data/bundler/lib/bundler/rubygems_integration.rb +29 -67
- data/bundler/lib/bundler/runtime.rb +48 -35
- data/bundler/lib/bundler/self_manager.rb +27 -7
- data/bundler/lib/bundler/settings.rb +32 -21
- data/bundler/lib/bundler/setup.rb +6 -0
- data/bundler/lib/bundler/shared_helpers.rb +39 -21
- data/bundler/lib/bundler/source/gemspec.rb +1 -4
- data/bundler/lib/bundler/source/git/git_proxy.rb +23 -6
- data/bundler/lib/bundler/source/git.rb +113 -41
- data/bundler/lib/bundler/source/metadata.rb +4 -3
- data/bundler/lib/bundler/source/path.rb +7 -18
- data/bundler/lib/bundler/source/rubygems/remote.rb +12 -4
- data/bundler/lib/bundler/source/rubygems.rb +54 -48
- data/bundler/lib/bundler/source.rb +2 -0
- data/bundler/lib/bundler/source_list.rb +53 -7
- data/bundler/lib/bundler/spec_set.rb +187 -88
- data/bundler/lib/bundler/stub_specification.rb +29 -2
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -3
- data/bundler/lib/bundler/templates/newgem/README.md.tt +7 -3
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -15
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -7
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
- data/bundler/lib/bundler/ui/shell.rb +24 -2
- data/bundler/lib/bundler/ui/silent.rb +12 -1
- data/bundler/lib/bundler/uri_credentials_filter.rb +3 -3
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +53 -3
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/bundler/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +11 -0
- data/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +68 -30
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +4 -24
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +1 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +20 -8
- data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +17 -29
- data/bundler/lib/bundler/vendor/securerandom/COPYING +56 -0
- data/bundler/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +11 -0
- data/bundler/lib/bundler/vendor/uri/COPYING +56 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +43 -16
- data/bundler/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +28 -37
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +16 -9
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +9 -9
- data/bundler/lib/bundler/vendored_net_http.rb +20 -5
- data/bundler/lib/bundler/vendored_securerandom.rb +12 -0
- data/bundler/lib/bundler/vendored_timeout.rb +7 -3
- data/bundler/lib/bundler/vendored_uri.rb +18 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler/yaml_serializer.rb +12 -7
- data/bundler/lib/bundler.rb +89 -51
- data/{CONTRIBUTING.md → doc/rubygems/CONTRIBUTING.md} +10 -14
- data/{POLICIES.md → doc/rubygems/POLICIES.md} +81 -12
- data/exe/update_rubygems +1 -1
- data/lib/rubygems/basic_specification.rb +43 -10
- data/lib/rubygems/bundler_version_finder.rb +1 -1
- data/lib/rubygems/command.rb +1 -4
- data/lib/rubygems/command_manager.rb +5 -6
- data/lib/rubygems/commands/build_command.rb +2 -11
- data/lib/rubygems/commands/cleanup_command.rb +3 -13
- data/lib/rubygems/commands/contents_command.rb +17 -10
- data/lib/rubygems/commands/environment_command.rb +5 -0
- data/lib/rubygems/commands/exec_command.rb +18 -11
- data/lib/rubygems/commands/fetch_command.rb +14 -0
- data/lib/rubygems/commands/help_command.rb +2 -2
- data/lib/rubygems/commands/install_command.rb +0 -4
- data/lib/rubygems/commands/pristine_command.rb +30 -17
- data/lib/rubygems/commands/push_command.rb +31 -6
- data/lib/rubygems/commands/rdoc_command.rb +3 -10
- data/lib/rubygems/commands/rebuild_command.rb +262 -0
- data/lib/rubygems/commands/setup_command.rb +11 -16
- data/lib/rubygems/commands/sources_command.rb +2 -2
- data/lib/rubygems/commands/uninstall_command.rb +9 -4
- data/lib/rubygems/commands/unpack_command.rb +0 -6
- data/lib/rubygems/commands/update_command.rb +10 -17
- data/lib/rubygems/config_file.rb +45 -16
- data/lib/rubygems/core_ext/kernel_warn.rb +2 -6
- data/lib/rubygems/defaults.rb +6 -6
- data/lib/rubygems/dependency.rb +12 -16
- data/lib/rubygems/dependency_list.rb +1 -1
- data/lib/rubygems/deprecate.rb +79 -77
- data/lib/rubygems/errors.rb +2 -1
- data/lib/rubygems/exceptions.rb +2 -9
- data/lib/rubygems/ext/builder.rb +21 -8
- data/lib/rubygems/ext/cargo_builder.rb +12 -26
- data/lib/rubygems/ext/cmake_builder.rb +7 -2
- data/lib/rubygems/ext/configure_builder.rb +7 -2
- data/lib/rubygems/ext/ext_conf_builder.rb +9 -5
- data/lib/rubygems/ext/rake_builder.rb +7 -4
- data/lib/rubygems/gem_runner.rb +9 -0
- data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +1 -1
- data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +3 -1
- data/lib/rubygems/gemcutter_utilities.rb +52 -26
- data/lib/rubygems/gemspec_helpers.rb +19 -0
- data/lib/rubygems/install_update_options.rb +5 -0
- data/lib/rubygems/installer.rb +31 -40
- data/lib/rubygems/local_remote_options.rb +8 -8
- data/lib/rubygems/package/tar_header.rb +31 -4
- data/lib/rubygems/package/tar_reader/entry.rb +1 -5
- data/lib/rubygems/package/tar_writer.rb +5 -4
- data/lib/rubygems/package.rb +13 -8
- data/lib/rubygems/platform.rb +7 -5
- data/lib/rubygems/psych_tree.rb +4 -0
- data/lib/rubygems/query_utils.rb +2 -2
- data/lib/rubygems/rdoc.rb +16 -3
- data/lib/rubygems/remote_fetcher.rb +3 -4
- data/lib/rubygems/request.rb +5 -5
- data/lib/rubygems/request_set/gem_dependency_api.rb +1 -1
- data/lib/rubygems/request_set.rb +1 -1
- data/lib/rubygems/requirement.rb +16 -12
- data/lib/rubygems/resolver/activation_request.rb +1 -1
- data/lib/rubygems/resolver/api_set/gem_parser.rb +2 -5
- data/lib/rubygems/resolver/api_set.rb +13 -8
- data/lib/rubygems/resolver/best_set.rb +0 -28
- data/lib/rubygems/resolver/composed_set.rb +3 -3
- data/lib/rubygems/resolver/git_set.rb +0 -1
- data/lib/rubygems/resolver/index_set.rb +2 -2
- data/lib/rubygems/resolver/spec_specification.rb +7 -0
- data/lib/rubygems/resolver.rb +7 -7
- data/lib/rubygems/s3_uri_signer.rb +3 -3
- data/lib/rubygems/safe_marshal/reader.rb +31 -14
- data/lib/rubygems/safe_marshal/visitors/to_ruby.rb +29 -16
- data/lib/rubygems/safe_yaml.rb +10 -1
- data/lib/rubygems/security.rb +1 -1
- data/lib/rubygems/source/git.rb +22 -17
- data/lib/rubygems/source/installed.rb +3 -1
- data/lib/rubygems/source/local.rb +8 -4
- data/lib/rubygems/source/specific_file.rb +5 -3
- data/lib/rubygems/source.rb +10 -8
- data/lib/rubygems/source_list.rb +1 -1
- data/lib/rubygems/spec_fetcher.rb +47 -15
- data/lib/rubygems/specification.rb +107 -180
- data/lib/rubygems/specification_policy.rb +33 -13
- data/lib/rubygems/specification_record.rb +212 -0
- data/lib/rubygems/stub_specification.rb +32 -10
- data/lib/rubygems/target_rbconfig.rb +50 -0
- data/lib/rubygems/uninstaller.rb +42 -22
- data/lib/rubygems/uri.rb +6 -6
- data/lib/rubygems/util/licenses.rb +97 -1
- data/lib/rubygems/util.rb +1 -1
- data/lib/rubygems/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/delegates/specification_provider.rb +11 -11
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/log.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/vertex.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/rubygems/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/specification_provider.rb +2 -2
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/ui.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolution.rb +4 -4
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolver.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/state.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo.rb +2 -2
- data/lib/rubygems/vendor/net-http/COPYING +56 -0
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/generic_request.rb +9 -9
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/header.rb +3 -3
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/request.rb +3 -3
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/requests.rb +35 -30
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/response.rb +2 -2
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/responses.rb +6 -6
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/status.rb +1 -1
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http.rb +135 -51
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/https.rb +1 -1
- data/lib/rubygems/vendor/optparse/COPYING +56 -0
- data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/ac.rb +16 -0
- data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/kwargs.rb +8 -3
- data/lib/rubygems/vendor/optparse/lib/optparse/uri.rb +7 -0
- data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/version.rb +9 -0
- data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse.rb +158 -62
- data/lib/rubygems/vendor/resolv/COPYING +56 -0
- data/lib/rubygems/{resolv → vendor/resolv}/lib/resolv.rb +117 -49
- data/lib/rubygems/vendor/securerandom/COPYING +56 -0
- data/lib/rubygems/vendor/securerandom/lib/securerandom.rb +102 -0
- data/lib/rubygems/vendor/timeout/.document +1 -0
- data/lib/rubygems/vendor/timeout/COPYING +56 -0
- data/lib/rubygems/{timeout → vendor/timeout}/lib/timeout.rb +10 -11
- data/lib/rubygems/vendor/tsort/.document +1 -0
- data/lib/rubygems/{tsort → vendor/tsort}/lib/tsort.rb +2 -2
- data/lib/rubygems/vendor/uri/.document +1 -0
- data/lib/rubygems/vendor/uri/COPYING +56 -0
- data/lib/rubygems/vendor/uri/lib/uri/common.rb +880 -0
- data/lib/rubygems/vendor/uri/lib/uri/file.rb +100 -0
- data/lib/rubygems/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/rubygems/vendor/uri/lib/uri/generic.rb +1579 -0
- data/lib/rubygems/vendor/uri/lib/uri/http.rb +125 -0
- data/lib/rubygems/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/rubygems/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/rubygems/vendor/uri/lib/uri/ldaps.rb +22 -0
- data/lib/rubygems/vendor/uri/lib/uri/mailto.rb +293 -0
- data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +206 -0
- data/lib/rubygems/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/rubygems/vendor/uri/lib/uri/ws.rb +83 -0
- data/lib/rubygems/vendor/uri/lib/uri/wss.rb +23 -0
- data/lib/rubygems/vendor/uri/lib/uri.rb +104 -0
- data/lib/rubygems/vendored_molinillo.rb +3 -0
- data/lib/rubygems/vendored_net_http.rb +5 -0
- data/lib/rubygems/vendored_optparse.rb +3 -0
- data/lib/rubygems/vendored_securerandom.rb +3 -0
- data/lib/rubygems/vendored_timeout.rb +5 -0
- data/lib/rubygems/vendored_tsort.rb +3 -0
- data/lib/rubygems/version.rb +26 -9
- data/lib/rubygems/yaml_serializer.rb +12 -7
- data/lib/rubygems.rb +82 -47
- data/rubygems-update.gemspec +11 -6
- data/setup.rb +1 -1
- metadata +131 -86
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +0 -32
- data/lib/rubygems/net/http.rb +0 -3
- data/lib/rubygems/net-http/LICENSE.txt +0 -22
- data/lib/rubygems/net-http/lib/net/http/backward.rb +0 -40
- data/lib/rubygems/net-protocol/LICENSE.txt +0 -22
- data/lib/rubygems/optparse/lib/optparse/uri.rb +0 -7
- data/lib/rubygems/optparse.rb +0 -3
- data/lib/rubygems/resolv/LICENSE.txt +0 -22
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/lib/rubygems/resolver/molinillo.rb +0 -3
- data/lib/rubygems/shellwords.rb +0 -3
- data/lib/rubygems/timeout/LICENSE.txt +0 -22
- data/lib/rubygems/timeout.rb +0 -3
- data/lib/rubygems/tsort/LICENSE.txt +0 -22
- data/lib/rubygems/tsort.rb +0 -3
- /data/{lib/rubygems/optparse → bundler/lib/bundler/vendor/fileutils}/COPYING +0 -0
- /data/{lib/rubygems/net-http → bundler/lib/bundler/vendor/securerandom}/.document +0 -0
- /data/{MAINTAINERS.txt → doc/MAINTAINERS.txt} +0 -0
- /data/{bundler → doc/bundler}/UPGRADING.md +0 -0
- /data/{UPGRADING.md → doc/rubygems/UPGRADING.md} +0 -0
- /data/lib/rubygems/{net-protocol → vendor/molinillo}/.document +0 -0
- /data/lib/rubygems/{resolver → vendor}/molinillo/LICENSE +0 -0
- /data/lib/rubygems/{optparse → vendor/net-http}/.document +0 -0
- /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/exceptions.rb +0 -0
- /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/proxy_delta.rb +0 -0
- /data/lib/rubygems/{resolv → vendor/net-protocol}/.document +0 -0
- /data/{bundler/lib/bundler/vendor/fileutils → lib/rubygems/vendor/net-protocol}/LICENSE.txt +0 -0
- /data/lib/rubygems/{net-protocol → vendor/net-protocol}/lib/net/protocol.rb +0 -0
- /data/lib/rubygems/{resolver/molinillo → vendor/optparse}/.document +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optionparser.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/date.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/shellwords.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/time.rb +0 -0
- /data/lib/rubygems/{timeout → vendor/resolv}/.document +0 -0
- /data/lib/rubygems/{tsort → vendor/securerandom}/.document +0 -0
- /data/{bundler/lib/bundler/vendor/uri → lib/rubygems/vendor/tsort}/LICENSE.txt +0 -0
|
@@ -13,13 +13,14 @@ module Bundler
|
|
|
13
13
|
|
|
14
14
|
attr_reader(
|
|
15
15
|
:dependencies,
|
|
16
|
+
:locked_checksums,
|
|
16
17
|
:locked_deps,
|
|
17
18
|
:locked_gems,
|
|
18
19
|
:platforms,
|
|
19
20
|
:ruby_version,
|
|
20
21
|
:lockfile,
|
|
21
22
|
:gemfiles,
|
|
22
|
-
:
|
|
23
|
+
:sources
|
|
23
24
|
)
|
|
24
25
|
|
|
25
26
|
# Given a gemfile and lockfile creates a Bundler definition
|
|
@@ -57,19 +58,29 @@ module Bundler
|
|
|
57
58
|
# @param ruby_version [Bundler::RubyVersion, nil] Requested Ruby Version
|
|
58
59
|
# @param optional_groups [Array(String)] A list of optional groups
|
|
59
60
|
def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, optional_groups = [], gemfiles = [])
|
|
60
|
-
|
|
61
|
+
unlock ||= {}
|
|
62
|
+
|
|
63
|
+
if unlock == true
|
|
64
|
+
@unlocking_all = true
|
|
61
65
|
@unlocking_bundler = false
|
|
62
66
|
@unlocking = unlock
|
|
67
|
+
@sources_to_unlock = []
|
|
68
|
+
@unlocking_ruby = false
|
|
69
|
+
@explicit_unlocks = []
|
|
70
|
+
conservative = false
|
|
63
71
|
else
|
|
72
|
+
@unlocking_all = false
|
|
64
73
|
@unlocking_bundler = unlock.delete(:bundler)
|
|
65
74
|
@unlocking = unlock.any? {|_k, v| !Array(v).empty? }
|
|
75
|
+
@sources_to_unlock = unlock.delete(:sources) || []
|
|
76
|
+
@unlocking_ruby = unlock.delete(:ruby)
|
|
77
|
+
@explicit_unlocks = unlock.delete(:gems) || []
|
|
78
|
+
conservative = unlock.delete(:conservative)
|
|
66
79
|
end
|
|
67
80
|
|
|
68
81
|
@dependencies = dependencies
|
|
69
82
|
@sources = sources
|
|
70
|
-
@unlock = unlock
|
|
71
83
|
@optional_groups = optional_groups
|
|
72
|
-
@remote = false
|
|
73
84
|
@prefer_local = false
|
|
74
85
|
@specs = nil
|
|
75
86
|
@ruby_version = ruby_version
|
|
@@ -82,39 +93,39 @@ module Bundler
|
|
|
82
93
|
@resolved_bundler_version = nil
|
|
83
94
|
|
|
84
95
|
@locked_ruby_version = nil
|
|
85
|
-
@
|
|
86
|
-
@
|
|
96
|
+
@new_platforms = []
|
|
97
|
+
@removed_platforms = []
|
|
98
|
+
@originally_invalid_platforms = []
|
|
87
99
|
|
|
88
100
|
if lockfile_exists?
|
|
89
101
|
@lockfile_contents = Bundler.read_file(lockfile)
|
|
90
102
|
@locked_gems = LockfileParser.new(@lockfile_contents)
|
|
91
103
|
@locked_platforms = @locked_gems.platforms
|
|
104
|
+
@most_specific_locked_platform = @locked_gems.most_specific_locked_platform
|
|
92
105
|
@platforms = @locked_platforms.dup
|
|
93
106
|
@locked_bundler_version = @locked_gems.bundler_version
|
|
94
107
|
@locked_ruby_version = @locked_gems.ruby_version
|
|
108
|
+
@locked_deps = @locked_gems.dependencies
|
|
95
109
|
@originally_locked_specs = SpecSet.new(@locked_gems.specs)
|
|
96
110
|
@locked_checksums = @locked_gems.checksums
|
|
97
111
|
|
|
98
|
-
if
|
|
99
|
-
@locked_deps = @locked_gems.dependencies
|
|
100
|
-
@locked_specs = @originally_locked_specs
|
|
101
|
-
@locked_sources = @locked_gems.sources
|
|
102
|
-
else
|
|
103
|
-
@unlock = {}
|
|
104
|
-
@locked_deps = {}
|
|
112
|
+
if @unlocking_all
|
|
105
113
|
@locked_specs = SpecSet.new([])
|
|
106
114
|
@locked_sources = []
|
|
115
|
+
else
|
|
116
|
+
@locked_specs = @originally_locked_specs
|
|
117
|
+
@locked_sources = @locked_gems.sources
|
|
107
118
|
end
|
|
108
119
|
else
|
|
109
|
-
@
|
|
120
|
+
@locked_gems = nil
|
|
121
|
+
@locked_platforms = []
|
|
122
|
+
@most_specific_locked_platform = nil
|
|
110
123
|
@platforms = []
|
|
111
|
-
@locked_gems = nil
|
|
112
124
|
@locked_deps = {}
|
|
113
125
|
@locked_specs = SpecSet.new([])
|
|
114
126
|
@originally_locked_specs = @locked_specs
|
|
115
127
|
@locked_sources = []
|
|
116
|
-
@
|
|
117
|
-
@locked_checksums = nil
|
|
128
|
+
@locked_checksums = Bundler.feature_flag.lockfile_checksums?
|
|
118
129
|
end
|
|
119
130
|
|
|
120
131
|
locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
|
|
@@ -130,23 +141,21 @@ module Bundler
|
|
|
130
141
|
@sources.merged_gem_lockfile_sections!(locked_gem_sources.first)
|
|
131
142
|
end
|
|
132
143
|
|
|
133
|
-
@
|
|
134
|
-
@unlock[:ruby] ||= if @ruby_version && locked_ruby_version_object
|
|
144
|
+
@unlocking_ruby ||= if @ruby_version && locked_ruby_version_object
|
|
135
145
|
@ruby_version.diff(locked_ruby_version_object)
|
|
136
146
|
end
|
|
137
|
-
@unlocking ||= @
|
|
147
|
+
@unlocking ||= @unlocking_ruby ||= (!@locked_ruby_version ^ !@ruby_version)
|
|
138
148
|
|
|
139
|
-
add_current_platform unless Bundler.frozen_bundle?
|
|
149
|
+
@current_platform_missing = add_current_platform unless Bundler.frozen_bundle?
|
|
140
150
|
|
|
141
|
-
converge_path_sources_to_gemspec_sources
|
|
142
|
-
@path_changes = converge_paths
|
|
143
151
|
@source_changes = converge_sources
|
|
152
|
+
@path_changes = converge_paths
|
|
144
153
|
|
|
145
|
-
if
|
|
146
|
-
@
|
|
154
|
+
if conservative
|
|
155
|
+
@gems_to_unlock = @explicit_unlocks.any? ? @explicit_unlocks : @dependencies.map(&:name)
|
|
147
156
|
else
|
|
148
|
-
eager_unlock =
|
|
149
|
-
@
|
|
157
|
+
eager_unlock = @explicit_unlocks.map {|name| Dependency.new(name, ">= 0") }
|
|
158
|
+
@gems_to_unlock = @locked_specs.for(eager_unlock, platforms).map(&:name).uniq
|
|
150
159
|
end
|
|
151
160
|
|
|
152
161
|
@dependency_changes = converge_dependencies
|
|
@@ -159,38 +168,63 @@ module Bundler
|
|
|
159
168
|
@gem_version_promoter ||= GemVersionPromoter.new
|
|
160
169
|
end
|
|
161
170
|
|
|
162
|
-
def
|
|
163
|
-
|
|
171
|
+
def check!
|
|
172
|
+
# If dependencies have changed, we need to resolve remotely. Otherwise,
|
|
173
|
+
# since we'll be resolving with a single local source, we may end up
|
|
174
|
+
# locking gems under the wrong source in the lockfile, and missing lockfile
|
|
175
|
+
# checksums
|
|
176
|
+
resolve_remotely! if @dependency_changes
|
|
177
|
+
|
|
178
|
+
# Now do a local only resolve, to verify if any gems are missing locally
|
|
164
179
|
sources.local_only!
|
|
165
180
|
resolve
|
|
166
181
|
end
|
|
167
182
|
|
|
183
|
+
#
|
|
184
|
+
# Setup sources according to the given options and the state of the
|
|
185
|
+
# definition.
|
|
186
|
+
#
|
|
187
|
+
# @return [Boolean] Whether fetching remote information will be necessary or not
|
|
188
|
+
#
|
|
189
|
+
def setup_domain!(options = {})
|
|
190
|
+
prefer_local! if options[:"prefer-local"]
|
|
191
|
+
|
|
192
|
+
if options[:add_checksums] || (!options[:local] && install_needed?)
|
|
193
|
+
remotely!
|
|
194
|
+
true
|
|
195
|
+
else
|
|
196
|
+
Bundler.settings.set_command_option(:jobs, 1) unless install_needed? # to avoid the overhead of Bundler::Worker
|
|
197
|
+
with_cache!
|
|
198
|
+
false
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
168
202
|
def resolve_with_cache!
|
|
169
|
-
|
|
203
|
+
with_cache!
|
|
204
|
+
|
|
170
205
|
resolve
|
|
171
206
|
end
|
|
172
207
|
|
|
208
|
+
def with_cache!
|
|
209
|
+
sources.local!
|
|
210
|
+
sources.cached!
|
|
211
|
+
end
|
|
212
|
+
|
|
173
213
|
def resolve_remotely!
|
|
174
|
-
|
|
175
|
-
|
|
214
|
+
remotely!
|
|
215
|
+
|
|
176
216
|
resolve
|
|
177
217
|
end
|
|
178
218
|
|
|
179
|
-
def
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
else
|
|
183
|
-
@remote = true
|
|
184
|
-
@prefer_local = options["prefer-local"]
|
|
185
|
-
end
|
|
219
|
+
def remotely!
|
|
220
|
+
sources.cached!
|
|
221
|
+
sources.remote!
|
|
186
222
|
end
|
|
187
223
|
|
|
188
|
-
def
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
sources.remote!
|
|
193
|
-
end
|
|
224
|
+
def prefer_local!
|
|
225
|
+
@prefer_local = true
|
|
226
|
+
|
|
227
|
+
sources.prefer_local!
|
|
194
228
|
end
|
|
195
229
|
|
|
196
230
|
# For given dependency list returns a SpecSet with Gemspec of all the required
|
|
@@ -212,7 +246,7 @@ module Bundler
|
|
|
212
246
|
end
|
|
213
247
|
|
|
214
248
|
def missing_specs
|
|
215
|
-
resolve.
|
|
249
|
+
resolve.missing_specs_for(requested_dependencies)
|
|
216
250
|
end
|
|
217
251
|
|
|
218
252
|
def missing_specs?
|
|
@@ -223,9 +257,9 @@ module Bundler
|
|
|
223
257
|
rescue BundlerError => e
|
|
224
258
|
@resolve = nil
|
|
225
259
|
@resolver = nil
|
|
226
|
-
@
|
|
260
|
+
@resolution_base = nil
|
|
261
|
+
@source_requirements = nil
|
|
227
262
|
@specs = nil
|
|
228
|
-
@gem_version_promoter = nil
|
|
229
263
|
|
|
230
264
|
Bundler.ui.debug "The definition is missing dependencies, failed to resolve & materialize locally (#{e})"
|
|
231
265
|
true
|
|
@@ -276,11 +310,7 @@ module Bundler
|
|
|
276
310
|
groups.map!(&:to_sym)
|
|
277
311
|
deps = current_dependencies # always returns a new array
|
|
278
312
|
deps.select! do |d|
|
|
279
|
-
|
|
280
|
-
d.groups.intersect?(groups)
|
|
281
|
-
else
|
|
282
|
-
!(d.groups & groups).empty?
|
|
283
|
-
end
|
|
313
|
+
d.groups.intersect?(groups)
|
|
284
314
|
end
|
|
285
315
|
deps
|
|
286
316
|
end
|
|
@@ -300,63 +330,52 @@ module Bundler
|
|
|
300
330
|
SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
|
|
301
331
|
else
|
|
302
332
|
Bundler.ui.debug "Found no changes, using resolution from the lockfile"
|
|
303
|
-
if @
|
|
333
|
+
if @removed_platforms.any? || @locked_gems.may_include_redundant_platform_specific_gems?
|
|
304
334
|
SpecSet.new(filter_specs(@locked_specs, @dependencies))
|
|
305
335
|
else
|
|
306
336
|
@locked_specs
|
|
307
337
|
end
|
|
308
338
|
end
|
|
309
339
|
else
|
|
310
|
-
Bundler.ui.debug
|
|
340
|
+
Bundler.ui.debug resolve_needed_reason
|
|
341
|
+
|
|
311
342
|
start_resolution
|
|
312
343
|
end
|
|
313
344
|
end
|
|
314
345
|
|
|
315
346
|
def spec_git_paths
|
|
316
|
-
sources.git_sources.
|
|
347
|
+
sources.git_sources.filter_map {|s| File.realpath(s.path) if File.exist?(s.path) }
|
|
317
348
|
end
|
|
318
349
|
|
|
319
350
|
def groups
|
|
320
|
-
dependencies.
|
|
351
|
+
dependencies.flat_map(&:groups).uniq
|
|
321
352
|
end
|
|
322
353
|
|
|
323
|
-
def lock(
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
|
|
331
|
-
|
|
332
|
-
if @locked_bundler_version
|
|
333
|
-
locked_major = @locked_bundler_version.segments.first
|
|
334
|
-
current_major = bundler_version_to_lock.segments.first
|
|
335
|
-
|
|
336
|
-
updating_major = locked_major < current_major
|
|
337
|
-
end
|
|
354
|
+
def lock(file_or_preserve_unknown_sections = false, preserve_unknown_sections_or_unused = false)
|
|
355
|
+
if [true, false, nil].include?(file_or_preserve_unknown_sections)
|
|
356
|
+
target_lockfile = lockfile
|
|
357
|
+
preserve_unknown_sections = file_or_preserve_unknown_sections
|
|
358
|
+
else
|
|
359
|
+
target_lockfile = file_or_preserve_unknown_sections
|
|
360
|
+
preserve_unknown_sections = preserve_unknown_sections_or_unused
|
|
338
361
|
|
|
339
|
-
|
|
362
|
+
suggestion = if target_lockfile == lockfile
|
|
363
|
+
"To fix this warning, remove it from the `Definition#lock` call."
|
|
364
|
+
else
|
|
365
|
+
"Instead, instantiate a new definition passing `#{target_lockfile}`, and call `lock` without a file argument on that definition"
|
|
366
|
+
end
|
|
340
367
|
|
|
341
|
-
|
|
342
|
-
return if Bundler.frozen_bundle?
|
|
343
|
-
SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
|
|
344
|
-
return
|
|
345
|
-
end
|
|
368
|
+
msg = "`Definition#lock` was passed a target file argument. #{suggestion}"
|
|
346
369
|
|
|
347
|
-
|
|
348
|
-
Bundler.ui.error "Cannot write a changed lockfile while frozen."
|
|
349
|
-
return
|
|
370
|
+
Bundler::SharedHelpers.major_deprecation 2, msg
|
|
350
371
|
end
|
|
351
372
|
|
|
352
|
-
|
|
353
|
-
File.open(p, "wb") {|f| f.puts(contents) }
|
|
354
|
-
end
|
|
373
|
+
write_lock(target_lockfile, preserve_unknown_sections)
|
|
355
374
|
end
|
|
356
375
|
|
|
357
376
|
def locked_ruby_version
|
|
358
377
|
return unless ruby_version
|
|
359
|
-
if @
|
|
378
|
+
if @unlocking_ruby || !@locked_ruby_version
|
|
360
379
|
Bundler::RubyVersion.system
|
|
361
380
|
else
|
|
362
381
|
@locked_ruby_version
|
|
@@ -385,51 +404,22 @@ module Bundler
|
|
|
385
404
|
end
|
|
386
405
|
|
|
387
406
|
def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
|
|
388
|
-
|
|
389
|
-
deleted = []
|
|
390
|
-
changed = []
|
|
407
|
+
return unless Bundler.frozen_bundle?
|
|
391
408
|
|
|
392
|
-
|
|
393
|
-
deleted_platforms = @locked_platforms - @platforms
|
|
394
|
-
added.concat new_platforms.map {|p| "* platform: #{p}" }
|
|
395
|
-
deleted.concat deleted_platforms.map {|p| "* platform: #{p}" }
|
|
409
|
+
raise ProductionError, "Frozen mode is set, but there's no lockfile" unless lockfile_exists?
|
|
396
410
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
both_sources = Hash.new {|h, k| h[k] = [] }
|
|
401
|
-
current_dependencies.each {|d| both_sources[d.name][0] = d }
|
|
402
|
-
current_locked_dependencies.each {|d| both_sources[d.name][1] = d }
|
|
403
|
-
|
|
404
|
-
both_sources.each do |name, (dep, lock_dep)|
|
|
405
|
-
next if dep.nil? || lock_dep.nil?
|
|
406
|
-
|
|
407
|
-
gemfile_source = dep.source || default_source
|
|
408
|
-
lock_source = lock_dep.source || default_source
|
|
409
|
-
next if lock_source.include?(gemfile_source)
|
|
410
|
-
|
|
411
|
-
gemfile_source_name = dep.source ? gemfile_source.to_gemfile : "no specified source"
|
|
412
|
-
lockfile_source_name = lock_dep.source ? lock_source.to_gemfile : "no specified source"
|
|
413
|
-
changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`"
|
|
414
|
-
end
|
|
415
|
-
|
|
416
|
-
reason = change_reason
|
|
417
|
-
msg = String.new
|
|
418
|
-
msg << "#{reason.capitalize.strip}, but the lockfile can't be updated because frozen mode is set"
|
|
419
|
-
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
|
|
420
|
-
msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
|
|
421
|
-
msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
|
|
422
|
-
msg << "\n\nRun `bundle install` elsewhere and add the updated #{SharedHelpers.relative_gemfile_path} to version control.\n"
|
|
411
|
+
msg = lockfile_changes_summary("frozen mode is set")
|
|
412
|
+
return unless msg
|
|
423
413
|
|
|
424
414
|
unless explicit_flag
|
|
425
415
|
suggested_command = unless Bundler.settings.locations("frozen").keys.include?(:env)
|
|
426
416
|
"bundle config set frozen false"
|
|
427
417
|
end
|
|
428
|
-
msg << "
|
|
418
|
+
msg << "\n\nIf this is a development machine, remove the #{SharedHelpers.relative_lockfile_path} " \
|
|
429
419
|
"freeze by running `#{suggested_command}`." if suggested_command
|
|
430
420
|
end
|
|
431
421
|
|
|
432
|
-
raise ProductionError, msg
|
|
422
|
+
raise ProductionError, msg
|
|
433
423
|
end
|
|
434
424
|
|
|
435
425
|
def validate_runtime!
|
|
@@ -463,56 +453,120 @@ module Bundler
|
|
|
463
453
|
end
|
|
464
454
|
|
|
465
455
|
def validate_platforms!
|
|
466
|
-
return if current_platform_locked?
|
|
456
|
+
return if current_platform_locked? || @platforms.include?(Gem::Platform::RUBY)
|
|
467
457
|
|
|
468
458
|
raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
|
|
469
459
|
"but your local platform is #{local_platform}. " \
|
|
470
460
|
"Add the current platform to the lockfile with\n`bundle lock --add-platform #{local_platform}` and try again."
|
|
471
461
|
end
|
|
472
462
|
|
|
463
|
+
def normalize_platforms
|
|
464
|
+
resolve.normalize_platforms!(current_dependencies, platforms)
|
|
465
|
+
|
|
466
|
+
@resolve = SpecSet.new(resolve.for(current_dependencies, @platforms))
|
|
467
|
+
end
|
|
468
|
+
|
|
473
469
|
def add_platform(platform)
|
|
474
|
-
|
|
475
|
-
|
|
470
|
+
return if @platforms.include?(platform)
|
|
471
|
+
|
|
472
|
+
@new_platforms << platform
|
|
473
|
+
@platforms << platform
|
|
476
474
|
end
|
|
477
475
|
|
|
478
476
|
def remove_platform(platform)
|
|
479
|
-
|
|
480
|
-
@removed_platform ||= removed_platform
|
|
481
|
-
return if removed_platform
|
|
482
|
-
raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
|
|
483
|
-
end
|
|
477
|
+
raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}" unless @platforms.include?(platform)
|
|
484
478
|
|
|
485
|
-
|
|
486
|
-
@platforms.
|
|
487
|
-
platform_specificity_match(bundle_platform, local_platform)
|
|
488
|
-
end
|
|
479
|
+
@removed_platforms << platform
|
|
480
|
+
@platforms.delete(platform)
|
|
489
481
|
end
|
|
490
482
|
|
|
491
|
-
attr_reader :sources
|
|
492
|
-
private :sources
|
|
493
|
-
|
|
494
483
|
def nothing_changed?
|
|
495
|
-
|
|
496
|
-
!@dependency_changes &&
|
|
497
|
-
!@new_platform &&
|
|
498
|
-
!@path_changes &&
|
|
499
|
-
!@local_changes &&
|
|
500
|
-
!@missing_lockfile_dep &&
|
|
501
|
-
!@unlocking_bundler &&
|
|
502
|
-
!@locked_spec_with_missing_deps &&
|
|
503
|
-
!@locked_spec_with_invalid_deps
|
|
484
|
+
!something_changed?
|
|
504
485
|
end
|
|
505
486
|
|
|
506
487
|
def no_resolve_needed?
|
|
507
|
-
!
|
|
488
|
+
!resolve_needed?
|
|
508
489
|
end
|
|
509
490
|
|
|
510
491
|
def unlocking?
|
|
511
492
|
@unlocking
|
|
512
493
|
end
|
|
513
494
|
|
|
495
|
+
attr_writer :source_requirements
|
|
496
|
+
|
|
497
|
+
def add_checksums
|
|
498
|
+
@locked_checksums = true
|
|
499
|
+
|
|
500
|
+
setup_domain!(add_checksums: true)
|
|
501
|
+
|
|
502
|
+
specs # force materialization to real specifications, so that checksums are fetched
|
|
503
|
+
end
|
|
504
|
+
|
|
514
505
|
private
|
|
515
506
|
|
|
507
|
+
def lockfile_changes_summary(update_refused_reason)
|
|
508
|
+
added = []
|
|
509
|
+
deleted = []
|
|
510
|
+
changed = []
|
|
511
|
+
|
|
512
|
+
added.concat @new_platforms.map {|p| "* platform: #{p}" }
|
|
513
|
+
deleted.concat @removed_platforms.map {|p| "* platform: #{p}" }
|
|
514
|
+
|
|
515
|
+
added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
|
|
516
|
+
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
|
517
|
+
|
|
518
|
+
both_sources = Hash.new {|h, k| h[k] = [] }
|
|
519
|
+
current_dependencies.each {|d| both_sources[d.name][0] = d }
|
|
520
|
+
current_locked_dependencies.each {|d| both_sources[d.name][1] = d }
|
|
521
|
+
|
|
522
|
+
both_sources.each do |name, (dep, lock_dep)|
|
|
523
|
+
next if dep.nil? || lock_dep.nil?
|
|
524
|
+
|
|
525
|
+
gemfile_source = dep.source || default_source
|
|
526
|
+
lock_source = lock_dep.source || default_source
|
|
527
|
+
next if lock_source.include?(gemfile_source)
|
|
528
|
+
|
|
529
|
+
gemfile_source_name = dep.source ? gemfile_source.to_gemfile : "no specified source"
|
|
530
|
+
lockfile_source_name = lock_dep.source ? lock_source.to_gemfile : "no specified source"
|
|
531
|
+
changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`"
|
|
532
|
+
end
|
|
533
|
+
|
|
534
|
+
return unless added.any? || deleted.any? || changed.any? || resolve_needed?
|
|
535
|
+
|
|
536
|
+
msg = String.new("#{change_reason.capitalize.strip}, but ")
|
|
537
|
+
msg << "the lockfile " unless msg.start_with?("Your lockfile")
|
|
538
|
+
msg << "can't be updated because #{update_refused_reason}"
|
|
539
|
+
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
|
|
540
|
+
msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
|
|
541
|
+
msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
|
|
542
|
+
msg << "\n\nRun `bundle install` elsewhere and add the updated #{SharedHelpers.relative_lockfile_path} to version control.\n" unless unlocking?
|
|
543
|
+
msg
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
def install_needed?
|
|
547
|
+
resolve_needed? || missing_specs?
|
|
548
|
+
end
|
|
549
|
+
|
|
550
|
+
def something_changed?
|
|
551
|
+
return true unless lockfile_exists?
|
|
552
|
+
|
|
553
|
+
@source_changes ||
|
|
554
|
+
@dependency_changes ||
|
|
555
|
+
@current_platform_missing ||
|
|
556
|
+
@new_platforms.any? ||
|
|
557
|
+
@path_changes ||
|
|
558
|
+
@local_changes ||
|
|
559
|
+
@missing_lockfile_dep ||
|
|
560
|
+
@unlocking_bundler ||
|
|
561
|
+
@locked_spec_with_missing_checksums ||
|
|
562
|
+
@locked_spec_with_missing_deps ||
|
|
563
|
+
@locked_spec_with_invalid_deps
|
|
564
|
+
end
|
|
565
|
+
|
|
566
|
+
def resolve_needed?
|
|
567
|
+
unlocking? || something_changed?
|
|
568
|
+
end
|
|
569
|
+
|
|
516
570
|
def should_add_extra_platforms?
|
|
517
571
|
!lockfile_exists? && generic_local_platform_is_ruby? && !Bundler.settings[:force_ruby_platform]
|
|
518
572
|
end
|
|
@@ -521,8 +575,46 @@ module Bundler
|
|
|
521
575
|
lockfile && File.exist?(lockfile)
|
|
522
576
|
end
|
|
523
577
|
|
|
578
|
+
def write_lock(file, preserve_unknown_sections)
|
|
579
|
+
return if Definition.no_lock || file.nil?
|
|
580
|
+
|
|
581
|
+
contents = to_lock
|
|
582
|
+
|
|
583
|
+
# Convert to \r\n if the existing lock has them
|
|
584
|
+
# i.e., Windows with `git config core.autocrlf=true`
|
|
585
|
+
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match?("\r\n")
|
|
586
|
+
|
|
587
|
+
if @locked_bundler_version
|
|
588
|
+
locked_major = @locked_bundler_version.segments.first
|
|
589
|
+
current_major = bundler_version_to_lock.segments.first
|
|
590
|
+
|
|
591
|
+
updating_major = locked_major < current_major
|
|
592
|
+
end
|
|
593
|
+
|
|
594
|
+
preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
|
|
595
|
+
|
|
596
|
+
if File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
|
|
597
|
+
return if Bundler.frozen_bundle?
|
|
598
|
+
SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
|
|
599
|
+
return
|
|
600
|
+
end
|
|
601
|
+
|
|
602
|
+
if Bundler.frozen_bundle?
|
|
603
|
+
Bundler.ui.error "Cannot write a changed lockfile while frozen."
|
|
604
|
+
return
|
|
605
|
+
end
|
|
606
|
+
|
|
607
|
+
begin
|
|
608
|
+
SharedHelpers.filesystem_access(file) do |p|
|
|
609
|
+
File.open(p, "wb") {|f| f.puts(contents) }
|
|
610
|
+
end
|
|
611
|
+
rescue ReadOnlyFileSystemError
|
|
612
|
+
raise ProductionError, lockfile_changes_summary("file system is read-only")
|
|
613
|
+
end
|
|
614
|
+
end
|
|
615
|
+
|
|
524
616
|
def resolver
|
|
525
|
-
@resolver ||= Resolver.new(
|
|
617
|
+
@resolver ||= Resolver.new(resolution_base, gem_version_promoter, @most_specific_locked_platform)
|
|
526
618
|
end
|
|
527
619
|
|
|
528
620
|
def expanded_dependencies
|
|
@@ -531,36 +623,65 @@ module Bundler
|
|
|
531
623
|
|
|
532
624
|
def dependencies_with_bundler
|
|
533
625
|
return dependencies unless @unlocking_bundler
|
|
534
|
-
return dependencies if dependencies.
|
|
626
|
+
return dependencies if dependencies.any? {|d| d.name == "bundler" }
|
|
535
627
|
|
|
536
628
|
[Dependency.new("bundler", @unlocking_bundler)] + dependencies
|
|
537
629
|
end
|
|
538
630
|
|
|
539
|
-
def
|
|
540
|
-
@
|
|
631
|
+
def resolution_base
|
|
632
|
+
@resolution_base ||= begin
|
|
541
633
|
last_resolve = converge_locked_specs
|
|
542
|
-
remove_invalid_platforms!
|
|
543
|
-
|
|
544
|
-
|
|
634
|
+
remove_invalid_platforms!
|
|
635
|
+
new_resolution_platforms = @current_platform_missing ? @new_platforms + [local_platform] : @new_platforms
|
|
636
|
+
base = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @unlocking_all || @gems_to_unlock, prerelease: gem_version_promoter.pre?, prefer_local: @prefer_local, new_platforms: new_resolution_platforms)
|
|
637
|
+
base = additional_base_requirements_to_prevent_downgrades(base)
|
|
638
|
+
base = additional_base_requirements_to_force_updates(base)
|
|
639
|
+
base
|
|
545
640
|
end
|
|
546
641
|
end
|
|
547
642
|
|
|
548
|
-
def filter_specs(specs, deps)
|
|
549
|
-
SpecSet.new(specs).for(deps,
|
|
643
|
+
def filter_specs(specs, deps, skips: [])
|
|
644
|
+
SpecSet.new(specs).for(deps, platforms, skips: skips)
|
|
550
645
|
end
|
|
551
646
|
|
|
552
647
|
def materialize(dependencies)
|
|
553
|
-
|
|
554
|
-
|
|
648
|
+
# Tracks potential endless loops trying to re-resolve.
|
|
649
|
+
# TODO: Remove as dead code if not reports are received in a while
|
|
650
|
+
incorrect_spec = nil
|
|
651
|
+
|
|
652
|
+
specs = begin
|
|
653
|
+
resolve.materialize(dependencies)
|
|
654
|
+
rescue IncorrectLockfileDependencies => e
|
|
655
|
+
raise if Bundler.frozen_bundle?
|
|
656
|
+
|
|
657
|
+
spec = e.spec
|
|
658
|
+
raise "Infinite loop while fixing lockfile dependencies" if incorrect_spec == spec
|
|
659
|
+
|
|
660
|
+
incorrect_spec = spec
|
|
661
|
+
reresolve_without([spec])
|
|
662
|
+
retry
|
|
663
|
+
end
|
|
664
|
+
|
|
665
|
+
missing_specs = resolve.missing_specs
|
|
555
666
|
|
|
556
667
|
if missing_specs.any?
|
|
557
668
|
missing_specs.each do |s|
|
|
558
669
|
locked_gem = @locked_specs[s.name].last
|
|
559
|
-
next if locked_gem.nil? || locked_gem.version != s.version ||
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
670
|
+
next if locked_gem.nil? || locked_gem.version != s.version || sources.local_mode?
|
|
671
|
+
|
|
672
|
+
message = if sources.implicit_global_source?
|
|
673
|
+
"Because your Gemfile specifies no global remote source, your bundle is locked to " \
|
|
674
|
+
"#{locked_gem} from #{locked_gem.source}. However, #{locked_gem} is not installed. You'll " \
|
|
675
|
+
"need to either add a global remote source to your Gemfile or make sure #{locked_gem} is " \
|
|
676
|
+
"available locally before rerunning Bundler."
|
|
677
|
+
else
|
|
678
|
+
"Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
|
|
679
|
+
"no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
|
|
680
|
+
"You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
|
|
681
|
+
"removed in order to install."
|
|
682
|
+
end
|
|
683
|
+
|
|
684
|
+
raise GemNotFound, message
|
|
564
685
|
end
|
|
565
686
|
|
|
566
687
|
missing_specs_list = missing_specs.group_by(&:source).map do |source, missing_specs_for_source|
|
|
@@ -570,100 +691,164 @@ module Bundler
|
|
|
570
691
|
raise GemNotFound, "Could not find #{missing_specs_list.join(" nor ")}"
|
|
571
692
|
end
|
|
572
693
|
|
|
573
|
-
|
|
694
|
+
partially_missing_specs = resolve.partially_missing_specs
|
|
695
|
+
|
|
696
|
+
if partially_missing_specs.any? && !sources.local_mode?
|
|
697
|
+
Bundler.ui.warn "Some locked specs have possibly been yanked (#{partially_missing_specs.map(&:full_name).join(", ")}). Ignoring them..."
|
|
698
|
+
|
|
699
|
+
resolve.delete(partially_missing_specs)
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
incomplete_specs = resolve.incomplete_specs
|
|
574
703
|
loop do
|
|
575
704
|
break if incomplete_specs.empty?
|
|
576
705
|
|
|
577
706
|
Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
@resolve = start_resolution
|
|
707
|
+
sources.remote!
|
|
708
|
+
reresolve_without(incomplete_specs)
|
|
581
709
|
specs = resolve.materialize(dependencies)
|
|
582
710
|
|
|
583
|
-
still_incomplete_specs =
|
|
711
|
+
still_incomplete_specs = resolve.incomplete_specs
|
|
584
712
|
|
|
585
713
|
if still_incomplete_specs == incomplete_specs
|
|
586
|
-
|
|
587
|
-
resolver.raise_not_found! package
|
|
714
|
+
resolver.raise_incomplete! incomplete_specs
|
|
588
715
|
end
|
|
589
716
|
|
|
590
717
|
incomplete_specs = still_incomplete_specs
|
|
591
718
|
end
|
|
592
719
|
|
|
720
|
+
insecurely_materialized_specs = resolve.insecurely_materialized_specs
|
|
721
|
+
|
|
722
|
+
if insecurely_materialized_specs.any?
|
|
723
|
+
Bundler.ui.warn "The following platform specific gems are getting installed, yet the lockfile includes only their generic ruby version:\n" \
|
|
724
|
+
" * #{insecurely_materialized_specs.map(&:full_name).join("\n * ")}\n" \
|
|
725
|
+
"Please run `bundle lock --normalize-platforms` and commit the resulting lockfile.\n" \
|
|
726
|
+
"Alternatively, you may run `bundle lock --add-platform <list-of-platforms-that-you-want-to-support>`"
|
|
727
|
+
end
|
|
728
|
+
|
|
593
729
|
bundler = sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
|
|
594
730
|
specs["bundler"] = bundler
|
|
595
731
|
|
|
596
732
|
specs
|
|
597
733
|
end
|
|
598
734
|
|
|
735
|
+
def reresolve_without(incomplete_specs)
|
|
736
|
+
resolution_base.delete(incomplete_specs)
|
|
737
|
+
@resolve = start_resolution
|
|
738
|
+
end
|
|
739
|
+
|
|
599
740
|
def start_resolution
|
|
741
|
+
local_platform_needed_for_resolvability = @most_specific_non_local_locked_platform && !@platforms.include?(local_platform)
|
|
742
|
+
@platforms << local_platform if local_platform_needed_for_resolvability
|
|
743
|
+
add_platform(Gem::Platform::RUBY) if RUBY_ENGINE == "truffleruby"
|
|
744
|
+
|
|
600
745
|
result = SpecSet.new(resolver.start)
|
|
601
746
|
|
|
602
747
|
@resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
|
|
603
|
-
@platforms = result.add_extra_platforms!(platforms) if should_add_extra_platforms?
|
|
604
748
|
|
|
605
|
-
|
|
749
|
+
@new_platforms.each do |platform|
|
|
750
|
+
incomplete_specs = result.incomplete_specs_for_platform(current_dependencies, platform)
|
|
751
|
+
|
|
752
|
+
if incomplete_specs.any?
|
|
753
|
+
resolver.raise_incomplete! incomplete_specs
|
|
754
|
+
end
|
|
755
|
+
end
|
|
756
|
+
|
|
757
|
+
if @most_specific_non_local_locked_platform
|
|
758
|
+
if result.incomplete_for_platform?(current_dependencies, @most_specific_non_local_locked_platform)
|
|
759
|
+
@platforms.delete(@most_specific_non_local_locked_platform)
|
|
760
|
+
elsif local_platform_needed_for_resolvability
|
|
761
|
+
@platforms.delete(local_platform)
|
|
762
|
+
end
|
|
763
|
+
end
|
|
764
|
+
|
|
765
|
+
if should_add_extra_platforms?
|
|
766
|
+
result.add_extra_platforms!(platforms)
|
|
767
|
+
elsif @originally_invalid_platforms.any?
|
|
768
|
+
result.add_originally_invalid_platforms!(platforms, @originally_invalid_platforms)
|
|
769
|
+
end
|
|
606
770
|
|
|
607
|
-
SpecSet.new(result.for(dependencies,
|
|
771
|
+
SpecSet.new(result.for(dependencies, @platforms | [Gem::Platform::RUBY]))
|
|
608
772
|
end
|
|
609
773
|
|
|
610
774
|
def precompute_source_requirements_for_indirect_dependencies?
|
|
611
775
|
sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
|
|
612
776
|
end
|
|
613
777
|
|
|
614
|
-
def
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
778
|
+
def current_platform_locked?
|
|
779
|
+
@platforms.any? do |bundle_platform|
|
|
780
|
+
generic_local_platform == bundle_platform || local_platform === bundle_platform
|
|
781
|
+
end
|
|
782
|
+
end
|
|
618
783
|
|
|
619
|
-
|
|
620
|
-
|
|
784
|
+
def add_current_platform
|
|
785
|
+
return if @platforms.include?(local_platform)
|
|
786
|
+
|
|
787
|
+
@most_specific_non_local_locked_platform = find_most_specific_locked_platform
|
|
788
|
+
return if @most_specific_non_local_locked_platform
|
|
789
|
+
|
|
790
|
+
@platforms << local_platform
|
|
791
|
+
true
|
|
792
|
+
end
|
|
793
|
+
|
|
794
|
+
def find_most_specific_locked_platform
|
|
795
|
+
return unless current_platform_locked?
|
|
796
|
+
|
|
797
|
+
@most_specific_locked_platform
|
|
798
|
+
end
|
|
799
|
+
|
|
800
|
+
def resolve_needed_reason
|
|
801
|
+
if lockfile_exists?
|
|
802
|
+
if unlocking?
|
|
803
|
+
"Re-resolving dependencies because #{unlocking_reason}"
|
|
621
804
|
else
|
|
622
|
-
|
|
805
|
+
"Found changes from the lockfile, re-resolving dependencies because #{lockfile_changed_reason}"
|
|
623
806
|
end
|
|
807
|
+
else
|
|
808
|
+
"Resolving dependencies because there's no lockfile"
|
|
624
809
|
end
|
|
625
810
|
end
|
|
626
811
|
|
|
627
|
-
def
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
812
|
+
def change_reason
|
|
813
|
+
if resolve_needed?
|
|
814
|
+
if unlocking?
|
|
815
|
+
unlocking_reason
|
|
816
|
+
else
|
|
817
|
+
lockfile_changed_reason
|
|
818
|
+
end
|
|
819
|
+
else
|
|
820
|
+
"some dependencies were deleted from your gemfile"
|
|
821
|
+
end
|
|
632
822
|
end
|
|
633
823
|
|
|
634
|
-
def
|
|
635
|
-
@
|
|
636
|
-
|
|
824
|
+
def unlocking_reason
|
|
825
|
+
unlock_targets = if @gems_to_unlock.any?
|
|
826
|
+
["gems", @gems_to_unlock]
|
|
827
|
+
elsif @sources_to_unlock.any?
|
|
828
|
+
["sources", @sources_to_unlock]
|
|
637
829
|
end
|
|
638
|
-
end
|
|
639
830
|
|
|
640
|
-
|
|
641
|
-
|
|
831
|
+
unlock_reason = if unlock_targets
|
|
832
|
+
"#{unlock_targets.first}: (#{unlock_targets.last.join(", ")})"
|
|
833
|
+
else
|
|
834
|
+
@unlocking_ruby ? "ruby" : ""
|
|
835
|
+
end
|
|
642
836
|
|
|
643
|
-
|
|
837
|
+
"bundler is unlocking #{unlock_reason}"
|
|
644
838
|
end
|
|
645
839
|
|
|
646
|
-
def
|
|
647
|
-
if unlocking?
|
|
648
|
-
unlock_reason = @unlock.reject {|_k, v| Array(v).empty? }.map do |k, v|
|
|
649
|
-
if v == true
|
|
650
|
-
k.to_s
|
|
651
|
-
else
|
|
652
|
-
v = Array(v)
|
|
653
|
-
"#{k}: (#{v.join(", ")})"
|
|
654
|
-
end
|
|
655
|
-
end.join(", ")
|
|
656
|
-
return "bundler is unlocking #{unlock_reason}"
|
|
657
|
-
end
|
|
840
|
+
def lockfile_changed_reason
|
|
658
841
|
[
|
|
659
842
|
[@source_changes, "the list of sources changed"],
|
|
660
843
|
[@dependency_changes, "the dependencies in your gemfile changed"],
|
|
661
|
-
[@
|
|
844
|
+
[@current_platform_missing, "your lockfile is missing the current platform"],
|
|
845
|
+
[@new_platforms.any?, "you are adding a new platform to your lockfile"],
|
|
662
846
|
[@path_changes, "the gemspecs for path gems changed"],
|
|
663
847
|
[@local_changes, "the gemspecs for git local gems changed"],
|
|
664
|
-
[@missing_lockfile_dep, "your
|
|
848
|
+
[@missing_lockfile_dep, "your lockfile is missing \"#{@missing_lockfile_dep}\""],
|
|
665
849
|
[@unlocking_bundler, "an update to the version of Bundler itself was requested"],
|
|
666
|
-
[@
|
|
850
|
+
[@locked_spec_with_missing_checksums, "your lockfile is missing a CHECKSUMS entry for \"#{@locked_spec_with_missing_checksums}\""],
|
|
851
|
+
[@locked_spec_with_missing_deps, "your lockfile includes \"#{@locked_spec_with_missing_deps}\" but not some of its dependencies"],
|
|
667
852
|
[@locked_spec_with_invalid_deps, "your lockfile does not satisfy dependencies of \"#{@locked_spec_with_invalid_deps}\""],
|
|
668
853
|
].select(&:first).map(&:last).join(", ")
|
|
669
854
|
end
|
|
@@ -680,8 +865,8 @@ module Bundler
|
|
|
680
865
|
!locked || dependencies_for_source_changed?(source, locked) || specs_for_source_changed?(source)
|
|
681
866
|
end
|
|
682
867
|
|
|
683
|
-
def dependencies_for_source_changed?(source, locked_source
|
|
684
|
-
deps_for_source = @dependencies.select {|
|
|
868
|
+
def dependencies_for_source_changed?(source, locked_source)
|
|
869
|
+
deps_for_source = @dependencies.select {|dep| dep.source == source }
|
|
685
870
|
locked_deps_for_source = locked_dependencies.select {|dep| dep.source == locked_source }
|
|
686
871
|
|
|
687
872
|
deps_for_source.uniq.sort != locked_deps_for_source.sort
|
|
@@ -689,7 +874,7 @@ module Bundler
|
|
|
689
874
|
|
|
690
875
|
def specs_for_source_changed?(source)
|
|
691
876
|
locked_index = Index.new
|
|
692
|
-
locked_index.use(@locked_specs.select {|s|
|
|
877
|
+
locked_index.use(@locked_specs.select {|s| s.replace_source_with!(source) })
|
|
693
878
|
|
|
694
879
|
!locked_index.subset?(source.specs)
|
|
695
880
|
rescue PathError, GitError => e
|
|
@@ -707,7 +892,7 @@ module Bundler
|
|
|
707
892
|
spec = @dependencies.find {|s| s.name == k }
|
|
708
893
|
source = spec&.source
|
|
709
894
|
if source&.respond_to?(:local_override!)
|
|
710
|
-
source.unlock! if @
|
|
895
|
+
source.unlock! if @gems_to_unlock.include?(spec.name)
|
|
711
896
|
locals << [source, source.local_override!(v)]
|
|
712
897
|
end
|
|
713
898
|
end
|
|
@@ -715,33 +900,33 @@ module Bundler
|
|
|
715
900
|
sources_with_changes = locals.select do |source, changed|
|
|
716
901
|
changed || specs_changed?(source)
|
|
717
902
|
end.map(&:first)
|
|
718
|
-
!sources_with_changes.each {|source| @
|
|
903
|
+
!sources_with_changes.each {|source| @sources_to_unlock << source.name }.empty?
|
|
719
904
|
end
|
|
720
905
|
|
|
721
906
|
def check_lockfile
|
|
722
|
-
@missing_lockfile_dep = nil
|
|
723
|
-
|
|
724
907
|
@locked_spec_with_invalid_deps = nil
|
|
725
908
|
@locked_spec_with_missing_deps = nil
|
|
909
|
+
@locked_spec_with_missing_checksums = nil
|
|
726
910
|
|
|
727
|
-
|
|
911
|
+
missing_deps = []
|
|
912
|
+
missing_checksums = []
|
|
728
913
|
invalid = []
|
|
729
914
|
|
|
730
915
|
@locked_specs.each do |s|
|
|
916
|
+
missing_checksums << s if @locked_checksums && s.source.checksum_store.missing?(s)
|
|
917
|
+
|
|
731
918
|
validation = @locked_specs.validate_deps(s)
|
|
732
919
|
|
|
733
|
-
|
|
920
|
+
missing_deps << s if validation == :missing
|
|
734
921
|
invalid << s if validation == :invalid
|
|
735
922
|
end
|
|
736
923
|
|
|
737
|
-
if
|
|
738
|
-
@locked_specs.delete(missing)
|
|
924
|
+
@locked_spec_with_missing_checksums = missing_checksums.first.name if missing_checksums.any?
|
|
739
925
|
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
end&.name
|
|
926
|
+
if missing_deps.any?
|
|
927
|
+
@locked_specs.delete(missing_deps)
|
|
928
|
+
|
|
929
|
+
@locked_spec_with_missing_deps = missing_deps.first.name
|
|
745
930
|
end
|
|
746
931
|
|
|
747
932
|
if invalid.any?
|
|
@@ -757,24 +942,6 @@ module Bundler
|
|
|
757
942
|
end
|
|
758
943
|
end
|
|
759
944
|
|
|
760
|
-
def converge_path_source_to_gemspec_source(source)
|
|
761
|
-
return source unless source.instance_of?(Source::Path)
|
|
762
|
-
gemspec_source = sources.path_sources.find {|s| s.is_a?(Source::Gemspec) && s.as_path_source == source }
|
|
763
|
-
gemspec_source || source
|
|
764
|
-
end
|
|
765
|
-
|
|
766
|
-
def converge_path_sources_to_gemspec_sources
|
|
767
|
-
@locked_sources.map! do |source|
|
|
768
|
-
converge_path_source_to_gemspec_source(source)
|
|
769
|
-
end
|
|
770
|
-
@locked_specs.each do |spec|
|
|
771
|
-
spec.source &&= converge_path_source_to_gemspec_source(spec.source)
|
|
772
|
-
end
|
|
773
|
-
@locked_deps.each do |_, dep|
|
|
774
|
-
dep.source &&= converge_path_source_to_gemspec_source(dep.source)
|
|
775
|
-
end
|
|
776
|
-
end
|
|
777
|
-
|
|
778
945
|
def converge_sources
|
|
779
946
|
# Replace the sources from the Gemfile with the sources from the Gemfile.lock,
|
|
780
947
|
# if they exist in the Gemfile.lock and are `==`. If you can't find an equivalent
|
|
@@ -792,7 +959,7 @@ module Bundler
|
|
|
792
959
|
# gem), unlock it. For git sources, this means to unlock the revision, which
|
|
793
960
|
# will cause the `ref` used to be the most recent for the branch (or master) if
|
|
794
961
|
# an explicit `ref` is not used.
|
|
795
|
-
if source.respond_to?(:unlock!) && @
|
|
962
|
+
if source.respond_to?(:unlock!) && @sources_to_unlock.include?(source.name)
|
|
796
963
|
source.unlock!
|
|
797
964
|
changes = true
|
|
798
965
|
end
|
|
@@ -802,34 +969,39 @@ module Bundler
|
|
|
802
969
|
end
|
|
803
970
|
|
|
804
971
|
def converge_dependencies
|
|
805
|
-
|
|
972
|
+
@missing_lockfile_dep = nil
|
|
973
|
+
@changed_dependencies = []
|
|
806
974
|
|
|
807
|
-
|
|
975
|
+
current_dependencies.each do |dep|
|
|
808
976
|
if dep.source
|
|
809
977
|
dep.source = sources.get(dep.source)
|
|
810
978
|
end
|
|
811
979
|
|
|
812
|
-
|
|
980
|
+
name = dep.name
|
|
813
981
|
|
|
814
|
-
|
|
815
|
-
changes = true
|
|
816
|
-
next
|
|
817
|
-
end
|
|
982
|
+
dep_changed = @locked_deps[name].nil?
|
|
818
983
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
# add_development_dependency in a gemspec that's loaded with the gemspec
|
|
822
|
-
# directive, the lockfile dependencies and resolved dependencies end up
|
|
823
|
-
# with a mismatch on #type. Work around that by setting the type on the
|
|
824
|
-
# dep from the lockfile.
|
|
825
|
-
locked_dep.instance_variable_set(:@type, dep.type)
|
|
984
|
+
unless name == "bundler"
|
|
985
|
+
locked_specs = @originally_locked_specs[name]
|
|
826
986
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
987
|
+
if locked_specs.empty?
|
|
988
|
+
@missing_lockfile_dep = name if dep_changed == false
|
|
989
|
+
else
|
|
990
|
+
if locked_specs.map(&:source).uniq.size > 1
|
|
991
|
+
@locked_specs.delete(locked_specs.select {|s| s.source != dep.source })
|
|
992
|
+
end
|
|
993
|
+
|
|
994
|
+
unless dep.matches_spec?(locked_specs.first)
|
|
995
|
+
@gems_to_unlock << name
|
|
996
|
+
dep_changed = true
|
|
997
|
+
end
|
|
998
|
+
end
|
|
999
|
+
end
|
|
1000
|
+
|
|
1001
|
+
@changed_dependencies << name if dep_changed
|
|
830
1002
|
end
|
|
831
1003
|
|
|
832
|
-
|
|
1004
|
+
@changed_dependencies.any?
|
|
833
1005
|
end
|
|
834
1006
|
|
|
835
1007
|
# Remove elements from the locked specs that are expired. This will most
|
|
@@ -838,7 +1010,7 @@ module Bundler
|
|
|
838
1010
|
def converge_locked_specs
|
|
839
1011
|
converged = converge_specs(@locked_specs)
|
|
840
1012
|
|
|
841
|
-
resolve = SpecSet.new(converged
|
|
1013
|
+
resolve = SpecSet.new(converged)
|
|
842
1014
|
|
|
843
1015
|
diff = nil
|
|
844
1016
|
|
|
@@ -859,8 +1031,6 @@ module Bundler
|
|
|
859
1031
|
converged = []
|
|
860
1032
|
deps = []
|
|
861
1033
|
|
|
862
|
-
@specs_that_changed_sources = []
|
|
863
|
-
|
|
864
1034
|
specs.each do |s|
|
|
865
1035
|
name = s.name
|
|
866
1036
|
dep = @dependencies.find {|d| s.satisfies?(d) }
|
|
@@ -869,9 +1039,7 @@ module Bundler
|
|
|
869
1039
|
if dep
|
|
870
1040
|
gemfile_source = dep.source || default_source
|
|
871
1041
|
|
|
872
|
-
|
|
873
|
-
deps << dep if !dep.source || lockfile_source.include?(dep.source)
|
|
874
|
-
@unlock[:gems] << name if lockfile_source.include?(dep.source) && lockfile_source != gemfile_source
|
|
1042
|
+
deps << dep if !dep.source || lockfile_source.include?(dep.source) || new_deps.include?(dep)
|
|
875
1043
|
|
|
876
1044
|
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
|
877
1045
|
s.source = gemfile_source
|
|
@@ -880,40 +1048,25 @@ module Bundler
|
|
|
880
1048
|
s.source = default_source unless sources.get(lockfile_source)
|
|
881
1049
|
end
|
|
882
1050
|
|
|
883
|
-
|
|
1051
|
+
source = s.source
|
|
1052
|
+
next if @sources_to_unlock.include?(source.name)
|
|
884
1053
|
|
|
885
1054
|
# Path sources have special logic
|
|
886
|
-
if
|
|
887
|
-
|
|
888
|
-
s.source.specs
|
|
889
|
-
rescue PathError
|
|
890
|
-
# if we won't need the source (according to the lockfile),
|
|
891
|
-
# don't error if the path source isn't available
|
|
892
|
-
next if specs.
|
|
893
|
-
for(requested_dependencies, false).
|
|
894
|
-
none? {|locked_spec| locked_spec.source == s.source }
|
|
895
|
-
|
|
896
|
-
raise
|
|
897
|
-
end
|
|
898
|
-
|
|
899
|
-
new_spec = new_specs[s].first
|
|
1055
|
+
if source.instance_of?(Source::Path) || source.instance_of?(Source::Gemspec) || (source.instance_of?(Source::Git) && !@gems_to_unlock.include?(name) && deps.include?(dep))
|
|
1056
|
+
new_spec = source.specs[s].first
|
|
900
1057
|
if new_spec
|
|
901
|
-
s.
|
|
1058
|
+
s.runtime_dependencies.replace(new_spec.runtime_dependencies)
|
|
902
1059
|
else
|
|
903
1060
|
# If the spec is no longer in the path source, unlock it. This
|
|
904
1061
|
# commonly happens if the version changed in the gemspec
|
|
905
|
-
@
|
|
1062
|
+
@gems_to_unlock << name
|
|
906
1063
|
end
|
|
907
1064
|
end
|
|
908
1065
|
|
|
909
|
-
|
|
910
|
-
@unlock[:gems] << s.name
|
|
911
|
-
else
|
|
912
|
-
converged << s
|
|
913
|
-
end
|
|
1066
|
+
converged << s
|
|
914
1067
|
end
|
|
915
1068
|
|
|
916
|
-
filter_specs(converged, deps)
|
|
1069
|
+
filter_specs(converged, deps, skips: @gems_to_unlock)
|
|
917
1070
|
end
|
|
918
1071
|
|
|
919
1072
|
def metadata_dependencies
|
|
@@ -924,17 +1077,20 @@ module Bundler
|
|
|
924
1077
|
end
|
|
925
1078
|
|
|
926
1079
|
def source_requirements
|
|
1080
|
+
@source_requirements ||= find_source_requirements
|
|
1081
|
+
end
|
|
1082
|
+
|
|
1083
|
+
def find_source_requirements
|
|
927
1084
|
# Record the specs available in each gem's source, so that those
|
|
928
1085
|
# specs will be available later when the resolver knows where to
|
|
929
1086
|
# look for that gemspec (or its dependencies)
|
|
930
1087
|
source_requirements = if precompute_source_requirements_for_indirect_dependencies?
|
|
931
1088
|
all_requirements = source_map.all_requirements
|
|
932
|
-
all_requirements = pin_locally_available_names(all_requirements) if @prefer_local
|
|
933
1089
|
{ default: default_source }.merge(all_requirements)
|
|
934
1090
|
else
|
|
935
1091
|
{ default: Source::RubygemsAggregate.new(sources, source_map) }.merge(source_map.direct_requirements)
|
|
936
1092
|
end
|
|
937
|
-
source_requirements.merge!(source_map.locked_requirements)
|
|
1093
|
+
source_requirements.merge!(source_map.locked_requirements) if nothing_changed?
|
|
938
1094
|
metadata_dependencies.each do |dep|
|
|
939
1095
|
source_requirements[dep.name] = sources.metadata_source
|
|
940
1096
|
end
|
|
@@ -948,7 +1104,6 @@ module Bundler
|
|
|
948
1104
|
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
|
949
1105
|
end
|
|
950
1106
|
|
|
951
|
-
verify_changed_sources!
|
|
952
1107
|
source_requirements
|
|
953
1108
|
end
|
|
954
1109
|
|
|
@@ -956,14 +1111,6 @@ module Bundler
|
|
|
956
1111
|
sources.default_source
|
|
957
1112
|
end
|
|
958
1113
|
|
|
959
|
-
def verify_changed_sources!
|
|
960
|
-
@specs_that_changed_sources.each do |s|
|
|
961
|
-
if s.source.specs.search(s.name).empty?
|
|
962
|
-
raise GemNotFound, "Could not find gem '#{s.name}' in #{s.source}"
|
|
963
|
-
end
|
|
964
|
-
end
|
|
965
|
-
end
|
|
966
|
-
|
|
967
1114
|
def requested_groups
|
|
968
1115
|
values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
|
969
1116
|
values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
|
|
@@ -984,28 +1131,53 @@ module Bundler
|
|
|
984
1131
|
current == proposed
|
|
985
1132
|
end
|
|
986
1133
|
|
|
987
|
-
def
|
|
988
|
-
return
|
|
989
|
-
|
|
1134
|
+
def additional_base_requirements_to_prevent_downgrades(resolution_base)
|
|
1135
|
+
return resolution_base unless @locked_gems && !sources.expired_sources?(@locked_gems.sources)
|
|
1136
|
+
@originally_locked_specs.each do |locked_spec|
|
|
990
1137
|
next if locked_spec.source.is_a?(Source::Path)
|
|
991
|
-
|
|
1138
|
+
|
|
1139
|
+
name = locked_spec.name
|
|
1140
|
+
next if @changed_dependencies.include?(name)
|
|
1141
|
+
|
|
1142
|
+
resolution_base.base_requirements[name] = Gem::Requirement.new(">= #{locked_spec.version}")
|
|
992
1143
|
end
|
|
993
|
-
|
|
1144
|
+
resolution_base
|
|
994
1145
|
end
|
|
995
1146
|
|
|
996
|
-
def
|
|
1147
|
+
def additional_base_requirements_to_force_updates(resolution_base)
|
|
1148
|
+
return resolution_base if @explicit_unlocks.empty?
|
|
1149
|
+
full_update = dup_for_full_unlock.resolve
|
|
1150
|
+
@explicit_unlocks.each do |name|
|
|
1151
|
+
version = full_update.version_for(name)
|
|
1152
|
+
resolution_base.base_requirements[name] = Gem::Requirement.new("= #{version}") if version
|
|
1153
|
+
end
|
|
1154
|
+
resolution_base
|
|
1155
|
+
end
|
|
1156
|
+
|
|
1157
|
+
def dup_for_full_unlock
|
|
1158
|
+
unlocked_definition = self.class.new(@lockfile, @dependencies, @sources, true, @ruby_version, @optional_groups, @gemfiles)
|
|
1159
|
+
unlocked_definition.source_requirements = source_requirements
|
|
1160
|
+
unlocked_definition.gem_version_promoter.tap do |gvp|
|
|
1161
|
+
gvp.level = gem_version_promoter.level
|
|
1162
|
+
gvp.strict = gem_version_promoter.strict
|
|
1163
|
+
gvp.pre = gem_version_promoter.pre
|
|
1164
|
+
end
|
|
1165
|
+
unlocked_definition
|
|
1166
|
+
end
|
|
1167
|
+
|
|
1168
|
+
def remove_invalid_platforms!
|
|
997
1169
|
return if Bundler.frozen_bundle?
|
|
998
1170
|
|
|
999
|
-
|
|
1000
|
-
next if local_platform == platform ||
|
|
1001
|
-
(@new_platform && platforms.last == platform) ||
|
|
1002
|
-
@path_changes ||
|
|
1003
|
-
@dependency_changes ||
|
|
1004
|
-
!@originally_locked_specs.incomplete_for_platform?(dependencies, platform)
|
|
1171
|
+
skips = (@new_platforms + [local_platform]).uniq
|
|
1005
1172
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1173
|
+
# We should probably avoid removing non-ruby platforms, since that means
|
|
1174
|
+
# lockfile will no longer install on those platforms, so a error to give
|
|
1175
|
+
# heads up to the user may be better. However, we have tests expecting
|
|
1176
|
+
# non ruby platform autoremoval to work, so leaving that in place for
|
|
1177
|
+
# now.
|
|
1178
|
+
skips |= platforms - [Gem::Platform::RUBY] if @dependency_changes
|
|
1179
|
+
|
|
1180
|
+
@originally_invalid_platforms = @originally_locked_specs.remove_invalid_platforms!(current_dependencies, platforms, skips: skips)
|
|
1009
1181
|
end
|
|
1010
1182
|
|
|
1011
1183
|
def source_map
|