bundler 2.2.29 → 2.5.16
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 +1129 -4
- data/README.md +4 -8
- data/bundler.gemspec +11 -11
- data/exe/bundle +5 -26
- data/exe/bundler +1 -1
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +4 -4
- data/lib/bundler/capistrano.rb +1 -1
- data/lib/bundler/checksum.rb +254 -0
- data/lib/bundler/ci_detector.rb +75 -0
- data/lib/bundler/cli/add.rb +4 -4
- data/lib/bundler/cli/binstubs.rb +10 -6
- data/lib/bundler/cli/cache.rb +1 -1
- data/lib/bundler/cli/check.rb +3 -3
- data/lib/bundler/cli/common.rb +13 -3
- data/lib/bundler/cli/config.rb +18 -8
- data/lib/bundler/cli/console.rb +5 -4
- data/lib/bundler/cli/doctor.rb +12 -5
- data/lib/bundler/cli/exec.rb +1 -1
- data/lib/bundler/cli/fund.rb +1 -1
- data/lib/bundler/cli/gem.rb +141 -48
- data/lib/bundler/cli/info.rb +27 -17
- data/lib/bundler/cli/init.rb +6 -2
- data/lib/bundler/cli/install.rb +22 -39
- data/lib/bundler/cli/issue.rb +5 -4
- data/lib/bundler/cli/lock.rb +36 -29
- data/lib/bundler/cli/open.rb +9 -9
- data/lib/bundler/cli/outdated.rb +19 -12
- data/lib/bundler/cli/platform.rb +8 -6
- data/lib/bundler/cli/plugin.rb +9 -15
- data/lib/bundler/cli/pristine.rb +38 -30
- data/lib/bundler/cli/show.rb +3 -3
- data/lib/bundler/cli/update.rb +12 -7
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +266 -285
- data/lib/bundler/compact_index_client/cache.rb +53 -67
- data/lib/bundler/compact_index_client/cache_file.rb +153 -0
- data/lib/bundler/compact_index_client/gem_parser.rb +7 -3
- data/lib/bundler/compact_index_client/parser.rb +84 -0
- data/lib/bundler/compact_index_client/updater.rb +83 -76
- data/lib/bundler/compact_index_client.rb +59 -87
- data/lib/bundler/constants.rb +9 -2
- data/lib/bundler/current_ruby.rb +12 -16
- data/lib/bundler/definition.rb +509 -319
- data/lib/bundler/dependency.rb +33 -71
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +88 -69
- data/lib/bundler/endpoint_specification.rb +32 -15
- data/lib/bundler/env.rb +5 -7
- data/lib/bundler/environment_preserver.rb +8 -22
- data/lib/bundler/errors.rb +101 -13
- data/lib/bundler/feature_flag.rb +0 -2
- data/lib/bundler/fetcher/base.rb +11 -11
- data/lib/bundler/fetcher/compact_index.rb +32 -52
- data/lib/bundler/fetcher/dependency.rb +3 -7
- data/lib/bundler/fetcher/downloader.rb +17 -16
- data/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
- data/lib/bundler/fetcher/index.rb +2 -29
- data/lib/bundler/fetcher.rb +87 -79
- data/lib/bundler/force_platform.rb +18 -0
- data/lib/bundler/friendly_errors.rb +29 -40
- data/lib/bundler/gem_helper.rb +11 -23
- data/lib/bundler/gem_helpers.rb +30 -6
- data/lib/bundler/gem_version_promoter.rb +68 -109
- data/lib/bundler/graph.rb +9 -9
- data/lib/bundler/index.rb +71 -79
- data/lib/bundler/injector.rb +23 -11
- data/lib/bundler/inline.rb +11 -23
- data/lib/bundler/installer/gem_installer.rb +18 -11
- data/lib/bundler/installer/parallel_installer.rb +17 -65
- data/lib/bundler/installer/standalone.rb +56 -15
- data/lib/bundler/installer.rb +35 -61
- data/lib/bundler/lazy_specification.rb +92 -61
- data/lib/bundler/lockfile_generator.rb +12 -3
- data/lib/bundler/lockfile_parser.rb +137 -70
- data/lib/bundler/man/bundle-add.1 +19 -26
- data/lib/bundler/man/bundle-add.1.ronn +16 -4
- data/lib/bundler/man/bundle-binstubs.1 +4 -16
- data/lib/bundler/man/bundle-cache.1 +9 -24
- data/lib/bundler/man/bundle-cache.1.ronn +9 -2
- data/lib/bundler/man/bundle-check.1 +5 -12
- data/lib/bundler/man/bundle-check.1.ronn +3 -0
- data/lib/bundler/man/bundle-clean.1 +4 -11
- data/lib/bundler/man/bundle-clean.1.ronn +1 -1
- data/lib/bundler/man/bundle-config.1 +47 -224
- data/lib/bundler/man/bundle-config.1.ronn +40 -28
- data/lib/bundler/man/bundle-console.1 +35 -0
- data/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/lib/bundler/man/bundle-doctor.1 +4 -18
- data/lib/bundler/man/bundle-exec.1 +16 -77
- data/lib/bundler/man/bundle-exec.1.ronn +8 -9
- data/lib/bundler/man/bundle-gem.1 +45 -72
- data/lib/bundler/man/bundle-gem.1.ronn +32 -5
- data/lib/bundler/man/bundle-help.1 +9 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/lib/bundler/man/bundle-info.1 +5 -11
- data/lib/bundler/man/bundle-info.1.ronn +3 -3
- data/lib/bundler/man/bundle-init.1 +6 -11
- data/lib/bundler/man/bundle-init.1.ronn +2 -0
- data/lib/bundler/man/bundle-inject.1 +8 -18
- data/lib/bundler/man/bundle-inject.1.ronn +3 -1
- data/lib/bundler/man/bundle-install.1 +32 -155
- data/lib/bundler/man/bundle-install.1.ronn +11 -33
- data/lib/bundler/man/bundle-list.1 +4 -19
- data/lib/bundler/man/bundle-lock.1 +5 -29
- data/lib/bundler/man/bundle-open.1 +18 -18
- data/lib/bundler/man/bundle-open.1.ronn +9 -1
- data/lib/bundler/man/bundle-outdated.1 +17 -72
- data/lib/bundler/man/bundle-outdated.1.ronn +13 -18
- data/lib/bundler/man/bundle-platform.1 +16 -28
- data/lib/bundler/man/bundle-platform.1.ronn +14 -7
- data/lib/bundler/man/bundle-plugin.1 +58 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +63 -0
- data/lib/bundler/man/bundle-pristine.1 +5 -16
- data/lib/bundler/man/bundle-remove.1 +4 -14
- data/lib/bundler/man/bundle-show.1 +3 -10
- data/lib/bundler/man/bundle-update.1 +19 -138
- data/lib/bundler/man/bundle-update.1.ronn +2 -1
- data/lib/bundler/man/bundle-version.1 +22 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/lib/bundler/man/bundle-viz.1 +6 -15
- data/lib/bundler/man/bundle-viz.1.ronn +2 -0
- data/lib/bundler/man/bundle.1 +17 -51
- data/lib/bundler/man/bundle.1.ronn +12 -7
- data/lib/bundler/man/gemfile.5 +130 -346
- data/lib/bundler/man/gemfile.5.ronn +121 -86
- data/lib/bundler/man/index.txt +4 -0
- data/lib/bundler/match_metadata.rb +17 -0
- data/lib/bundler/match_platform.rb +1 -2
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/mirror.rb +8 -10
- data/lib/bundler/plugin/api/source.rb +9 -13
- data/lib/bundler/plugin/index.rb +13 -5
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/path.rb +18 -0
- data/lib/bundler/plugin/installer/rubygems.rb +0 -8
- data/lib/bundler/plugin/installer.rb +42 -19
- data/lib/bundler/plugin/source_list.rb +4 -4
- data/lib/bundler/plugin.rb +16 -7
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +11 -5
- data/lib/bundler/resolver/base.rb +111 -0
- data/lib/bundler/resolver/candidate.rb +82 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +81 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +53 -66
- data/lib/bundler/resolver.rb +419 -307
- data/lib/bundler/retry.rb +1 -1
- data/lib/bundler/ruby_dsl.rb +42 -7
- data/lib/bundler/ruby_version.rb +16 -22
- data/lib/bundler/rubygems_ext.rb +250 -64
- data/lib/bundler/rubygems_gem_installer.rb +90 -64
- data/lib/bundler/rubygems_integration.rb +81 -190
- data/lib/bundler/runtime.rb +8 -13
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/self_manager.rb +206 -0
- data/lib/bundler/settings.rb +139 -57
- data/lib/bundler/setup.rb +13 -1
- data/lib/bundler/shared_helpers.rb +67 -36
- data/lib/bundler/source/git/git_proxy.rb +285 -82
- data/lib/bundler/source/git.rb +81 -41
- data/lib/bundler/source/metadata.rb +17 -16
- data/lib/bundler/source/path/installer.rb +1 -22
- data/lib/bundler/source/path.rb +13 -25
- data/lib/bundler/source/rubygems/remote.rb +1 -1
- data/lib/bundler/source/rubygems.rb +164 -234
- data/lib/bundler/source/rubygems_aggregate.rb +1 -1
- data/lib/bundler/source.rb +7 -6
- data/lib/bundler/source_list.rb +40 -32
- data/lib/bundler/source_map.rb +15 -2
- data/lib/bundler/spec_set.rb +156 -46
- data/lib/bundler/stub_specification.rb +18 -5
- data/lib/bundler/templates/Executable +3 -5
- data/lib/bundler/templates/Executable.bundler +7 -12
- data/lib/bundler/templates/Executable.standalone +4 -4
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
- data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +8 -2
- data/lib/bundler/templates/newgem/README.md.tt +7 -11
- data/lib/bundler/templates/newgem/Rakefile.tt +28 -4
- data/lib/bundler/templates/newgem/bin/console.tt +0 -4
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +13 -3
- data/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +25 -17
- data/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +38 -15
- data/lib/bundler/ui/silent.rb +21 -5
- data/lib/bundler/uri_credentials_filter.rb +2 -2
- data/lib/bundler/uri_normalizer.rb +23 -0
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +92 -78
- data/lib/bundler/vendor/fileutils/.document +1 -0
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1340 -410
- data/lib/bundler/vendor/net-http-persistent/.document +1 -0
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +4 -3
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +23 -11
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +1 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +57 -57
- data/lib/bundler/vendor/pub_grub/.document +1 -0
- data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +61 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/lib/bundler/vendor/thor/.document +1 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +12 -14
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +16 -6
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +21 -17
- data/lib/bundler/vendor/thor/lib/thor/base.rb +140 -14
- data/lib/bundler/vendor/thor/lib/thor/command.rb +13 -4
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +10 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +16 -20
- data/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +20 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +33 -17
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +27 -8
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +63 -7
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +40 -30
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +48 -154
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -46
- data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +0 -45
- data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +134 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/util.rb +9 -8
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +155 -8
- data/lib/bundler/vendor/tsort/.document +1 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
- data/lib/bundler/vendor/uri/.document +1 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +316 -207
- data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +33 -13
- data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
- data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +16 -23
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +105 -47
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +3 -3
- data/lib/bundler/vendored_net_http.rb +23 -0
- data/lib/bundler/vendored_persistent.rb +0 -36
- data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/lib/bundler/vendored_timeout.rb +12 -0
- data/lib/bundler/{vendored_tmpdir.rb → vendored_tsort.rb} +1 -1
- data/lib/bundler/vendored_uri.rb +18 -1
- data/lib/bundler/version.rb +5 -1
- data/lib/bundler/vlad.rb +1 -1
- data/lib/bundler/worker.rb +7 -9
- data/lib/bundler/yaml_serializer.rb +21 -12
- data/lib/bundler.rb +114 -121
- metadata +87 -41
- data/lib/bundler/dep_proxy.rb +0 -55
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/psyched_yaml.rb +0 -22
- data/lib/bundler/templates/gems.rb +0 -8
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -5
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
- data/lib/bundler/version_ranges.rb +0 -122
data/lib/bundler/fetcher.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "vendored_persistent"
|
4
|
+
require_relative "vendored_timeout"
|
4
5
|
require "cgi"
|
5
6
|
require "securerandom"
|
6
7
|
require "zlib"
|
7
|
-
require "rubygems/request"
|
8
8
|
|
9
9
|
module Bundler
|
10
10
|
# Handles all the fetching with the rubygems server
|
11
11
|
class Fetcher
|
12
|
+
autoload :Base, File.expand_path("fetcher/base", __dir__)
|
12
13
|
autoload :CompactIndex, File.expand_path("fetcher/compact_index", __dir__)
|
13
14
|
autoload :Downloader, File.expand_path("fetcher/downloader", __dir__)
|
14
15
|
autoload :Dependency, File.expand_path("fetcher/dependency", __dir__)
|
@@ -20,6 +21,7 @@ module Bundler
|
|
20
21
|
class TooManyRequestsError < HTTPError; end
|
21
22
|
# This error is raised if the API returns a 413 (only printed in verbose)
|
22
23
|
class FallbackError < HTTPError; end
|
24
|
+
|
23
25
|
# This is the error raised if OpenSSL fails the cert verification
|
24
26
|
class CertificateFailureError < HTTPError
|
25
27
|
def initialize(remote_uri)
|
@@ -28,19 +30,18 @@ module Bundler
|
|
28
30
|
" is a chance you are experiencing a man-in-the-middle attack, but" \
|
29
31
|
" most likely your system doesn't have the CA certificates needed" \
|
30
32
|
" for verification. For information about OpenSSL certificates, see" \
|
31
|
-
"
|
32
|
-
" sources and change 'https' to 'http'."
|
33
|
+
" https://railsapps.github.io/openssl-certificate-verify-failed.html."
|
33
34
|
end
|
34
35
|
end
|
36
|
+
|
35
37
|
# This is the error raised when a source is HTTPS and OpenSSL didn't load
|
36
38
|
class SSLError < HTTPError
|
37
39
|
def initialize(msg = nil)
|
38
40
|
super msg || "Could not load OpenSSL.\n" \
|
39
|
-
"You must recompile Ruby with OpenSSL support
|
40
|
-
"Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL " \
|
41
|
-
"using RVM are available at rvm.io/packages/openssl."
|
41
|
+
"You must recompile Ruby with OpenSSL support."
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
44
45
|
# This error is raised if HTTP authentication is required, but not provided.
|
45
46
|
class AuthenticationRequiredError < HTTPError
|
46
47
|
def initialize(remote_uri)
|
@@ -51,6 +52,7 @@ module Bundler
|
|
51
52
|
"or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
|
52
53
|
end
|
53
54
|
end
|
55
|
+
|
54
56
|
# This error is raised if HTTP authentication is provided, but incorrect.
|
55
57
|
class BadAuthenticationError < HTTPError
|
56
58
|
def initialize(remote_uri)
|
@@ -60,6 +62,16 @@ module Bundler
|
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
65
|
+
# This error is raised if HTTP authentication is correct, but lacks
|
66
|
+
# necessary permissions.
|
67
|
+
class AuthenticationForbiddenError < HTTPError
|
68
|
+
def initialize(remote_uri)
|
69
|
+
remote_uri = filter_uri(remote_uri)
|
70
|
+
super "Access token could not be authenticated for #{remote_uri}.\n" \
|
71
|
+
"Make sure it's valid and has the necessary scopes configured."
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
63
75
|
# Exceptions classes that should bypass retry attempts. If your password didn't work the
|
64
76
|
# first time, it's not going to the third time.
|
65
77
|
NET_ERRORS = [:HTTPBadGateway, :HTTPBadRequest, :HTTPFailedDependency,
|
@@ -69,9 +81,9 @@ module Bundler
|
|
69
81
|
:HTTPRequestURITooLong, :HTTPUnauthorized, :HTTPUnprocessableEntity,
|
70
82
|
:HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze
|
71
83
|
FAIL_ERRORS = begin
|
72
|
-
fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError]
|
73
|
-
fail_errors << Gem::Requirement::BadRequirementError
|
74
|
-
fail_errors.concat(NET_ERRORS.map {|e|
|
84
|
+
fail_errors = [AuthenticationRequiredError, BadAuthenticationError, AuthenticationForbiddenError, FallbackError, SecurityError]
|
85
|
+
fail_errors << Gem::Requirement::BadRequirementError
|
86
|
+
fail_errors.concat(NET_ERRORS.map {|e| Gem::Net.const_get(e) })
|
75
87
|
end.freeze
|
76
88
|
|
77
89
|
class << self
|
@@ -83,6 +95,7 @@ module Bundler
|
|
83
95
|
self.max_retries = Bundler.settings[:retry] # How many retries for the API call
|
84
96
|
|
85
97
|
def initialize(remote)
|
98
|
+
@cis = nil
|
86
99
|
@remote = remote
|
87
100
|
|
88
101
|
Socket.do_not_reverse_lookup = true
|
@@ -98,15 +111,17 @@ module Bundler
|
|
98
111
|
spec -= [nil, "ruby", ""]
|
99
112
|
spec_file_name = "#{spec.join "-"}.gemspec"
|
100
113
|
|
101
|
-
uri =
|
102
|
-
if uri.scheme == "file"
|
103
|
-
path =
|
104
|
-
Bundler.
|
114
|
+
uri = Gem::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
|
115
|
+
spec = if uri.scheme == "file"
|
116
|
+
path = Gem::Util.correct_for_windows_path(uri.path)
|
117
|
+
Bundler.safe_load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
|
105
118
|
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
|
106
119
|
Bundler.load_gemspec(cached_spec_path)
|
107
120
|
else
|
108
|
-
Bundler.
|
121
|
+
Bundler.safe_load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
|
109
122
|
end
|
123
|
+
raise MarshalError, "is #{spec.inspect}" unless spec.is_a?(Gem::Specification)
|
124
|
+
spec
|
110
125
|
rescue MarshalError
|
111
126
|
raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
|
112
127
|
"Your network or your gem server is probably having issues right now."
|
@@ -121,25 +136,13 @@ module Bundler
|
|
121
136
|
|
122
137
|
# return the specs in the bundler format as an index
|
123
138
|
def specs(gem_names, source)
|
124
|
-
old = Bundler.rubygems.sources
|
125
139
|
index = Bundler::Index.new
|
126
140
|
|
127
|
-
|
128
|
-
@use_api = false
|
129
|
-
specs = fetchers.last.specs(gem_names)
|
130
|
-
else
|
131
|
-
specs = []
|
132
|
-
fetchers.shift until fetchers.first.available? || fetchers.empty?
|
133
|
-
fetchers.dup.each do |f|
|
134
|
-
break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names)
|
135
|
-
fetchers.delete(f)
|
136
|
-
end
|
137
|
-
@use_api = false if fetchers.none?(&:api_fetcher?)
|
138
|
-
end
|
139
|
-
|
140
|
-
specs.each do |name, version, platform, dependencies, metadata|
|
141
|
+
fetch_specs(gem_names).each do |name, version, platform, dependencies, metadata|
|
141
142
|
spec = if dependencies
|
142
|
-
EndpointSpecification.new(name, version, platform, dependencies, metadata)
|
143
|
+
EndpointSpecification.new(name, version, platform, self, dependencies, metadata).tap do |es|
|
144
|
+
source.checksum_store.replace(es, es.checksum)
|
145
|
+
end
|
143
146
|
else
|
144
147
|
RemoteSpecification.new(name, version, platform, self)
|
145
148
|
end
|
@@ -150,22 +153,8 @@ module Bundler
|
|
150
153
|
|
151
154
|
index
|
152
155
|
rescue CertificateFailureError
|
153
|
-
Bundler.ui.info "" if gem_names &&
|
156
|
+
Bundler.ui.info "" if gem_names && api_fetcher? # newline after dots
|
154
157
|
raise
|
155
|
-
ensure
|
156
|
-
Bundler.rubygems.sources = old
|
157
|
-
end
|
158
|
-
|
159
|
-
def use_api
|
160
|
-
return @use_api if defined?(@use_api)
|
161
|
-
|
162
|
-
fetchers.shift until fetchers.first.available?
|
163
|
-
|
164
|
-
@use_api = if remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint
|
165
|
-
false
|
166
|
-
else
|
167
|
-
fetchers.first.api_fetcher?
|
168
|
-
end
|
169
158
|
end
|
170
159
|
|
171
160
|
def user_agent
|
@@ -203,10 +192,6 @@ module Bundler
|
|
203
192
|
end
|
204
193
|
end
|
205
194
|
|
206
|
-
def fetchers
|
207
|
-
@fetchers ||= FETCHERS.map {|f| f.new(downloader, @remote, uri) }
|
208
|
-
end
|
209
|
-
|
210
195
|
def http_proxy
|
211
196
|
return unless uri = connection.proxy_uri
|
212
197
|
uri.to_s
|
@@ -216,36 +201,61 @@ module Bundler
|
|
216
201
|
"#<#{self.class}:0x#{object_id} uri=#{uri}>"
|
217
202
|
end
|
218
203
|
|
204
|
+
def api_fetcher?
|
205
|
+
fetchers.first.api_fetcher?
|
206
|
+
end
|
207
|
+
|
208
|
+
def gem_remote_fetcher
|
209
|
+
@gem_remote_fetcher ||= begin
|
210
|
+
require_relative "fetcher/gem_remote_fetcher"
|
211
|
+
fetcher = GemRemoteFetcher.new Gem.configuration[:http_proxy]
|
212
|
+
fetcher.headers["User-Agent"] = user_agent
|
213
|
+
fetcher.headers["X-Gemfile-Source"] = @remote.original_uri.to_s if @remote.original_uri
|
214
|
+
fetcher
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
219
218
|
private
|
220
219
|
|
221
|
-
|
220
|
+
def available_fetchers
|
221
|
+
if Bundler::Fetcher.disable_endpoint
|
222
|
+
[Index]
|
223
|
+
elsif remote_uri.scheme == "file"
|
224
|
+
Bundler.ui.debug("Using a local server, bundler won't use the CompactIndex API")
|
225
|
+
[Index]
|
226
|
+
else
|
227
|
+
[CompactIndex, Dependency, Index]
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def fetchers
|
232
|
+
@fetchers ||= available_fetchers.map {|f| f.new(downloader, @remote, uri, gem_remote_fetcher) }.drop_while {|f| !f.available? }
|
233
|
+
end
|
234
|
+
|
235
|
+
def fetch_specs(gem_names)
|
236
|
+
fetchers.reject!(&:api_fetcher?) unless gem_names
|
237
|
+
fetchers.reject! do |f|
|
238
|
+
specs = f.specs(gem_names)
|
239
|
+
return specs if specs
|
240
|
+
true
|
241
|
+
end
|
242
|
+
[]
|
243
|
+
end
|
222
244
|
|
223
245
|
def cis
|
224
|
-
|
225
|
-
"TRAVIS" => "travis",
|
226
|
-
"CIRCLECI" => "circle",
|
227
|
-
"SEMAPHORE" => "semaphore",
|
228
|
-
"JENKINS_URL" => "jenkins",
|
229
|
-
"BUILDBOX" => "buildbox",
|
230
|
-
"GO_SERVER_URL" => "go",
|
231
|
-
"SNAP_CI" => "snap",
|
232
|
-
"GITLAB_CI" => "gitlab",
|
233
|
-
"CI_NAME" => ENV["CI_NAME"],
|
234
|
-
"CI" => "ci",
|
235
|
-
}
|
236
|
-
env_cis.find_all {|env, _| ENV[env] }.map {|_, ci| ci }
|
246
|
+
@cis ||= Bundler::CIDetector.ci_strings
|
237
247
|
end
|
238
248
|
|
239
249
|
def connection
|
240
250
|
@connection ||= begin
|
241
251
|
needs_ssl = remote_uri.scheme == "https" ||
|
242
|
-
|
243
|
-
|
252
|
+
Bundler.settings[:ssl_verify_mode] ||
|
253
|
+
Bundler.settings[:ssl_client_cert]
|
244
254
|
raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
|
245
255
|
|
246
|
-
con =
|
247
|
-
if gem_proxy =
|
248
|
-
con.proxy =
|
256
|
+
con = Gem::Net::HTTP::Persistent.new name: "bundler", proxy: :ENV
|
257
|
+
if gem_proxy = Gem.configuration[:http_proxy]
|
258
|
+
con.proxy = Gem::URI.parse(gem_proxy) if gem_proxy != :no_proxy
|
249
259
|
end
|
250
260
|
|
251
261
|
if remote_uri.scheme == "https"
|
@@ -255,8 +265,8 @@ module Bundler
|
|
255
265
|
end
|
256
266
|
|
257
267
|
ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
|
258
|
-
|
259
|
-
|
268
|
+
(Gem.configuration.ssl_client_cert if
|
269
|
+
Gem.configuration.respond_to?(:ssl_client_cert))
|
260
270
|
if ssl_client_cert
|
261
271
|
pem = File.read(ssl_client_cert)
|
262
272
|
con.cert = OpenSSL::X509::Certificate.new(pem)
|
@@ -274,22 +284,21 @@ module Bundler
|
|
274
284
|
# cached gem specification path, if one exists
|
275
285
|
def gemspec_cached_path(spec_file_name)
|
276
286
|
paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
|
277
|
-
paths
|
278
|
-
paths.first
|
287
|
+
paths.find {|path| File.file? path }
|
279
288
|
end
|
280
289
|
|
281
290
|
HTTP_ERRORS = [
|
282
|
-
Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
|
291
|
+
Gem::Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
|
283
292
|
Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
|
284
|
-
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
|
285
|
-
|
293
|
+
Gem::Net::HTTPBadResponse, Gem::Net::HTTPHeaderSyntaxError, Gem::Net::ProtocolError,
|
294
|
+
Gem::Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH
|
286
295
|
].freeze
|
287
296
|
|
288
297
|
def bundler_cert_store
|
289
298
|
store = OpenSSL::X509::Store.new
|
290
299
|
ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
|
291
|
-
|
292
|
-
|
300
|
+
(Gem.configuration.ssl_ca_cert if
|
301
|
+
Gem.configuration.respond_to?(:ssl_ca_cert))
|
293
302
|
if ssl_ca_cert
|
294
303
|
if File.directory? ssl_ca_cert
|
295
304
|
store.add_path ssl_ca_cert
|
@@ -298,13 +307,12 @@ module Bundler
|
|
298
307
|
end
|
299
308
|
else
|
300
309
|
store.set_default_paths
|
310
|
+
require "rubygems/request"
|
301
311
|
Gem::Request.get_cert_files.each {|c| store.add_file c }
|
302
312
|
end
|
303
313
|
store
|
304
314
|
end
|
305
315
|
|
306
|
-
private
|
307
|
-
|
308
316
|
def remote_uri
|
309
317
|
@remote.uri
|
310
318
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module ForcePlatform
|
5
|
+
private
|
6
|
+
|
7
|
+
# The `:force_ruby_platform` value used by dependencies for resolution, and
|
8
|
+
# by locked specifications for materialization is `false` by default, except
|
9
|
+
# for TruffleRuby. TruffleRuby generally needs to force the RUBY platform
|
10
|
+
# variant unless the name is explicitly allowlisted.
|
11
|
+
|
12
|
+
def default_force_ruby_platform
|
13
|
+
return false unless RUBY_ENGINE == "truffleruby"
|
14
|
+
|
15
|
+
!Gem::Platform::REUSE_AS_BINARY_ON_TRUFFLERUBY.include?(name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -29,18 +29,18 @@ module Bundler
|
|
29
29
|
Bundler.ui.error error.message
|
30
30
|
Bundler.ui.trace error.orig_exception
|
31
31
|
when BundlerError
|
32
|
-
Bundler.ui.
|
33
|
-
|
32
|
+
if Bundler.ui.debug?
|
33
|
+
Bundler.ui.trace error
|
34
|
+
else
|
35
|
+
Bundler.ui.error error.message, wrap: true
|
36
|
+
end
|
34
37
|
when Thor::Error
|
35
38
|
Bundler.ui.error error.message
|
36
|
-
when LoadError
|
37
|
-
raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
|
38
|
-
Bundler.ui.error "\nCould not load OpenSSL. #{error.class}: #{error}\n#{error.backtrace.join("\n ")}"
|
39
39
|
when Interrupt
|
40
40
|
Bundler.ui.error "\nQuitting..."
|
41
41
|
Bundler.ui.trace error
|
42
42
|
when Gem::InvalidSpecificationException
|
43
|
-
Bundler.ui.error error.message, :
|
43
|
+
Bundler.ui.error error.message, wrap: true
|
44
44
|
when SystemExit
|
45
45
|
when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact
|
46
46
|
Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \
|
@@ -61,40 +61,11 @@ module Bundler
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def request_issue_report_for(e)
|
64
|
-
Bundler.ui.error
|
64
|
+
Bundler.ui.error <<~EOS, nil, nil
|
65
65
|
--- ERROR REPORT TEMPLATE -------------------------------------------------------
|
66
|
-
# Error Report
|
67
|
-
|
68
|
-
## Questions
|
69
|
-
|
70
|
-
Please fill out answers to these questions, it'll help us figure out
|
71
|
-
why things are going wrong.
|
72
|
-
|
73
|
-
- **What did you do?**
|
74
|
-
|
75
|
-
I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}`
|
76
|
-
|
77
|
-
- **What did you expect to happen?**
|
78
|
-
|
79
|
-
I expected Bundler to...
|
80
|
-
|
81
|
-
- **What happened instead?**
|
82
|
-
|
83
|
-
Instead, what happened was...
|
84
|
-
|
85
|
-
- **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**
|
86
|
-
|
87
|
-
I tried...
|
88
|
-
|
89
|
-
- **Have you read our issues document, https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/ISSUES.md?**
|
90
|
-
|
91
|
-
...
|
92
|
-
|
93
|
-
## Backtrace
|
94
66
|
|
95
67
|
```
|
96
|
-
#{e
|
97
|
-
#{e.backtrace && e.backtrace.join("\n ").chomp}
|
68
|
+
#{exception_message(e)}
|
98
69
|
```
|
99
70
|
|
100
71
|
#{Bundler::Env.report}
|
@@ -104,13 +75,27 @@ module Bundler
|
|
104
75
|
|
105
76
|
Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."
|
106
77
|
|
107
|
-
Bundler.ui.error
|
78
|
+
Bundler.ui.error <<~EOS, nil, :yellow
|
108
79
|
|
109
80
|
First, try this link to see if there are any existing issue reports for this error:
|
110
81
|
#{issues_url(e)}
|
111
82
|
|
112
|
-
If there aren't any reports for this error yet, please
|
113
|
-
|
83
|
+
If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}, and copy and paste the report template above in there.
|
84
|
+
EOS
|
85
|
+
end
|
86
|
+
|
87
|
+
def exception_message(error)
|
88
|
+
message = serialized_exception_for(error)
|
89
|
+
cause = error.cause
|
90
|
+
return message unless cause
|
91
|
+
|
92
|
+
message + serialized_exception_for(cause)
|
93
|
+
end
|
94
|
+
|
95
|
+
def serialized_exception_for(e)
|
96
|
+
<<~EOS
|
97
|
+
#{e.class}: #{e.message}
|
98
|
+
#{e.backtrace&.join("\n ")&.chomp}
|
114
99
|
EOS
|
115
100
|
end
|
116
101
|
|
@@ -121,6 +106,10 @@ module Bundler
|
|
121
106
|
"https://github.com/rubygems/rubygems/search?q=" \
|
122
107
|
"#{CGI.escape(message)}&type=Issues"
|
123
108
|
end
|
109
|
+
|
110
|
+
def new_issue_url
|
111
|
+
"https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md"
|
112
|
+
end
|
124
113
|
end
|
125
114
|
|
126
115
|
def self.with_friendly_errors
|
data/lib/bundler/gem_helper.rb
CHANGED
@@ -21,7 +21,7 @@ module Bundler
|
|
21
21
|
|
22
22
|
def gemspec(&block)
|
23
23
|
gemspec = instance.gemspec
|
24
|
-
block
|
24
|
+
block&.call(gemspec)
|
25
25
|
gemspec
|
26
26
|
end
|
27
27
|
end
|
@@ -47,7 +47,7 @@ module Bundler
|
|
47
47
|
built_gem_path = build_gem
|
48
48
|
end
|
49
49
|
|
50
|
-
desc "Generate SHA512 checksum
|
50
|
+
desc "Generate SHA512 checksum of #{name}-#{version}.gem into the checksums directory."
|
51
51
|
task "build:checksum" => "build" do
|
52
52
|
build_checksum(built_gem_path)
|
53
53
|
end
|
@@ -98,10 +98,7 @@ module Bundler
|
|
98
98
|
built_gem_path ||= build_gem
|
99
99
|
cmd = [*gem_command, "install", built_gem_path.to_s]
|
100
100
|
cmd << "--local" if local
|
101
|
-
|
102
|
-
unless status.success?
|
103
|
-
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
|
104
|
-
end
|
101
|
+
sh(cmd)
|
105
102
|
Bundler.ui.confirm "#{name} (#{version}) installed."
|
106
103
|
end
|
107
104
|
|
@@ -110,9 +107,9 @@ module Bundler
|
|
110
107
|
SharedHelpers.filesystem_access(File.join(base, "checksums")) {|p| FileUtils.mkdir_p(p) }
|
111
108
|
file_name = "#{File.basename(built_gem_path)}.sha512"
|
112
109
|
require "digest/sha2"
|
113
|
-
checksum = Digest::SHA512.
|
110
|
+
checksum = ::Digest::SHA512.file(built_gem_path).hexdigest
|
114
111
|
target = File.join(base, "checksums", file_name)
|
115
|
-
File.write(target, checksum)
|
112
|
+
File.write(target, checksum + "\n")
|
116
113
|
Bundler.ui.confirm "#{name} #{version} checksum written to checksums/#{file_name}."
|
117
114
|
end
|
118
115
|
|
@@ -132,8 +129,8 @@ module Bundler
|
|
132
129
|
|
133
130
|
def git_push(remote = nil)
|
134
131
|
remote ||= default_remote
|
135
|
-
|
136
|
-
|
132
|
+
sh("git push #{remote} refs/heads/#{current_branch}".shellsplit)
|
133
|
+
sh("git push #{remote} refs/tags/#{version_tag}".shellsplit)
|
137
134
|
Bundler.ui.confirm "Pushed git commits and release tag."
|
138
135
|
end
|
139
136
|
|
@@ -155,19 +152,11 @@ module Bundler
|
|
155
152
|
|
156
153
|
def gem_push_host
|
157
154
|
env_rubygems_host = ENV["RUBYGEMS_HOST"]
|
158
|
-
env_rubygems_host = nil if
|
159
|
-
env_rubygems_host && env_rubygems_host.empty?
|
155
|
+
env_rubygems_host = nil if env_rubygems_host&.empty?
|
160
156
|
|
161
157
|
allowed_push_host || env_rubygems_host || "rubygems.org"
|
162
158
|
end
|
163
159
|
|
164
|
-
def perform_git_push(options = "")
|
165
|
-
cmd = "git push #{options}"
|
166
|
-
out, status = sh_with_status(cmd.shellsplit)
|
167
|
-
return if status.success?
|
168
|
-
raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
|
169
|
-
end
|
170
|
-
|
171
160
|
def already_tagged?
|
172
161
|
return false unless sh(%w[git tag]).split(/\n/).include?(version_tag)
|
173
162
|
Bundler.ui.confirm "Tag #{version_tag} has already been created."
|
@@ -218,8 +207,7 @@ module Bundler
|
|
218
207
|
def sh(cmd, &block)
|
219
208
|
out, status = sh_with_status(cmd, &block)
|
220
209
|
unless status.success?
|
221
|
-
|
222
|
-
raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
|
210
|
+
raise("Running `#{cmd.shelljoin}` failed with the following output:\n\n#{out}\n")
|
223
211
|
end
|
224
212
|
out
|
225
213
|
end
|
@@ -227,9 +215,9 @@ module Bundler
|
|
227
215
|
def sh_with_status(cmd, &block)
|
228
216
|
Bundler.ui.debug(cmd)
|
229
217
|
SharedHelpers.chdir(base) do
|
230
|
-
outbuf = IO.popen(cmd, :
|
218
|
+
outbuf = IO.popen(cmd, err: [:child, :out], &:read)
|
231
219
|
status = $?
|
232
|
-
block
|
220
|
+
block&.call(outbuf) if status.success?
|
233
221
|
[outbuf, status]
|
234
222
|
end
|
235
223
|
end
|
data/lib/bundler/gem_helpers.rb
CHANGED
@@ -10,6 +10,7 @@ module Bundler
|
|
10
10
|
[Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
|
11
11
|
[Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
|
12
12
|
[Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
|
13
|
+
[Gem::Platform.new("x64-mingw-ucrt"), Gem::Platform.new("x64-mingw-ucrt")],
|
13
14
|
[Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")],
|
14
15
|
].freeze
|
15
16
|
|
@@ -33,6 +34,11 @@ module Bundler
|
|
33
34
|
end
|
34
35
|
module_function :local_platform
|
35
36
|
|
37
|
+
def generic_local_platform_is_ruby?
|
38
|
+
generic_local_platform == Gem::Platform::RUBY
|
39
|
+
end
|
40
|
+
module_function :generic_local_platform_is_ruby?
|
41
|
+
|
36
42
|
def platform_specificity_match(spec_platform, user_platform)
|
37
43
|
spec_platform = Gem::Platform.new(spec_platform)
|
38
44
|
|
@@ -40,17 +46,37 @@ module Bundler
|
|
40
46
|
end
|
41
47
|
module_function :platform_specificity_match
|
42
48
|
|
43
|
-
def select_best_platform_match(specs, platform)
|
44
|
-
matching =
|
49
|
+
def select_best_platform_match(specs, platform, force_ruby: false, prefer_locked: false)
|
50
|
+
matching = if force_ruby
|
51
|
+
specs.select {|spec| spec.match_platform(Gem::Platform::RUBY) && spec.force_ruby_platform! }
|
52
|
+
else
|
53
|
+
specs.select {|spec| spec.match_platform(platform) }
|
54
|
+
end
|
55
|
+
|
56
|
+
if prefer_locked
|
57
|
+
locked_originally = matching.select {|spec| spec.is_a?(LazySpecification) }
|
58
|
+
return locked_originally if locked_originally.any?
|
59
|
+
end
|
60
|
+
|
61
|
+
sort_best_platform_match(matching, platform)
|
62
|
+
end
|
63
|
+
module_function :select_best_platform_match
|
64
|
+
|
65
|
+
def select_best_local_platform_match(specs, force_ruby: false)
|
66
|
+
select_best_platform_match(specs, local_platform, force_ruby: force_ruby).map(&:materialize_for_installation).compact
|
67
|
+
end
|
68
|
+
module_function :select_best_local_platform_match
|
69
|
+
|
70
|
+
def sort_best_platform_match(matching, platform)
|
45
71
|
exact = matching.select {|spec| spec.platform == platform }
|
46
72
|
return exact if exact.any?
|
47
73
|
|
48
74
|
sorted_matching = matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) }
|
49
75
|
exemplary_spec = sorted_matching.first
|
50
76
|
|
51
|
-
sorted_matching.take_while{|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
|
77
|
+
sorted_matching.take_while {|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
|
52
78
|
end
|
53
|
-
module_function :
|
79
|
+
module_function :sort_best_platform_match
|
54
80
|
|
55
81
|
class PlatformMatch
|
56
82
|
def self.specificity_score(spec_platform, user_platform)
|
@@ -100,8 +126,6 @@ module Bundler
|
|
100
126
|
|
101
127
|
def same_deps(spec, exemplary_spec)
|
102
128
|
same_runtime_deps = spec.dependencies.sort == exemplary_spec.dependencies.sort
|
103
|
-
return same_runtime_deps unless spec.is_a?(Gem::Specification) && exemplary_spec.is_a?(Gem::Specification)
|
104
|
-
|
105
129
|
same_metadata_deps = spec.required_ruby_version == exemplary_spec.required_ruby_version && spec.required_rubygems_version == exemplary_spec.required_rubygems_version
|
106
130
|
same_runtime_deps && same_metadata_deps
|
107
131
|
end
|