bundler 2.2.11 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +414 -5
- data/README.md +1 -1
- data/bundler.gemspec +2 -3
- data/exe/bundle +7 -8
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/cache.rb +1 -1
- data/lib/bundler/cli/check.rb +4 -2
- data/lib/bundler/cli/common.rb +15 -2
- data/lib/bundler/cli/doctor.rb +24 -5
- data/lib/bundler/cli/exec.rb +1 -6
- data/lib/bundler/cli/gem.rb +130 -26
- data/lib/bundler/cli/info.rb +16 -4
- data/lib/bundler/cli/install.rb +12 -27
- data/lib/bundler/cli/issue.rb +4 -3
- data/lib/bundler/cli/list.rb +7 -1
- data/lib/bundler/cli/lock.rb +5 -1
- data/lib/bundler/cli/open.rb +1 -2
- data/lib/bundler/cli/outdated.rb +10 -11
- data/lib/bundler/cli/platform.rb +1 -1
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/update.rb +17 -8
- data/lib/bundler/cli.rb +41 -55
- data/lib/bundler/compact_index_client/cache.rb +0 -9
- data/lib/bundler/compact_index_client/updater.rb +10 -11
- data/lib/bundler/compact_index_client.rb +2 -8
- data/lib/bundler/current_ruby.rb +5 -4
- data/lib/bundler/definition.rb +147 -290
- data/lib/bundler/dependency.rb +5 -7
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +67 -66
- data/lib/bundler/endpoint_specification.rb +21 -11
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/environment_preserver.rb +4 -1
- data/lib/bundler/errors.rb +19 -3
- data/lib/bundler/feature_flag.rb +0 -4
- data/lib/bundler/fetcher/compact_index.rb +10 -15
- data/lib/bundler/fetcher/downloader.rb +9 -6
- data/lib/bundler/fetcher/index.rb +0 -27
- data/lib/bundler/fetcher.rb +10 -16
- data/lib/bundler/friendly_errors.rb +5 -32
- data/lib/bundler/gem_helper.rb +21 -16
- data/lib/bundler/index.rb +2 -7
- data/lib/bundler/injector.rb +12 -3
- data/lib/bundler/inline.rb +2 -1
- data/lib/bundler/installer/gem_installer.rb +4 -22
- data/lib/bundler/installer/parallel_installer.rb +36 -15
- data/lib/bundler/installer/standalone.rb +14 -9
- data/lib/bundler/installer.rb +8 -17
- data/lib/bundler/lazy_specification.rb +23 -2
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +16 -45
- 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 +23 -15
- data/lib/bundler/man/bundle-config.1.ronn +24 -17
- 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 +14 -1
- data/lib/bundler/man/bundle-gem.1.ronn +16 -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 +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 +5 -5
- data/lib/bundler/man/bundle-update.1.ronn +5 -4
- 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 +22 -0
- data/lib/bundler/plugin/index.rb +4 -1
- data/lib/bundler/plugin/installer.rb +10 -10
- data/lib/bundler/plugin/source_list.rb +4 -0
- data/lib/bundler/plugin.rb +28 -8
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/psyched_yaml.rb +1 -13
- data/lib/bundler/remote_specification.rb +7 -0
- data/lib/bundler/resolver/spec_group.rb +1 -25
- data/lib/bundler/resolver.rb +55 -147
- data/lib/bundler/retry.rb +1 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +30 -8
- data/lib/bundler/rubygems_gem_installer.rb +68 -1
- data/lib/bundler/rubygems_integration.rb +43 -60
- data/lib/bundler/runtime.rb +18 -11
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +96 -20
- data/lib/bundler/setup.rb +2 -2
- data/lib/bundler/shared_helpers.rb +4 -19
- data/lib/bundler/source/git/git_proxy.rb +8 -6
- data/lib/bundler/source/git.rb +22 -4
- data/lib/bundler/source/metadata.rb +1 -5
- data/lib/bundler/source/path/installer.rb +1 -1
- data/lib/bundler/source/path.rb +3 -1
- data/lib/bundler/source/rubygems.rb +111 -106
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +21 -0
- data/lib/bundler/source_list.rb +100 -60
- data/lib/bundler/source_map.rb +58 -0
- data/lib/bundler/spec_set.rb +17 -31
- data/lib/bundler/stub_specification.rb +8 -0
- data/lib/bundler/templates/Executable.bundler +7 -7
- 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 +5 -3
- data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -6
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +18 -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 +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.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 +5 -5
- 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/tmpdir/lib/tmpdir.rb +1 -1
- 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 +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 +19 -4
- data/lib/bundler.rb +28 -31
- metadata +27 -9
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -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
|
@@ -79,7 +79,7 @@ Do not allow any gem to be updated past latest \fB\-\-patch\fR | \fB\-\-minor\fR
|
|
79
79
|
.
|
80
80
|
.TP
|
81
81
|
\fB\-\-conservative\fR
|
82
|
-
Use bundle install conservative update behavior and do not allow
|
82
|
+
Use bundle install conservative update behavior and do not allow indirect dependencies to be updated\.
|
83
83
|
.
|
84
84
|
.SH "UPDATING ALL GEMS"
|
85
85
|
If you run \fBbundle update \-\-all\fR, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources\.
|
@@ -208,13 +208,13 @@ In this case, the two gems have their own set of dependencies, but they share \f
|
|
208
208
|
In short, by default, when you update a gem using \fBbundle update\fR, bundler will update all dependencies of that gem, including those that are also dependencies of another gem\.
|
209
209
|
.
|
210
210
|
.P
|
211
|
-
To prevent updating
|
211
|
+
To prevent updating indirect dependencies, prior to version 1\.14 the only option was the \fBCONSERVATIVE UPDATING\fR behavior in bundle install(1) \fIbundle\-install\.1\.html\fR:
|
212
212
|
.
|
213
213
|
.P
|
214
214
|
In this scenario, updating the \fBthin\fR version manually in the Gemfile(5), and then running bundle install(1) \fIbundle\-install\.1\.html\fR will only update \fBdaemons\fR and \fBeventmachine\fR, but not \fBrack\fR\. For more information, see the \fBCONSERVATIVE UPDATING\fR section of bundle install(1) \fIbundle\-install\.1\.html\fR\.
|
215
215
|
.
|
216
216
|
.P
|
217
|
-
Starting with 1\.14, specifying the \fB\-\-conservative\fR option will also prevent
|
217
|
+
Starting with 1\.14, specifying the \fB\-\-conservative\fR option will also prevent indirect dependencies from being updated\.
|
218
218
|
.
|
219
219
|
.SH "PATCH LEVEL OPTIONS"
|
220
220
|
Version 1\.14 introduced 4 patch\-level options that will influence how gem versions are resolved\. One of the following options can be used: \fB\-\-patch\fR, \fB\-\-minor\fR or \fB\-\-major\fR\. \fB\-\-strict\fR can be added to further influence resolution\.
|
@@ -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.
|
@@ -80,7 +81,7 @@ gem.
|
|
80
81
|
Do not allow any gem to be updated past latest `--patch` | `--minor` | `--major`.
|
81
82
|
|
82
83
|
* `--conservative`:
|
83
|
-
Use bundle install conservative update behavior and do not allow
|
84
|
+
Use bundle install conservative update behavior and do not allow indirect dependencies to be updated.
|
84
85
|
|
85
86
|
## UPDATING ALL GEMS
|
86
87
|
|
@@ -195,7 +196,7 @@ In short, by default, when you update a gem using `bundle update`, bundler will
|
|
195
196
|
update all dependencies of that gem, including those that are also dependencies
|
196
197
|
of another gem.
|
197
198
|
|
198
|
-
To prevent updating
|
199
|
+
To prevent updating indirect dependencies, prior to version 1.14 the only option
|
199
200
|
was the `CONSERVATIVE UPDATING` behavior in [bundle install(1)](bundle-install.1.html):
|
200
201
|
|
201
202
|
In this scenario, updating the `thin` version manually in the Gemfile(5),
|
@@ -203,7 +204,7 @@ and then running [bundle install(1)](bundle-install.1.html) will only update `da
|
|
203
204
|
but not `rack`. For more information, see the `CONSERVATIVE UPDATING` section
|
204
205
|
of [bundle install(1)](bundle-install.1.html).
|
205
206
|
|
206
|
-
Starting with 1.14, specifying the `--conservative` option will also prevent
|
207
|
+
Starting with 1.14, specifying the `--conservative` option will also prevent indirect
|
207
208
|
dependencies from being updated.
|
208
209
|
|
209
210
|
## PATCH LEVEL OPTIONS
|
@@ -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"
|
@@ -140,6 +140,13 @@ module Bundler
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
+
# Set internal representation to fetch the gems/specs locally.
|
144
|
+
#
|
145
|
+
# When this is called, the source should try to fetch the specs and
|
146
|
+
# install from the local system.
|
147
|
+
def local!
|
148
|
+
end
|
149
|
+
|
143
150
|
# Set internal representation to fetch the gems/specs from remote.
|
144
151
|
#
|
145
152
|
# When this is called, the source should try to fetch the specs and
|
@@ -237,6 +244,20 @@ module Bundler
|
|
237
244
|
specs.unmet_dependency_names
|
238
245
|
end
|
239
246
|
|
247
|
+
# Used by definition.
|
248
|
+
#
|
249
|
+
# Note: Do not override if you don't know what you are doing.
|
250
|
+
def spec_names
|
251
|
+
specs.spec_names
|
252
|
+
end
|
253
|
+
|
254
|
+
# Used by definition.
|
255
|
+
#
|
256
|
+
# Note: Do not override if you don't know what you are doing.
|
257
|
+
def add_dependency_names(names)
|
258
|
+
@dependencies |= Array(names)
|
259
|
+
end
|
260
|
+
|
240
261
|
# Note: Do not override if you don't know what you are doing.
|
241
262
|
def can_lock?(spec)
|
242
263
|
spec.source == self
|
@@ -262,6 +283,7 @@ module Bundler
|
|
262
283
|
def to_s
|
263
284
|
"plugin source for #{@type} with uri #{@uri}"
|
264
285
|
end
|
286
|
+
alias_method :identifier, :to_s
|
265
287
|
|
266
288
|
# Note: Do not override if you don't know what you are doing.
|
267
289
|
def include?(other)
|
data/lib/bundler/plugin/index.rb
CHANGED
@@ -74,7 +74,10 @@ module Bundler
|
|
74
74
|
def unregister_plugin(name)
|
75
75
|
@commands.delete_if {|_, v| v == name }
|
76
76
|
@sources.delete_if {|_, v| v == name }
|
77
|
-
@hooks.each
|
77
|
+
@hooks.each do |hook, names|
|
78
|
+
names.delete(name)
|
79
|
+
@hooks.delete(hook) if names.empty?
|
80
|
+
end
|
78
81
|
@plugin_paths.delete(name)
|
79
82
|
@load_paths.delete(name)
|
80
83
|
save_index
|
@@ -16,15 +16,13 @@ module Bundler
|
|
16
16
|
|
17
17
|
version = options[:version] || [">= 0"]
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
install_rubygems(names, version, sources)
|
27
|
-
end
|
19
|
+
if options[:git]
|
20
|
+
install_git(names, version, options)
|
21
|
+
elsif options[:local_git]
|
22
|
+
install_local_git(names, version, options)
|
23
|
+
else
|
24
|
+
sources = options[:source] || Gem.sources
|
25
|
+
install_rubygems(names, version, sources)
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
@@ -79,10 +77,12 @@ module Bundler
|
|
79
77
|
source_list = SourceList.new
|
80
78
|
|
81
79
|
source_list.add_git_source(git_source_options) if git_source_options
|
82
|
-
source_list.
|
80
|
+
Array(rubygems_source).each {|remote| source_list.add_global_rubygems_remote(remote) } if rubygems_source
|
83
81
|
|
84
82
|
deps = names.map {|name| Dependency.new name, version }
|
85
83
|
|
84
|
+
Bundler.configure_gem_home_and_path(Plugin.root)
|
85
|
+
|
86
86
|
definition = Definition.new(nil, deps, source_list, true)
|
87
87
|
install_definition(definition)
|
88
88
|
end
|
data/lib/bundler/plugin.rb
CHANGED
@@ -13,6 +13,7 @@ module Bundler
|
|
13
13
|
class MalformattedPlugin < PluginError; end
|
14
14
|
class UndefinedCommandError < PluginError; end
|
15
15
|
class UnknownSourceError < PluginError; end
|
16
|
+
class PluginInstallError < PluginError; end
|
16
17
|
|
17
18
|
PLUGIN_FILE_NAME = "plugins.rb".freeze
|
18
19
|
|
@@ -38,12 +39,11 @@ module Bundler
|
|
38
39
|
specs = Installer.new.install(names, options)
|
39
40
|
|
40
41
|
save_plugins names, specs
|
41
|
-
rescue PluginError
|
42
|
+
rescue PluginError
|
42
43
|
specs_to_delete = specs.select {|k, _v| names.include?(k) && !index.commands.values.include?(k) }
|
43
44
|
specs_to_delete.each_value {|spec| Bundler.rm_rf(spec.full_gem_path) }
|
44
45
|
|
45
|
-
|
46
|
-
Bundler.ui.error "Failed to install the following plugins: #{names_list}. The underlying error was: #{e.message}.\n #{e.backtrace.join("\n ")}"
|
46
|
+
raise
|
47
47
|
end
|
48
48
|
|
49
49
|
# Uninstalls plugins by the given names
|
@@ -105,6 +105,7 @@ module Bundler
|
|
105
105
|
else
|
106
106
|
builder.eval_gemfile(gemfile)
|
107
107
|
end
|
108
|
+
builder.check_primary_source_safety
|
108
109
|
definition = builder.to_definition(nil, true)
|
109
110
|
|
110
111
|
return if definition.dependencies.empty?
|
@@ -163,7 +164,7 @@ module Bundler
|
|
163
164
|
end
|
164
165
|
|
165
166
|
# To be called from Cli class to pass the command and argument to
|
166
|
-
#
|
167
|
+
# appropriate plugin class
|
167
168
|
def exec_command(command, args)
|
168
169
|
raise UndefinedCommandError, "Command `#{command}` not found" unless command? command
|
169
170
|
|
@@ -182,7 +183,7 @@ module Bundler
|
|
182
183
|
!index.source_plugin(name.to_s).nil?
|
183
184
|
end
|
184
185
|
|
185
|
-
# @return [Class] that handles the source. The
|
186
|
+
# @return [Class] that handles the source. The class includes API::Source
|
186
187
|
def source(name)
|
187
188
|
raise UnknownSourceError, "Source #{name} not found" unless source? name
|
188
189
|
|
@@ -244,10 +245,11 @@ module Bundler
|
|
244
245
|
# @param [Array<String>] names of inferred source plugins that can be ignored
|
245
246
|
def save_plugins(plugins, specs, optional_plugins = [])
|
246
247
|
plugins.each do |name|
|
248
|
+
next if index.installed?(name)
|
249
|
+
|
247
250
|
spec = specs[name]
|
248
|
-
|
249
|
-
|
250
|
-
Bundler.ui.info "Installed plugin #{name}" if installed
|
251
|
+
|
252
|
+
save_plugin(name, spec, optional_plugins.include?(name))
|
251
253
|
end
|
252
254
|
end
|
253
255
|
|
@@ -262,6 +264,22 @@ module Bundler
|
|
262
264
|
raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin." unless plugin_file.file?
|
263
265
|
end
|
264
266
|
|
267
|
+
# Validates and registers a plugin.
|
268
|
+
#
|
269
|
+
# @param [String] name the name of the plugin
|
270
|
+
# @param [Specification] spec of installed plugin
|
271
|
+
# @param [Boolean] optional_plugin, removed if there is conflict with any
|
272
|
+
# other plugin (used for default source plugins)
|
273
|
+
#
|
274
|
+
# @raise [PluginInstallError] if validation or registration raises any error
|
275
|
+
def save_plugin(name, spec, optional_plugin = false)
|
276
|
+
validate_plugin! Pathname.new(spec.full_gem_path)
|
277
|
+
installed = register_plugin(name, spec, optional_plugin)
|
278
|
+
Bundler.ui.info "Installed plugin #{name}" if installed
|
279
|
+
rescue PluginError => e
|
280
|
+
raise PluginInstallError, "Failed to install plugin `#{spec.name}`, due to #{e.class} (#{e.message})"
|
281
|
+
end
|
282
|
+
|
265
283
|
# Runs the plugins.rb file in an isolated namespace, records the plugin
|
266
284
|
# actions it registers for and then passes the data to index to be stored.
|
267
285
|
#
|
@@ -308,6 +326,8 @@ module Bundler
|
|
308
326
|
#
|
309
327
|
# @param [String] name of the plugin
|
310
328
|
def load_plugin(name)
|
329
|
+
return unless name && !name.empty?
|
330
|
+
|
311
331
|
# Need to ensure before this that plugin root where the rest of gems
|
312
332
|
# are installed to be on load path to support plugin deps. Currently not
|
313
333
|
# done to avoid conflicts
|
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
|
@@ -27,6 +27,13 @@ module Bundler
|
|
27
27
|
@platform = _remote_specification.platform
|
28
28
|
end
|
29
29
|
|
30
|
+
# A fallback is included because the original version of the specification
|
31
|
+
# API didn't include that field, so some marshalled specs in the index have it
|
32
|
+
# set to +nil+.
|
33
|
+
def required_rubygems_version
|
34
|
+
@required_rubygems_version ||= _remote_specification.required_rubygems_version || Gem::Requirement.default
|
35
|
+
end
|
36
|
+
|
30
37
|
def full_name
|
31
38
|
if platform == Gem::Platform::RUBY || platform.nil?
|
32
39
|
"#{@name}-#{@version}"
|
@@ -21,14 +21,10 @@ module Bundler
|
|
21
21
|
@version = exemplary_spec.version
|
22
22
|
@source = exemplary_spec.source
|
23
23
|
|
24
|
-
@all_platforms = relevant_platforms
|
25
24
|
@activated_platforms = relevant_platforms
|
26
25
|
@dependencies = Hash.new do |dependencies, platforms|
|
27
26
|
dependencies[platforms] = dependencies_for(platforms)
|
28
27
|
end
|
29
|
-
@partitioned_dependency_names = Hash.new do |partitioned_dependency_names, platforms|
|
30
|
-
partitioned_dependency_names[platforms] = partitioned_dependency_names_for(platforms)
|
31
|
-
end
|
32
28
|
@specs = specs
|
33
29
|
end
|
34
30
|
|
@@ -45,14 +41,6 @@ module Bundler
|
|
45
41
|
end.flatten.compact.uniq
|
46
42
|
end
|
47
43
|
|
48
|
-
def activate_platform!(platform)
|
49
|
-
self.activated_platforms = [platform]
|
50
|
-
end
|
51
|
-
|
52
|
-
def activate_all_platforms!
|
53
|
-
self.activated_platforms = @all_platforms
|
54
|
-
end
|
55
|
-
|
56
44
|
def to_s
|
57
45
|
activated_platforms_string = sorted_activated_platforms.join(", ")
|
58
46
|
"#{name} (#{version}) (#{activated_platforms_string})"
|
@@ -62,10 +50,6 @@ module Bundler
|
|
62
50
|
@dependencies[activated_platforms]
|
63
51
|
end
|
64
52
|
|
65
|
-
def partitioned_dependency_names_for_activated_platforms
|
66
|
-
@partitioned_dependency_names[activated_platforms]
|
67
|
-
end
|
68
|
-
|
69
53
|
def ==(other)
|
70
54
|
return unless other.is_a?(SpecGroup)
|
71
55
|
name == other.name &&
|
@@ -100,14 +84,6 @@ module Bundler
|
|
100
84
|
end.flatten
|
101
85
|
end
|
102
86
|
|
103
|
-
def partitioned_dependency_names_for(platforms)
|
104
|
-
return @dependencies[platforms].map(&:name), [] if platforms.size == 1
|
105
|
-
|
106
|
-
@dependencies[platforms].partition do |dep_proxy|
|
107
|
-
@dependencies[platforms].count {|dp| dp.dep == dep_proxy.dep } == platforms.size
|
108
|
-
end.map {|deps| deps.map(&:name) }
|
109
|
-
end
|
110
|
-
|
111
87
|
def __dependencies(platform)
|
112
88
|
dependencies = []
|
113
89
|
@specs[platform].first.dependencies.each do |dep|
|
@@ -119,7 +95,7 @@ module Bundler
|
|
119
95
|
|
120
96
|
def metadata_dependencies(platform)
|
121
97
|
spec = @specs[platform].first
|
122
|
-
return []
|
98
|
+
return [] if spec.is_a?(LazySpecification)
|
123
99
|
dependencies = []
|
124
100
|
if !spec.required_ruby_version.nil? && !spec.required_ruby_version.none?
|
125
101
|
dependencies << DepProxy.get_proxy(Gem::Dependency.new("Ruby\0", spec.required_ruby_version), platform)
|