rubygems-update 3.2.8 → 3.2.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/Manifest.txt +1 -0
  4. data/Rakefile +6 -0
  5. data/bundler/CHANGELOG.md +48 -0
  6. data/bundler/lib/bundler.rb +1 -1
  7. data/bundler/lib/bundler/build_metadata.rb +2 -2
  8. data/bundler/lib/bundler/cli/gem.rb +23 -17
  9. data/bundler/lib/bundler/definition.rb +26 -29
  10. data/bundler/lib/bundler/dsl.rb +36 -22
  11. data/bundler/lib/bundler/inline.rb +1 -0
  12. data/bundler/lib/bundler/installer.rb +2 -0
  13. data/bundler/lib/bundler/lockfile_parser.rb +12 -8
  14. data/bundler/lib/bundler/man/bundle-config.1 +4 -4
  15. data/bundler/lib/bundler/man/bundle-config.1.ronn +8 -7
  16. data/bundler/lib/bundler/plugin.rb +1 -0
  17. data/bundler/lib/bundler/plugin/installer.rb +8 -10
  18. data/bundler/lib/bundler/plugin/source_list.rb +4 -0
  19. data/bundler/lib/bundler/resolver.rb +36 -38
  20. data/bundler/lib/bundler/rubygems_gem_installer.rb +47 -0
  21. data/bundler/lib/bundler/source_list.rb +15 -18
  22. data/bundler/lib/bundler/stub_specification.rb +8 -0
  23. data/bundler/lib/bundler/templates/newgem/README.md.tt +5 -3
  24. data/bundler/lib/bundler/version.rb +1 -1
  25. data/lib/rubygems.rb +2 -2
  26. data/lib/rubygems/command.rb +1 -0
  27. data/lib/rubygems/config_file.rb +9 -0
  28. data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
  29. data/lib/rubygems/dependency.rb +5 -1
  30. data/lib/rubygems/platform.rb +7 -3
  31. data/lib/rubygems/remote_fetcher.rb +1 -0
  32. data/lib/rubygems/specification.rb +13 -11
  33. data/lib/rubygems/test_case.rb +5 -6
  34. data/rubygems-update.gemspec +1 -1
  35. data/test/rubygems/test_gem.rb +80 -8
  36. data/test/rubygems/test_gem_commands_outdated_command.rb +18 -0
  37. data/test/rubygems/test_gem_config_file.rb +10 -0
  38. data/test/rubygems/test_gem_dependency_installer.rb +2 -18
  39. data/test/rubygems/test_gem_platform.rb +29 -0
  40. data/test/rubygems/test_gem_remote_fetcher.rb +6 -0
  41. data/test/rubygems/test_gem_specification.rb +10 -15
  42. data/test/rubygems/test_gem_util.rb +4 -4
  43. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c88809da851f0467214e490fb43a1d4c54b9980d7c0099881d10b19bd5f668c
4
- data.tar.gz: adc3c7278c9bca2021b7bfb3f3ba0a215447512d2af3cc7bba8bd8c3781944d5
3
+ metadata.gz: 666dcbc545356912c49ba537a3964a73cf66167dae38bd44a1ef874c24939d09
4
+ data.tar.gz: 63c0da17d148277c4d34d63354fda167768b64d1349a4cb9b4175c74f918a9f0
5
5
  SHA512:
6
- metadata.gz: 6ce421e400fcb3e38ad14f83e5614f0ee77ad0f9cfba73c7a51b8afca807f1ef3f166a585e4ec377fb41f2526d02055dcaff66bf54d9dde221f68f256e0bf777
7
- data.tar.gz: b8da7349c0f8c7c71e95405a8748006c70c5917613f85f5ed56d7188d1cc6afa7b348d07e133535e9959c9505c9b86dc9087c1d4af25501a93535e0301d31bf4
6
+ metadata.gz: 3d99946c2c1d0ce009b4864fa1ab4bde104e70ba20d9b859cb5ad377e83a969d420a3abbe517c91290b788a83b8886e0e1403de15177dd0d5bd0d53583737e73
7
+ data.tar.gz: aa89692b9cdbb6c4220a6c51b3b0fdd07c2187ec1d71e83db17bd216ce26a1fc29912fff748409f44fbfff830dc998c888005c98851615369462de3a1ee5e620
data/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ # 3.2.13 / 2021-03-03
2
+
3
+ ## Bug fixes:
4
+
5
+ * Support non-gnu libc linux platforms. Pull request #4082 by lloeki
6
+
7
+ # 3.2.12 / 2021-03-01
8
+
9
+ ## Bug fixes:
10
+
11
+ * Restore the ability to manually install extension gems. Pull request
12
+ #4384 by cfis
13
+
14
+ # 3.2.11 / 2021-02-17
15
+
16
+ ## Enhancements:
17
+
18
+ * Optionally fallback to IPv4 when IPv6 is unreachable. Pull request #2662
19
+ by sonalkr132
20
+
21
+ # 3.2.10 / 2021-02-15
22
+
23
+ ## Documentation:
24
+
25
+ * Add a `gem push` example to `gem help`. Pull request #4373 by
26
+ deivid-rodriguez
27
+ * Improve documentation for `required_ruby_version`. Pull request #4343 by
28
+ AlexWayfer
29
+
30
+ # 3.2.9 / 2021-02-08
31
+
32
+ ## Bug fixes:
33
+
34
+ * Fix error message when underscore selection can't find bundler. Pull
35
+ request #4363 by deivid-rodriguez
36
+ * Fix `Gem::Specification.stubs_for` returning wrong named specs. Pull
37
+ request #4356 by tompng
38
+ * Don't error out when activating a binstub unless necessary. Pull request
39
+ #4351 by deivid-rodriguez
40
+ * Fix `gem outdated` incorrectly handling platform specific gems. Pull
41
+ request #4248 by deivid-rodriguez
42
+
1
43
  # 3.2.8 / 2021-02-02
2
44
 
3
45
  ## Bug fixes:
data/Manifest.txt CHANGED
@@ -354,6 +354,7 @@ lib/rubygems/config_file.rb
354
354
  lib/rubygems/core_ext/kernel_gem.rb
355
355
  lib/rubygems/core_ext/kernel_require.rb
356
356
  lib/rubygems/core_ext/kernel_warn.rb
357
+ lib/rubygems/core_ext/tcpsocket_init.rb
357
358
  lib/rubygems/defaults.rb
358
359
  lib/rubygems/dependency.rb
359
360
  lib/rubygems/dependency_installer.rb
data/Rakefile CHANGED
@@ -15,6 +15,12 @@ task :update do |_, args|
15
15
  sh "ruby", "bundler/bin/bundle", "update", *args, "--gemfile=dev_gems.rb"
16
16
  end
17
17
 
18
+ desc "Update the locked bundler version in dev environment"
19
+ task :update_locked_bundler do |_, args|
20
+ sh "ruby", "bundler/bin/bundle", "update", "--bundler", "--gemfile=dev_gems.rb"
21
+ sh "ruby", "bundler/bin/bundle", "update", "--bundler", "--gemfile=bundler/test_gems.rb"
22
+ end
23
+
18
24
  desc "Setup git hooks"
19
25
  task :git_hooks do
20
26
  sh "git config core.hooksPath .githooks"
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,51 @@
1
+ # 2.2.13 (March 3, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Respect user configured default branch in README links in new generated gems [#4303](https://github.com/rubygems/rubygems/pull/4303)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix gems sometimes being pulled from irrelevant sources [#4418](https://github.com/rubygems/rubygems/pull/4418)
10
+
11
+ # 2.2.12 (March 1, 2021)
12
+
13
+ ## Bug fixes:
14
+
15
+ - Fix sporadic warnings about `nil` gemspec on install/update and make those faster [#4409](https://github.com/rubygems/rubygems/pull/4409)
16
+ - Fix deployment install with duplicate path gems added to Gemfile [#4410](https://github.com/rubygems/rubygems/pull/4410)
17
+
18
+ # 2.2.11 (February 17, 2021)
19
+
20
+ ## Bug fixes:
21
+
22
+ - Revert disable_multisource changes [#4385](https://github.com/rubygems/rubygems/pull/4385)
23
+
24
+ # 2.2.10 (February 15, 2021)
25
+
26
+ ## Security fixes:
27
+
28
+ - Fix source priority for transitive dependencies and split lockfile rubygems source sections [#3655](https://github.com/rubygems/rubygems/pull/3655)
29
+
30
+ ## Bug fixes:
31
+
32
+ - Fix adding platforms to lockfile sometimes conflicting on ruby requirements [#4371](https://github.com/rubygems/rubygems/pull/4371)
33
+ - Fix bundler sometimes choosing ruby variants over java ones [#4367](https://github.com/rubygems/rubygems/pull/4367)
34
+
35
+ ## Documentation:
36
+
37
+ - Update man pages to reflect to new default for bundle install jobs [#4188](https://github.com/rubygems/rubygems/pull/4188)
38
+
39
+ # 2.2.9 (February 8, 2021)
40
+
41
+ ## Enhancements:
42
+
43
+ - Stop removing existing platforms when force_ruby_platform is true [#4336](https://github.com/rubygems/rubygems/pull/4336)
44
+
45
+ ## Bug fixes:
46
+
47
+ - Don't install platform specific gems on truffleruby [#4333](https://github.com/rubygems/rubygems/pull/4333)
48
+
1
49
  # 2.2.8 (February 2, 2021)
2
50
 
3
51
  ## Enhancements:
@@ -440,7 +440,7 @@ EOF
440
440
  end
441
441
 
442
442
  def local_platform
443
- return Gem::Platform::RUBY if settings[:force_ruby_platform]
443
+ return Gem::Platform::RUBY if settings[:force_ruby_platform] || Gem.platforms == [Gem::Platform::RUBY]
444
444
  Gem::Platform.local
445
445
  end
446
446
 
@@ -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-02-02".freeze
8
- @git_commit_sha = "4015e550dc".freeze
7
+ @built_at = "2021-03-03".freeze
8
+ @git_commit_sha = "9b15ab18c4".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -39,11 +39,11 @@ module Bundler
39
39
  constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
40
40
  constant_array = constant_name.split("::")
41
41
 
42
- git_installed = Bundler.git_present?
42
+ use_git = Bundler.git_present? && options[:git]
43
43
 
44
- git_author_name = git_installed ? `git config user.name`.chomp : ""
45
- github_username = git_installed ? `git config github.user`.chomp : ""
46
- git_user_email = git_installed ? `git config user.email`.chomp : ""
44
+ git_author_name = use_git ? `git config user.name`.chomp : ""
45
+ github_username = use_git ? `git config github.user`.chomp : ""
46
+ git_user_email = use_git ? `git config user.email`.chomp : ""
47
47
 
48
48
  config = {
49
49
  :name => name,
@@ -58,6 +58,7 @@ module Bundler
58
58
  :ext => options[:ext],
59
59
  :exe => options[:exe],
60
60
  :bundler_version => bundler_dependency_version,
61
+ :git => use_git,
61
62
  :github_username => github_username.empty? ? "[USERNAME]" : github_username,
62
63
  :required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
63
64
  }
@@ -79,7 +80,7 @@ module Bundler
79
80
  bin/setup
80
81
  ]
81
82
 
82
- templates.merge!("gitignore.tt" => ".gitignore") if Bundler.git_present?
83
+ templates.merge!("gitignore.tt" => ".gitignore") if use_git
83
84
 
84
85
  if test_framework = ask_and_set_test_framework
85
86
  config[:test] = test_framework
@@ -175,24 +176,31 @@ module Bundler
175
176
  )
176
177
  end
177
178
 
179
+ if File.exist?(target) && !File.directory?(target)
180
+ Bundler.ui.error "Couldn't create a new gem named `#{gem_name}` because there's an existing file named `#{gem_name}`."
181
+ exit Bundler::BundlerError.all_errors[Bundler::GenericSystemCallError]
182
+ end
183
+
184
+ if use_git
185
+ Bundler.ui.info "Initializing git repo in #{target}"
186
+ `git init #{target}`
187
+
188
+ config[:git_default_branch] = File.read("#{target}/.git/HEAD").split("/").last.chomp
189
+ end
190
+
178
191
  templates.each do |src, dst|
179
192
  destination = target.join(dst)
180
- SharedHelpers.filesystem_access(destination) do
181
- thor.template("newgem/#{src}", destination, config)
182
- end
193
+ thor.template("newgem/#{src}", destination, config)
183
194
  end
184
195
 
185
196
  executables.each do |file|
186
- SharedHelpers.filesystem_access(target.join(file)) do |path|
187
- executable = (path.stat.mode | 0o111)
188
- path.chmod(executable)
189
- end
197
+ path = target.join(file)
198
+ executable = (path.stat.mode | 0o111)
199
+ path.chmod(executable)
190
200
  end
191
201
 
192
- if Bundler.git_present? && options[:git]
193
- Bundler.ui.info "Initializing git repo in #{target}"
202
+ if use_git
194
203
  Dir.chdir(target) do
195
- `git init`
196
204
  `git add .`
197
205
  end
198
206
  end
@@ -202,8 +210,6 @@ module Bundler
202
210
 
203
211
  Bundler.ui.info "Gem '#{name}' was successfully created. " \
204
212
  "For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
205
- rescue Errno::EEXIST => e
206
- raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
207
213
  end
208
214
 
209
215
  private
@@ -82,11 +82,7 @@ module Bundler
82
82
  @lockfile_contents = Bundler.read_file(lockfile)
83
83
  @locked_gems = LockfileParser.new(@lockfile_contents)
84
84
  @locked_platforms = @locked_gems.platforms
85
- if Bundler.settings[:force_ruby_platform]
86
- @platforms = [Gem::Platform::RUBY]
87
- else
88
- @platforms = @locked_platforms.dup
89
- end
85
+ @platforms = @locked_platforms.dup
90
86
  @locked_bundler_version = @locked_gems.bundler_version
91
87
  @locked_ruby_version = @locked_gems.ruby_version
92
88
 
@@ -268,7 +264,7 @@ module Bundler
268
264
  # Run a resolve against the locally available gems
269
265
  Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
270
266
  expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
271
- Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
267
+ Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
272
268
  end
273
269
  end
274
270
  end
@@ -598,7 +594,7 @@ module Bundler
598
594
  deps_for_source = @dependencies.select {|s| s.source == source }
599
595
  locked_deps_for_source = @locked_deps.values.select {|dep| dep.source == locked_source }
600
596
 
601
- deps_for_source.sort != locked_deps_for_source.sort
597
+ deps_for_source.uniq.sort != locked_deps_for_source.sort
602
598
  end
603
599
 
604
600
  def specs_for_source_changed?(source)
@@ -660,19 +656,20 @@ module Bundler
660
656
  def converge_rubygems_sources
661
657
  return false if Bundler.feature_flag.disable_multisource?
662
658
 
663
- changes = false
664
-
665
659
  # Get the RubyGems sources from the Gemfile.lock
666
660
  locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
661
+ return false if locked_gem_sources.empty?
662
+
667
663
  # Get the RubyGems remotes from the Gemfile
668
664
  actual_remotes = sources.rubygems_remotes
665
+ return false if actual_remotes.empty?
666
+
667
+ changes = false
669
668
 
670
669
  # If there is a RubyGems source in both
671
- if !locked_gem_sources.empty? && !actual_remotes.empty?
672
- locked_gem_sources.each do |locked_gem|
673
- # Merge the remotes from the Gemfile into the Gemfile.lock
674
- changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
675
- end
670
+ locked_gem_sources.each do |locked_gem|
671
+ # Merge the remotes from the Gemfile into the Gemfile.lock
672
+ changes |= locked_gem.replace_remotes(actual_remotes, Bundler.settings[:allow_deployment_source_credential_changes])
676
673
  end
677
674
 
678
675
  changes
@@ -897,30 +894,18 @@ module Bundler
897
894
  # Record the specs available in each gem's source, so that those
898
895
  # specs will be available later when the resolver knows where to
899
896
  # look for that gemspec (or its dependencies)
900
- default = sources.default_source
901
- source_requirements = { :default => default }
902
- default = nil unless Bundler.feature_flag.disable_multisource?
903
- dependencies.each do |dep|
904
- next unless source = dep.source || default
905
- source_requirements[dep.name] = source
906
- end
897
+ source_requirements = { :default => sources.default_source }.merge(dependency_source_requirements)
907
898
  metadata_dependencies.each do |dep|
908
899
  source_requirements[dep.name] = sources.metadata_source
909
900
  end
901
+ source_requirements[:global] = index unless Bundler.feature_flag.disable_multisource?
910
902
  source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
911
903
  source_requirements["bundler"] = sources.metadata_source # needs to come last to override
912
904
  source_requirements
913
905
  end
914
906
 
915
907
  def pinned_spec_names(skip = nil)
916
- pinned_names = []
917
- default = Bundler.feature_flag.disable_multisource? && sources.default_source
918
- @dependencies.each do |dep|
919
- next unless dep_source = dep.source || default
920
- next if dep_source == skip
921
- pinned_names << dep.name
922
- end
923
- pinned_names
908
+ dependency_source_requirements.reject {|_, source| source == skip }.keys
924
909
  end
925
910
 
926
911
  def requested_groups
@@ -977,5 +962,17 @@ module Bundler
977
962
 
978
963
  Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
979
964
  end
965
+
966
+ def dependency_source_requirements
967
+ @dependency_source_requirements ||= begin
968
+ source_requirements = {}
969
+ default = sources.default_source
970
+ dependencies.each do |dep|
971
+ dep_source = dep.source || default
972
+ source_requirements[dep.name] = dep_source
973
+ end
974
+ source_requirements
975
+ end
976
+ end
980
977
  end
981
978
  end
@@ -24,6 +24,9 @@ module Bundler
24
24
  def initialize
25
25
  @source = nil
26
26
  @sources = SourceList.new
27
+
28
+ @global_rubygems_sources = []
29
+
27
30
  @git_sources = {}
28
31
  @dependencies = []
29
32
  @groups = []
@@ -45,6 +48,7 @@ module Bundler
45
48
  @gemfiles << expanded_gemfile_path
46
49
  contents ||= Bundler.read_file(@gemfile.to_s)
47
50
  instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
51
+ check_primary_source_safety
48
52
  rescue Exception => e # rubocop:disable Lint/RescueException
49
53
  message = "There was an error " \
50
54
  "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
@@ -164,8 +168,7 @@ module Bundler
164
168
  elsif block_given?
165
169
  with_source(@sources.add_rubygems_source("remotes" => source), &blk)
166
170
  else
167
- check_primary_source_safety(@sources)
168
- @sources.global_rubygems_source = source
171
+ @global_rubygems_sources << source
169
172
  end
170
173
  end
171
174
 
@@ -183,24 +186,14 @@ module Bundler
183
186
  end
184
187
 
185
188
  def path(path, options = {}, &blk)
186
- unless block_given?
187
- msg = "You can no longer specify a path source by itself. Instead, \n" \
188
- "either use the :path option on a gem, or specify the gems that \n" \
189
- "bundler should find in the path source by passing a block to \n" \
190
- "the path method, like: \n\n" \
191
- " path 'dir/containing/rails' do\n" \
192
- " gem 'rails'\n" \
193
- " end\n\n"
194
-
195
- raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
196
- SharedHelpers.major_deprecation(2, msg.strip)
197
- end
198
-
199
189
  source_options = normalize_hash(options).merge(
200
190
  "path" => Pathname.new(path),
201
191
  "root_path" => gemfile_root,
202
192
  "gemspec" => gemspecs.find {|g| g.name == options["name"] }
203
193
  )
194
+
195
+ source_options["global"] = true unless block_given?
196
+
204
197
  source = @sources.add_path_source(source_options)
205
198
  with_source(source, &blk)
206
199
  end
@@ -279,6 +272,11 @@ module Bundler
279
272
  raise GemfileError, "Undefined local variable or method `#{name}' for Gemfile"
280
273
  end
281
274
 
275
+ def check_primary_source_safety
276
+ check_path_source_safety
277
+ check_rubygems_source_safety
278
+ end
279
+
282
280
  private
283
281
 
284
282
  def add_git_sources
@@ -440,17 +438,33 @@ repo_name ||= user_name
440
438
  end
441
439
  end
442
440
 
443
- def check_primary_source_safety(source_list)
444
- return if source_list.rubygems_primary_remotes.empty? && source_list.global_rubygems_source.nil?
441
+ def check_path_source_safety
442
+ return if @sources.global_path_source.nil?
443
+
444
+ msg = "You can no longer specify a path source by itself. Instead, \n" \
445
+ "either use the :path option on a gem, or specify the gems that \n" \
446
+ "bundler should find in the path source by passing a block to \n" \
447
+ "the path method, like: \n\n" \
448
+ " path 'dir/containing/rails' do\n" \
449
+ " gem 'rails'\n" \
450
+ " end\n\n"
451
+
452
+ SharedHelpers.major_deprecation(2, msg.strip)
453
+ end
454
+
455
+ def check_rubygems_source_safety
456
+ @sources.global_rubygems_source = @global_rubygems_sources.shift
457
+ return if @global_rubygems_sources.empty?
458
+
459
+ @global_rubygems_sources.each do |source|
460
+ @sources.add_rubygems_remote(source)
461
+ end
445
462
 
446
463
  if Bundler.feature_flag.disable_multisource?
447
464
  msg = "This Gemfile contains multiple primary sources. " \
448
465
  "Each source after the first must include a block to indicate which gems " \
449
- "should come from that source"
450
- unless Bundler.feature_flag.bundler_2_mode?
451
- msg += ". To downgrade this error to a warning, run " \
452
- "`bundle config unset disable_multisource`"
453
- end
466
+ "should come from that source. To downgrade this error to a warning, run " \
467
+ "`bundle config unset disable_multisource`"
454
468
  raise GemfileEvalError, msg
455
469
  else
456
470
  Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \