bundler 2.5.11 → 2.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +84 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/check.rb +1 -1
- data/lib/bundler/cli/fund.rb +1 -1
- data/lib/bundler/cli/gem.rb +8 -15
- data/lib/bundler/cli.rb +26 -26
- data/lib/bundler/compact_index_client/cache.rb +47 -81
- data/lib/bundler/compact_index_client/parser.rb +84 -0
- data/lib/bundler/compact_index_client.rb +51 -80
- data/lib/bundler/definition.rb +50 -24
- data/lib/bundler/endpoint_specification.rb +11 -0
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/fetcher/compact_index.rb +15 -24
- data/lib/bundler/force_platform.rb +0 -2
- data/lib/bundler/gem_helpers.rb +14 -7
- data/lib/bundler/injector.rb +1 -4
- data/lib/bundler/installer/gem_installer.rb +0 -1
- data/lib/bundler/installer/standalone.rb +0 -3
- data/lib/bundler/installer.rb +1 -3
- data/lib/bundler/lazy_specification.rb +1 -0
- data/lib/bundler/man/bundle-add.1 +1 -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 +2 -2
- data/lib/bundler/man/bundle-config.1.ronn +1 -1
- data/lib/bundler/man/bundle-console.1 +1 -1
- 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 +7 -1
- data/lib/bundler/man/bundle-gem.1.ronn +11 -0
- data/lib/bundler/man/bundle-help.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 +1 -1
- 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-plugin.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 +1 -1
- data/lib/bundler/man/bundle-version.1 +1 -1
- data/lib/bundler/man/bundle-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/plugin/api/source.rb +1 -0
- data/lib/bundler/resolver/base.rb +4 -0
- data/lib/bundler/resolver/candidate.rb +4 -16
- data/lib/bundler/resolver/package.rb +4 -0
- data/lib/bundler/resolver/spec_group.rb +20 -2
- data/lib/bundler/resolver.rb +18 -9
- data/lib/bundler/rubygems_ext.rb +76 -14
- data/lib/bundler/rubygems_gem_installer.rb +35 -2
- data/lib/bundler/rubygems_integration.rb +16 -2
- data/lib/bundler/runtime.rb +1 -6
- data/lib/bundler/self_manager.rb +22 -2
- data/lib/bundler/settings.rb +12 -8
- data/lib/bundler/setup.rb +3 -0
- data/lib/bundler/shared_helpers.rb +2 -2
- data/lib/bundler/source/git.rb +43 -16
- data/lib/bundler/source/path.rb +0 -13
- data/lib/bundler/source/rubygems.rb +26 -13
- data/lib/bundler/spec_set.rb +15 -13
- data/lib/bundler/stub_specification.rb +8 -0
- data/lib/bundler/vendored_net_http.rb +17 -6
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/yaml_serializer.rb +2 -9
- data/lib/bundler.rb +6 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60cb5ee8526a6f8eb3c413e7d3d2ae8c9b32315685862943fc2a956f2fdcd5a1
|
4
|
+
data.tar.gz: 52aa4c3a435ed97c8dbc2adcfa51dc6d2113fefcb5020df0a5b0be3b605cc49f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afafe4e932d1840de3938e609f45555b1fbdf3fea481ee6d395a1f1458d579606d2f5ac64edc90d74799d9b117aae3fd1028b6d3a660df97e087bb9f6475d583
|
7
|
+
data.tar.gz: fd8907298e40c98124857ea7bf2594953d962946b66da695ce929db2623e67dacbee7dec6500a3dfb89cb6308377a26c305a25cd28a7083432ec10baf0d59810
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,87 @@
|
|
1
|
+
# 2.5.17 (August 1, 2024)
|
2
|
+
|
3
|
+
## Enhancements:
|
4
|
+
|
5
|
+
- Print better log message when current platform is not present in the lockfile [#7891](https://github.com/rubygems/rubygems/pull/7891)
|
6
|
+
- Explicitly encode `Gem::Dependency` to yaml [#7867](https://github.com/rubygems/rubygems/pull/7867)
|
7
|
+
- Enable lockfile checksums on future Bundler 3 when there's no previous lockfile [#7805](https://github.com/rubygems/rubygems/pull/7805)
|
8
|
+
|
9
|
+
## Bug fixes:
|
10
|
+
|
11
|
+
- Fix truffleruby removing gems from lockfile [#7795](https://github.com/rubygems/rubygems/pull/7795)
|
12
|
+
- Fix `bundle check` exit code when gem git source is not checked out [#7894](https://github.com/rubygems/rubygems/pull/7894)
|
13
|
+
- Generate gems.rb from Gemfile.tt template for `bundle-gem` [#7853](https://github.com/rubygems/rubygems/pull/7853)
|
14
|
+
- Fix git source cache being used as the install location [#4469](https://github.com/rubygems/rubygems/pull/4469)
|
15
|
+
- Fix `bundle exec gem uninstall` [#7886](https://github.com/rubygems/rubygems/pull/7886)
|
16
|
+
|
17
|
+
# 2.5.16 (July 18, 2024)
|
18
|
+
|
19
|
+
## Bug fixes:
|
20
|
+
|
21
|
+
- Fix platform removal regression when `platforms:` used in the Gemfile [#7864](https://github.com/rubygems/rubygems/pull/7864)
|
22
|
+
- Fix standalone script when default gems with extensions are used [#7870](https://github.com/rubygems/rubygems/pull/7870)
|
23
|
+
- Fix another case of `bundle lock --add-platform` doing nothing [#7848](https://github.com/rubygems/rubygems/pull/7848)
|
24
|
+
- Fix bad error messages when using `bundle add` with frozen mode set [#7845](https://github.com/rubygems/rubygems/pull/7845)
|
25
|
+
- Fix generic platform gems getting incorrectly removed from lockfile [#7833](https://github.com/rubygems/rubygems/pull/7833)
|
26
|
+
|
27
|
+
## Performance:
|
28
|
+
|
29
|
+
- Use `caller_locations` instead of splitting `caller` [#7708](https://github.com/rubygems/rubygems/pull/7708)
|
30
|
+
|
31
|
+
# 2.5.15 (July 9, 2024)
|
32
|
+
|
33
|
+
## Enhancements:
|
34
|
+
|
35
|
+
- Support `--no-test`, `--no-ci`, and `--no-linter` options [#7780](https://github.com/rubygems/rubygems/pull/7780)
|
36
|
+
- Allow bundle command in new gems with invalid metadata [#7707](https://github.com/rubygems/rubygems/pull/7707)
|
37
|
+
|
38
|
+
## Bug fixes:
|
39
|
+
|
40
|
+
- Protect creating RubyGems binstubs with a file lock [#7841](https://github.com/rubygems/rubygems/pull/7841)
|
41
|
+
- Only allow valid values for `--test`, `--ci`, and `--linter` options [#7801](https://github.com/rubygems/rubygems/pull/7801)
|
42
|
+
- Fix `bundle lock --add-platform <current_platform>` doing nothing [#7803](https://github.com/rubygems/rubygems/pull/7803)
|
43
|
+
- Print a proper error when bin dir does not have writable permission bit [#7794](https://github.com/rubygems/rubygems/pull/7794)
|
44
|
+
|
45
|
+
## Documentation:
|
46
|
+
|
47
|
+
- Regenerate bundler docs for June 2024 [#7787](https://github.com/rubygems/rubygems/pull/7787)
|
48
|
+
|
49
|
+
# 2.5.14 (June 21, 2024)
|
50
|
+
|
51
|
+
## Bug fixes:
|
52
|
+
|
53
|
+
- Fix credentials being re-added when re-resolving without a full unlock [#7767](https://github.com/rubygems/rubygems/pull/7767)
|
54
|
+
- Fix `bundle update <gem_name>` edge case [#7770](https://github.com/rubygems/rubygems/pull/7770)
|
55
|
+
- Fix `bundle fund` when the gemfile contains optional groups [#7758](https://github.com/rubygems/rubygems/pull/7758)
|
56
|
+
|
57
|
+
# 2.5.13 (June 14, 2024)
|
58
|
+
|
59
|
+
## Bug fixes:
|
60
|
+
|
61
|
+
- Fix funding metadata not being printed in some situations [#7746](https://github.com/rubygems/rubygems/pull/7746)
|
62
|
+
- Make sure to not re-resolve when a not fully specific local platform is locked [#7751](https://github.com/rubygems/rubygems/pull/7751)
|
63
|
+
- Don't print bug report template when bin dir is not writable [#7748](https://github.com/rubygems/rubygems/pull/7748)
|
64
|
+
|
65
|
+
# 2.5.12 (June 13, 2024)
|
66
|
+
|
67
|
+
## Enhancements:
|
68
|
+
|
69
|
+
- Keep credentials in lockfile if they are already there [#7720](https://github.com/rubygems/rubygems/pull/7720)
|
70
|
+
- Auto switch to locked bundler version even when using binstubs [#7719](https://github.com/rubygems/rubygems/pull/7719)
|
71
|
+
- Don't validate local gemspecs twice unnecessarily [#7725](https://github.com/rubygems/rubygems/pull/7725)
|
72
|
+
- Improve default gem handling by treating default gems as any other gem [#7673](https://github.com/rubygems/rubygems/pull/7673)
|
73
|
+
|
74
|
+
## Bug fixes:
|
75
|
+
|
76
|
+
- Fix slow and incorrect resolution when adding `sorbet` to a Gemfile and the lockfile only includes "RUBY" in the platforms section [#7731](https://github.com/rubygems/rubygems/pull/7731)
|
77
|
+
- Fix duplicated config keys generated when `fallback_timeout` uri option is used [#7704](https://github.com/rubygems/rubygems/pull/7704)
|
78
|
+
- Fix `bundle exec` no longer working in truffleruby after explicit `require` of `pathname` was removed [#7703](https://github.com/rubygems/rubygems/pull/7703)
|
79
|
+
- Don't let `bundle config` report a path without a Gemfile as "local app" [#7687](https://github.com/rubygems/rubygems/pull/7687)
|
80
|
+
|
81
|
+
## Documentation:
|
82
|
+
|
83
|
+
- Clarify BUNDLE_USER_CONFIG is a file [#7668](https://github.com/rubygems/rubygems/pull/7668)
|
84
|
+
|
1
85
|
# 2.5.11 (May 28, 2024)
|
2
86
|
|
3
87
|
## Deprecations:
|
@@ -4,8 +4,8 @@ module Bundler
|
|
4
4
|
# Represents metadata from when the Bundler gem was built.
|
5
5
|
module BuildMetadata
|
6
6
|
# begin ivars
|
7
|
-
@built_at = "2024-
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2024-08-01".freeze
|
8
|
+
@git_commit_sha = "74d92b2502".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/bundler/cli/check.rb
CHANGED
@@ -17,7 +17,7 @@ module Bundler
|
|
17
17
|
begin
|
18
18
|
definition.resolve_only_locally!
|
19
19
|
not_installed = definition.missing_specs
|
20
|
-
rescue GemNotFound, SolveFailure
|
20
|
+
rescue GemNotFound, GitError, SolveFailure
|
21
21
|
Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
|
22
22
|
Bundler.ui.warn "Install missing gems with `bundle install`."
|
23
23
|
exit 1
|
data/lib/bundler/cli/fund.rb
CHANGED
data/lib/bundler/cli/gem.rb
CHANGED
@@ -32,7 +32,6 @@ module Bundler
|
|
32
32
|
|
33
33
|
validate_ext_name if @extension
|
34
34
|
validate_rust_builder_rubygems_version if @extension == "rust"
|
35
|
-
travis_removal_info
|
36
35
|
end
|
37
36
|
|
38
37
|
def run
|
@@ -80,7 +79,7 @@ module Bundler
|
|
80
79
|
ensure_safe_gem_name(name, constant_array)
|
81
80
|
|
82
81
|
templates = {
|
83
|
-
"
|
82
|
+
"Gemfile.tt" => Bundler.preferred_gemfile_name,
|
84
83
|
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
|
85
84
|
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
|
86
85
|
"sig/newgem.rbs.tt" => "sig/#{namespaced_path}.rbs",
|
@@ -276,6 +275,7 @@ module Bundler
|
|
276
275
|
end
|
277
276
|
|
278
277
|
def ask_and_set_test_framework
|
278
|
+
return if skip?(:test)
|
279
279
|
test_framework = options[:test] || Bundler.settings["gem.test"]
|
280
280
|
|
281
281
|
if test_framework.to_s.empty?
|
@@ -301,6 +301,10 @@ module Bundler
|
|
301
301
|
test_framework
|
302
302
|
end
|
303
303
|
|
304
|
+
def skip?(option)
|
305
|
+
options.key?(option) && options[option].nil?
|
306
|
+
end
|
307
|
+
|
304
308
|
def hint_text(setting)
|
305
309
|
if Bundler.settings["gem.#{setting}"] == false
|
306
310
|
"Your choice will only be applied to this gem."
|
@@ -311,6 +315,7 @@ module Bundler
|
|
311
315
|
end
|
312
316
|
|
313
317
|
def ask_and_set_ci
|
318
|
+
return if skip?(:ci)
|
314
319
|
ci_template = options[:ci] || Bundler.settings["gem.ci"]
|
315
320
|
|
316
321
|
if ci_template.to_s.empty?
|
@@ -342,6 +347,7 @@ module Bundler
|
|
342
347
|
end
|
343
348
|
|
344
349
|
def ask_and_set_linter
|
350
|
+
return if skip?(:linter)
|
345
351
|
linter_template = options[:linter] || Bundler.settings["gem.linter"]
|
346
352
|
linter_template = deprecated_rubocop_option if linter_template.nil?
|
347
353
|
|
@@ -448,19 +454,6 @@ module Bundler
|
|
448
454
|
"1.3"
|
449
455
|
end
|
450
456
|
|
451
|
-
# TODO: remove at next minor release
|
452
|
-
def travis_removal_info
|
453
|
-
if options[:ci] == "travis"
|
454
|
-
Bundler.ui.error "Support for Travis CI was removed from gem skeleton generator."
|
455
|
-
exit 1
|
456
|
-
end
|
457
|
-
|
458
|
-
if Bundler.settings["gem.ci"] == "travis"
|
459
|
-
Bundler.ui.error "Support for Travis CI was removed from gem skeleton generator, but it is present in bundle config. Please configure another provider using `bundle config set gem.ci SERVICE` (where SERVICE is one of github/gitlab/circle) or unset configuration using `bundle config unset gem.ci`."
|
460
|
-
exit 1
|
461
|
-
end
|
462
|
-
end
|
463
|
-
|
464
457
|
def validate_rust_builder_rubygems_version
|
465
458
|
if Gem::Version.new(rust_builder_required_rubygems_version) > Gem.rubygems_version
|
466
459
|
Bundler.ui.error "Your RubyGems version (#{Gem.rubygems_version}) is too old to build Rust extension. Please update your RubyGems using `gem update --system` or any other way and try again."
|
data/lib/bundler/cli.rb
CHANGED
@@ -65,7 +65,7 @@ module Bundler
|
|
65
65
|
Bundler.reset_settings_and_root!
|
66
66
|
end
|
67
67
|
|
68
|
-
Bundler.
|
68
|
+
Bundler.auto_switch
|
69
69
|
|
70
70
|
Bundler.settings.set_command_option_if_given :retry, options[:retry]
|
71
71
|
|
@@ -110,8 +110,8 @@ module Bundler
|
|
110
110
|
default_task(Bundler.feature_flag.default_cli_command)
|
111
111
|
|
112
112
|
class_option "no-color", type: :boolean, desc: "Disable colorization in output"
|
113
|
-
class_option "retry",
|
114
|
-
|
113
|
+
class_option "retry", type: :numeric, aliases: "-r", banner: "NUM",
|
114
|
+
desc: "Specify the number of times you wish to attempt network commands"
|
115
115
|
class_option "verbose", type: :boolean, desc: "Enable verbose output mode", aliases: "-V"
|
116
116
|
|
117
117
|
def help(cli = nil)
|
@@ -260,15 +260,15 @@ module Bundler
|
|
260
260
|
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
|
261
261
|
method_option "group", aliases: "-g", type: :array, banner: "Update a specific group"
|
262
262
|
method_option "jobs", aliases: "-j", type: :numeric, banner: "Specify the number of jobs to run in parallel"
|
263
|
-
method_option "local", type: :boolean, banner:
|
264
|
-
method_option "quiet", type: :boolean, banner:
|
263
|
+
method_option "local", type: :boolean, banner: "Do not attempt to fetch gems remotely and use the gem cache instead"
|
264
|
+
method_option "quiet", type: :boolean, banner: "Only output warnings and errors."
|
265
265
|
method_option "source", type: :array, banner: "Update a specific source (and all gems associated with it)"
|
266
266
|
method_option "redownload", type: :boolean, aliases: "--force", banner: "Force downloading every gem."
|
267
267
|
method_option "ruby", type: :boolean, banner: "Update ruby specified in Gemfile.lock"
|
268
268
|
method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
|
269
|
-
method_option "patch", type: :boolean, banner:
|
270
|
-
method_option "minor", type: :boolean, banner:
|
271
|
-
method_option "major", type: :boolean, banner:
|
269
|
+
method_option "patch", type: :boolean, banner: "Prefer updating only to next patch version"
|
270
|
+
method_option "minor", type: :boolean, banner: "Prefer updating only to next minor version"
|
271
|
+
method_option "major", type: :boolean, banner: "Prefer updating to next major version (default)"
|
272
272
|
method_option "pre", type: :boolean, banner: "Always choose the highest allowed version when updating gems, regardless of prerelease status"
|
273
273
|
method_option "strict", type: :boolean, banner: "Do not allow any gem to be updated past latest --patch | --minor | --major"
|
274
274
|
method_option "conservative", type: :boolean, banner: "Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
|
@@ -397,11 +397,11 @@ module Bundler
|
|
397
397
|
end
|
398
398
|
|
399
399
|
desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
|
400
|
-
method_option "all",
|
401
|
-
|
402
|
-
|
400
|
+
method_option "all", type: :boolean,
|
401
|
+
default: Bundler.feature_flag.cache_all?,
|
402
|
+
banner: "Include all sources (including path and git)."
|
403
403
|
method_option "all-platforms", type: :boolean, banner: "Include gems for all platforms present in the lockfile, not only the current one"
|
404
|
-
method_option "cache-path", type: :string, banner:
|
404
|
+
method_option "cache-path", type: :string, banner: "Specify a different cache path than the default (vendor/cache)."
|
405
405
|
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
|
406
406
|
method_option "no-install", type: :boolean, banner: "Don't install the gems, only update the cache."
|
407
407
|
method_option "no-prune", type: :boolean, banner: "Don't remove stale gems from the cache."
|
@@ -550,10 +550,13 @@ module Bundler
|
|
550
550
|
method_option :rubocop, type: :boolean, desc: "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
|
551
551
|
method_option :changelog, type: :boolean, desc: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
|
552
552
|
method_option :test, type: :string, lazy_default: Bundler.settings["gem.test"] || "", aliases: "-t", banner: "Use the specified test framework for your library",
|
553
|
+
enum: %w[rspec minitest test-unit],
|
553
554
|
desc: "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
|
554
555
|
method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "",
|
556
|
+
enum: %w[github gitlab circle],
|
555
557
|
desc: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
|
556
558
|
method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "",
|
559
|
+
enum: %w[rubocop standard],
|
557
560
|
desc: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
|
558
561
|
method_option :github_username, type: :string, default: Bundler.settings["gem.github_username"], banner: "Set your username on GitHub", desc: "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
|
559
562
|
|
@@ -602,7 +605,7 @@ module Bundler
|
|
602
605
|
end
|
603
606
|
|
604
607
|
desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile", hide: true
|
605
|
-
method_option "source", type: :string, banner:
|
608
|
+
method_option "source", type: :string, banner: "Install gem from the given source"
|
606
609
|
method_option "group", type: :string, banner: "Install gem into a bundler group"
|
607
610
|
def inject(name, version)
|
608
611
|
SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
|
@@ -612,16 +615,16 @@ module Bundler
|
|
612
615
|
|
613
616
|
desc "lock", "Creates a lockfile without installing"
|
614
617
|
method_option "update", type: :array, lazy_default: true, banner: "ignore the existing lockfile, update all gems by default, or update list of given gems"
|
615
|
-
method_option "local", type: :boolean, default: false, banner:
|
616
|
-
method_option "print", type: :boolean, default: false, banner:
|
618
|
+
method_option "local", type: :boolean, default: false, banner: "do not attempt to fetch remote gemspecs and use the local gem cache only"
|
619
|
+
method_option "print", type: :boolean, default: false, banner: "print the lockfile to STDOUT instead of writing to the file system"
|
617
620
|
method_option "gemfile", type: :string, banner: "Use the specified gemfile instead of Gemfile"
|
618
621
|
method_option "lockfile", type: :string, default: nil, banner: "the path the lockfile should be written to"
|
619
622
|
method_option "full-index", type: :boolean, default: false, banner: "Fall back to using the single-file index of all gems"
|
620
623
|
method_option "add-platform", type: :array, default: [], banner: "Add a new platform to the lockfile"
|
621
|
-
method_option "remove-platform", type: :array, default: [], banner:
|
622
|
-
method_option "patch", type: :boolean, banner:
|
623
|
-
method_option "minor", type: :boolean, banner:
|
624
|
-
method_option "major", type: :boolean, banner:
|
624
|
+
method_option "remove-platform", type: :array, default: [], banner: "Remove a platform from the lockfile"
|
625
|
+
method_option "patch", type: :boolean, banner: "If updating, prefer updating only to next patch version"
|
626
|
+
method_option "minor", type: :boolean, banner: "If updating, prefer updating only to next minor version"
|
627
|
+
method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)"
|
625
628
|
method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status"
|
626
629
|
method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
|
627
630
|
method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
|
@@ -767,13 +770,10 @@ module Bundler
|
|
767
770
|
|
768
771
|
return unless SharedHelpers.md5_available?
|
769
772
|
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
dependencies("bundler").
|
775
|
-
map {|d| Gem::Version.new(d.first) }.
|
776
|
-
max
|
773
|
+
require_relative "vendored_uri"
|
774
|
+
remote = Source::Rubygems::Remote.new(Gem::URI("https://rubygems.org"))
|
775
|
+
cache_path = Bundler.user_cache.join("compact_index", remote.cache_slug)
|
776
|
+
latest = Bundler::CompactIndexClient.new(cache_path).latest_version("bundler")
|
777
777
|
return unless latest
|
778
778
|
|
779
779
|
current = Gem::Version.new(VERSION)
|
@@ -7,123 +7,89 @@ module Bundler
|
|
7
7
|
class Cache
|
8
8
|
attr_reader :directory
|
9
9
|
|
10
|
-
def initialize(directory)
|
10
|
+
def initialize(directory, fetcher = nil)
|
11
11
|
@directory = Pathname.new(directory).expand_path
|
12
|
-
|
13
|
-
|
12
|
+
@updater = Updater.new(fetcher) if fetcher
|
13
|
+
@mutex = Thread::Mutex.new
|
14
|
+
@endpoints = Set.new
|
15
|
+
|
16
|
+
@info_root = mkdir("info")
|
17
|
+
@special_characters_info_root = mkdir("info-special-characters")
|
18
|
+
@info_etag_root = mkdir("info-etags")
|
14
19
|
end
|
15
20
|
|
16
21
|
def names
|
17
|
-
|
22
|
+
fetch("names", names_path, names_etag_path)
|
18
23
|
end
|
19
24
|
|
20
|
-
def
|
21
|
-
|
25
|
+
def versions
|
26
|
+
fetch("versions", versions_path, versions_etag_path)
|
22
27
|
end
|
23
28
|
|
24
|
-
def
|
25
|
-
|
26
|
-
end
|
29
|
+
def info(name, remote_checksum = nil)
|
30
|
+
path = info_path(name)
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
name, versions_string, info_checksum = line.split(" ", 3)
|
34
|
-
info_checksums_by_name[name] = info_checksum || ""
|
35
|
-
versions_string.split(",") do |version|
|
36
|
-
delete = version.delete_prefix!("-")
|
37
|
-
version = version.split("-", 2).unshift(name)
|
38
|
-
if delete
|
39
|
-
versions_by_name[name].delete(version)
|
40
|
-
else
|
41
|
-
versions_by_name[name] << version
|
42
|
-
end
|
43
|
-
end
|
32
|
+
if remote_checksum && remote_checksum != SharedHelpers.checksum_for_file(path, :MD5)
|
33
|
+
fetch("info/#{name}", path, info_etag_path(name))
|
34
|
+
else
|
35
|
+
Bundler::CompactIndexClient.debug { "update skipped info/#{name} (#{remote_checksum ? "versions index checksum is nil" : "versions index checksum matches local"})" }
|
36
|
+
read(path)
|
44
37
|
end
|
45
|
-
|
46
|
-
[versions_by_name, info_checksums_by_name]
|
47
|
-
end
|
48
|
-
|
49
|
-
def versions_path
|
50
|
-
directory.join("versions")
|
51
38
|
end
|
52
39
|
|
53
|
-
def
|
54
|
-
|
40
|
+
def reset!
|
41
|
+
@mutex.synchronize { @endpoints.clear }
|
55
42
|
end
|
56
43
|
|
57
|
-
|
58
|
-
lines(versions_path).each_with_object({}) do |line, checksums|
|
59
|
-
parse_version_checksum(line, checksums)
|
60
|
-
end
|
61
|
-
end
|
44
|
+
private
|
62
45
|
|
63
|
-
def
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
46
|
+
def names_path = directory.join("names")
|
47
|
+
def names_etag_path = directory.join("names.etag")
|
48
|
+
def versions_path = directory.join("versions")
|
49
|
+
def versions_etag_path = directory.join("versions.etag")
|
68
50
|
|
69
51
|
def info_path(name)
|
70
52
|
name = name.to_s
|
53
|
+
# TODO: converge this into the info_root by hashing all filenames like info_etag_path
|
71
54
|
if /[^a-z0-9_-]/.match?(name)
|
72
55
|
name += "-#{SharedHelpers.digest(:MD5).hexdigest(name).downcase}"
|
73
|
-
|
56
|
+
@special_characters_info_root.join(name)
|
74
57
|
else
|
75
|
-
|
58
|
+
@info_root.join(name)
|
76
59
|
end
|
77
60
|
end
|
78
61
|
|
79
62
|
def info_etag_path(name)
|
80
63
|
name = name.to_s
|
81
|
-
info_etag_root.join("#{name}-#{SharedHelpers.digest(:MD5).hexdigest(name).downcase}")
|
64
|
+
@info_etag_root.join("#{name}-#{SharedHelpers.digest(:MD5).hexdigest(name).downcase}")
|
82
65
|
end
|
83
66
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
67
|
+
def mkdir(name)
|
68
|
+
directory.join(name).tap do |dir|
|
69
|
+
SharedHelpers.filesystem_access(dir) do
|
70
|
+
FileUtils.mkdir_p(dir)
|
71
|
+
end
|
89
72
|
end
|
90
73
|
end
|
91
74
|
|
92
|
-
def
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
def parse_gem(line)
|
100
|
-
@dependency_parser ||= GemParser.new
|
101
|
-
@dependency_parser.parse(line)
|
102
|
-
end
|
75
|
+
def fetch(remote_path, path, etag_path)
|
76
|
+
if already_fetched?(remote_path)
|
77
|
+
Bundler::CompactIndexClient.debug { "already fetched #{remote_path}" }
|
78
|
+
else
|
79
|
+
Bundler::CompactIndexClient.debug { "fetching #{remote_path}" }
|
80
|
+
@updater&.update(remote_path, path, etag_path)
|
81
|
+
end
|
103
82
|
|
104
|
-
|
105
|
-
# This method gets called at least once for every gem when parsing versions.
|
106
|
-
def parse_version_checksum(line, checksums)
|
107
|
-
line.freeze # allows slicing into the string to not allocate a copy of the line
|
108
|
-
name_end = line.index(" ")
|
109
|
-
checksum_start = line.index(" ", name_end + 1) + 1
|
110
|
-
checksum_end = line.size - checksum_start
|
111
|
-
# freeze name since it is used as a hash key
|
112
|
-
# pre-freezing means a frozen copy isn't created
|
113
|
-
name = line[0, name_end].freeze
|
114
|
-
checksum = line[checksum_start, checksum_end]
|
115
|
-
checksums[name] = checksum
|
83
|
+
read(path)
|
116
84
|
end
|
117
85
|
|
118
|
-
def
|
119
|
-
|
120
|
-
directory.join("info"),
|
121
|
-
directory.join("info-special-characters"),
|
122
|
-
]
|
86
|
+
def already_fetched?(remote_path)
|
87
|
+
@mutex.synchronize { !@endpoints.add?(remote_path) }
|
123
88
|
end
|
124
89
|
|
125
|
-
def
|
126
|
-
|
90
|
+
def read(path)
|
91
|
+
return unless path.file?
|
92
|
+
SharedHelpers.filesystem_access(path, :read, &:read)
|
127
93
|
end
|
128
94
|
end
|
129
95
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class CompactIndexClient
|
5
|
+
class Parser
|
6
|
+
# `compact_index` - an object responding to #names, #versions, #info(name, checksum),
|
7
|
+
# returning the file contents as a string
|
8
|
+
def initialize(compact_index)
|
9
|
+
@compact_index = compact_index
|
10
|
+
@info_checksums = nil
|
11
|
+
@versions_by_name = nil
|
12
|
+
@available = nil
|
13
|
+
@gem_parser = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def names
|
17
|
+
lines(@compact_index.names)
|
18
|
+
end
|
19
|
+
|
20
|
+
def versions
|
21
|
+
@versions_by_name ||= Hash.new {|hash, key| hash[key] = [] }
|
22
|
+
@info_checksums = {}
|
23
|
+
|
24
|
+
lines(@compact_index.versions).each do |line|
|
25
|
+
name, versions_string, checksum = line.split(" ", 3)
|
26
|
+
@info_checksums[name] = checksum || ""
|
27
|
+
versions_string.split(",") do |version|
|
28
|
+
delete = version.delete_prefix!("-")
|
29
|
+
version = version.split("-", 2).unshift(name)
|
30
|
+
if delete
|
31
|
+
@versions_by_name[name].delete(version)
|
32
|
+
else
|
33
|
+
@versions_by_name[name] << version
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
@versions_by_name
|
39
|
+
end
|
40
|
+
|
41
|
+
def info(name)
|
42
|
+
data = @compact_index.info(name, info_checksums[name])
|
43
|
+
lines(data).map {|line| gem_parser.parse(line).unshift(name) }
|
44
|
+
end
|
45
|
+
|
46
|
+
def available?
|
47
|
+
return @available unless @available.nil?
|
48
|
+
@available = !info_checksums.empty?
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def info_checksums
|
54
|
+
@info_checksums ||= lines(@compact_index.versions).each_with_object({}) do |line, checksums|
|
55
|
+
parse_version_checksum(line, checksums)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def lines(data)
|
60
|
+
return [] if data.nil? || data.empty?
|
61
|
+
lines = data.split("\n")
|
62
|
+
header = lines.index("---")
|
63
|
+
header ? lines[header + 1..-1] : lines
|
64
|
+
end
|
65
|
+
|
66
|
+
def gem_parser
|
67
|
+
@gem_parser ||= GemParser.new
|
68
|
+
end
|
69
|
+
|
70
|
+
# This is mostly the same as `split(" ", 3)` but it avoids allocating extra objects.
|
71
|
+
# This method gets called at least once for every gem when parsing versions.
|
72
|
+
def parse_version_checksum(line, checksums)
|
73
|
+
return unless (name_end = line.index(" ")) # Artifactory bug causes blank lines in artifactor index files
|
74
|
+
return unless (checksum_start = line.index(" ", name_end + 1) + 1)
|
75
|
+
checksum_end = line.size - checksum_start
|
76
|
+
|
77
|
+
line.freeze # allows slicing into the string to not allocate a copy of the line
|
78
|
+
name = line[0, name_end]
|
79
|
+
checksum = line[checksum_start, checksum_end]
|
80
|
+
checksums[name.freeze] = checksum # freeze name since it is used as a hash key
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|