rubygems-update 3.2.2 → 3.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/{History.txt → CHANGELOG.md} +482 -424
  3. data/Manifest.txt +30 -27
  4. data/Rakefile +11 -15
  5. data/bundler/CHANGELOG.md +67 -2
  6. data/bundler/bundler.gemspec +1 -1
  7. data/bundler/lib/bundler.rb +3 -7
  8. data/bundler/lib/bundler/build_metadata.rb +2 -2
  9. data/bundler/lib/bundler/cli.rb +2 -5
  10. data/bundler/lib/bundler/cli/cache.rb +1 -0
  11. data/bundler/lib/bundler/cli/gem.rb +2 -0
  12. data/bundler/lib/bundler/cli/update.rb +1 -1
  13. data/bundler/lib/bundler/compact_index_client/cache.rb +5 -13
  14. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  15. data/bundler/lib/bundler/compact_index_client/updater.rb +0 -8
  16. data/bundler/lib/bundler/definition.rb +29 -21
  17. data/bundler/lib/bundler/dep_proxy.rb +15 -8
  18. data/bundler/lib/bundler/feature_flag.rb +0 -1
  19. data/bundler/lib/bundler/fetcher.rb +0 -1
  20. data/bundler/lib/bundler/gem_helper.rb +9 -7
  21. data/bundler/lib/bundler/gem_helpers.rb +30 -24
  22. data/bundler/lib/bundler/gem_version_promoter.rb +2 -2
  23. data/bundler/lib/bundler/installer.rb +0 -17
  24. data/bundler/lib/bundler/installer/standalone.rb +14 -0
  25. data/bundler/lib/bundler/lazy_specification.rb +10 -11
  26. data/bundler/{man → lib/bundler/man}/bundle-add.1 +1 -1
  27. data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +1 -1
  28. data/bundler/{man → lib/bundler/man}/bundle-cache.1 +1 -1
  29. data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
  30. data/bundler/{man → lib/bundler/man}/bundle-clean.1 +1 -1
  31. data/bundler/{man → lib/bundler/man}/bundle-config.1 +4 -4
  32. data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
  33. data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  34. data/bundler/{man → lib/bundler/man}/bundle-exec.1 +1 -1
  35. data/bundler/{man → lib/bundler/man}/bundle-gem.1 +1 -1
  36. data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
  37. data/bundler/{man → lib/bundler/man}/bundle-init.1 +1 -1
  38. data/bundler/{man → lib/bundler/man}/bundle-inject.1 +1 -1
  39. data/bundler/{man → lib/bundler/man}/bundle-install.1 +1 -1
  40. data/bundler/{man → lib/bundler/man}/bundle-list.1 +1 -1
  41. data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  42. data/bundler/{man → lib/bundler/man}/bundle-open.1 +1 -1
  43. data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
  44. data/bundler/{man → lib/bundler/man}/bundle-platform.1 +1 -1
  45. data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  46. data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  47. data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
  48. data/bundler/{man → lib/bundler/man}/bundle-update.1 +1 -1
  49. data/bundler/{man → lib/bundler/man}/bundle-viz.1 +1 -1
  50. data/bundler/{man → lib/bundler/man}/bundle.1 +1 -1
  51. data/bundler/{man → lib/bundler/man}/gemfile.5 +1 -1
  52. data/bundler/{man → lib/bundler/man}/index.txt +0 -0
  53. data/bundler/lib/bundler/resolver.rb +36 -16
  54. data/bundler/lib/bundler/resolver/spec_group.rb +18 -23
  55. data/bundler/lib/bundler/rubygems_ext.rb +16 -0
  56. data/bundler/lib/bundler/rubygems_integration.rb +0 -5
  57. data/bundler/lib/bundler/settings.rb +1 -1
  58. data/bundler/lib/bundler/source/git.rb +19 -17
  59. data/bundler/lib/bundler/source/git/git_proxy.rb +54 -49
  60. data/bundler/lib/bundler/source/path/installer.rb +2 -0
  61. data/bundler/lib/bundler/source/rubygems.rb +10 -2
  62. data/bundler/lib/bundler/spec_set.rb +6 -9
  63. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  64. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  65. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
  66. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  67. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
  68. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
  69. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
  70. data/bundler/lib/bundler/version.rb +1 -1
  71. data/lib/rubygems.rb +2 -2
  72. data/lib/rubygems/commands/setup_command.rb +16 -62
  73. data/lib/rubygems/dependency_installer.rb +1 -0
  74. data/lib/rubygems/ext/builder.rb +5 -4
  75. data/lib/rubygems/ext/cmake_builder.rb +1 -2
  76. data/lib/rubygems/ext/configure_builder.rb +1 -2
  77. data/lib/rubygems/gemcutter_utilities.rb +2 -2
  78. data/lib/rubygems/installer.rb +0 -23
  79. data/lib/rubygems/installer_uninstaller_utils.rb +6 -1
  80. data/lib/rubygems/platform.rb +0 -4
  81. data/lib/rubygems/remote_fetcher.rb +4 -2
  82. data/lib/rubygems/request_set.rb +2 -13
  83. data/lib/rubygems/requirement.rb +1 -1
  84. data/lib/rubygems/resolver.rb +6 -1
  85. data/lib/rubygems/resolver/api_set.rb +28 -19
  86. data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
  87. data/lib/rubygems/resolver/api_specification.rb +4 -3
  88. data/lib/rubygems/resolver/best_set.rb +2 -2
  89. data/lib/rubygems/resolver/index_specification.rb +18 -0
  90. data/lib/rubygems/resolver/installer_set.rb +57 -7
  91. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +1 -1
  92. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +1 -1
  93. data/lib/rubygems/resolver/spec_specification.rb +14 -0
  94. data/lib/rubygems/resolver/specification.rb +12 -0
  95. data/lib/rubygems/source.rb +10 -6
  96. data/lib/rubygems/specification.rb +18 -14
  97. data/lib/rubygems/test_case.rb +17 -4
  98. data/rubygems-update.gemspec +2 -2
  99. data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
  100. data/test/rubygems/test_gem.rb +5 -0
  101. data/test/rubygems/test_gem_commands_install_command.rb +131 -0
  102. data/test/rubygems/test_gem_commands_setup_command.rb +21 -37
  103. data/test/rubygems/test_gem_dependency_installer.rb +27 -47
  104. data/test/rubygems/test_gem_ext_builder.rb +30 -6
  105. data/test/rubygems/test_gem_ext_cmake_builder.rb +2 -4
  106. data/test/rubygems/test_gem_ext_configure_builder.rb +2 -2
  107. data/test/rubygems/test_gem_installer.rb +8 -60
  108. data/test/rubygems/test_gem_platform.rb +8 -0
  109. data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
  110. data/test/rubygems/test_gem_requirement.rb +34 -0
  111. data/test/rubygems/test_gem_resolver_api_set.rb +26 -52
  112. data/test/rubygems/test_gem_resolver_api_specification.rb +3 -3
  113. data/test/rubygems/test_gem_resolver_best_set.rb +26 -3
  114. data/test/rubygems/test_gem_source.rb +2 -2
  115. data/test/rubygems/test_gem_source_subpath_problem.rb +2 -2
  116. data/test/rubygems/test_gem_specification.rb +9 -3
  117. data/test/rubygems/test_gem_stream_ui.rb +1 -1
  118. metadata +34 -55
@@ -118,7 +118,7 @@ module Bundler
118
118
  end
119
119
  @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
120
120
 
121
- add_current_platform unless Bundler.frozen_bundle?
121
+ add_current_platform unless current_ruby_platform_locked? || Bundler.frozen_bundle?
122
122
 
123
123
  converge_path_sources_to_gemspec_sources
124
124
  @path_changes = converge_paths
@@ -157,7 +157,7 @@ module Bundler
157
157
  end
158
158
 
159
159
  def resolve_remotely!
160
- raise "Specs already loaded" if @specs
160
+ return if @specs
161
161
  @remote = true
162
162
  sources.remote!
163
163
  specs
@@ -269,9 +269,8 @@ module Bundler
269
269
  else
270
270
  # Run a resolve against the locally available gems
271
271
  Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
272
- platforms_for_resolve = platforms.one? {|p| generic(p) == Gem::Platform::RUBY } ? platforms : platforms.reject{|p| p == Gem::Platform::RUBY }
273
- expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote, platforms_for_resolve.map {|p| generic(p) })
274
- last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms_for_resolve)
272
+ expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
273
+ last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
275
274
  end
276
275
 
277
276
  # filter out gems that _can_ be installed on multiple platforms, but don't need
@@ -507,15 +506,11 @@ module Bundler
507
506
  end
508
507
 
509
508
  def validate_platforms!
510
- return if @platforms.any? do |bundle_platform|
511
- Bundler.rubygems.platforms.any? do |local_platform|
512
- MatchPlatform.platforms_match?(bundle_platform, local_platform)
513
- end
514
- end
509
+ return if current_platform_locked?
515
510
 
516
511
  raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
517
- "but your local platforms are #{Bundler.rubygems.platforms.map(&:to_s)}, and " \
518
- "there's no compatible match between those two lists."
512
+ "but your local platform is #{Bundler.local_platform}. " \
513
+ "Add the current platform to the lockfile with `bundle lock --add-platform #{Bundler.local_platform}` and try again."
519
514
  end
520
515
 
521
516
  def add_platform(platform)
@@ -528,6 +523,12 @@ module Bundler
528
523
  raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
529
524
  end
530
525
 
526
+ def most_specific_locked_platform
527
+ @platforms.min_by do |bundle_platform|
528
+ platform_specificity_match(bundle_platform, local_platform)
529
+ end
530
+ end
531
+
531
532
  def find_resolved_spec(current_spec)
532
533
  specs.find_by_name_and_platform(current_spec.name, current_spec.platform)
533
534
  end
@@ -549,6 +550,18 @@ module Bundler
549
550
 
550
551
  private
551
552
 
553
+ def current_ruby_platform_locked?
554
+ return false unless generic_local_platform == Gem::Platform::RUBY
555
+
556
+ current_platform_locked?
557
+ end
558
+
559
+ def current_platform_locked?
560
+ @platforms.any? do |bundle_platform|
561
+ MatchPlatform.platforms_match?(bundle_platform, Bundler.local_platform)
562
+ end
563
+ end
564
+
552
565
  def add_current_platform
553
566
  add_platform(local_platform)
554
567
  end
@@ -805,11 +818,6 @@ module Bundler
805
818
  # commonly happens if the version changed in the gemspec
806
819
  next unless new_spec
807
820
 
808
- new_runtime_deps = new_spec.dependencies.select {|d| d.type != :development }
809
- old_runtime_deps = s.dependencies.select {|d| d.type != :development }
810
- # If the dependencies of the path source have changed and locked spec can't satisfy new dependencies, unlock it
811
- next unless new_runtime_deps.sort == old_runtime_deps.sort || new_runtime_deps.all? {|d| satisfies_locked_spec?(d) }
812
-
813
821
  s.dependencies.replace(new_spec.dependencies)
814
822
  end
815
823
 
@@ -871,8 +879,7 @@ module Bundler
871
879
  end
872
880
  end
873
881
 
874
- def expand_dependencies(dependencies, remote = false, platforms = nil)
875
- platforms ||= @platforms
882
+ def expand_dependencies(dependencies, remote = false)
876
883
  deps = []
877
884
  dependencies.each do |dep|
878
885
  dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
@@ -885,7 +892,7 @@ module Bundler
885
892
 
886
893
  def expand_dependency_with_platforms(dep, platforms)
887
894
  platforms.map do |p|
888
- DepProxy.new(dep, p)
895
+ DepProxy.get_proxy(dep, p)
889
896
  end
890
897
  end
891
898
 
@@ -906,6 +913,7 @@ module Bundler
906
913
  metadata_dependencies.each do |dep|
907
914
  source_requirements[dep.name] = sources.metadata_source
908
915
  end
916
+ source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
909
917
  source_requirements["bundler"] = sources.metadata_source # needs to come last to override
910
918
  source_requirements
911
919
  end
@@ -965,7 +973,7 @@ module Bundler
965
973
  next requirements if @locked_gems.dependencies[name] != dependency
966
974
  next requirements if dependency.source.is_a?(Source::Path)
967
975
  dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
968
- requirements[name] = DepProxy.new(dep, locked_spec.platform)
976
+ requirements[name] = DepProxy.get_proxy(dep, locked_spec.platform)
969
977
  requirements
970
978
  end.values
971
979
  end
@@ -4,19 +4,18 @@ module Bundler
4
4
  class DepProxy
5
5
  attr_reader :__platform, :dep
6
6
 
7
+ @proxies = {}
8
+
9
+ def self.get_proxy(dep, platform)
10
+ @proxies[[dep, platform]] ||= new(dep, platform).freeze
11
+ end
12
+
7
13
  def initialize(dep, platform)
8
14
  @dep = dep
9
15
  @__platform = platform
10
16
  end
11
17
 
12
- def hash
13
- @hash ||= [dep, __platform].hash
14
- end
15
-
16
- def ==(other)
17
- return false if other.class != self.class
18
- dep == other.dep && __platform == other.__platform
19
- end
18
+ private_class_method :new
20
19
 
21
20
  alias_method :eql?, :==
22
21
 
@@ -39,6 +38,14 @@ module Bundler
39
38
  s
40
39
  end
41
40
 
41
+ def dup
42
+ raise NoMethodError.new("DepProxy cannot be duplicated")
43
+ end
44
+
45
+ def clone
46
+ raise NoMethodError.new("DepProxy cannot be cloned")
47
+ end
48
+
42
49
  private
43
50
 
44
51
  def method_missing(*args, &blk)
@@ -27,7 +27,6 @@ module Bundler
27
27
 
28
28
  (1..10).each {|v| define_method("bundler_#{v}_mode?") { major_version >= v } }
29
29
 
30
- settings_flag(:allow_bundler_dependency_conflicts) { bundler_3_mode? }
31
30
  settings_flag(:allow_offline_install) { bundler_3_mode? }
32
31
  settings_flag(:auto_clean_without_path) { bundler_3_mode? }
33
32
  settings_flag(:cache_all) { bundler_3_mode? }
@@ -137,7 +137,6 @@ module Bundler
137
137
  end
138
138
 
139
139
  specs.each do |name, version, platform, dependencies, metadata|
140
- next if name == "bundler"
141
140
  spec = if dependencies
142
141
  EndpointSpecification.new(name, version, platform, dependencies, metadata)
143
142
  else
@@ -116,19 +116,21 @@ module Bundler
116
116
 
117
117
  def git_push(remote = nil)
118
118
  remote ||= default_remote
119
- perform_git_push remote
120
- perform_git_push "#{remote} #{version_tag}"
119
+ perform_git_push "#{remote} refs/heads/#{current_branch}"
120
+ perform_git_push "#{remote} refs/tags/#{version_tag}"
121
121
  Bundler.ui.confirm "Pushed git commits and release tag."
122
122
  end
123
123
 
124
124
  def default_remote
125
- current_branch = sh(%w[git rev-parse --abbrev-ref HEAD]).strip
126
- return "origin" if current_branch.empty?
125
+ remote_for_branch, status = sh_with_status(%W[git config --get branch.#{current_branch}.remote])
126
+ return "origin" unless status.success?
127
127
 
128
- remote_for_branch = sh(%W[git config --get branch.#{current_branch}.remote]).strip
129
- return "origin" if remote_for_branch.empty?
128
+ remote_for_branch.strip
129
+ end
130
130
 
131
- remote_for_branch
131
+ def current_branch
132
+ # We can replace this with `git branch --show-current` once we drop support for git < 2.22.0
133
+ sh(%w[git rev-parse --abbrev-ref HEAD]).gsub(%r{\Aheads/}, "").strip
132
134
  end
133
135
 
134
136
  def allowed_push_host
@@ -35,41 +35,33 @@ module Bundler
35
35
 
36
36
  def platform_specificity_match(spec_platform, user_platform)
37
37
  spec_platform = Gem::Platform.new(spec_platform)
38
- return PlatformMatch::EXACT_MATCH if spec_platform == user_platform
39
- return PlatformMatch::WORST_MATCH if spec_platform.nil? || spec_platform == Gem::Platform::RUBY || user_platform == Gem::Platform::RUBY
40
-
41
- PlatformMatch.new(
42
- PlatformMatch.os_match(spec_platform, user_platform),
43
- PlatformMatch.cpu_match(spec_platform, user_platform),
44
- PlatformMatch.platform_version_match(spec_platform, user_platform)
45
- )
38
+
39
+ PlatformMatch.specificity_score(spec_platform, user_platform)
46
40
  end
47
41
  module_function :platform_specificity_match
48
42
 
49
43
  def select_best_platform_match(specs, platform)
50
- specs.select {|spec| spec.match_platform(platform) }.
51
- min_by {|spec| platform_specificity_match(spec.platform, platform) }
44
+ matching = specs.select {|spec| spec.match_platform(platform) }
45
+ exact = matching.select {|spec| spec.platform == platform }
46
+ return exact if exact.any?
47
+
48
+ sorted_matching = matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) }
49
+ exemplary_spec = sorted_matching.first
50
+
51
+ sorted_matching.take_while{|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) }
52
52
  end
53
53
  module_function :select_best_platform_match
54
54
 
55
- PlatformMatch = Struct.new(:os_match, :cpu_match, :platform_version_match)
56
55
  class PlatformMatch
57
- def <=>(other)
58
- return nil unless other.is_a?(PlatformMatch)
56
+ def self.specificity_score(spec_platform, user_platform)
57
+ return -1 if spec_platform == user_platform
58
+ return 1_000_000 if spec_platform.nil? || spec_platform == Gem::Platform::RUBY || user_platform == Gem::Platform::RUBY
59
59
 
60
- m = os_match <=> other.os_match
61
- return m unless m.zero?
62
-
63
- m = cpu_match <=> other.cpu_match
64
- return m unless m.zero?
65
-
66
- m = platform_version_match <=> other.platform_version_match
67
- m
60
+ os_match(spec_platform, user_platform) +
61
+ cpu_match(spec_platform, user_platform) * 10 +
62
+ platform_version_match(spec_platform, user_platform) * 100
68
63
  end
69
64
 
70
- EXACT_MATCH = new(-1, -1, -1).freeze
71
- WORST_MATCH = new(1_000_000, 1_000_000, 1_000_000).freeze
72
-
73
65
  def self.os_match(spec_platform, user_platform)
74
66
  if spec_platform.os == user_platform.os
75
67
  0
@@ -100,5 +92,19 @@ module Bundler
100
92
  end
101
93
  end
102
94
  end
95
+
96
+ def same_specificity(platform, spec, exemplary_spec)
97
+ platform_specificity_match(spec.platform, platform) == platform_specificity_match(exemplary_spec.platform, platform)
98
+ end
99
+ module_function :same_specificity
100
+
101
+ def same_deps(spec, exemplary_spec)
102
+ same_runtime_deps = spec.dependencies.sort == exemplary_spec.dependencies.sort
103
+ return same_runtime_deps unless spec.is_a?(Gem::Specification) && exemplary_spec.is_a?(Gem::Specification)
104
+
105
+ same_metadata_deps = spec.required_ruby_version == exemplary_spec.required_ruby_version && spec.required_rubygems_version == exemplary_spec.required_rubygems_version
106
+ same_runtime_deps && same_metadata_deps
107
+ end
108
+ module_function :same_deps
103
109
  end
104
110
  end
@@ -81,8 +81,8 @@ module Bundler
81
81
  sort_dep_specs(spec_groups, locked_spec)
82
82
  end.tap do |specs|
83
83
  if DEBUG
84
- warn before_result
85
- warn " after sort_versions: #{debug_format_result(dep, specs).inspect}"
84
+ puts before_result
85
+ puts " after sort_versions: #{debug_format_result(dep, specs).inspect}"
86
86
  end
87
87
  end
88
88
  end
@@ -82,7 +82,6 @@ module Bundler
82
82
 
83
83
  if resolve_if_needed(options)
84
84
  ensure_specs_are_compatible!
85
- warn_on_incompatible_bundler_deps
86
85
  load_plugins
87
86
  options.delete(:jobs)
88
87
  else
@@ -265,22 +264,6 @@ module Bundler
265
264
  end
266
265
  end
267
266
 
268
- def warn_on_incompatible_bundler_deps
269
- bundler_version = Gem::Version.create(Bundler::VERSION)
270
- @definition.specs.each do |spec|
271
- spec.dependencies.each do |dep|
272
- next if dep.type == :development
273
- next unless dep.name == "bundler".freeze
274
- next if dep.requirement.satisfied_by?(bundler_version)
275
-
276
- Bundler.ui.warn "#{spec.name} (#{spec.version}) has dependency" \
277
- " #{SharedHelpers.pretty_dependency(dep)}" \
278
- ", which is unsatisfied by the current bundler version #{VERSION}" \
279
- ", so the dependency is being ignored"
280
- end
281
- end
282
- end
283
-
284
267
  def install_in_parallel(size, standalone, force = false)
285
268
  spec_installations = ParallelInstaller.call(self, @definition.specs, size, standalone, force)
286
269
  spec_installations.each do |installation|
@@ -15,6 +15,7 @@ module Bundler
15
15
  file.puts "ruby_engine = RUBY_ENGINE"
16
16
  file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
17
17
  file.puts "path = File.expand_path('..', __FILE__)"
18
+ file.puts reverse_rubygems_kernel_mixin
18
19
  paths.each do |path|
19
20
  file.puts %($:.unshift File.expand_path("\#{path}/#{path}"))
20
21
  end
@@ -48,5 +49,18 @@ module Bundler
48
49
  error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
49
50
  raise Gem::InvalidSpecificationException.new(error_message)
50
51
  end
52
+
53
+ def reverse_rubygems_kernel_mixin
54
+ <<~END
55
+ kernel = (class << ::Kernel; self; end)
56
+ [kernel, ::Kernel].each do |k|
57
+ if k.private_method_defined?(:gem_original_require)
58
+ k.send(:remove_method, :require)
59
+ k.send(:define_method, :require, k.instance_method(:gem_original_require))
60
+ k.send(:private, :require)
61
+ end
62
+ end
63
+ END
64
+ end
51
65
  end
52
66
  end
@@ -4,7 +4,7 @@ require_relative "match_platform"
4
4
 
5
5
  module Bundler
6
6
  class LazySpecification
7
- Identifier = Struct.new(:name, :version, :source, :platform, :dependencies)
7
+ Identifier = Struct.new(:name, :version, :platform)
8
8
  class Identifier
9
9
  include Comparable
10
10
  def <=>(other)
@@ -108,7 +108,7 @@ module Bundler
108
108
  end
109
109
 
110
110
  def identifier
111
- @__identifier ||= Identifier.new(name, version, source, platform, dependencies)
111
+ @__identifier ||= Identifier.new(name, version, platform)
112
112
  end
113
113
 
114
114
  def git_version
@@ -131,17 +131,16 @@ module Bundler
131
131
  end
132
132
 
133
133
  #
134
- # Bundler 2.2.0 was the first version that records the full resolution
135
- # including platform specific gems in the lockfile, which means that if a
136
- # gem with RUBY platform is recorded, the RUBY platform version of the gem
137
- # should be installed. Previously bundler would record only generic versions
138
- # in the lockfile and then install the most specific platform variant if
139
- # available.
134
+ # For backwards compatibility with existing lockfiles, if the most specific
135
+ # locked platform is RUBY, we keep the previous behaviour of resolving the
136
+ # best platform variant at materiliazation time. For previous bundler
137
+ # versions (before 2.2.0) this was always the case (except when the lockfile
138
+ # only included non-ruby platforms), but we're also keeping this behaviour
139
+ # on newer bundlers unless users generate the lockfile from scratch or
140
+ # explicitly add a more specific platform.
140
141
  #
141
142
  def ruby_platform_materializes_to_ruby_platform?
142
- locked_bundler_version = Bundler.locked_bundler_version
143
-
144
- locked_bundler_version.nil? || Gem::Version.new(locked_bundler_version) >= Gem::Version.new("2.2.0")
143
+ !Bundler.most_specific_locked_platform?(Gem::Platform::RUBY) || Bundler.settings[:force_ruby_platform]
145
144
  end
146
145
  end
147
146
  end
@@ -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\-ADD" "1" "November 2020" "" ""
4
+ .TH "BUNDLE\-ADD" "1" "January 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
@@ -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\-BINSTUBS" "1" "November 2020" "" ""
4
+ .TH "BUNDLE\-BINSTUBS" "1" "January 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
@@ -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\-CACHE" "1" "November 2020" "" ""
4
+ .TH "BUNDLE\-CACHE" "1" "January 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
@@ -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\-CHECK" "1" "November 2020" "" ""
4
+ .TH "BUNDLE\-CHECK" "1" "January 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
@@ -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\-CLEAN" "1" "November 2020" "" ""
4
+ .TH "BUNDLE\-CLEAN" "1" "January 2021" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory