bundler 2.2.31 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +83 -0
- data/exe/bundle +7 -8
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/doctor.rb +3 -2
- data/lib/bundler/cli/gem.rb +2 -1
- data/lib/bundler/cli/info.rb +6 -1
- data/lib/bundler/cli/install.rb +2 -0
- data/lib/bundler/cli/update.rb +2 -2
- data/lib/bundler/cli.rb +7 -1
- data/lib/bundler/compact_index_client/updater.rb +0 -5
- data/lib/bundler/definition.rb +61 -119
- data/lib/bundler/dependency.rb +5 -7
- data/lib/bundler/dsl.rb +18 -30
- data/lib/bundler/endpoint_specification.rb +0 -8
- data/lib/bundler/environment_preserver.rb +4 -1
- data/lib/bundler/fetcher/compact_index.rb +9 -4
- data/lib/bundler/fetcher.rb +2 -5
- data/lib/bundler/gem_helper.rb +2 -2
- data/lib/bundler/injector.rb +10 -1
- data/lib/bundler/installer/gem_installer.rb +1 -6
- data/lib/bundler/installer.rb +1 -4
- data/lib/bundler/lazy_specification.rb +17 -1
- data/lib/bundler/lockfile_parser.rb +10 -13
- data/lib/bundler/man/bundle-add.1 +10 -2
- data/lib/bundler/man/bundle-add.1.ronn +7 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +3 -3
- data/lib/bundler/man/bundle-config.1.ronn +3 -3
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +1 -1
- 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 +1 -1
- data/lib/bundler/man/bundle-install.1 +2 -2
- data/lib/bundler/man/bundle-install.1.ronn +2 -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 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- 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-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +28 -2
- data/lib/bundler/man/gemfile.5.ronn +9 -1
- data/lib/bundler/plugin/api/source.rb +1 -0
- data/lib/bundler/plugin/installer.rb +1 -1
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/psyched_yaml.rb +1 -13
- data/lib/bundler/resolver.rb +34 -31
- data/lib/bundler/rubygems_ext.rb +2 -0
- data/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +11 -48
- data/lib/bundler/self_manager.rb +76 -0
- data/lib/bundler/shared_helpers.rb +4 -12
- data/lib/bundler/source/git/git_proxy.rb +2 -2
- data/lib/bundler/source/metadata.rb +1 -1
- data/lib/bundler/source/rubygems.rb +16 -12
- data/lib/bundler/source/rubygems_aggregate.rb +1 -1
- data/lib/bundler/source.rb +1 -1
- data/lib/bundler/source_list.rb +7 -29
- data/lib/bundler/templates/Executable.bundler +1 -1
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/gems.rb +0 -3
- data/lib/bundler/templates/newgem/Rakefile.tt +10 -1
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +0 -2
- 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/thor/lib/thor/actions/file_manipulation.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +5 -3
- 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/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/version.rb +1 -1
- data/lib/bundler.rb +9 -3
- metadata +10 -5
- data/lib/bundler/gemdeps.rb +0 -29
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-UPDATE" "1" "
|
4
|
+
.TH "BUNDLE\-UPDATE" "1" "December 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-update\fR \- Update your gems to the latest available versions
|
@@ -47,7 +47,7 @@ Fall back to using the single\-file index of all gems\.
|
|
47
47
|
.
|
48
48
|
.TP
|
49
49
|
\fB\-\-jobs=[<number>]\fR, \fB\-j[<number>]\fR
|
50
|
-
Specify the number of jobs to run in parallel\. The default is
|
50
|
+
Specify the number of jobs to run in parallel\. The default is the number of available processors\.
|
51
51
|
.
|
52
52
|
.TP
|
53
53
|
\fB\-\-retry=[<number>]\fR
|
@@ -56,7 +56,8 @@ gem.
|
|
56
56
|
Fall back to using the single-file index of all gems.
|
57
57
|
|
58
58
|
* `--jobs=[<number>]`, `-j[<number>]`:
|
59
|
-
Specify the number of jobs to run in parallel. The default is
|
59
|
+
Specify the number of jobs to run in parallel. The default is the number of
|
60
|
+
available processors.
|
60
61
|
|
61
62
|
* `--retry=[<number>]`:
|
62
63
|
Retry failed network or git requests for <number> times.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-VIZ" "1" "
|
4
|
+
.TH "BUNDLE\-VIZ" "1" "December 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
|
data/lib/bundler/man/bundle.1
CHANGED
data/lib/bundler/man/gemfile.5
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "GEMFILE" "5" "
|
4
|
+
.TH "GEMFILE" "5" "December 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
|
@@ -506,8 +506,34 @@ gem "rails", :git => "git://github\.com/rails/rails\.git"
|
|
506
506
|
.P
|
507
507
|
Since the \fBgithub\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\.
|
508
508
|
.
|
509
|
+
.P
|
510
|
+
You can also directly pass a pull request URL:
|
511
|
+
.
|
512
|
+
.IP "" 4
|
513
|
+
.
|
514
|
+
.nf
|
515
|
+
|
516
|
+
gem "rails", :github => "https://github\.com/rails/rails/pull/43753"
|
517
|
+
.
|
518
|
+
.fi
|
519
|
+
.
|
520
|
+
.IP "" 0
|
521
|
+
.
|
522
|
+
.P
|
523
|
+
Which is equivalent to:
|
524
|
+
.
|
525
|
+
.IP "" 4
|
526
|
+
.
|
527
|
+
.nf
|
528
|
+
|
529
|
+
gem "rails", :github => "rails/rails", branch: "refs/pull/43753/head"
|
530
|
+
.
|
531
|
+
.fi
|
532
|
+
.
|
533
|
+
.IP "" 0
|
534
|
+
.
|
509
535
|
.SS "GIST"
|
510
|
-
If the git repository you want to use is hosted as a
|
536
|
+
If the git repository you want to use is hosted as a GitHub Gist and is public, you can use the :gist shorthand to specify the gist identifier (without the trailing "\.git")\.
|
511
537
|
.
|
512
538
|
.IP "" 4
|
513
539
|
.
|
@@ -372,9 +372,17 @@ Are both equivalent to
|
|
372
372
|
|
373
373
|
Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument.
|
374
374
|
|
375
|
+
You can also directly pass a pull request URL:
|
376
|
+
|
377
|
+
gem "rails", :github => "https://github.com/rails/rails/pull/43753"
|
378
|
+
|
379
|
+
Which is equivalent to:
|
380
|
+
|
381
|
+
gem "rails", :github => "rails/rails", branch: "refs/pull/43753/head"
|
382
|
+
|
375
383
|
### GIST
|
376
384
|
|
377
|
-
If the git repository you want to use is hosted as a
|
385
|
+
If the git repository you want to use is hosted as a GitHub Gist and is public, you can use
|
378
386
|
the :gist shorthand to specify the gist identifier (without the trailing ".git").
|
379
387
|
|
380
388
|
gem "the_hatch", :gist => "4815162342"
|
data/lib/bundler/process_lock.rb
CHANGED
@@ -12,7 +12,7 @@ module Bundler
|
|
12
12
|
yield
|
13
13
|
f.flock(File::LOCK_UN)
|
14
14
|
end
|
15
|
-
rescue Errno::EACCES, Errno::ENOLCK,
|
15
|
+
rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP
|
16
16
|
# In the case the user does not have access to
|
17
17
|
# create the lock file or is using NFS where
|
18
18
|
# locks are not available we skip locking.
|
data/lib/bundler/psyched_yaml.rb
CHANGED
@@ -1,22 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Psych could be in the stdlib
|
4
|
-
# but it's too late if Syck is already loaded
|
5
3
|
begin
|
6
|
-
require "psych"
|
4
|
+
require "psych"
|
7
5
|
rescue LoadError
|
8
6
|
# Apparently Psych wasn't available. Oh well.
|
9
7
|
end
|
10
8
|
|
11
9
|
# At least load the YAML stdlib, whatever that may be
|
12
10
|
require "yaml" unless defined?(YAML.dump)
|
13
|
-
|
14
|
-
module Bundler
|
15
|
-
# On encountering invalid YAML,
|
16
|
-
# Psych raises Psych::SyntaxError
|
17
|
-
if defined?(::Psych::SyntaxError)
|
18
|
-
YamlLibrarySyntaxError = ::Psych::SyntaxError
|
19
|
-
else # Syck raises ArgumentError
|
20
|
-
YamlLibrarySyntaxError = ::ArgumentError
|
21
|
-
end
|
22
|
-
end
|
data/lib/bundler/resolver.rb
CHANGED
@@ -30,10 +30,8 @@ module Bundler
|
|
30
30
|
@resolver = Molinillo::Resolver.new(self, self)
|
31
31
|
@search_for = {}
|
32
32
|
@base_dg = Molinillo::DependencyGraph.new
|
33
|
-
aggregate_global_source = @source_requirements[:default].is_a?(Source::RubygemsAggregate)
|
34
33
|
@base.each do |ls|
|
35
34
|
dep = Dependency.new(ls.name, ls.version)
|
36
|
-
ls.source = source_for(ls.name) unless aggregate_global_source
|
37
35
|
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
|
38
36
|
end
|
39
37
|
additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
|
@@ -136,6 +134,7 @@ module Bundler
|
|
136
134
|
end
|
137
135
|
nested.reduce([]) do |groups, (version, specs)|
|
138
136
|
next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
|
137
|
+
next groups unless specs.any? {|spec| spec.match_platform(platform) }
|
139
138
|
|
140
139
|
specs_by_platform = Hash.new do |current_specs, current_platform|
|
141
140
|
current_specs[current_platform] = select_best_platform_match(specs, current_platform)
|
@@ -147,7 +146,7 @@ module Bundler
|
|
147
146
|
next groups if @resolving_only_for_ruby
|
148
147
|
|
149
148
|
spec_group = SpecGroup.create_for(specs_by_platform, @platforms, platform)
|
150
|
-
groups << spec_group
|
149
|
+
groups << spec_group
|
151
150
|
|
152
151
|
groups
|
153
152
|
end
|
@@ -264,30 +263,37 @@ module Bundler
|
|
264
263
|
"If you are updating multiple gems in your Gemfile at once,\n" \
|
265
264
|
"try passing them all to `bundle update`"
|
266
265
|
else
|
267
|
-
|
268
|
-
specs = source.specs.search(name)
|
269
|
-
versions_with_platforms = specs.map {|s| [s.version, s.platform] }
|
270
|
-
cache_message = begin
|
271
|
-
" or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
|
272
|
-
rescue GemfileNotFound
|
273
|
-
nil
|
274
|
-
end
|
275
|
-
message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source.to_err}#{cache_message}.\n")
|
276
|
-
message << "The source contains the following versions of '#{name}': #{formatted_versions_with_platforms(versions_with_platforms)}" if versions_with_platforms.any?
|
266
|
+
message = gem_not_found_message(name, requirement, source_for(name))
|
277
267
|
end
|
278
268
|
raise GemNotFound, message
|
279
269
|
end
|
280
270
|
end
|
281
271
|
|
282
|
-
def
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
272
|
+
def gem_not_found_message(name, requirement, source, extra_message = "")
|
273
|
+
specs = source.specs.search(name)
|
274
|
+
matching_part = name
|
275
|
+
requirement_label = SharedHelpers.pretty_dependency(requirement)
|
276
|
+
cache_message = begin
|
277
|
+
" or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist?
|
278
|
+
rescue GemfileNotFound
|
279
|
+
nil
|
280
|
+
end
|
281
|
+
specs_matching_requirement = specs.select {| spec| requirement.matches_spec?(spec) }
|
282
|
+
|
283
|
+
if specs_matching_requirement.any?
|
284
|
+
specs = specs_matching_requirement
|
285
|
+
matching_part = requirement_label
|
286
|
+
requirement_label = "#{requirement_label} #{requirement.__platform}"
|
289
287
|
end
|
290
|
-
|
288
|
+
|
289
|
+
message = String.new("Could not find gem '#{requirement_label}'#{extra_message} in #{source}#{cache_message}.\n")
|
290
|
+
|
291
|
+
if specs.any?
|
292
|
+
message << "\nThe source contains the following gems matching '#{matching_part}':\n"
|
293
|
+
message << specs.map {|s| " * #{s.full_name}" }.join("\n")
|
294
|
+
end
|
295
|
+
|
296
|
+
message
|
291
297
|
end
|
292
298
|
|
293
299
|
def version_conflict_message(e)
|
@@ -359,19 +365,16 @@ module Bundler
|
|
359
365
|
|
360
366
|
metadata_requirement = name.end_with?("\0")
|
361
367
|
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
o << ", which is required by "
|
367
|
-
o << "gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
|
368
|
+
extra_message = if conflict.requirement_trees.first.size > 1
|
369
|
+
", which is required by gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
|
370
|
+
else
|
371
|
+
""
|
368
372
|
end
|
369
|
-
o << " "
|
370
373
|
|
371
|
-
|
372
|
-
"is not available in #{relevant_source}"
|
374
|
+
if metadata_requirement
|
375
|
+
o << "#{SharedHelpers.pretty_dependency(conflict.requirement)}#{extra_message} is not available in #{relevant_source}"
|
373
376
|
else
|
374
|
-
|
377
|
+
o << gem_not_found_message(name, conflict.requirement, relevant_source, extra_message)
|
375
378
|
end
|
376
379
|
end
|
377
380
|
end,
|
data/lib/bundler/rubygems_ext.rb
CHANGED
@@ -67,7 +67,7 @@ module Bundler
|
|
67
67
|
def build_extensions
|
68
68
|
extension_cache_path = options[:bundler_extension_cache_path]
|
69
69
|
unless extension_cache_path && extension_dir = spec.extension_dir
|
70
|
-
require "shellwords"
|
70
|
+
require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25")
|
71
71
|
return super
|
72
72
|
end
|
73
73
|
|
@@ -12,25 +12,21 @@ module Bundler
|
|
12
12
|
EXT_LOCK = Monitor.new
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.version
|
16
|
-
@version ||= Gem::Version.new(Gem::VERSION)
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.provides?(req_str)
|
20
|
-
Gem::Requirement.new(req_str).satisfied_by?(version)
|
21
|
-
end
|
22
|
-
|
23
15
|
def initialize
|
24
16
|
@replaced_methods = {}
|
25
17
|
backport_ext_builder_monitor
|
26
18
|
end
|
27
19
|
|
28
20
|
def version
|
29
|
-
|
21
|
+
@version ||= Gem.rubygems_version
|
30
22
|
end
|
31
23
|
|
32
24
|
def provides?(req_str)
|
33
|
-
|
25
|
+
Gem::Requirement.new(req_str).satisfied_by?(version)
|
26
|
+
end
|
27
|
+
|
28
|
+
def supports_bundler_trampolining?
|
29
|
+
provides?(">= 3.3.0.a")
|
34
30
|
end
|
35
31
|
|
36
32
|
def build_args
|
@@ -115,7 +111,7 @@ module Bundler
|
|
115
111
|
Bundler.ui.error "#{e.class}: #{e.message}"
|
116
112
|
Bundler.ui.trace e
|
117
113
|
raise
|
118
|
-
rescue
|
114
|
+
rescue ::Psych::SyntaxError => e
|
119
115
|
raise YamlSyntaxError.new(e, "Your RubyGems configuration, which is " \
|
120
116
|
"usually located in ~/.gemrc, contains invalid YAML syntax.")
|
121
117
|
end
|
@@ -142,19 +138,6 @@ module Bundler
|
|
142
138
|
end
|
143
139
|
end
|
144
140
|
|
145
|
-
def sources=(val)
|
146
|
-
# Gem.configuration creates a new Gem::ConfigFile, which by default will read ~/.gemrc
|
147
|
-
# If that file exists, its settings (including sources) will overwrite the values we
|
148
|
-
# are about to set here. In order to avoid that, we force memoizing the config file now.
|
149
|
-
configuration
|
150
|
-
|
151
|
-
Gem.sources = val
|
152
|
-
end
|
153
|
-
|
154
|
-
def sources
|
155
|
-
Gem.sources
|
156
|
-
end
|
157
|
-
|
158
141
|
def gem_dir
|
159
142
|
Gem.dir
|
160
143
|
end
|
@@ -232,18 +215,6 @@ module Bundler
|
|
232
215
|
EXT_LOCK
|
233
216
|
end
|
234
217
|
|
235
|
-
def with_build_args(args)
|
236
|
-
ext_lock.synchronize do
|
237
|
-
old_args = build_args
|
238
|
-
begin
|
239
|
-
self.build_args = args
|
240
|
-
yield
|
241
|
-
ensure
|
242
|
-
self.build_args = old_args
|
243
|
-
end
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
218
|
def spec_from_gem(path, policy = nil)
|
248
219
|
require "rubygems/security"
|
249
220
|
require_relative "psyched_yaml"
|
@@ -571,10 +542,6 @@ module Bundler
|
|
571
542
|
Gem::REPOSITORY_SUBDIRECTORIES
|
572
543
|
end
|
573
544
|
|
574
|
-
def install_with_build_args(args)
|
575
|
-
yield
|
576
|
-
end
|
577
|
-
|
578
545
|
def path_separator
|
579
546
|
Gem.path_separator
|
580
547
|
end
|
@@ -604,6 +571,10 @@ module Bundler
|
|
604
571
|
end
|
605
572
|
end
|
606
573
|
|
574
|
+
def find_bundler(version)
|
575
|
+
find_name("bundler").find {|s| s.version.to_s == version }
|
576
|
+
end
|
577
|
+
|
607
578
|
def find_name(name)
|
608
579
|
Gem::Specification.stubs_for(name).map(&:to_spec)
|
609
580
|
end
|
@@ -617,14 +588,6 @@ module Bundler
|
|
617
588
|
Gem::Specification.send(:default_stubs, "*.gemspec")
|
618
589
|
end
|
619
590
|
end
|
620
|
-
|
621
|
-
def use_gemdeps(gemfile)
|
622
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
|
623
|
-
require_relative "gemdeps"
|
624
|
-
runtime = Bundler.setup
|
625
|
-
activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
|
626
|
-
[Gemdeps.new(runtime), activated_spec_names]
|
627
|
-
end
|
628
591
|
end
|
629
592
|
|
630
593
|
def self.rubygems
|
@@ -0,0 +1,76 @@
|
|
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_locked_bundler
|
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_locked_bundler
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def install_and_restart_with_locked_bundler
|
28
|
+
bundler_dep = Gem::Dependency.new("bundler", lockfile_version)
|
29
|
+
|
30
|
+
Gem.install(bundler_dep)
|
31
|
+
rescue StandardError => e
|
32
|
+
Bundler.ui.trace e
|
33
|
+
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}."
|
34
|
+
else
|
35
|
+
restart_with_locked_bundler
|
36
|
+
end
|
37
|
+
|
38
|
+
def restart_with_locked_bundler
|
39
|
+
configured_gem_home = ENV["GEM_HOME"]
|
40
|
+
configured_gem_path = ENV["GEM_PATH"]
|
41
|
+
|
42
|
+
cmd = [$PROGRAM_NAME, *ARGV]
|
43
|
+
cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME)
|
44
|
+
|
45
|
+
Bundler.with_original_env do
|
46
|
+
Kernel.exec(
|
47
|
+
{ "GEM_HOME" => configured_gem_home, "GEM_PATH" => configured_gem_path, "BUNDLER_VERSION" => lockfile_version },
|
48
|
+
*cmd
|
49
|
+
)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def needs_switching?
|
54
|
+
ENV["BUNDLER_VERSION"].nil? &&
|
55
|
+
Bundler.rubygems.supports_bundler_trampolining? &&
|
56
|
+
SharedHelpers.in_bundle? &&
|
57
|
+
lockfile_version &&
|
58
|
+
!lockfile_version.end_with?(".dev") &&
|
59
|
+
lockfile_version != current_version
|
60
|
+
end
|
61
|
+
|
62
|
+
def installed?
|
63
|
+
Bundler.configure
|
64
|
+
|
65
|
+
Bundler.rubygems.find_bundler(lockfile_version)
|
66
|
+
end
|
67
|
+
|
68
|
+
def current_version
|
69
|
+
@current_version ||= Bundler::VERSION
|
70
|
+
end
|
71
|
+
|
72
|
+
def lockfile_version
|
73
|
+
@lockfile_version ||= Bundler::LockfileParser.bundled_with
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -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
|
@@ -246,7 +239,7 @@ module Bundler
|
|
246
239
|
current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
247
240
|
|
248
241
|
until !File.directory?(current) || current == previous
|
249
|
-
if ENV["
|
242
|
+
if ENV["BUNDLER_SPEC_RUN"]
|
250
243
|
# avoid stepping above the tmp directory when testing
|
251
244
|
gemspec = if ENV["GEM_COMMAND"]
|
252
245
|
# for Ruby Core
|
@@ -320,12 +313,11 @@ module Bundler
|
|
320
313
|
end
|
321
314
|
|
322
315
|
def clean_load_path
|
323
|
-
bundler_lib = bundler_ruby_lib
|
324
|
-
|
325
316
|
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
|
326
317
|
|
327
318
|
$LOAD_PATH.reject! do |p|
|
328
|
-
|
319
|
+
resolved_path = resolve_path(p)
|
320
|
+
next if $LOADED_FEATURES.any? {|lf| lf.start_with?(resolved_path) }
|
329
321
|
loaded_gem_paths.delete(p)
|
330
322
|
end
|
331
323
|
$LOAD_PATH.uniq!
|
@@ -95,12 +95,12 @@ module Bundler
|
|
95
95
|
SharedHelpers.filesystem_access(path.dirname) do |p|
|
96
96
|
FileUtils.mkdir_p(p)
|
97
97
|
end
|
98
|
-
git_retry "clone",
|
98
|
+
git_retry "clone", "--bare", "--no-hardlinks", "--quiet", "--", configured_uri, path.to_s
|
99
99
|
return unless extra_ref
|
100
100
|
end
|
101
101
|
|
102
102
|
with_path do
|
103
|
-
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)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -25,7 +25,7 @@ module Bundler
|
|
25
25
|
s.loaded_from = File.expand_path("..", __FILE__)
|
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
|
|
@@ -98,26 +98,30 @@ module Bundler
|
|
98
98
|
out << " specs:\n"
|
99
99
|
end
|
100
100
|
|
101
|
-
def
|
101
|
+
def to_s
|
102
102
|
if remotes.empty?
|
103
103
|
"locally installed gems"
|
104
|
-
elsif @allow_remote
|
104
|
+
elsif @allow_remote && @allow_cached && @allow_local
|
105
|
+
"rubygems repository #{remote_names}, cached gems or installed locally"
|
106
|
+
elsif @allow_remote && @allow_local
|
105
107
|
"rubygems repository #{remote_names} or installed locally"
|
106
|
-
elsif @
|
107
|
-
"
|
108
|
+
elsif @allow_remote
|
109
|
+
"rubygems repository #{remote_names}"
|
110
|
+
elsif @allow_cached && @allow_local
|
111
|
+
"cached gems or installed locally"
|
108
112
|
else
|
109
113
|
"locally installed gems"
|
110
114
|
end
|
111
115
|
end
|
112
116
|
|
113
|
-
def
|
117
|
+
def identifier
|
114
118
|
if remotes.empty?
|
115
119
|
"locally installed gems"
|
116
120
|
else
|
117
|
-
"rubygems repository #{remote_names}
|
121
|
+
"rubygems repository #{remote_names}"
|
118
122
|
end
|
119
123
|
end
|
120
|
-
alias_method :name, :
|
124
|
+
alias_method :name, :identifier
|
121
125
|
|
122
126
|
def specs
|
123
127
|
@specs ||= begin
|
@@ -262,10 +266,6 @@ module Bundler
|
|
262
266
|
@remotes.unshift(uri) unless @remotes.include?(uri)
|
263
267
|
end
|
264
268
|
|
265
|
-
def equivalent_remotes?(other_remotes)
|
266
|
-
other_remotes.map(&method(:remove_auth)) == @remotes.map(&method(:remove_auth))
|
267
|
-
end
|
268
|
-
|
269
269
|
def spec_names
|
270
270
|
if @allow_remote && dependency_api_available?
|
271
271
|
remote_specs.spec_names
|
@@ -334,7 +334,11 @@ module Bundler
|
|
334
334
|
end
|
335
335
|
|
336
336
|
def credless_remotes
|
337
|
-
|
337
|
+
if Bundler.settings[:allow_deployment_source_credential_changes]
|
338
|
+
remotes.map(&method(:remove_auth))
|
339
|
+
else
|
340
|
+
remotes.map(&method(:suppress_configured_credentials))
|
341
|
+
end
|
338
342
|
end
|
339
343
|
|
340
344
|
def remotes_for_spec(spec)
|