bundler 2.2.28 → 2.2.32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -1
- data/README.md +1 -1
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/gem.rb +86 -8
- data/lib/bundler/cli/info.rb +11 -4
- data/lib/bundler/cli/issue.rb +4 -3
- data/lib/bundler/cli.rb +3 -1
- data/lib/bundler/compact_index_client.rb +2 -2
- data/lib/bundler/definition.rb +49 -78
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/errors.rb +18 -2
- data/lib/bundler/fetcher.rb +2 -1
- data/lib/bundler/friendly_errors.rb +5 -30
- data/lib/bundler/gem_helper.rb +6 -17
- data/lib/bundler/lockfile_parser.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 +3 -3
- data/lib/bundler/man/bundle-config.1.ronn +2 -2
- 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 +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-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-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/rubygems_ext.rb +4 -0
- data/lib/bundler/rubygems_gem_installer.rb +20 -4
- data/lib/bundler/rubygems_integration.rb +26 -9
- data/lib/bundler/runtime.rb +2 -2
- data/lib/bundler/source/git/git_proxy.rb +5 -2
- data/lib/bundler/source/git.rb +22 -4
- data/lib/bundler/source/rubygems.rb +36 -72
- data/lib/bundler/spec_set.rb +1 -1
- data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/lib/bundler/templates/newgem/Rakefile.tt +5 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +12 -12
- data/lib/bundler/templates/newgem/standard.yml.tt +2 -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/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +2 -2
- data/lib/bundler.rb +2 -1
- metadata +18 -7
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71d34e0696d7d7121b9bf4db66aca17c0e0b115a1099fa8879e509784ee62e4d
|
4
|
+
data.tar.gz: 0a68018b980b5e28358609b632a3b5bbf738ec2fd664aa34c4cc7c3d3ff207ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f0bc7ca02e4e2972c004cd40f4fb01c23ba52fdd8d0420733e2d4d0fe2afcc0a706f4985720c5ab8c9828821329f3e2b11328a2b61fe749833c1e8ba0d3edc7
|
7
|
+
data.tar.gz: 39220087ca48d38cb1980593607946da010cdf74e3a039e493d848c46eff798539aec4267e95e9d03807e143cc7cfcaa29a36f5118bb6e09bbc60b00fa77fe03
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,60 @@
|
|
1
|
+
# 2.2.32 (November 23, 2021)
|
2
|
+
|
3
|
+
## Enhancements:
|
4
|
+
|
5
|
+
- Clarify `bundle viz` deprecation [#5083](https://github.com/rubygems/rubygems/pull/5083)
|
6
|
+
- Unlock dependencies that no longer match lockfile [#5068](https://github.com/rubygems/rubygems/pull/5068)
|
7
|
+
- Use `shellsplit` instead of array of strings for git push [#5062](https://github.com/rubygems/rubygems/pull/5062)
|
8
|
+
- Re-enable `default_ignores` option for standard [#5003](https://github.com/rubygems/rubygems/pull/5003)
|
9
|
+
|
10
|
+
## Bug fixes:
|
11
|
+
|
12
|
+
- Fix downgrading dependencies by changing the `Gemfile` and running `bundle update` [#5078](https://github.com/rubygems/rubygems/pull/5078)
|
13
|
+
|
14
|
+
# 2.2.31 (November 8, 2021)
|
15
|
+
|
16
|
+
## Enhancements:
|
17
|
+
|
18
|
+
- Link to working `bundler-graph` plugin in `bundle viz` deprecation message [#5061](https://github.com/rubygems/rubygems/pull/5061)
|
19
|
+
- Memoize materialized specs when requiring `bundler/setup` [#5033](https://github.com/rubygems/rubygems/pull/5033)
|
20
|
+
- Allow custom LicenseRef [#5013](https://github.com/rubygems/rubygems/pull/5013)
|
21
|
+
- Better error when installing a lockfile with git sources and git is not installed [#5036](https://github.com/rubygems/rubygems/pull/5036)
|
22
|
+
- Only delete cached gem when it's corrupted [#5031](https://github.com/rubygems/rubygems/pull/5031)
|
23
|
+
- Support gemified `tsort` [#5032](https://github.com/rubygems/rubygems/pull/5032)
|
24
|
+
- Add standard option alongside rubocop to `bundle gem` [#4411](https://github.com/rubygems/rubygems/pull/4411)
|
25
|
+
|
26
|
+
## Bug fixes:
|
27
|
+
|
28
|
+
- Fix system man pages no longer working after bundler overrides `MANPATH` [#5039](https://github.com/rubygems/rubygems/pull/5039)
|
29
|
+
- Don't warn when a lockfile is locked to a dev version [#5018](https://github.com/rubygems/rubygems/pull/5018)
|
30
|
+
|
31
|
+
# 2.2.30 (October 26, 2021)
|
32
|
+
|
33
|
+
## Enhancements:
|
34
|
+
|
35
|
+
- Add a custom SHA1 digest implementation to no longer depend on the digest gem before we know which version to activate [#4989](https://github.com/rubygems/rubygems/pull/4989)
|
36
|
+
- Ensure vendored gems have licenses [#4998](https://github.com/rubygems/rubygems/pull/4998)
|
37
|
+
- Update broken link in Bundler::Fetcher::CertificateFailureError [#4987](https://github.com/rubygems/rubygems/pull/4987)
|
38
|
+
- Give better errors for some permission issues [#4965](https://github.com/rubygems/rubygems/pull/4965)
|
39
|
+
- Print better errors when `bundler/gem_tasks` fail [#4872](https://github.com/rubygems/rubygems/pull/4872)
|
40
|
+
- Fix `bundle install` to reinstall deleted gems [#4974](https://github.com/rubygems/rubygems/pull/4974)
|
41
|
+
- Unify issue template and ISSUES.md document [#4980](https://github.com/rubygems/rubygems/pull/4980)
|
42
|
+
- Bump vendored connection_pool to 2.2.5 [#4738](https://github.com/rubygems/rubygems/pull/4738)
|
43
|
+
|
44
|
+
## Bug fixes:
|
45
|
+
|
46
|
+
- Fix error message pointing to non existing file when using a global gem cache [#4999](https://github.com/rubygems/rubygems/pull/4999)
|
47
|
+
- Fix install crash when lockfile has missing dependencies for the current platform [#4941](https://github.com/rubygems/rubygems/pull/4941)
|
48
|
+
- Make `bundle info` show a proper warning every time it finds a deleted gem [#4971](https://github.com/rubygems/rubygems/pull/4971)
|
49
|
+
|
50
|
+
# 2.2.29 (October 8, 2021)
|
51
|
+
|
52
|
+
## Enhancements:
|
53
|
+
|
54
|
+
- Require at least Ruby 2.6.0 for gems created with recent rubies [#4920](https://github.com/rubygems/rubygems/pull/4920)
|
55
|
+
- Include glob information in string representation of git sources to make generated lockfiles deterministic [#4947](https://github.com/rubygems/rubygems/pull/4947)
|
56
|
+
- Add missing `rubygem_push` prerequisite [#4930](https://github.com/rubygems/rubygems/pull/4930)
|
57
|
+
|
1
58
|
# 2.2.28 (September 23, 2021)
|
2
59
|
|
3
60
|
## Enhancements:
|
@@ -99,7 +156,7 @@
|
|
99
156
|
- Fix `bundle doctor` crashing when finding a broken symlink [#4707](https://github.com/rubygems/rubygems/pull/4707)
|
100
157
|
- Fix incorrect re-resolve edge case [#4700](https://github.com/rubygems/rubygems/pull/4700)
|
101
158
|
- Fix some gems being unintentionally locked under multiple lockfile sections [#4701](https://github.com/rubygems/rubygems/pull/4701)
|
102
|
-
- Fix `--conservative` flag unexpectedly updating indirect dependencies [#4692](https://github.com/rubygems/rubygems/pull/4692)
|
159
|
+
- Fix `--conservative` flag unexpectedly updating indirect dependencies. NOTE: As part of this bug fix, some undocumented, unintentional code causing `bundle update --source <gem>` to update conservatively was fixed. Use the documented `bundle update --conservative <gem>` instead [#4692](https://github.com/rubygems/rubygems/pull/4692)
|
103
160
|
|
104
161
|
# 2.2.21 (June 23, 2021)
|
105
162
|
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ See [bundler.io](https://bundler.io) for the full documentation.
|
|
32
32
|
|
33
33
|
For help with common problems, see [TROUBLESHOOTING](doc/TROUBLESHOOTING.md).
|
34
34
|
|
35
|
-
Still stuck? Try [filing an issue](
|
35
|
+
Still stuck? Try [filing an issue](https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md).
|
36
36
|
|
37
37
|
### Other questions
|
38
38
|
|
@@ -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 = "2021-
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2021-11-23".freeze
|
8
|
+
@git_commit_sha = "20d4957649".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/bundler/cli/gem.rb
CHANGED
@@ -68,7 +68,7 @@ module Bundler
|
|
68
68
|
:bundler_version => bundler_dependency_version,
|
69
69
|
:git => use_git,
|
70
70
|
:github_username => github_username.empty? ? "[USERNAME]" : github_username,
|
71
|
-
:required_ruby_version =>
|
71
|
+
:required_ruby_version => required_ruby_version,
|
72
72
|
}
|
73
73
|
ensure_safe_gem_name(name, constant_array)
|
74
74
|
|
@@ -163,15 +163,16 @@ module Bundler
|
|
163
163
|
templates.merge!("CHANGELOG.md.tt" => "CHANGELOG.md")
|
164
164
|
end
|
165
165
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
"and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
|
171
|
-
config[:rubocop] = true
|
172
|
-
config[:rubocop_version] = Gem.ruby_version < Gem::Version.new("2.4.a") ? "0.81.0" : "1.7"
|
166
|
+
config[:linter] = ask_and_set_linter
|
167
|
+
case config[:linter]
|
168
|
+
when "rubocop"
|
169
|
+
config[:linter_version] = rubocop_version
|
173
170
|
Bundler.ui.info "RuboCop enabled in config"
|
174
171
|
templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
|
172
|
+
when "standard"
|
173
|
+
config[:linter_version] = standard_version
|
174
|
+
Bundler.ui.info "Standard enabled in config"
|
175
|
+
templates.merge!("standard.yml.tt" => ".standard.yml")
|
175
176
|
end
|
176
177
|
|
177
178
|
templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
|
@@ -317,6 +318,58 @@ module Bundler
|
|
317
318
|
ci_template
|
318
319
|
end
|
319
320
|
|
321
|
+
def ask_and_set_linter
|
322
|
+
linter_template = options[:linter] || Bundler.settings["gem.linter"]
|
323
|
+
linter_template = deprecated_rubocop_option if linter_template.nil?
|
324
|
+
|
325
|
+
if linter_template.to_s.empty?
|
326
|
+
Bundler.ui.confirm "Do you want to add a code linter and formatter to your gem? " \
|
327
|
+
"Supported Linters:\n" \
|
328
|
+
"* RuboCop: https://rubocop.org\n" \
|
329
|
+
"* Standard: https://github.com/testdouble/standard\n" \
|
330
|
+
"\n"
|
331
|
+
Bundler.ui.info hint_text("linter")
|
332
|
+
|
333
|
+
result = Bundler.ui.ask "Enter a linter. rubocop/standard/(none):"
|
334
|
+
if result =~ /rubocop|standard/
|
335
|
+
linter_template = result
|
336
|
+
else
|
337
|
+
linter_template = false
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
if Bundler.settings["gem.linter"].nil?
|
342
|
+
Bundler.settings.set_global("gem.linter", linter_template)
|
343
|
+
end
|
344
|
+
|
345
|
+
# Once gem.linter safely set, unset the deprecated gem.rubocop
|
346
|
+
unless Bundler.settings["gem.rubocop"].nil?
|
347
|
+
Bundler.settings.set_global("gem.rubocop", nil)
|
348
|
+
end
|
349
|
+
|
350
|
+
if options[:linter] == Bundler.settings["gem.linter"]
|
351
|
+
Bundler.ui.info "#{options[:linter]} is already configured, ignoring --linter flag."
|
352
|
+
end
|
353
|
+
|
354
|
+
linter_template
|
355
|
+
end
|
356
|
+
|
357
|
+
def deprecated_rubocop_option
|
358
|
+
if !options[:rubocop].nil?
|
359
|
+
if options[:rubocop]
|
360
|
+
Bundler::SharedHelpers.major_deprecation 2, "--rubocop is deprecated, use --linter=rubocop"
|
361
|
+
"rubocop"
|
362
|
+
else
|
363
|
+
Bundler::SharedHelpers.major_deprecation 2, "--no-rubocop is deprecated, use --linter"
|
364
|
+
false
|
365
|
+
end
|
366
|
+
elsif !Bundler.settings["gem.rubocop"].nil?
|
367
|
+
Bundler::SharedHelpers.major_deprecation 2,
|
368
|
+
"config gem.rubocop is deprecated; we've updated your config to use gem.linter instead"
|
369
|
+
Bundler.settings["gem.rubocop"] ? "rubocop" : false
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
320
373
|
def bundler_dependency_version
|
321
374
|
v = Gem::Version.new(Bundler::VERSION)
|
322
375
|
req = v.segments[0..1]
|
@@ -350,5 +403,30 @@ module Bundler
|
|
350
403
|
def open_editor(editor, file)
|
351
404
|
thor.run(%(#{editor} "#{file}"))
|
352
405
|
end
|
406
|
+
|
407
|
+
def required_ruby_version
|
408
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "2.3.0"
|
409
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "2.4.0"
|
410
|
+
elsif Gem.ruby_version < Gem::Version.new("2.6.a") then "2.5.0"
|
411
|
+
else
|
412
|
+
"2.6.0"
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
def rubocop_version
|
417
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "0.81.0"
|
418
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "1.12"
|
419
|
+
else
|
420
|
+
"1.21"
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
def standard_version
|
425
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "0.2.5"
|
426
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "1.0"
|
427
|
+
else
|
428
|
+
"1.3"
|
429
|
+
end
|
430
|
+
end
|
353
431
|
end
|
354
432
|
end
|
data/lib/bundler/cli/info.rb
CHANGED
@@ -40,12 +40,13 @@ module Bundler
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def print_gem_path(spec)
|
43
|
-
|
43
|
+
name = spec.name
|
44
|
+
if name == "bundler"
|
44
45
|
path = File.expand_path("../../../..", __FILE__)
|
45
46
|
else
|
46
47
|
path = spec.full_gem_path
|
47
|
-
|
48
|
-
return Bundler.ui.warn "The gem #{
|
48
|
+
if spec.deleted_gem?
|
49
|
+
return Bundler.ui.warn "The gem #{name} has been deleted. It was installed at: #{path}"
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
@@ -54,8 +55,9 @@ module Bundler
|
|
54
55
|
|
55
56
|
def print_gem_info(spec)
|
56
57
|
metadata = spec.metadata
|
58
|
+
name = spec.name
|
57
59
|
gem_info = String.new
|
58
|
-
gem_info << " * #{
|
60
|
+
gem_info << " * #{name} (#{spec.version}#{spec.git_version})\n"
|
59
61
|
gem_info << "\tSummary: #{spec.summary}\n" if spec.summary
|
60
62
|
gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage
|
61
63
|
gem_info << "\tDocumentation: #{metadata["documentation_uri"]}\n" if metadata.key?("documentation_uri")
|
@@ -67,6 +69,11 @@ module Bundler
|
|
67
69
|
gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
|
68
70
|
gem_info << "\tPath: #{spec.full_gem_path}\n"
|
69
71
|
gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
|
72
|
+
|
73
|
+
if spec.deleted_gem?
|
74
|
+
return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
|
75
|
+
end
|
76
|
+
|
70
77
|
Bundler.ui.info gem_info
|
71
78
|
end
|
72
79
|
end
|
data/lib/bundler/cli/issue.rb
CHANGED
@@ -20,9 +20,10 @@ module Bundler
|
|
20
20
|
|
21
21
|
Hopefully the troubleshooting steps above resolved your problem! If things
|
22
22
|
still aren't working the way you expect them to, please let us know so
|
23
|
-
that we can diagnose and help fix the problem you're having
|
24
|
-
|
25
|
-
https://github.com/rubygems/rubygems/
|
23
|
+
that we can diagnose and help fix the problem you're having, by filling
|
24
|
+
in the new issue form located at
|
25
|
+
https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md,
|
26
|
+
and copy and pasting the information below.
|
26
27
|
|
27
28
|
EOS
|
28
29
|
|
data/lib/bundler/cli.rb
CHANGED
@@ -552,7 +552,7 @@ module Bundler
|
|
552
552
|
method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
|
553
553
|
method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
|
554
554
|
def viz
|
555
|
-
SharedHelpers.major_deprecation 2, "The `viz` command has been
|
555
|
+
SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
|
556
556
|
require_relative "cli/viz"
|
557
557
|
Viz.new(options.dup).run
|
558
558
|
end
|
@@ -575,6 +575,8 @@ module Bundler
|
|
575
575
|
: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)`."
|
576
576
|
method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
|
577
577
|
:desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|travis|gitlab|circle)`"
|
578
|
+
method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "",
|
579
|
+
:desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
|
578
580
|
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>`."
|
579
581
|
|
580
582
|
def gem(name)
|
@@ -5,7 +5,7 @@ require "set"
|
|
5
5
|
|
6
6
|
module Bundler
|
7
7
|
class CompactIndexClient
|
8
|
-
DEBUG_MUTEX = Mutex.new
|
8
|
+
DEBUG_MUTEX = Thread::Mutex.new
|
9
9
|
def self.debug
|
10
10
|
return unless ENV["DEBUG_COMPACT_INDEX"]
|
11
11
|
DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") }
|
@@ -25,7 +25,7 @@ module Bundler
|
|
25
25
|
@endpoints = Set.new
|
26
26
|
@info_checksums_by_name = {}
|
27
27
|
@parsed_checksums = false
|
28
|
-
@mutex = Mutex.new
|
28
|
+
@mutex = Thread::Mutex.new
|
29
29
|
end
|
30
30
|
|
31
31
|
def execution_mode=(block)
|
data/lib/bundler/definition.rb
CHANGED
@@ -73,7 +73,6 @@ module Bundler
|
|
73
73
|
@lockfile_contents = String.new
|
74
74
|
@locked_bundler_version = nil
|
75
75
|
@locked_ruby_version = nil
|
76
|
-
@locked_specs_incomplete_for_platform = false
|
77
76
|
@new_platform = nil
|
78
77
|
|
79
78
|
if lockfile && File.exist?(lockfile)
|
@@ -139,6 +138,8 @@ module Bundler
|
|
139
138
|
@dependency_changes = converge_dependencies
|
140
139
|
@local_changes = converge_locals
|
141
140
|
|
141
|
+
@locked_specs_incomplete_for_platform = !@locked_specs.for(requested_dependencies & expand_dependencies(locked_dependencies), true, true)
|
142
|
+
|
142
143
|
@requires = compute_requires
|
143
144
|
end
|
144
145
|
|
@@ -228,17 +229,22 @@ module Bundler
|
|
228
229
|
end
|
229
230
|
end
|
230
231
|
|
232
|
+
def locked_dependencies
|
233
|
+
@locked_deps.values
|
234
|
+
end
|
235
|
+
|
231
236
|
def specs_for(groups)
|
232
|
-
|
237
|
+
return specs if groups.empty?
|
233
238
|
deps = dependencies_for(groups)
|
234
|
-
materialize(
|
239
|
+
materialize(deps)
|
235
240
|
end
|
236
241
|
|
237
242
|
def dependencies_for(groups)
|
238
243
|
groups.map!(&:to_sym)
|
239
|
-
current_dependencies.reject do |d|
|
244
|
+
deps = current_dependencies.reject do |d|
|
240
245
|
(d.groups & groups).empty?
|
241
246
|
end
|
247
|
+
expand_dependencies(deps)
|
242
248
|
end
|
243
249
|
|
244
250
|
# Resolve all the dependencies specified in Gemfile. It ensures that
|
@@ -367,8 +373,8 @@ module Bundler
|
|
367
373
|
new_sources = gemfile_sources - @locked_sources
|
368
374
|
deleted_sources = @locked_sources - gemfile_sources
|
369
375
|
|
370
|
-
new_deps = @dependencies -
|
371
|
-
deleted_deps =
|
376
|
+
new_deps = @dependencies - locked_dependencies
|
377
|
+
deleted_deps = locked_dependencies - @dependencies
|
372
378
|
|
373
379
|
# Check if it is possible that the source is only changed thing
|
374
380
|
if (new_deps.empty? && deleted_deps.empty?) && (!new_sources.empty? && !deleted_sources.empty?)
|
@@ -560,7 +566,7 @@ module Bundler
|
|
560
566
|
|
561
567
|
def dependencies_for_source_changed?(source, locked_source = source)
|
562
568
|
deps_for_source = @dependencies.select {|s| s.source == source }
|
563
|
-
locked_deps_for_source =
|
569
|
+
locked_deps_for_source = locked_dependencies.select {|dep| dep.source == locked_source }
|
564
570
|
|
565
571
|
deps_for_source.uniq.sort != locked_deps_for_source.sort
|
566
572
|
end
|
@@ -643,25 +649,16 @@ module Bundler
|
|
643
649
|
end
|
644
650
|
|
645
651
|
def converge_dependencies
|
646
|
-
|
647
|
-
|
648
|
-
locked_source = @locked_deps[dep.name]
|
649
|
-
# This is to make sure that if bundler is installing in deployment mode and
|
650
|
-
# after locked_source and sources don't match, we still use locked_source.
|
651
|
-
if frozen && !locked_source.nil? &&
|
652
|
-
locked_source.respond_to?(:source) && locked_source.source.instance_of?(Source::Path) && locked_source.source.path.exist?
|
653
|
-
dep.source = locked_source.source
|
654
|
-
elsif dep.source
|
652
|
+
(@dependencies + locked_dependencies).each do |dep|
|
653
|
+
if dep.source
|
655
654
|
dep.source = sources.get(dep.source)
|
656
655
|
end
|
657
656
|
end
|
658
657
|
|
659
658
|
changes = false
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
@dependencies.each do |dependency|
|
664
|
-
unless locked_dep = @locked_deps[dependency.name]
|
659
|
+
|
660
|
+
@dependencies.each do |dep|
|
661
|
+
unless locked_dep = @locked_deps[dep.name]
|
665
662
|
changes = true
|
666
663
|
next
|
667
664
|
end
|
@@ -672,11 +669,11 @@ module Bundler
|
|
672
669
|
# directive, the lockfile dependencies and resolved dependencies end up
|
673
670
|
# with a mismatch on #type. Work around that by setting the type on the
|
674
671
|
# dep from the lockfile.
|
675
|
-
locked_dep.instance_variable_set(:@type,
|
672
|
+
locked_dep.instance_variable_set(:@type, dep.type)
|
676
673
|
|
677
674
|
# We already know the name matches from the hash lookup
|
678
675
|
# so we only need to check the requirement now
|
679
|
-
changes ||=
|
676
|
+
changes ||= dep.requirement != locked_dep.requirement
|
680
677
|
end
|
681
678
|
|
682
679
|
changes
|
@@ -686,34 +683,34 @@ module Bundler
|
|
686
683
|
# commonly happen if the Gemfile has changed since the lockfile was last
|
687
684
|
# generated
|
688
685
|
def converge_locked_specs
|
689
|
-
|
686
|
+
resolve = converge_specs(@locked_specs)
|
690
687
|
|
691
|
-
|
692
|
-
# and Gemfile.lock. If the Gemfile modified a dependency, but
|
693
|
-
# the gem in the Gemfile.lock still satisfies it, this is fine
|
694
|
-
# too.
|
695
|
-
@dependencies.each do |dep|
|
696
|
-
locked_dep = @locked_deps[dep.name]
|
697
|
-
|
698
|
-
# If the locked_dep doesn't match the dependency we're looking for then we ignore the locked_dep
|
699
|
-
locked_dep = nil unless locked_dep == dep
|
688
|
+
diff = nil
|
700
689
|
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
@locked_specs.each do |s|
|
705
|
-
@unlock[:gems] << s.name if s.source == dep.source
|
706
|
-
end
|
690
|
+
# Now, we unlock any sources that do not have anymore gems pinned to it
|
691
|
+
sources.all_sources.each do |source|
|
692
|
+
next unless source.respond_to?(:unlock!)
|
707
693
|
|
708
|
-
|
709
|
-
|
694
|
+
unless resolve.any? {|s| s.source == source }
|
695
|
+
diff ||= @locked_specs.to_a - resolve.to_a
|
696
|
+
source.unlock! if diff.any? {|s| s.source == source }
|
710
697
|
end
|
711
698
|
end
|
712
699
|
|
700
|
+
resolve
|
701
|
+
end
|
702
|
+
|
703
|
+
def converge_specs(specs)
|
704
|
+
deps = []
|
713
705
|
converged = []
|
714
|
-
|
706
|
+
specs.each do |s|
|
715
707
|
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
716
708
|
dep = @dependencies.find {|d| s.satisfies?(d) }
|
709
|
+
|
710
|
+
if dep && (!dep.source || s.source.include?(dep.source))
|
711
|
+
deps << dep
|
712
|
+
end
|
713
|
+
|
717
714
|
s.source = (dep && dep.source) || sources.get(s.source) unless multisource_allowed?
|
718
715
|
|
719
716
|
# Don't add a spec to the list if its source is expired. For example,
|
@@ -731,7 +728,7 @@ module Bundler
|
|
731
728
|
rescue PathError, GitError
|
732
729
|
# if we won't need the source (according to the lockfile),
|
733
730
|
# don't error if the path/git source isn't available
|
734
|
-
next if
|
731
|
+
next if specs.
|
735
732
|
for(requested_dependencies, false, true).
|
736
733
|
none? {|locked_spec| locked_spec.source == s.source }
|
737
734
|
|
@@ -747,36 +744,15 @@ module Bundler
|
|
747
744
|
s.dependencies.replace(new_spec.dependencies)
|
748
745
|
end
|
749
746
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
@locked_specs_incomplete_for_platform = !resolve.for(expand_dependencies(requested_dependencies & deps), true, true)
|
755
|
-
resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
|
756
|
-
diff = nil
|
757
|
-
|
758
|
-
# Now, we unlock any sources that do not have anymore gems pinned to it
|
759
|
-
sources.all_sources.each do |source|
|
760
|
-
next unless source.respond_to?(:unlock!)
|
761
|
-
|
762
|
-
unless resolve.any? {|s| s.source == source }
|
763
|
-
diff ||= @locked_specs.to_a - resolve.to_a
|
764
|
-
source.unlock! if diff.any? {|s| s.source == source }
|
747
|
+
if dep.nil? && @dependencies.find {|d| s.name == d.name }
|
748
|
+
@unlock[:gems] << s.name
|
749
|
+
else
|
750
|
+
converged << s
|
765
751
|
end
|
766
752
|
end
|
767
753
|
|
768
|
-
resolve
|
769
|
-
|
770
|
-
|
771
|
-
def in_locked_deps?(dep, locked_dep)
|
772
|
-
# Because the lockfile can't link a dep to a specific remote, we need to
|
773
|
-
# treat sources as equivalent anytime the locked dep has all the remotes
|
774
|
-
# that the Gemfile dep does.
|
775
|
-
locked_dep && locked_dep.source && dep.source && locked_dep.source.include?(dep.source)
|
776
|
-
end
|
777
|
-
|
778
|
-
def satisfies_locked_spec?(dep)
|
779
|
-
@locked_specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
|
754
|
+
resolve = SpecSet.new(converged)
|
755
|
+
SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
|
780
756
|
end
|
781
757
|
|
782
758
|
def metadata_dependencies
|
@@ -869,16 +845,11 @@ module Bundler
|
|
869
845
|
|
870
846
|
def additional_base_requirements_for_resolve
|
871
847
|
return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
|
872
|
-
|
873
|
-
@locked_gems.specs.reduce({}) do |requirements, locked_spec|
|
848
|
+
converge_specs(@locked_gems.specs).map do |locked_spec|
|
874
849
|
name = locked_spec.name
|
875
|
-
dependency = dependencies_by_name[name]
|
876
|
-
next requirements if @locked_gems.dependencies[name] != dependency
|
877
|
-
next requirements if dependency && dependency.source.is_a?(Source::Path)
|
878
850
|
dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
|
879
|
-
|
880
|
-
|
881
|
-
end.values
|
851
|
+
DepProxy.get_proxy(dep, locked_spec.platform)
|
852
|
+
end
|
882
853
|
end
|
883
854
|
|
884
855
|
def equivalent_rubygems_remotes?(source)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This code was extracted from https://github.com/Solistra/ruby-digest which is under public domain
|
4
|
+
module Bundler
|
5
|
+
module Digest
|
6
|
+
# The initial constant values for the 32-bit constant words A, B, C, D, and
|
7
|
+
# E, respectively.
|
8
|
+
SHA1_WORDS = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0].freeze
|
9
|
+
|
10
|
+
# The 8-bit field used for bitwise `AND` masking. Defaults to `0xFFFFFFFF`.
|
11
|
+
SHA1_MASK = 0xFFFFFFFF
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def sha1(string)
|
15
|
+
unless string.is_a?(String)
|
16
|
+
raise TypeError, "can't convert #{string.class.inspect} into String"
|
17
|
+
end
|
18
|
+
|
19
|
+
buffer = string.b
|
20
|
+
|
21
|
+
words = SHA1_WORDS.dup
|
22
|
+
generate_split_buffer(buffer) do |chunk|
|
23
|
+
w = []
|
24
|
+
chunk.each_slice(4) do |a, b, c, d|
|
25
|
+
w << (((a << 8 | b) << 8 | c) << 8 | d)
|
26
|
+
end
|
27
|
+
a, b, c, d, e = *words
|
28
|
+
(16..79).each do |i|
|
29
|
+
w[i] = SHA1_MASK & rotate((w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16]), 1)
|
30
|
+
end
|
31
|
+
0.upto(79) do |i|
|
32
|
+
case i
|
33
|
+
when 0..19
|
34
|
+
f = ((b & c) | (~b & d))
|
35
|
+
k = 0x5A827999
|
36
|
+
when 20..39
|
37
|
+
f = (b ^ c ^ d)
|
38
|
+
k = 0x6ED9EBA1
|
39
|
+
when 40..59
|
40
|
+
f = ((b & c) | (b & d) | (c & d))
|
41
|
+
k = 0x8F1BBCDC
|
42
|
+
when 60..79
|
43
|
+
f = (b ^ c ^ d)
|
44
|
+
k = 0xCA62C1D6
|
45
|
+
end
|
46
|
+
t = SHA1_MASK & (SHA1_MASK & rotate(a, 5) + f + e + k + w[i])
|
47
|
+
a, b, c, d, e = t, a, SHA1_MASK & rotate(b, 30), c, d # rubocop:disable Style/ParallelAssignment
|
48
|
+
end
|
49
|
+
mutated = [a, b, c, d, e]
|
50
|
+
words.map!.with_index {|word, index| SHA1_MASK & (word + mutated[index]) }
|
51
|
+
end
|
52
|
+
|
53
|
+
words.pack("N*").unpack("H*").first
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def generate_split_buffer(string, &block)
|
59
|
+
size = string.bytesize * 8
|
60
|
+
buffer = string.bytes << 128
|
61
|
+
buffer << 0 while buffer.size % 64 != 56
|
62
|
+
buffer.concat([size].pack("Q>").bytes)
|
63
|
+
buffer.each_slice(64, &block)
|
64
|
+
end
|
65
|
+
|
66
|
+
def rotate(value, spaces)
|
67
|
+
value << spaces | value >> (32 - spaces)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/bundler/errors.rb
CHANGED
@@ -75,10 +75,26 @@ module Bundler
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
def permission_type
|
79
|
+
case @permission_type
|
80
|
+
when :create
|
81
|
+
"executable permissions for all parent directories and write permissions for `#{parent_folder}`"
|
82
|
+
when :delete
|
83
|
+
permissions = "executable permissions for all parent directories and write permissions for `#{parent_folder}`"
|
84
|
+
permissions += ", and the same thing for all subdirectories inside #{@path}" if File.directory?(@path)
|
85
|
+
permissions
|
86
|
+
else
|
87
|
+
"#{@permission_type} permissions for that path"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def parent_folder
|
92
|
+
File.dirname(@path)
|
93
|
+
end
|
94
|
+
|
78
95
|
def message
|
79
96
|
"There was an error while trying to #{action} `#{@path}`. " \
|
80
|
-
"It is likely that you need to grant #{
|
81
|
-
"for that path."
|
97
|
+
"It is likely that you need to grant #{permission_type}."
|
82
98
|
end
|
83
99
|
|
84
100
|
status_code(23)
|
data/lib/bundler/fetcher.rb
CHANGED
@@ -28,7 +28,8 @@ module Bundler
|
|
28
28
|
" is a chance you are experiencing a man-in-the-middle attack, but" \
|
29
29
|
" most likely your system doesn't have the CA certificates needed" \
|
30
30
|
" for verification. For information about OpenSSL certificates, see" \
|
31
|
-
"
|
31
|
+
" https://railsapps.github.io/openssl-certificate-verify-failed.html." \
|
32
|
+
" To connect without using SSL, edit your Gemfile" \
|
32
33
|
" sources and change 'https' to 'http'."
|
33
34
|
end
|
34
35
|
end
|