bundler 1.17.2 → 2.2.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2095 -1251
- data/LICENSE.md +18 -19
- data/README.md +10 -11
- data/bundler.gemspec +10 -28
- data/exe/bundle +22 -3
- data/lib/bundler/build_metadata.rb +4 -12
- data/lib/bundler/capistrano.rb +4 -4
- data/lib/bundler/cli/add.rb +28 -16
- data/lib/bundler/cli/binstubs.rb +6 -2
- data/lib/bundler/cli/cache.rb +24 -17
- data/lib/bundler/cli/check.rb +4 -2
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +39 -13
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +1 -1
- data/lib/bundler/cli/doctor.rb +20 -9
- data/lib/bundler/cli/exec.rb +8 -25
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +213 -32
- data/lib/bundler/cli/info.rb +42 -7
- data/lib/bundler/cli/init.rb +2 -2
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +34 -44
- data/lib/bundler/cli/issue.rb +8 -7
- data/lib/bundler/cli/list.rb +19 -11
- data/lib/bundler/cli/lock.rb +5 -1
- data/lib/bundler/cli/open.rb +11 -8
- data/lib/bundler/cli/outdated.rb +142 -118
- data/lib/bundler/cli/plugin.rb +19 -2
- data/lib/bundler/cli/pristine.rb +6 -1
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/show.rb +2 -2
- data/lib/bundler/cli/update.rb +43 -16
- data/lib/bundler/cli.rb +211 -150
- data/lib/bundler/compact_index_client/cache.rb +6 -14
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +15 -28
- data/lib/bundler/compact_index_client.rb +28 -12
- data/lib/bundler/current_ruby.rb +14 -11
- data/lib/bundler/definition.rb +207 -368
- data/lib/bundler/dep_proxy.rb +16 -9
- data/lib/bundler/dependency.rb +19 -14
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +81 -81
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/env.rb +9 -14
- data/lib/bundler/environment_preserver.rb +29 -3
- data/lib/bundler/errors.rb +20 -3
- data/lib/bundler/feature_flag.rb +14 -33
- data/lib/bundler/fetcher/base.rb +1 -1
- data/lib/bundler/fetcher/compact_index.rb +28 -14
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +14 -8
- data/lib/bundler/fetcher/index.rb +8 -8
- data/lib/bundler/fetcher.rb +22 -17
- data/lib/bundler/friendly_errors.rb +29 -48
- data/lib/bundler/gem_helper.rb +79 -43
- data/lib/bundler/gem_helpers.rb +38 -29
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +5 -5
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/index.rb +9 -9
- data/lib/bundler/injector.rb +33 -13
- data/lib/bundler/inline.rb +41 -30
- data/lib/bundler/installer/gem_installer.rb +9 -18
- data/lib/bundler/installer/parallel_installer.rb +50 -33
- data/lib/bundler/installer/standalone.rb +30 -11
- data/lib/bundler/installer.rb +39 -66
- data/lib/bundler/lazy_specification.rb +63 -28
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +19 -52
- data/lib/bundler/{ssl_certs → man}/.document +0 -0
- data/{man → lib/bundler/man}/bundle-add.1 +10 -2
- data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
- data/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
- data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/lib/bundler/man/bundle-cache.1 +55 -0
- data/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-config.1 +59 -60
- data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +77 -78
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-exec.1 +2 -2
- data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-gem.1 +38 -3
- data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
- data/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-init.1 +2 -2
- data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
- data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-install.1 +37 -7
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
- data/{man → lib/bundler/man}/bundle-list.1 +7 -7
- data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-open.1 +1 -1
- data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
- data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-update.1 +7 -7
- data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +6 -6
- data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
- data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle.1 +7 -3
- data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +5 -2
- data/{man → lib/bundler/man}/gemfile.5 +44 -21
- data/{man → lib/bundler/man}/gemfile.5.ronn +24 -20
- data/{man → lib/bundler/man}/index.txt +1 -1
- data/lib/bundler/match_platform.rb +1 -1
- data/lib/bundler/mirror.rb +5 -5
- data/lib/bundler/plugin/api/source.rb +27 -7
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/plugin/index.rb +27 -4
- data/lib/bundler/plugin/installer/rubygems.rb +1 -1
- data/lib/bundler/plugin/installer.rb +35 -22
- data/lib/bundler/plugin/source_list.rb +5 -1
- data/lib/bundler/plugin.rb +100 -42
- data/lib/bundler/psyched_yaml.rb +0 -15
- data/lib/bundler/remote_specification.rb +5 -4
- data/lib/bundler/resolver/spec_group.rb +57 -53
- data/lib/bundler/resolver.rb +127 -113
- data/lib/bundler/retry.rb +4 -4
- data/lib/bundler/ruby_version.rb +5 -20
- data/lib/bundler/rubygems_ext.rb +103 -79
- data/lib/bundler/rubygems_gem_installer.rb +69 -8
- data/lib/bundler/rubygems_integration.rb +181 -446
- data/lib/bundler/runtime.rb +24 -34
- data/lib/bundler/settings.rb +159 -110
- data/lib/bundler/setup.rb +11 -12
- data/lib/bundler/shared_helpers.rb +56 -90
- data/lib/bundler/similarity_detector.rb +3 -3
- data/lib/bundler/source/git/git_proxy.rb +106 -105
- data/lib/bundler/source/git.rb +66 -39
- data/lib/bundler/source/metadata.rb +9 -9
- data/lib/bundler/source/path/installer.rb +10 -10
- data/lib/bundler/source/path.rb +23 -12
- data/lib/bundler/source/rubygems/remote.rb +3 -4
- data/lib/bundler/source/rubygems.rb +136 -120
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +27 -6
- data/lib/bundler/source_list.rb +101 -66
- data/lib/bundler/source_map.rb +58 -0
- data/lib/bundler/spec_set.rb +49 -53
- data/lib/bundler/stub_specification.rb +40 -34
- data/lib/bundler/templates/Executable.bundler +24 -15
- data/lib/bundler/templates/Gemfile +1 -1
- data/lib/bundler/templates/gems.rb +1 -1
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/lib/bundler/templates/newgem/Gemfile.tt +19 -2
- data/lib/bundler/templates/newgem/README.md.tt +7 -5
- data/lib/bundler/templates/newgem/Rakefile.tt +23 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +27 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +29 -40
- data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/lib/bundler/templates/newgem/standard.yml.tt +2 -0
- data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
- data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +7 -11
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/uri_credentials_filter.rb +10 -4
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +126 -0
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
- data/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +38 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +20 -9
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
- data/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +21 -5
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +65 -8
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
- data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendored_fileutils.rb +1 -6
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +7 -12
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/vendored_tmpdir.rb +4 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +1 -20
- data/lib/bundler/version_ranges.rb +51 -5
- data/lib/bundler/vlad.rb +2 -2
- data/lib/bundler/worker.rb +21 -8
- data/lib/bundler/yaml_serializer.rb +3 -4
- data/lib/bundler.rb +248 -118
- metadata +115 -190
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -49
- data/lib/bundler/compatibility_guard.rb +0 -14
- data/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/man/bundle-add.1.txt +0 -52
- data/man/bundle-binstubs.1.txt +0 -48
- data/man/bundle-check.1.txt +0 -33
- data/man/bundle-clean.1.txt +0 -26
- data/man/bundle-config.1.txt +0 -529
- data/man/bundle-doctor.1.txt +0 -44
- data/man/bundle-exec.1.txt +0 -178
- data/man/bundle-gem.1.txt +0 -91
- data/man/bundle-info.1.txt +0 -21
- data/man/bundle-init.1.txt +0 -34
- data/man/bundle-inject.1.txt +0 -32
- data/man/bundle-install.1.txt +0 -396
- data/man/bundle-list.1.txt +0 -43
- data/man/bundle-lock.1.txt +0 -93
- data/man/bundle-open.1.txt +0 -29
- data/man/bundle-outdated.1.txt +0 -131
- data/man/bundle-package.1 +0 -55
- data/man/bundle-package.1.txt +0 -79
- data/man/bundle-platform.1.txt +0 -57
- data/man/bundle-pristine.1.txt +0 -44
- data/man/bundle-remove.1.txt +0 -34
- data/man/bundle-show.1.txt +0 -27
- data/man/bundle-update.1.txt +0 -391
- data/man/bundle-viz.1.txt +0 -39
- data/man/bundle.1.txt +0 -113
- data/man/gemfile.5.txt +0 -653
data/lib/bundler/dep_proxy.rb
CHANGED
@@ -4,19 +4,18 @@ module Bundler
|
|
4
4
|
class DepProxy
|
5
5
|
attr_reader :__platform, :dep
|
6
6
|
|
7
|
+
@proxies = {}
|
8
|
+
|
9
|
+
def self.get_proxy(dep, platform)
|
10
|
+
@proxies[[dep, platform]] ||= new(dep, platform).freeze
|
11
|
+
end
|
12
|
+
|
7
13
|
def initialize(dep, platform)
|
8
14
|
@dep = dep
|
9
15
|
@__platform = platform
|
10
16
|
end
|
11
17
|
|
12
|
-
|
13
|
-
@hash ||= [dep, __platform].hash
|
14
|
-
end
|
15
|
-
|
16
|
-
def ==(other)
|
17
|
-
return false if other.class != self.class
|
18
|
-
dep == other.dep && __platform == other.__platform
|
19
|
-
end
|
18
|
+
private_class_method :new
|
20
19
|
|
21
20
|
alias_method :eql?, :==
|
22
21
|
|
@@ -39,7 +38,15 @@ module Bundler
|
|
39
38
|
s
|
40
39
|
end
|
41
40
|
|
42
|
-
|
41
|
+
def dup
|
42
|
+
raise NoMethodError.new("DepProxy cannot be duplicated")
|
43
|
+
end
|
44
|
+
|
45
|
+
def clone
|
46
|
+
raise NoMethodError.new("DepProxy cannot be cloned")
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
43
50
|
|
44
51
|
def method_missing(*args, &blk)
|
45
52
|
@dep.send(*args, &blk)
|
data/lib/bundler/dependency.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rubygems/dependency"
|
4
|
-
|
5
|
-
|
4
|
+
require_relative "shared_helpers"
|
5
|
+
require_relative "rubygems_ext"
|
6
6
|
|
7
7
|
module Bundler
|
8
8
|
class Dependency < Gem::Dependency
|
9
9
|
attr_reader :autorequire
|
10
|
-
attr_reader :groups, :platforms, :gemfile
|
10
|
+
attr_reader :groups, :platforms, :gemfile, :git, :branch
|
11
11
|
|
12
12
|
PLATFORM_MAP = {
|
13
13
|
:ruby => Gem::Platform::RUBY,
|
@@ -19,6 +19,7 @@ module Bundler
|
|
19
19
|
:ruby_23 => Gem::Platform::RUBY,
|
20
20
|
:ruby_24 => Gem::Platform::RUBY,
|
21
21
|
:ruby_25 => Gem::Platform::RUBY,
|
22
|
+
:ruby_26 => Gem::Platform::RUBY,
|
22
23
|
:mri => Gem::Platform::RUBY,
|
23
24
|
:mri_18 => Gem::Platform::RUBY,
|
24
25
|
:mri_19 => Gem::Platform::RUBY,
|
@@ -28,6 +29,7 @@ module Bundler
|
|
28
29
|
:mri_23 => Gem::Platform::RUBY,
|
29
30
|
:mri_24 => Gem::Platform::RUBY,
|
30
31
|
:mri_25 => Gem::Platform::RUBY,
|
32
|
+
:mri_26 => Gem::Platform::RUBY,
|
31
33
|
:rbx => Gem::Platform::RUBY,
|
32
34
|
:truffleruby => Gem::Platform::RUBY,
|
33
35
|
:jruby => Gem::Platform::JAVA,
|
@@ -42,6 +44,7 @@ module Bundler
|
|
42
44
|
:mswin_23 => Gem::Platform::MSWIN,
|
43
45
|
:mswin_24 => Gem::Platform::MSWIN,
|
44
46
|
:mswin_25 => Gem::Platform::MSWIN,
|
47
|
+
:mswin_26 => Gem::Platform::MSWIN,
|
45
48
|
:mswin64 => Gem::Platform::MSWIN64,
|
46
49
|
:mswin64_19 => Gem::Platform::MSWIN64,
|
47
50
|
:mswin64_20 => Gem::Platform::MSWIN64,
|
@@ -50,6 +53,7 @@ module Bundler
|
|
50
53
|
:mswin64_23 => Gem::Platform::MSWIN64,
|
51
54
|
:mswin64_24 => Gem::Platform::MSWIN64,
|
52
55
|
:mswin64_25 => Gem::Platform::MSWIN64,
|
56
|
+
:mswin64_26 => Gem::Platform::MSWIN64,
|
53
57
|
:mingw => Gem::Platform::MINGW,
|
54
58
|
:mingw_18 => Gem::Platform::MINGW,
|
55
59
|
:mingw_19 => Gem::Platform::MINGW,
|
@@ -59,6 +63,7 @@ module Bundler
|
|
59
63
|
:mingw_23 => Gem::Platform::MINGW,
|
60
64
|
:mingw_24 => Gem::Platform::MINGW,
|
61
65
|
:mingw_25 => Gem::Platform::MINGW,
|
66
|
+
:mingw_26 => Gem::Platform::MINGW,
|
62
67
|
:x64_mingw => Gem::Platform::X64_MINGW,
|
63
68
|
:x64_mingw_20 => Gem::Platform::X64_MINGW,
|
64
69
|
:x64_mingw_21 => Gem::Platform::X64_MINGW,
|
@@ -66,17 +71,9 @@ module Bundler
|
|
66
71
|
:x64_mingw_23 => Gem::Platform::X64_MINGW,
|
67
72
|
:x64_mingw_24 => Gem::Platform::X64_MINGW,
|
68
73
|
:x64_mingw_25 => Gem::Platform::X64_MINGW,
|
74
|
+
:x64_mingw_26 => Gem::Platform::X64_MINGW,
|
69
75
|
}.freeze
|
70
76
|
|
71
|
-
REVERSE_PLATFORM_MAP = {}.tap do |reverse_platform_map|
|
72
|
-
PLATFORM_MAP.each do |key, value|
|
73
|
-
reverse_platform_map[value] ||= []
|
74
|
-
reverse_platform_map[value] << key
|
75
|
-
end
|
76
|
-
|
77
|
-
reverse_platform_map.each {|_, platforms| platforms.freeze }
|
78
|
-
end.freeze
|
79
|
-
|
80
77
|
def initialize(name, version, options = {}, &blk)
|
81
78
|
type = options["type"] || :runtime
|
82
79
|
super(name, version, type)
|
@@ -84,6 +81,8 @@ module Bundler
|
|
84
81
|
@autorequire = nil
|
85
82
|
@groups = Array(options["group"] || :default).map(&:to_sym)
|
86
83
|
@source = options["source"]
|
84
|
+
@git = options["git"]
|
85
|
+
@branch = options["branch"]
|
87
86
|
@platforms = Array(options["platforms"])
|
88
87
|
@env = options["env"]
|
89
88
|
@should_include = options.fetch("should_include", true)
|
@@ -97,9 +96,15 @@ module Bundler
|
|
97
96
|
def gem_platforms(valid_platforms)
|
98
97
|
return valid_platforms if @platforms.empty?
|
99
98
|
|
100
|
-
|
99
|
+
valid_generic_platforms = valid_platforms.map {|p| [p, GemHelpers.generic(p)] }.to_h
|
100
|
+
@gem_platforms ||= expanded_platforms.compact.uniq
|
101
|
+
|
102
|
+
filtered_generic_platforms = valid_generic_platforms.values & @gem_platforms
|
103
|
+
valid_generic_platforms.select {|_, v| filtered_generic_platforms.include?(v) }.keys
|
104
|
+
end
|
101
105
|
|
102
|
-
|
106
|
+
def expanded_platforms
|
107
|
+
@platforms.map {|pl| PLATFORM_MAP[pl] }
|
103
108
|
end
|
104
109
|
|
105
110
|
def should_include?
|
data/lib/bundler/deployment.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "shared_helpers"
|
4
4
|
Bundler::SharedHelpers.major_deprecation 2, "Bundler no longer integrates with " \
|
5
5
|
"Capistrano, but Capistrano provides its own integration with " \
|
6
6
|
"Bundler via the capistrano-bundler gem. Use it instead."
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This code was extracted from https://github.com/Solistra/ruby-digest which is under public domain
|
4
|
+
module Bundler
|
5
|
+
module Digest
|
6
|
+
# The initial constant values for the 32-bit constant words A, B, C, D, and
|
7
|
+
# E, respectively.
|
8
|
+
SHA1_WORDS = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0].freeze
|
9
|
+
|
10
|
+
# The 8-bit field used for bitwise `AND` masking. Defaults to `0xFFFFFFFF`.
|
11
|
+
SHA1_MASK = 0xFFFFFFFF
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def sha1(string)
|
15
|
+
unless string.is_a?(String)
|
16
|
+
raise TypeError, "can't convert #{string.class.inspect} into String"
|
17
|
+
end
|
18
|
+
|
19
|
+
buffer = string.b
|
20
|
+
|
21
|
+
words = SHA1_WORDS.dup
|
22
|
+
generate_split_buffer(buffer) do |chunk|
|
23
|
+
w = []
|
24
|
+
chunk.each_slice(4) do |a, b, c, d|
|
25
|
+
w << (((a << 8 | b) << 8 | c) << 8 | d)
|
26
|
+
end
|
27
|
+
a, b, c, d, e = *words
|
28
|
+
(16..79).each do |i|
|
29
|
+
w[i] = SHA1_MASK & rotate((w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16]), 1)
|
30
|
+
end
|
31
|
+
0.upto(79) do |i|
|
32
|
+
case i
|
33
|
+
when 0..19
|
34
|
+
f = ((b & c) | (~b & d))
|
35
|
+
k = 0x5A827999
|
36
|
+
when 20..39
|
37
|
+
f = (b ^ c ^ d)
|
38
|
+
k = 0x6ED9EBA1
|
39
|
+
when 40..59
|
40
|
+
f = ((b & c) | (b & d) | (c & d))
|
41
|
+
k = 0x8F1BBCDC
|
42
|
+
when 60..79
|
43
|
+
f = (b ^ c ^ d)
|
44
|
+
k = 0xCA62C1D6
|
45
|
+
end
|
46
|
+
t = SHA1_MASK & (SHA1_MASK & rotate(a, 5) + f + e + k + w[i])
|
47
|
+
a, b, c, d, e = t, a, SHA1_MASK & rotate(b, 30), c, d # rubocop:disable Style/ParallelAssignment
|
48
|
+
end
|
49
|
+
mutated = [a, b, c, d, e]
|
50
|
+
words.map!.with_index {|word, index| SHA1_MASK & (word + mutated[index]) }
|
51
|
+
end
|
52
|
+
|
53
|
+
words.pack("N*").unpack("H*").first
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def generate_split_buffer(string, &block)
|
59
|
+
size = string.bytesize * 8
|
60
|
+
buffer = string.bytes << 128
|
61
|
+
buffer << 0 while buffer.size % 64 != 56
|
62
|
+
buffer.concat([size].pack("Q>").bytes)
|
63
|
+
buffer.each_slice(64, &block)
|
64
|
+
end
|
65
|
+
|
66
|
+
def rotate(value, spaces)
|
67
|
+
value << spaces | value >> (32 - spaces)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/bundler/dsl.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative "dependency"
|
4
|
+
require_relative "ruby_dsl"
|
5
5
|
|
6
6
|
module Bundler
|
7
7
|
class Dsl
|
@@ -18,6 +18,8 @@ module Bundler
|
|
18
18
|
VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
|
19
19
|
platform platforms type source install_if gemfile].freeze
|
20
20
|
|
21
|
+
GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}.freeze
|
22
|
+
|
21
23
|
attr_reader :gemspecs
|
22
24
|
attr_accessor :dependencies
|
23
25
|
|
@@ -44,8 +46,8 @@ module Bundler
|
|
44
46
|
@gemfile = expanded_gemfile_path
|
45
47
|
@gemfiles << expanded_gemfile_path
|
46
48
|
contents ||= Bundler.read_file(@gemfile.to_s)
|
47
|
-
instance_eval(contents.dup.untaint, gemfile.to_s, 1)
|
48
|
-
rescue Exception => e
|
49
|
+
instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
|
50
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
49
51
|
message = "There was an error " \
|
50
52
|
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
|
51
53
|
"`#{File.basename gemfile.to_s}`: #{e.message}"
|
@@ -63,7 +65,7 @@ module Bundler
|
|
63
65
|
development_group = opts[:development_group] || :development
|
64
66
|
expanded_path = gemfile_root.join(path)
|
65
67
|
|
66
|
-
gemspecs =
|
68
|
+
gemspecs = Gem::Util.glob_files_in_dir("{,*}.gemspec", expanded_path).map {|g| Bundler.load_gemspec(g) }.compact
|
67
69
|
gemspecs.reject! {|s| s.name != name } if name
|
68
70
|
Index.sort_specs(gemspecs)
|
69
71
|
specs_by_name_and_version = gemspecs.group_by {|s| [s.name, s.version] }
|
@@ -75,8 +77,7 @@ module Bundler
|
|
75
77
|
|
76
78
|
@gemspecs << spec
|
77
79
|
|
78
|
-
|
79
|
-
gem spec.name, :name => spec.name, :path => path, :glob => glob, :platforms => gem_platforms
|
80
|
+
gem spec.name, :name => spec.name, :path => path, :glob => glob
|
80
81
|
|
81
82
|
group(development_group) do
|
82
83
|
spec.development_dependencies.each do |dep|
|
@@ -104,8 +105,8 @@ module Bundler
|
|
104
105
|
if current = @dependencies.find {|d| d.name == dep.name }
|
105
106
|
deleted_dep = @dependencies.delete(current) if current.type == :development
|
106
107
|
|
107
|
-
|
108
|
-
|
108
|
+
unless deleted_dep
|
109
|
+
if current.requirement != dep.requirement
|
109
110
|
return if dep.type == :development
|
110
111
|
|
111
112
|
update_prompt = ""
|
@@ -123,17 +124,14 @@ module Bundler
|
|
123
124
|
raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
|
124
125
|
"You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
|
125
126
|
"#{update_prompt}"
|
127
|
+
else
|
128
|
+
Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
|
129
|
+
"You should probably keep only one of them.\n" \
|
130
|
+
"Remove any duplicate entries and specify the gem only once.\n" \
|
131
|
+
"While it's not a problem now, it could cause errors if you change the version of one of them later."
|
126
132
|
end
|
127
133
|
|
128
|
-
|
129
|
-
Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
|
130
|
-
"You should probably keep only one of them.\n" \
|
131
|
-
"Remove any duplicate entries and specify the gem only once (per group).\n" \
|
132
|
-
"While it's not a problem now, it could cause errors if you change the version of one of them later."
|
133
|
-
end
|
134
|
-
|
135
|
-
if current.source != dep.source
|
136
|
-
unless deleted_dep
|
134
|
+
if current.source != dep.source
|
137
135
|
return if dep.type == :development
|
138
136
|
raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
|
139
137
|
"You specified that #{dep.name} (#{dep.requirement}) should come from " \
|
@@ -165,8 +163,7 @@ module Bundler
|
|
165
163
|
elsif block_given?
|
166
164
|
with_source(@sources.add_rubygems_source("remotes" => source), &blk)
|
167
165
|
else
|
168
|
-
|
169
|
-
@sources.global_rubygems_source = source
|
166
|
+
@sources.add_global_rubygems_remote(source)
|
170
167
|
end
|
171
168
|
end
|
172
169
|
|
@@ -184,24 +181,14 @@ module Bundler
|
|
184
181
|
end
|
185
182
|
|
186
183
|
def path(path, options = {}, &blk)
|
187
|
-
unless block_given?
|
188
|
-
msg = "You can no longer specify a path source by itself. Instead, \n" \
|
189
|
-
"either use the :path option on a gem, or specify the gems that \n" \
|
190
|
-
"bundler should find in the path source by passing a block to \n" \
|
191
|
-
"the path method, like: \n\n" \
|
192
|
-
" path 'dir/containing/rails' do\n" \
|
193
|
-
" gem 'rails'\n" \
|
194
|
-
" end\n\n"
|
195
|
-
|
196
|
-
raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
|
197
|
-
SharedHelpers.major_deprecation(2, msg.strip)
|
198
|
-
end
|
199
|
-
|
200
184
|
source_options = normalize_hash(options).merge(
|
201
185
|
"path" => Pathname.new(path),
|
202
186
|
"root_path" => gemfile_root,
|
203
187
|
"gemspec" => gemspecs.find {|g| g.name == options["name"] }
|
204
188
|
)
|
189
|
+
|
190
|
+
source_options["global"] = true unless block_given?
|
191
|
+
|
205
192
|
source = @sources.add_path_source(source_options)
|
206
193
|
with_source(source, &blk)
|
207
194
|
end
|
@@ -223,7 +210,6 @@ module Bundler
|
|
223
210
|
|
224
211
|
def github(repo, options = {})
|
225
212
|
raise ArgumentError, "GitHub sources require a block" unless block_given?
|
226
|
-
raise DeprecatedError, "The #github method has been removed" if Bundler.feature_flag.skip_default_git_sources?
|
227
213
|
github_uri = @git_sources["github"].call(repo)
|
228
214
|
git_options = normalize_hash(options).merge("uri" => github_uri)
|
229
215
|
git_source = @sources.add_git_source(git_options)
|
@@ -231,6 +217,7 @@ module Bundler
|
|
231
217
|
end
|
232
218
|
|
233
219
|
def to_definition(lockfile, unlock)
|
220
|
+
check_primary_source_safety
|
234
221
|
Definition.new(lockfile, @dependencies, @sources, unlock, @ruby_version, @optional_groups, @gemfiles)
|
235
222
|
end
|
236
223
|
|
@@ -281,46 +268,37 @@ module Bundler
|
|
281
268
|
raise GemfileError, "Undefined local variable or method `#{name}' for Gemfile"
|
282
269
|
end
|
283
270
|
|
284
|
-
|
271
|
+
def check_primary_source_safety
|
272
|
+
check_path_source_safety
|
273
|
+
check_rubygems_source_safety
|
274
|
+
end
|
285
275
|
|
286
|
-
|
287
|
-
return if Bundler.feature_flag.skip_default_git_sources?
|
276
|
+
private
|
288
277
|
|
278
|
+
def add_git_sources
|
289
279
|
git_source(:github) do |repo_name|
|
290
280
|
warn_deprecated_git_source(:github, <<-'RUBY'.strip, 'Change any "reponame" :github sources to "username/reponame".')
|
291
281
|
"https://github.com/#{repo_name}.git"
|
292
282
|
RUBY
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
# This can be overridden by adding this code to your Gemfiles:
|
301
|
-
#
|
302
|
-
# git_source(:github) do |repo_name|
|
303
|
-
# repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
304
|
-
# "https://github.com/#{repo_name}.git"
|
305
|
-
# end
|
306
|
-
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
307
|
-
# TODO: 2.0 upgrade this setting to the default
|
308
|
-
if Bundler.feature_flag.github_https?
|
309
|
-
Bundler::SharedHelpers.major_deprecation 2, "The `github.https` setting will be removed"
|
310
|
-
"https://github.com/#{repo_name}.git"
|
283
|
+
if repo_name =~ GITHUB_PULL_REQUEST_URL
|
284
|
+
{
|
285
|
+
"git" => "https://github.com/#{$1}.git",
|
286
|
+
"branch" => "refs/pull/#{$2}/head",
|
287
|
+
"ref" => nil,
|
288
|
+
"tag" => nil,
|
289
|
+
}
|
311
290
|
else
|
312
|
-
"
|
291
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
292
|
+
"https://github.com/#{repo_name}.git"
|
313
293
|
end
|
314
294
|
end
|
315
295
|
|
316
|
-
# TODO: 2.0 remove this deprecated git source
|
317
296
|
git_source(:gist) do |repo_name|
|
318
297
|
warn_deprecated_git_source(:gist, '"https://gist.github.com/#{repo_name}.git"')
|
319
298
|
|
320
299
|
"https://gist.github.com/#{repo_name}.git"
|
321
300
|
end
|
322
301
|
|
323
|
-
# TODO: 2.0 remove this deprecated git source
|
324
302
|
git_source(:bitbucket) do |repo_name|
|
325
303
|
warn_deprecated_git_source(:bitbucket, <<-'RUBY'.strip)
|
326
304
|
user_name, repo_name = repo_name.split("/")
|
@@ -363,9 +341,7 @@ repo_name ||= user_name
|
|
363
341
|
if name =~ /\s/
|
364
342
|
raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
|
365
343
|
end
|
366
|
-
if name.empty?
|
367
|
-
raise GemfileError, %(an empty gem name is not valid)
|
368
|
-
end
|
344
|
+
raise GemfileError, %(an empty gem name is not valid) if name.empty?
|
369
345
|
|
370
346
|
normalize_hash(opts)
|
371
347
|
|
@@ -400,7 +376,11 @@ repo_name ||= user_name
|
|
400
376
|
|
401
377
|
git_name = (git_names & opts.keys).last
|
402
378
|
if @git_sources[git_name]
|
403
|
-
|
379
|
+
git_opts = @git_sources[git_name].call(opts[git_name])
|
380
|
+
git_opts = { "git" => git_opts } if git_opts.is_a?(String)
|
381
|
+
opts.merge!(git_opts) do |key, _gemfile_value, _git_source_value|
|
382
|
+
raise GemfileError, %(The :#{key} option can't be used with `#{git_name}: #{opts[git_name].inspect}`)
|
383
|
+
end
|
404
384
|
end
|
405
385
|
|
406
386
|
%w[git path].each do |type|
|
@@ -443,10 +423,10 @@ repo_name ||= user_name
|
|
443
423
|
message = String.new
|
444
424
|
message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} "
|
445
425
|
message << if invalid_keys.size > 1
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
426
|
+
"as options for #{command}, but they are invalid."
|
427
|
+
else
|
428
|
+
"as an option for #{command}, but it is invalid."
|
429
|
+
end
|
450
430
|
|
451
431
|
message << " Valid options are: #{valid_keys.join(", ")}."
|
452
432
|
message << " You may be able to resolve this by upgrading Bundler to the newest version."
|
@@ -467,30 +447,50 @@ repo_name ||= user_name
|
|
467
447
|
end
|
468
448
|
end
|
469
449
|
|
470
|
-
def
|
471
|
-
return if
|
450
|
+
def check_path_source_safety
|
451
|
+
return if @sources.global_path_source.nil?
|
472
452
|
|
473
|
-
|
453
|
+
msg = "You can no longer specify a path source by itself. Instead, \n" \
|
454
|
+
"either use the :path option on a gem, or specify the gems that \n" \
|
455
|
+
"bundler should find in the path source by passing a block to \n" \
|
456
|
+
"the path method, like: \n\n" \
|
457
|
+
" path 'dir/containing/rails' do\n" \
|
458
|
+
" gem 'rails'\n" \
|
459
|
+
" end\n\n"
|
460
|
+
|
461
|
+
SharedHelpers.major_deprecation(2, msg.strip)
|
462
|
+
end
|
463
|
+
|
464
|
+
def check_rubygems_source_safety
|
465
|
+
if @sources.implicit_global_source?
|
466
|
+
implicit_global_source_warning
|
467
|
+
elsif @sources.aggregate_global_source?
|
468
|
+
multiple_global_source_warning
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
472
|
+
def implicit_global_source_warning
|
473
|
+
Bundler::SharedHelpers.major_deprecation 2, "This Gemfile does not include an explicit global source. " \
|
474
|
+
"Not using an explicit global source may result in a different lockfile being generated depending on " \
|
475
|
+
"the gems you have installed locally before bundler is run. " \
|
476
|
+
"Instead, define a global source in your Gemfile like this: source \"https://rubygems.org\"."
|
477
|
+
end
|
478
|
+
|
479
|
+
def multiple_global_source_warning
|
480
|
+
if Bundler.feature_flag.bundler_3_mode?
|
474
481
|
msg = "This Gemfile contains multiple primary sources. " \
|
475
482
|
"Each source after the first must include a block to indicate which gems " \
|
476
483
|
"should come from that source"
|
477
|
-
unless Bundler.feature_flag.bundler_2_mode?
|
478
|
-
msg += ". To downgrade this error to a warning, run " \
|
479
|
-
"`bundle config --delete disable_multisource`"
|
480
|
-
end
|
481
484
|
raise GemfileEvalError, msg
|
482
485
|
else
|
483
486
|
Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
|
484
487
|
"Using `source` more than once without a block is a security risk, and " \
|
485
488
|
"may result in installing unexpected gems. To resolve this warning, use " \
|
486
|
-
"a block to indicate which gems should come from the secondary source.
|
487
|
-
"To upgrade this warning to an error, run `bundle config " \
|
488
|
-
"disable_multisource true`."
|
489
|
+
"a block to indicate which gems should come from the secondary source."
|
489
490
|
end
|
490
491
|
end
|
491
492
|
|
492
493
|
def warn_deprecated_git_source(name, replacement, additional_message = nil)
|
493
|
-
# TODO: 2.0 remove deprecation
|
494
494
|
additional_message &&= " #{additional_message}"
|
495
495
|
replacement = if replacement.count("\n").zero?
|
496
496
|
"{|repo_name| #{replacement} }"
|
@@ -498,8 +498,8 @@ repo_name ||= user_name
|
|
498
498
|
"do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end"
|
499
499
|
end
|
500
500
|
|
501
|
-
Bundler::SharedHelpers.major_deprecation
|
502
|
-
The :#{name} git source is deprecated, and will be removed in
|
501
|
+
Bundler::SharedHelpers.major_deprecation 3, <<-EOS
|
502
|
+
The :#{name} git source is deprecated, and will be removed in the future.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
|
503
503
|
|
504
504
|
git_source(:#{name}) #{replacement}
|
505
505
|
|
@@ -595,13 +595,13 @@ The :#{name} git source is deprecated, and will be removed in Bundler 2.0.#{addi
|
|
595
595
|
end
|
596
596
|
end
|
597
597
|
|
598
|
-
|
598
|
+
private
|
599
599
|
|
600
600
|
def parse_line_number_from_description
|
601
601
|
description = self.description
|
602
602
|
if dsl_path && description =~ /((#{Regexp.quote File.expand_path(dsl_path)}|#{Regexp.quote dsl_path.to_s}):\d+)/
|
603
603
|
trace_line = Regexp.last_match[1]
|
604
|
-
description = description.sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ")
|
604
|
+
description = description.sub(/\n.*\n(\.\.\.)? *\^~+$/, "").sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ")
|
605
605
|
end
|
606
606
|
[trace_line, description]
|
607
607
|
end
|
data/lib/bundler/env.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative "rubygems_integration"
|
4
|
+
require_relative "source/git/git_proxy"
|
5
5
|
|
6
6
|
module Bundler
|
7
7
|
class Env
|
@@ -69,15 +69,9 @@ module Bundler
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def self.ruby_version
|
72
|
-
str = String.new(
|
73
|
-
|
74
|
-
|
75
|
-
str << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
|
76
|
-
str << ") [#{RUBY_PLATFORM}]"
|
77
|
-
else
|
78
|
-
str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
|
79
|
-
str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
|
80
|
-
end
|
72
|
+
str = String.new(RUBY_VERSION)
|
73
|
+
str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
|
74
|
+
str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
|
81
75
|
end
|
82
76
|
|
83
77
|
def self.git_version
|
@@ -106,11 +100,12 @@ module Bundler
|
|
106
100
|
out << [" Full Path", Gem.ruby]
|
107
101
|
out << [" Config Dir", Pathname.new(Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE).dirname]
|
108
102
|
out << ["RubyGems", Gem::VERSION]
|
109
|
-
out << [" Gem Home",
|
110
|
-
out << [" Gem Path",
|
103
|
+
out << [" Gem Home", Gem.dir]
|
104
|
+
out << [" Gem Path", Gem.path.join(File::PATH_SEPARATOR)]
|
105
|
+
out << [" User Home", Gem.user_home]
|
111
106
|
out << [" User Path", Gem.user_dir]
|
112
107
|
out << [" Bin Dir", Gem.bindir]
|
113
|
-
if defined?(OpenSSL)
|
108
|
+
if defined?(OpenSSL::SSL)
|
114
109
|
out << ["OpenSSL"]
|
115
110
|
out << [" Compiled", OpenSSL::OPENSSL_VERSION] if defined?(OpenSSL::OPENSSL_VERSION)
|
116
111
|
out << [" Loaded", OpenSSL::OPENSSL_LIBRARY_VERSION] if defined?(OpenSSL::OPENSSL_LIBRARY_VERSION)
|
@@ -6,7 +6,6 @@ module Bundler
|
|
6
6
|
BUNDLER_KEYS = %w[
|
7
7
|
BUNDLE_BIN_PATH
|
8
8
|
BUNDLE_GEMFILE
|
9
|
-
BUNDLER_ORIG_MANPATH
|
10
9
|
BUNDLER_VERSION
|
11
10
|
GEM_HOME
|
12
11
|
GEM_PATH
|
@@ -18,14 +17,41 @@ module Bundler
|
|
18
17
|
].map(&:freeze).freeze
|
19
18
|
BUNDLER_PREFIX = "BUNDLER_ORIG_".freeze
|
20
19
|
|
21
|
-
|
20
|
+
def self.from_env
|
21
|
+
new(env_to_hash(ENV), BUNDLER_KEYS)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.env_to_hash(env)
|
25
|
+
to_hash = env.to_hash
|
26
|
+
return to_hash unless Gem.win_platform?
|
27
|
+
|
28
|
+
to_hash.each_with_object({}) {|(k,v), a| a[k.upcase] = v }
|
29
|
+
end
|
30
|
+
|
31
|
+
# @param env [Hash]
|
22
32
|
# @param keys [Array<String>]
|
23
33
|
def initialize(env, keys)
|
24
|
-
@original = env
|
34
|
+
@original = env
|
25
35
|
@keys = keys
|
26
36
|
@prefix = BUNDLER_PREFIX
|
27
37
|
end
|
28
38
|
|
39
|
+
# Replaces `ENV` with the bundler environment variables backed up
|
40
|
+
def replace_with_backup
|
41
|
+
unless Gem.win_platform?
|
42
|
+
ENV.replace(backup)
|
43
|
+
return
|
44
|
+
end
|
45
|
+
|
46
|
+
# Fallback logic for Windows below to workaround
|
47
|
+
# https://bugs.ruby-lang.org/issues/16798. Can be dropped once all
|
48
|
+
# supported rubies include the fix for that.
|
49
|
+
|
50
|
+
ENV.clear
|
51
|
+
|
52
|
+
backup.each {|k, v| ENV[k] = v }
|
53
|
+
end
|
54
|
+
|
29
55
|
# @return [Hash]
|
30
56
|
def backup
|
31
57
|
env = @original.clone
|