bundler 2.2.26 → 2.3.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +501 -1
- data/README.md +1 -1
- data/bundler.gemspec +6 -8
- data/exe/bundle +7 -8
- data/exe/bundler +1 -1
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +3 -3
- data/lib/bundler/cli/check.rb +1 -1
- data/lib/bundler/cli/common.rb +3 -2
- data/lib/bundler/cli/config.rb +10 -1
- data/lib/bundler/cli/doctor.rb +12 -3
- data/lib/bundler/cli/gem.rb +98 -9
- data/lib/bundler/cli/info.rb +27 -6
- data/lib/bundler/cli/init.rb +5 -1
- data/lib/bundler/cli/install.rb +13 -30
- data/lib/bundler/cli/issue.rb +4 -3
- data/lib/bundler/cli/outdated.rb +12 -3
- data/lib/bundler/cli/platform.rb +2 -2
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/cli/update.rb +8 -4
- data/lib/bundler/cli.rb +23 -19
- data/lib/bundler/compact_index_client/cache.rb +0 -9
- data/lib/bundler/compact_index_client/updater.rb +16 -8
- data/lib/bundler/compact_index_client.rb +2 -8
- data/lib/bundler/current_ruby.rb +16 -6
- data/lib/bundler/definition.rb +204 -217
- data/lib/bundler/dependency.rb +23 -71
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +28 -45
- data/lib/bundler/endpoint_specification.rb +19 -13
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/environment_preserver.rb +4 -1
- data/lib/bundler/errors.rb +28 -2
- data/lib/bundler/feature_flag.rb +0 -1
- data/lib/bundler/fetcher/base.rb +6 -8
- data/lib/bundler/fetcher/compact_index.rb +9 -14
- data/lib/bundler/fetcher/index.rb +0 -26
- data/lib/bundler/fetcher.rb +20 -22
- data/lib/bundler/friendly_errors.rb +26 -34
- data/lib/bundler/gem_helper.rb +7 -18
- data/lib/bundler/gem_helpers.rb +9 -2
- data/lib/bundler/gem_version_promoter.rb +14 -25
- data/lib/bundler/index.rb +10 -40
- data/lib/bundler/injector.rb +16 -2
- data/lib/bundler/inline.rb +2 -12
- data/lib/bundler/installer/gem_installer.rb +13 -5
- data/lib/bundler/installer/standalone.rb +30 -3
- data/lib/bundler/installer.rb +18 -29
- data/lib/bundler/lazy_specification.rb +52 -35
- data/lib/bundler/lockfile_generator.rb +2 -2
- data/lib/bundler/lockfile_parser.rb +12 -10
- data/lib/bundler/man/bundle-add.1 +21 -5
- data/lib/bundler/man/bundle-add.1.ronn +16 -4
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +7 -1
- data/lib/bundler/man/bundle-cache.1.ronn +7 -0
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +2 -2
- data/lib/bundler/man/bundle-clean.1.ronn +1 -1
- data/lib/bundler/man/bundle-config.1 +33 -14
- data/lib/bundler/man/bundle-config.1.ronn +30 -18
- data/lib/bundler/man/bundle-console.1 +53 -0
- data/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +2 -2
- data/lib/bundler/man/bundle-exec.1.ronn +1 -1
- data/lib/bundler/man/bundle-gem.1 +14 -1
- data/lib/bundler/man/bundle-gem.1.ronn +16 -0
- data/lib/bundler/man/bundle-help.1 +13 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-inject.1 +5 -2
- data/lib/bundler/man/bundle-inject.1.ronn +3 -1
- data/lib/bundler/man/bundle-install.1 +6 -2
- data/lib/bundler/man/bundle-install.1.ronn +8 -2
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +3 -10
- data/lib/bundler/man/bundle-outdated.1.ronn +1 -10
- data/lib/bundler/man/bundle-platform.1 +16 -6
- data/lib/bundler/man/bundle-platform.1.ronn +14 -7
- data/lib/bundler/man/bundle-plugin.1 +81 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +2 -2
- data/lib/bundler/man/bundle-update.1.ronn +2 -1
- data/lib/bundler/man/bundle-version.1 +35 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/lib/bundler/man/bundle-viz.1 +4 -1
- data/lib/bundler/man/bundle-viz.1.ronn +2 -0
- data/lib/bundler/man/bundle.1 +15 -10
- data/lib/bundler/man/bundle.1.ronn +12 -7
- data/lib/bundler/man/gemfile.5 +117 -80
- data/lib/bundler/man/gemfile.5.ronn +105 -84
- data/lib/bundler/man/index.txt +4 -0
- data/lib/bundler/match_metadata.rb +13 -0
- data/lib/bundler/match_platform.rb +0 -1
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/plugin/api/source.rb +4 -9
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/rubygems.rb +0 -4
- data/lib/bundler/plugin/installer.rb +3 -1
- data/lib/bundler/plugin.rb +25 -6
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +10 -4
- data/lib/bundler/resolver/base.rb +50 -0
- data/lib/bundler/resolver/spec_group.rb +31 -49
- data/lib/bundler/resolver.rb +183 -192
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +5 -18
- data/lib/bundler/rubygems_ext.rb +138 -20
- data/lib/bundler/rubygems_gem_installer.rb +42 -16
- data/lib/bundler/rubygems_integration.rb +42 -90
- data/lib/bundler/runtime.rb +2 -3
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +13 -4
- data/lib/bundler/shared_helpers.rb +15 -24
- data/lib/bundler/source/git/git_proxy.rb +7 -4
- data/lib/bundler/source/git.rb +29 -13
- data/lib/bundler/source/metadata.rb +3 -3
- data/lib/bundler/source/path.rb +1 -1
- data/lib/bundler/source/rubygems.rb +148 -161
- data/lib/bundler/source/rubygems_aggregate.rb +1 -1
- data/lib/bundler/source.rb +6 -5
- data/lib/bundler/source_list.rb +15 -29
- data/lib/bundler/source_map.rb +15 -2
- data/lib/bundler/spec_set.rb +52 -32
- data/lib/bundler/stub_specification.rb +5 -3
- data/lib/bundler/templates/Executable +2 -4
- data/lib/bundler/templates/Executable.bundler +2 -2
- data/lib/bundler/templates/Executable.standalone +2 -4
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/gems.rb +0 -3
- data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/lib/bundler/templates/newgem/README.md.tt +3 -9
- data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +5 -4
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +5 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +16 -16
- 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/shell.rb +1 -1
- 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 +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 +57 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +32 -26
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +2 -2
- data/lib/bundler.rb +40 -29
- metadata +37 -12
- 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/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -0,0 +1,168 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
#
|
5
|
+
# This class handles installing and switching to the version of bundler needed
|
6
|
+
# by an application.
|
7
|
+
#
|
8
|
+
class SelfManager
|
9
|
+
def restart_with_locked_bundler_if_needed
|
10
|
+
return unless needs_switching? && installed?
|
11
|
+
|
12
|
+
restart_with(lockfile_version)
|
13
|
+
end
|
14
|
+
|
15
|
+
def install_locked_bundler_and_restart_with_it_if_needed
|
16
|
+
return unless needs_switching?
|
17
|
+
|
18
|
+
Bundler.ui.info \
|
19
|
+
"Bundler #{current_version} is running, but your lockfile was generated with #{lockfile_version}. " \
|
20
|
+
"Installing Bundler #{lockfile_version} and restarting using that version."
|
21
|
+
|
22
|
+
install_and_restart_with(lockfile_version)
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_bundler_and_restart_with_it_if_needed(target)
|
26
|
+
return unless autoswitching_applies?
|
27
|
+
|
28
|
+
spec = resolve_update_version_from(target)
|
29
|
+
return unless spec
|
30
|
+
|
31
|
+
version = spec.version
|
32
|
+
|
33
|
+
Bundler.ui.info "Updating bundler to #{version}."
|
34
|
+
|
35
|
+
install(spec)
|
36
|
+
|
37
|
+
restart_with(version)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def install_and_restart_with(version)
|
43
|
+
requirement = Gem::Requirement.new(version)
|
44
|
+
spec = find_latest_matching_spec(requirement)
|
45
|
+
|
46
|
+
if spec.nil?
|
47
|
+
Bundler.ui.warn "Your lockfile is locked to a version of bundler (#{lockfile_version}) that doesn't exist at https://rubygems.org/. Going on using #{current_version}"
|
48
|
+
return
|
49
|
+
end
|
50
|
+
|
51
|
+
install(spec)
|
52
|
+
rescue StandardError => e
|
53
|
+
Bundler.ui.trace e
|
54
|
+
Bundler.ui.warn "There was an error installing the locked bundler version (#{lockfile_version}), rerun with the `--verbose` flag for more details. Going on using bundler #{current_version}."
|
55
|
+
else
|
56
|
+
restart_with(version)
|
57
|
+
end
|
58
|
+
|
59
|
+
def install(spec)
|
60
|
+
spec.source.install(spec)
|
61
|
+
end
|
62
|
+
|
63
|
+
def restart_with(version)
|
64
|
+
configured_gem_home = ENV["GEM_HOME"]
|
65
|
+
configured_gem_path = ENV["GEM_PATH"]
|
66
|
+
|
67
|
+
cmd = [$PROGRAM_NAME, *ARGV]
|
68
|
+
cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME)
|
69
|
+
|
70
|
+
Bundler.with_original_env do
|
71
|
+
Kernel.exec(
|
72
|
+
{ "GEM_HOME" => configured_gem_home, "GEM_PATH" => configured_gem_path, "BUNDLER_VERSION" => version.to_s },
|
73
|
+
*cmd
|
74
|
+
)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def needs_switching?
|
79
|
+
autoswitching_applies? &&
|
80
|
+
released?(lockfile_version) &&
|
81
|
+
!running?(lockfile_version) &&
|
82
|
+
!updating?
|
83
|
+
end
|
84
|
+
|
85
|
+
def autoswitching_applies?
|
86
|
+
ENV["BUNDLER_VERSION"].nil? &&
|
87
|
+
Bundler.rubygems.supports_bundler_trampolining? &&
|
88
|
+
SharedHelpers.in_bundle? &&
|
89
|
+
lockfile_version
|
90
|
+
end
|
91
|
+
|
92
|
+
def resolve_update_version_from(target)
|
93
|
+
requirement = Gem::Requirement.new(target)
|
94
|
+
update_candidate = find_latest_matching_spec(requirement)
|
95
|
+
|
96
|
+
if update_candidate.nil?
|
97
|
+
raise InvalidOption, "The `bundle update --bundler` target version (#{target}) does not exist"
|
98
|
+
end
|
99
|
+
|
100
|
+
resolved_version = update_candidate.version
|
101
|
+
needs_update = requirement.specific? ? !running?(resolved_version) : running_older_than?(resolved_version)
|
102
|
+
|
103
|
+
return unless needs_update
|
104
|
+
|
105
|
+
update_candidate
|
106
|
+
end
|
107
|
+
|
108
|
+
def local_specs
|
109
|
+
@local_specs ||= Bundler::Source::Rubygems.new("allow_local" => true).specs.select {|spec| spec.name == "bundler" }
|
110
|
+
end
|
111
|
+
|
112
|
+
def remote_specs
|
113
|
+
@remote_specs ||= begin
|
114
|
+
source = Bundler::Source::Rubygems.new("remotes" => "https://rubygems.org")
|
115
|
+
source.remote!
|
116
|
+
source.add_dependency_names("bundler")
|
117
|
+
source.specs
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def find_latest_matching_spec(requirement)
|
122
|
+
local_result = find_latest_matching_spec_from_collection(local_specs, requirement)
|
123
|
+
return local_result if local_result && requirement.specific?
|
124
|
+
|
125
|
+
remote_result = find_latest_matching_spec_from_collection(remote_specs, requirement)
|
126
|
+
return remote_result if local_result.nil?
|
127
|
+
|
128
|
+
[local_result, remote_result].max
|
129
|
+
end
|
130
|
+
|
131
|
+
def find_latest_matching_spec_from_collection(specs, requirement)
|
132
|
+
specs.sort.reverse_each.find {|spec| requirement.satisfied_by?(spec.version) }
|
133
|
+
end
|
134
|
+
|
135
|
+
def running?(version)
|
136
|
+
version == current_version
|
137
|
+
end
|
138
|
+
|
139
|
+
def running_older_than?(version)
|
140
|
+
current_version < version
|
141
|
+
end
|
142
|
+
|
143
|
+
def released?(version)
|
144
|
+
!version.to_s.end_with?(".dev")
|
145
|
+
end
|
146
|
+
|
147
|
+
def updating?
|
148
|
+
"update".start_with?(ARGV.first || " ") && ARGV[1..-1].any? {|a| a.start_with?("--bundler") }
|
149
|
+
end
|
150
|
+
|
151
|
+
def installed?
|
152
|
+
Bundler.configure
|
153
|
+
|
154
|
+
Bundler.rubygems.find_bundler(lockfile_version.to_s)
|
155
|
+
end
|
156
|
+
|
157
|
+
def current_version
|
158
|
+
@current_version ||= Gem::Version.new(Bundler::VERSION)
|
159
|
+
end
|
160
|
+
|
161
|
+
def lockfile_version
|
162
|
+
return @lockfile_version if defined?(@lockfile_version)
|
163
|
+
|
164
|
+
parsed_version = Bundler::LockfileParser.bundled_with
|
165
|
+
@lockfile_version = parsed_version ? Gem::Version.new(parsed_version) : nil
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
data/lib/bundler/settings.rb
CHANGED
@@ -45,7 +45,6 @@ module Bundler
|
|
45
45
|
silence_root_warning
|
46
46
|
suppress_install_using_messages
|
47
47
|
update_requires_all_flag
|
48
|
-
use_gem_version_promoter_for_major_updates
|
49
48
|
].freeze
|
50
49
|
|
51
50
|
NUMBER_KEYS = %w[
|
@@ -57,6 +56,7 @@ module Bundler
|
|
57
56
|
].freeze
|
58
57
|
|
59
58
|
ARRAY_KEYS = %w[
|
59
|
+
only
|
60
60
|
with
|
61
61
|
without
|
62
62
|
].freeze
|
@@ -219,6 +219,7 @@ module Bundler
|
|
219
219
|
def path
|
220
220
|
configs.each do |_level, settings|
|
221
221
|
path = value_for("path", settings)
|
222
|
+
path = "vendor/bundle" if value_for("deployment", settings) && path.nil?
|
222
223
|
path_system = value_for("path.system", settings)
|
223
224
|
disabled_shared_gems = value_for("disable_shared_gems", settings)
|
224
225
|
next if path.nil? && path_system.nil? && disabled_shared_gems.nil?
|
@@ -366,7 +367,7 @@ module Bundler
|
|
366
367
|
|
367
368
|
def to_array(value)
|
368
369
|
return [] unless value
|
369
|
-
value.split(":").map(&:to_sym)
|
370
|
+
value.tr(" ", ":").split(":").map(&:to_sym)
|
370
371
|
end
|
371
372
|
|
372
373
|
def array_to_s(array)
|
@@ -419,7 +420,15 @@ module Bundler
|
|
419
420
|
elsif is_credential(key)
|
420
421
|
"[REDACTED]"
|
421
422
|
elsif is_userinfo(converted)
|
422
|
-
converted.
|
423
|
+
username, pass = converted.split(":", 2)
|
424
|
+
|
425
|
+
if pass == "x-oauth-basic"
|
426
|
+
username = "[REDACTED]"
|
427
|
+
else
|
428
|
+
pass = "[REDACTED]"
|
429
|
+
end
|
430
|
+
|
431
|
+
[username, pass].join(":")
|
423
432
|
else
|
424
433
|
converted
|
425
434
|
end
|
@@ -478,7 +487,7 @@ module Bundler
|
|
478
487
|
/ix.freeze
|
479
488
|
|
480
489
|
def self.key_for(key)
|
481
|
-
key = normalize_uri(key).to_s if key.is_a?(String) &&
|
490
|
+
key = normalize_uri(key).to_s if key.is_a?(String) && key.start_with?("http", "mirror.http")
|
482
491
|
key = key.to_s.gsub(".", "__").gsub("-", "___").upcase
|
483
492
|
"BUNDLE_#{key}"
|
484
493
|
end
|
@@ -13,13 +13,13 @@ module Bundler
|
|
13
13
|
def root
|
14
14
|
gemfile = find_gemfile
|
15
15
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
16
|
-
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
|
16
|
+
Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
|
17
17
|
end
|
18
18
|
|
19
19
|
def default_gemfile
|
20
20
|
gemfile = find_gemfile
|
21
21
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
22
|
-
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
|
22
|
+
Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
|
23
23
|
end
|
24
24
|
|
25
25
|
def default_lockfile
|
@@ -28,7 +28,7 @@ module Bundler
|
|
28
28
|
case gemfile.basename.to_s
|
29
29
|
when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
|
30
30
|
else Pathname.new("#{gemfile}.lock")
|
31
|
-
end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
31
|
+
end.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
|
32
32
|
end
|
33
33
|
|
34
34
|
def default_bundle_dir
|
@@ -100,7 +100,7 @@ module Bundler
|
|
100
100
|
#
|
101
101
|
# @see {Bundler::PermissionError}
|
102
102
|
def filesystem_access(path, action = :write, &block)
|
103
|
-
yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
|
103
|
+
yield(path.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" })
|
104
104
|
rescue Errno::EACCES
|
105
105
|
raise PermissionError.new(path, action)
|
106
106
|
rescue Errno::EAGAIN
|
@@ -109,7 +109,7 @@ module Bundler
|
|
109
109
|
raise VirtualProtocolError.new
|
110
110
|
rescue Errno::ENOSPC
|
111
111
|
raise NoSpaceOnDeviceError.new(path, action)
|
112
|
-
rescue
|
112
|
+
rescue Errno::ENOTSUP
|
113
113
|
raise OperationNotSupportedError.new(path, action)
|
114
114
|
rescue Errno::EEXIST, Errno::ENOENT
|
115
115
|
raise
|
@@ -117,13 +117,6 @@ module Bundler
|
|
117
117
|
raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
|
118
118
|
end
|
119
119
|
|
120
|
-
def const_get_safely(constant_name, namespace)
|
121
|
-
const_in_namespace = namespace.constants.include?(constant_name.to_s) ||
|
122
|
-
namespace.constants.include?(constant_name.to_sym)
|
123
|
-
return nil unless const_in_namespace
|
124
|
-
namespace.const_get(constant_name)
|
125
|
-
end
|
126
|
-
|
127
120
|
def major_deprecation(major_version, message, print_caller_location: false)
|
128
121
|
if print_caller_location
|
129
122
|
caller_location = caller_locations(2, 2).first
|
@@ -148,7 +141,7 @@ module Bundler
|
|
148
141
|
end
|
149
142
|
return unless multiple_gemfiles
|
150
143
|
message = "Multiple gemfiles (gems.rb and Gemfile) detected. " \
|
151
|
-
"Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.
|
144
|
+
"Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.locked."
|
152
145
|
Bundler.ui.warn message
|
153
146
|
end
|
154
147
|
|
@@ -170,7 +163,7 @@ module Bundler
|
|
170
163
|
"\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
|
171
164
|
end
|
172
165
|
|
173
|
-
def pretty_dependency(dep
|
166
|
+
def pretty_dependency(dep)
|
174
167
|
msg = String.new(dep.name)
|
175
168
|
msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
|
176
169
|
|
@@ -179,7 +172,6 @@ module Bundler
|
|
179
172
|
msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
|
180
173
|
end
|
181
174
|
|
182
|
-
msg << " from the `#{dep.source}` source" if print_source && dep.source
|
183
175
|
msg
|
184
176
|
end
|
185
177
|
|
@@ -243,10 +235,10 @@ module Bundler
|
|
243
235
|
|
244
236
|
def search_up(*names)
|
245
237
|
previous = nil
|
246
|
-
current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
238
|
+
current = File.expand_path(SharedHelpers.pwd).tap {|x| x.untaint if RUBY_VERSION < "2.7" }
|
247
239
|
|
248
240
|
until !File.directory?(current) || current == previous
|
249
|
-
if ENV["
|
241
|
+
if ENV["BUNDLER_SPEC_RUN"]
|
250
242
|
# avoid stepping above the tmp directory when testing
|
251
243
|
gemspec = if ENV["GEM_COMMAND"]
|
252
244
|
# for Ruby Core
|
@@ -281,10 +273,10 @@ module Bundler
|
|
281
273
|
|
282
274
|
def set_bundle_variables
|
283
275
|
# bundler exe & lib folders have same root folder, typical gem installation
|
284
|
-
exe_file = File.expand_path("
|
276
|
+
exe_file = File.expand_path("../../exe/bundle", __dir__)
|
285
277
|
|
286
278
|
# for Ruby core repository testing
|
287
|
-
exe_file = File.expand_path("
|
279
|
+
exe_file = File.expand_path("../../libexec/bundle", __dir__) unless File.exist?(exe_file)
|
288
280
|
|
289
281
|
# bundler is a default gem, exe path is separate
|
290
282
|
exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
|
@@ -316,16 +308,15 @@ module Bundler
|
|
316
308
|
end
|
317
309
|
|
318
310
|
def bundler_ruby_lib
|
319
|
-
|
311
|
+
File.expand_path("..", __dir__)
|
320
312
|
end
|
321
313
|
|
322
314
|
def clean_load_path
|
323
|
-
bundler_lib = bundler_ruby_lib
|
324
|
-
|
325
315
|
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
|
326
316
|
|
327
317
|
$LOAD_PATH.reject! do |p|
|
328
|
-
|
318
|
+
resolved_path = resolve_path(p)
|
319
|
+
next if $LOADED_FEATURES.any? {|lf| lf.start_with?(resolved_path) }
|
329
320
|
loaded_gem_paths.delete(p)
|
330
321
|
end
|
331
322
|
$LOAD_PATH.uniq!
|
@@ -333,7 +324,7 @@ module Bundler
|
|
333
324
|
|
334
325
|
def resolve_path(path)
|
335
326
|
expanded = File.expand_path(path)
|
336
|
-
return expanded unless File.
|
327
|
+
return expanded unless File.exist?(expanded)
|
337
328
|
|
338
329
|
File.realpath(expanded)
|
339
330
|
end
|
@@ -56,7 +56,6 @@ module Bundler
|
|
56
56
|
@ref = ref
|
57
57
|
@revision = revision
|
58
58
|
@git = git
|
59
|
-
raise GitNotInstalledError.new if allow? && !Bundler.git_present?
|
60
59
|
end
|
61
60
|
|
62
61
|
def revision
|
@@ -96,12 +95,12 @@ module Bundler
|
|
96
95
|
SharedHelpers.filesystem_access(path.dirname) do |p|
|
97
96
|
FileUtils.mkdir_p(p)
|
98
97
|
end
|
99
|
-
git_retry "clone",
|
98
|
+
git_retry "clone", "--bare", "--no-hardlinks", "--quiet", "--", configured_uri, path.to_s
|
100
99
|
return unless extra_ref
|
101
100
|
end
|
102
101
|
|
103
102
|
with_path do
|
104
|
-
git_retry(*["fetch", "--force", "--quiet", "--tags", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
|
103
|
+
git_retry(*["fetch", "--force", "--quiet", "--tags", "--", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
|
105
104
|
end
|
106
105
|
end
|
107
106
|
|
@@ -208,7 +207,11 @@ module Bundler
|
|
208
207
|
end
|
209
208
|
|
210
209
|
def allow?
|
211
|
-
@git ? @git.allow_git_ops? : true
|
210
|
+
allowed = @git ? @git.allow_git_ops? : true
|
211
|
+
|
212
|
+
raise GitNotInstalledError.new if allowed && !Bundler.git_present?
|
213
|
+
|
214
|
+
allowed
|
212
215
|
end
|
213
216
|
|
214
217
|
def with_path(&blk)
|
data/lib/bundler/source/git.rb
CHANGED
@@ -42,7 +42,7 @@ module Bundler
|
|
42
42
|
%w[ref branch tag submodules].each do |opt|
|
43
43
|
out << " #{opt}: #{options[opt]}\n" if options[opt]
|
44
44
|
end
|
45
|
-
out << " glob: #{@glob}\n" unless
|
45
|
+
out << " glob: #{@glob}\n" unless default_glob?
|
46
46
|
out << " specs:\n"
|
47
47
|
end
|
48
48
|
|
@@ -75,12 +75,20 @@ module Bundler
|
|
75
75
|
git_proxy.branch
|
76
76
|
end
|
77
77
|
|
78
|
-
rev = "
|
78
|
+
rev = "at #{at}@#{shortref_for_display(revision)}"
|
79
79
|
rescue GitError
|
80
80
|
""
|
81
81
|
end
|
82
82
|
|
83
|
-
|
83
|
+
specifiers = [rev, glob_for_display].compact
|
84
|
+
suffix =
|
85
|
+
if specifiers.any?
|
86
|
+
" (#{specifiers.join(", ")})"
|
87
|
+
else
|
88
|
+
""
|
89
|
+
end
|
90
|
+
|
91
|
+
"#{@safe_uri}#{suffix}"
|
84
92
|
end
|
85
93
|
|
86
94
|
def name
|
@@ -173,7 +181,7 @@ module Bundler
|
|
173
181
|
def install(spec, options = {})
|
174
182
|
force = options[:force]
|
175
183
|
|
176
|
-
print_using_message "Using #{version_message(spec)} from #{self}"
|
184
|
+
print_using_message "Using #{version_message(spec, options[:previous_spec])} from #{self}"
|
177
185
|
|
178
186
|
if (requires_checkout? && !@copied) || force
|
179
187
|
Bundler.ui.debug " * Checking out revision: #{ref}"
|
@@ -211,13 +219,11 @@ module Bundler
|
|
211
219
|
# across different projects, this cache will be shared.
|
212
220
|
# When using local git repos, this is set to the local repo.
|
213
221
|
def cache_path
|
214
|
-
@cache_path ||=
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
end.join("git", git_scope)
|
220
|
-
end
|
222
|
+
@cache_path ||= if Bundler.requires_sudo? || Bundler.feature_flag.global_gem_cache?
|
223
|
+
Bundler.user_cache
|
224
|
+
else
|
225
|
+
Bundler.bundle_path.join("cache", "bundler")
|
226
|
+
end.join("git", git_scope)
|
221
227
|
end
|
222
228
|
|
223
229
|
def app_cache_dirname
|
@@ -282,6 +288,14 @@ module Bundler
|
|
282
288
|
ref[0..11]
|
283
289
|
end
|
284
290
|
|
291
|
+
def glob_for_display
|
292
|
+
default_glob? ? nil : "glob: #{@glob}"
|
293
|
+
end
|
294
|
+
|
295
|
+
def default_glob?
|
296
|
+
@glob == DEFAULT_GLOB
|
297
|
+
end
|
298
|
+
|
285
299
|
def uri_hash
|
286
300
|
if uri =~ %r{^\w+://(\w+@)?}
|
287
301
|
# Downcase the domain component of the URI
|
@@ -291,7 +305,9 @@ module Bundler
|
|
291
305
|
# If there is no URI scheme, assume it is an ssh/git URI
|
292
306
|
input = uri
|
293
307
|
end
|
294
|
-
|
308
|
+
# We use SHA1 here for historical reason and to preserve backward compatibility.
|
309
|
+
# But a transition to a simpler mangling algorithm would be welcome.
|
310
|
+
Bundler::Digest.sha1(input)
|
295
311
|
end
|
296
312
|
|
297
313
|
def cached_revision
|
@@ -318,7 +334,7 @@ module Bundler
|
|
318
334
|
|
319
335
|
def load_gemspec(file)
|
320
336
|
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
|
321
|
-
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
337
|
+
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
|
322
338
|
StubSpecification.from_stub(stub)
|
323
339
|
end
|
324
340
|
|
@@ -5,7 +5,7 @@ module Bundler
|
|
5
5
|
class Metadata < Source
|
6
6
|
def specs
|
7
7
|
@specs ||= Index.build do |idx|
|
8
|
-
idx << Gem::Specification.new("Ruby\0",
|
8
|
+
idx << Gem::Specification.new("Ruby\0", Gem.ruby_version)
|
9
9
|
idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.default
|
11
11
|
end
|
@@ -22,10 +22,10 @@ module Bundler
|
|
22
22
|
s.summary = "The best way to manage your application's dependencies"
|
23
23
|
s.executables = %w[bundle]
|
24
24
|
# can't point to the actual gemspec or else the require paths will be wrong
|
25
|
-
s.loaded_from =
|
25
|
+
s.loaded_from = __dir__
|
26
26
|
end
|
27
27
|
|
28
|
-
if local_spec = Bundler.rubygems.
|
28
|
+
if local_spec = Bundler.rubygems.find_bundler(VERSION)
|
29
29
|
idx << local_spec
|
30
30
|
end
|
31
31
|
|
data/lib/bundler/source/path.rb
CHANGED
@@ -82,7 +82,7 @@ module Bundler
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def install(spec, options = {})
|
85
|
-
using_message = "Using #{version_message(spec)} from #{self}"
|
85
|
+
using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}"
|
86
86
|
using_message += " and installing its executables" unless spec.executables.empty?
|
87
87
|
print_using_message using_message
|
88
88
|
generate_bin(spec, :disable_extensions => true)
|