bundler 2.2.13 → 2.2.18

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.

Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +85 -5
  3. data/bundler.gemspec +2 -3
  4. data/lib/bundler.rb +1 -0
  5. data/lib/bundler/build_metadata.rb +2 -2
  6. data/lib/bundler/cli.rb +16 -35
  7. data/lib/bundler/cli/common.rb +15 -2
  8. data/lib/bundler/cli/gem.rb +9 -1
  9. data/lib/bundler/cli/outdated.rb +8 -11
  10. data/lib/bundler/compact_index_client/updater.rb +10 -6
  11. data/lib/bundler/current_ruby.rb +1 -0
  12. data/lib/bundler/definition.rb +40 -87
  13. data/lib/bundler/dsl.rb +3 -6
  14. data/lib/bundler/feature_flag.rb +0 -2
  15. data/lib/bundler/fetcher.rb +2 -1
  16. data/lib/bundler/fetcher/downloader.rb +8 -4
  17. data/lib/bundler/friendly_errors.rb +1 -1
  18. data/lib/bundler/gem_helper.rb +16 -0
  19. data/lib/bundler/index.rb +1 -2
  20. data/lib/bundler/injector.rb +2 -2
  21. data/lib/bundler/inline.rb +1 -1
  22. data/lib/bundler/installer/parallel_installer.rb +36 -15
  23. data/lib/bundler/lazy_specification.rb +6 -1
  24. data/lib/bundler/lockfile_parser.rb +2 -16
  25. data/lib/bundler/man/bundle-add.1 +1 -1
  26. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  27. data/lib/bundler/man/bundle-cache.1 +1 -1
  28. data/lib/bundler/man/bundle-check.1 +1 -1
  29. data/lib/bundler/man/bundle-clean.1 +1 -1
  30. data/lib/bundler/man/bundle-config.1 +21 -10
  31. data/lib/bundler/man/bundle-config.1.ronn +21 -11
  32. data/lib/bundler/man/bundle-doctor.1 +1 -1
  33. data/lib/bundler/man/bundle-exec.1 +1 -1
  34. data/lib/bundler/man/bundle-gem.1 +1 -1
  35. data/lib/bundler/man/bundle-info.1 +1 -1
  36. data/lib/bundler/man/bundle-init.1 +1 -1
  37. data/lib/bundler/man/bundle-inject.1 +1 -1
  38. data/lib/bundler/man/bundle-install.1 +1 -1
  39. data/lib/bundler/man/bundle-list.1 +1 -1
  40. data/lib/bundler/man/bundle-lock.1 +1 -1
  41. data/lib/bundler/man/bundle-open.1 +1 -1
  42. data/lib/bundler/man/bundle-outdated.1 +1 -1
  43. data/lib/bundler/man/bundle-platform.1 +1 -1
  44. data/lib/bundler/man/bundle-pristine.1 +1 -1
  45. data/lib/bundler/man/bundle-remove.1 +1 -1
  46. data/lib/bundler/man/bundle-show.1 +1 -1
  47. data/lib/bundler/man/bundle-update.1 +1 -1
  48. data/lib/bundler/man/bundle-viz.1 +1 -1
  49. data/lib/bundler/man/bundle.1 +1 -1
  50. data/lib/bundler/man/gemfile.5 +1 -1
  51. data/lib/bundler/plugin.rb +2 -2
  52. data/lib/bundler/plugin/api/source.rb +21 -0
  53. data/lib/bundler/resolver.rb +13 -96
  54. data/lib/bundler/resolver/spec_group.rb +0 -24
  55. data/lib/bundler/retry.rb +1 -1
  56. data/lib/bundler/rubygems_ext.rb +2 -2
  57. data/lib/bundler/settings.rb +60 -11
  58. data/lib/bundler/source.rb +15 -0
  59. data/lib/bundler/source/metadata.rb +0 -4
  60. data/lib/bundler/source/path.rb +3 -1
  61. data/lib/bundler/source/path/installer.rb +1 -1
  62. data/lib/bundler/source/rubygems.rb +37 -10
  63. data/lib/bundler/source/rubygems_aggregate.rb +64 -0
  64. data/lib/bundler/source_list.rb +37 -8
  65. data/lib/bundler/source_map.rb +58 -0
  66. data/lib/bundler/spec_set.rb +18 -5
  67. data/lib/bundler/templates/Gemfile +1 -1
  68. data/lib/bundler/templates/gems.rb +1 -1
  69. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -4
  70. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  71. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -1
  72. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +1 -1
  73. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +1 -1
  74. data/lib/bundler/version.rb +1 -1
  75. metadata +9 -4
@@ -9,7 +9,7 @@ module Bundler
9
9
  :metadata_source
10
10
 
11
11
  def global_rubygems_source
12
- @global_rubygems_source ||= rubygems_aggregate_class.new
12
+ @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
13
13
  end
14
14
 
15
15
  def initialize
@@ -20,6 +20,20 @@ module Bundler
20
20
  @global_path_source = nil
21
21
  @rubygems_sources = []
22
22
  @metadata_source = Source::Metadata.new
23
+
24
+ @merged_gem_lockfile_sections = false
25
+ end
26
+
27
+ def merged_gem_lockfile_sections?
28
+ @merged_gem_lockfile_sections
29
+ end
30
+
31
+ def merged_gem_lockfile_sections!
32
+ @merged_gem_lockfile_sections = true
33
+ end
34
+
35
+ def no_aggregate_global_source?
36
+ global_rubygems_source.remotes.size <= 1
23
37
  end
24
38
 
25
39
  def add_path_source(options = {})
@@ -47,7 +61,7 @@ module Bundler
47
61
  end
48
62
 
49
63
  def global_rubygems_source=(uri)
50
- @global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
64
+ @global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri, "allow_local" => true)
51
65
  end
52
66
 
53
67
  def add_rubygems_remote(uri)
@@ -60,7 +74,11 @@ module Bundler
60
74
  end
61
75
 
62
76
  def rubygems_sources
63
- @rubygems_sources + [global_rubygems_source]
77
+ non_global_rubygems_sources + [global_rubygems_source]
78
+ end
79
+
80
+ def non_global_rubygems_sources
81
+ @rubygems_sources
64
82
  end
65
83
 
66
84
  def rubygems_remotes
@@ -71,16 +89,27 @@ module Bundler
71
89
  path_sources + git_sources + plugin_sources + rubygems_sources + [metadata_source]
72
90
  end
73
91
 
92
+ def non_default_explicit_sources
93
+ all_sources - [default_source, metadata_source]
94
+ end
95
+
74
96
  def get(source)
75
97
  source_list_for(source).find {|s| equal_source?(source, s) || equivalent_source?(source, s) }
76
98
  end
77
99
 
78
100
  def lock_sources
79
- lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
80
- if Bundler.feature_flag.disable_multisource?
81
- lock_sources + rubygems_sources.sort_by(&:to_s)
101
+ lock_other_sources + lock_rubygems_sources
102
+ end
103
+
104
+ def lock_other_sources
105
+ (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
106
+ end
107
+
108
+ def lock_rubygems_sources
109
+ if merged_gem_lockfile_sections?
110
+ [combine_rubygems_sources]
82
111
  else
83
- lock_sources << combine_rubygems_sources
112
+ rubygems_sources.sort_by(&:to_s).uniq
84
113
  end
85
114
  end
86
115
 
@@ -94,7 +123,7 @@ module Bundler
94
123
  end
95
124
  end
96
125
 
97
- replacement_rubygems = !Bundler.feature_flag.disable_multisource? &&
126
+ replacement_rubygems = merged_gem_lockfile_sections? &&
98
127
  replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
99
128
  @global_rubygems_source = replacement_rubygems if replacement_rubygems
100
129
 
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class SourceMap
5
+ attr_reader :sources, :dependencies
6
+
7
+ def initialize(sources, dependencies)
8
+ @sources = sources
9
+ @dependencies = dependencies
10
+ end
11
+
12
+ def pinned_spec_names(skip = nil)
13
+ direct_requirements.reject {|_, source| source == skip }.keys
14
+ end
15
+
16
+ def all_requirements
17
+ requirements = direct_requirements.dup
18
+
19
+ unmet_deps = sources.non_default_explicit_sources.map do |source|
20
+ (source.spec_names - pinned_spec_names).each do |indirect_dependency_name|
21
+ previous_source = requirements[indirect_dependency_name]
22
+ if previous_source.nil?
23
+ requirements[indirect_dependency_name] = source
24
+ else
25
+ no_ambiguous_sources = Bundler.feature_flag.bundler_3_mode?
26
+
27
+ msg = ["The gem '#{indirect_dependency_name}' was found in multiple relevant sources."]
28
+ msg.concat [previous_source, source].map {|s| " * #{s}" }.sort
29
+ msg << "You #{no_ambiguous_sources ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
30
+ msg = msg.join("\n")
31
+
32
+ raise SecurityError, msg if no_ambiguous_sources
33
+ Bundler.ui.warn "Warning: #{msg}"
34
+ end
35
+ end
36
+
37
+ source.unmet_deps
38
+ end
39
+
40
+ sources.default_source.add_dependency_names(unmet_deps.flatten - requirements.keys)
41
+
42
+ requirements
43
+ end
44
+
45
+ def direct_requirements
46
+ @direct_requirements ||= begin
47
+ requirements = {}
48
+ default = sources.default_source
49
+ dependencies.each do |dep|
50
+ dep_source = dep.source || default
51
+ dep_source.add_dependency_names(dep.name)
52
+ requirements[dep.name] = dep_source
53
+ end
54
+ requirements
55
+ end
56
+ end
57
+ end
58
+ end
@@ -78,10 +78,17 @@ module Bundler
78
78
 
79
79
  def materialize(deps, missing_specs = nil)
80
80
  materialized = self.for(deps, [], false, true, !missing_specs).to_a
81
- deps = materialized.map(&:name).uniq
81
+
82
+ materialized.group_by(&:source).each do |source, specs|
83
+ next unless specs.any?{|s| s.is_a?(LazySpecification) }
84
+
85
+ source.local!
86
+ names = -> { specs.map(&:name).uniq }
87
+ source.double_check_for(names)
88
+ end
89
+
82
90
  materialized.map! do |s|
83
91
  next s unless s.is_a?(LazySpecification)
84
- s.source.dependency_names = deps if s.source.respond_to?(:dependency_names=)
85
92
  spec = s.__materialize__
86
93
  unless spec
87
94
  unless missing_specs
@@ -98,11 +105,17 @@ module Bundler
98
105
  # This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
99
106
  # @return [Array<Gem::Specification>]
100
107
  def materialized_for_all_platforms
101
- names = @specs.map(&:name).uniq
108
+ @specs.group_by(&:source).each do |source, specs|
109
+ next unless specs.any?{|s| s.is_a?(LazySpecification) }
110
+
111
+ source.local!
112
+ source.remote!
113
+ names = -> { specs.map(&:name).uniq }
114
+ source.double_check_for(names)
115
+ end
116
+
102
117
  @specs.map do |s|
103
118
  next s unless s.is_a?(LazySpecification)
104
- s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
105
- s.source.remote!
106
119
  spec = s.__materialize__
107
120
  raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
108
121
  spec
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
7
  # gem "rails"
@@ -3,6 +3,6 @@
3
3
  # A sample gems.rb
4
4
  source "https://rubygems.org"
5
5
 
6
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
7
7
 
8
8
  # gem "rails"
@@ -11,8 +11,6 @@ jobs:
11
11
  uses: ruby/setup-ruby@v1
12
12
  with:
13
13
  ruby-version: <%= RUBY_VERSION %>
14
+ bundler-cache: true
14
15
  - name: Run the default task
15
- run: |
16
- gem install bundler -v <%= Bundler::VERSION %>
17
- bundle install
18
- bundle exec rake
16
+ run: bundle exec rake
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  <%- if config[:mit] -%>
15
15
  spec.license = "MIT"
16
16
  <%- end -%>
17
- spec.required_ruby_version = Gem::Requirement.new(">= <%= config[:required_ruby_version] %>")
17
+ spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
18
18
 
19
19
  spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
20
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bundler::Molinillo
4
- # Provides information about specifcations and dependencies to the resolver,
4
+ # Provides information about specifications and dependencies to the resolver,
5
5
  # allowing the {Resolver} class to remain generic while still providing power
6
6
  # and flexibility.
7
7
  #
@@ -252,7 +252,7 @@ class Bundler::Thor
252
252
  # flag<Regexp|String>:: the regexp or string to be replaced
253
253
  # replacement<String>:: the replacement, can be also given as a block
254
254
  # config<Hash>:: give :verbose => false to not log the status, and
255
- # :force => true, to force the replacement regardles of runner behavior.
255
+ # :force => true, to force the replacement regardless of runner behavior.
256
256
  #
257
257
  # ==== Example
258
258
  #
@@ -115,7 +115,7 @@ class Bundler::Dir < Dir
115
115
  Bundler::Dir.tmpdir
116
116
  end
117
117
 
118
- UNUSABLE_CHARS = [File::SEPARATOR, File::ALT_SEPARATOR, File::PATH_SEPARATOR, ":"].uniq.join("").freeze
118
+ UNUSABLE_CHARS = "^,-.0-9A-Z_a-z~"
119
119
 
120
120
  class << (RANDOM = Random.new)
121
121
  MAX = 36**6 # < 0x100000000
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.2.13".freeze
4
+ VERSION = "2.2.18".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.13
4
+ version: 2.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2021-03-03 00:00:00.000000000 Z
25
+ date: 2021-05-25 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -32,7 +32,10 @@ executables:
32
32
  - bundle
33
33
  - bundler
34
34
  extensions: []
35
- extra_rdoc_files: []
35
+ extra_rdoc_files:
36
+ - CHANGELOG.md
37
+ - LICENSE.md
38
+ - README.md
36
39
  files:
37
40
  - CHANGELOG.md
38
41
  - LICENSE.md
@@ -202,7 +205,9 @@ files:
202
205
  - lib/bundler/source/path/installer.rb
203
206
  - lib/bundler/source/rubygems.rb
204
207
  - lib/bundler/source/rubygems/remote.rb
208
+ - lib/bundler/source/rubygems_aggregate.rb
205
209
  - lib/bundler/source_list.rb
210
+ - lib/bundler/source_map.rb
206
211
  - lib/bundler/spec_set.rb
207
212
  - lib/bundler/stub_specification.rb
208
213
  - lib/bundler/templates/.document
@@ -352,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
357
  - !ruby/object:Gem::Version
353
358
  version: 2.5.2
354
359
  requirements: []
355
- rubygems_version: 3.2.13
360
+ rubygems_version: 3.2.18
356
361
  signing_key:
357
362
  specification_version: 4
358
363
  summary: The best way to manage your application's dependencies