rubygems-update 3.5.6 → 3.5.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +204 -1
  3. data/CODE_OF_CONDUCT.md +79 -28
  4. data/CONTRIBUTING.md +2 -2
  5. data/Manifest.txt +9 -4
  6. data/POLICIES.md +75 -6
  7. data/bundler/CHANGELOG.md +156 -0
  8. data/bundler/lib/bundler/build_metadata.rb +2 -2
  9. data/bundler/lib/bundler/cli/binstubs.rb +1 -1
  10. data/bundler/lib/bundler/cli/fund.rb +1 -1
  11. data/bundler/lib/bundler/cli/gem.rb +7 -14
  12. data/bundler/lib/bundler/cli/install.rb +1 -1
  13. data/bundler/lib/bundler/cli/plugin.rb +3 -2
  14. data/bundler/lib/bundler/cli.rb +14 -31
  15. data/bundler/lib/bundler/compact_index_client/cache.rb +47 -72
  16. data/bundler/lib/bundler/compact_index_client/parser.rb +84 -0
  17. data/bundler/lib/bundler/compact_index_client.rb +51 -80
  18. data/bundler/lib/bundler/constants.rb +8 -1
  19. data/bundler/lib/bundler/definition.rb +114 -71
  20. data/bundler/lib/bundler/dependency.rb +2 -1
  21. data/bundler/lib/bundler/dsl.rb +16 -1
  22. data/bundler/lib/bundler/endpoint_specification.rb +11 -0
  23. data/bundler/lib/bundler/env.rb +1 -1
  24. data/bundler/lib/bundler/environment_preserver.rb +2 -20
  25. data/bundler/lib/bundler/errors.rb +14 -0
  26. data/bundler/lib/bundler/fetcher/compact_index.rb +15 -24
  27. data/bundler/lib/bundler/gem_helper.rb +1 -1
  28. data/bundler/lib/bundler/gem_helpers.rb +14 -7
  29. data/bundler/lib/bundler/gem_version_promoter.rb +42 -38
  30. data/bundler/lib/bundler/injector.rb +3 -5
  31. data/bundler/lib/bundler/installer/gem_installer.rb +0 -1
  32. data/bundler/lib/bundler/installer/standalone.rb +0 -3
  33. data/bundler/lib/bundler/installer.rb +9 -11
  34. data/bundler/lib/bundler/lazy_specification.rb +1 -0
  35. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  38. data/bundler/lib/bundler/man/bundle-check.1 +3 -1
  39. data/bundler/lib/bundler/man/bundle-check.1.ronn +3 -0
  40. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  41. data/bundler/lib/bundler/man/bundle-config.1 +2 -4
  42. data/bundler/lib/bundler/man/bundle-config.1.ronn +1 -4
  43. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  44. data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
  45. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  46. data/bundler/lib/bundler/man/bundle-gem.1 +7 -1
  47. data/bundler/lib/bundler/man/bundle-gem.1.ronn +11 -0
  48. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  49. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  50. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  51. data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
  52. data/bundler/lib/bundler/man/bundle-install.1 +3 -3
  53. data/bundler/lib/bundler/man/bundle-install.1.ronn +2 -2
  54. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  55. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  56. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  57. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  58. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  59. data/bundler/lib/bundler/man/bundle-plugin.1 +7 -4
  60. data/bundler/lib/bundler/man/bundle-plugin.1.ronn +7 -3
  61. data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
  62. data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
  63. data/bundler/lib/bundler/man/bundle-show.1 +1 -1
  64. data/bundler/lib/bundler/man/bundle-update.1 +1 -1
  65. data/bundler/lib/bundler/man/bundle-version.1 +1 -1
  66. data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
  67. data/bundler/lib/bundler/man/bundle.1 +1 -1
  68. data/bundler/lib/bundler/man/gemfile.5 +3 -3
  69. data/bundler/lib/bundler/man/gemfile.5.ronn +2 -2
  70. data/bundler/lib/bundler/plugin/installer/path.rb +18 -0
  71. data/bundler/lib/bundler/plugin/installer.rb +36 -16
  72. data/bundler/lib/bundler/plugin/source_list.rb +4 -4
  73. data/bundler/lib/bundler/resolver/base.rb +4 -0
  74. data/bundler/lib/bundler/resolver/candidate.rb +5 -17
  75. data/bundler/lib/bundler/resolver/package.rb +4 -0
  76. data/bundler/lib/bundler/resolver/spec_group.rb +20 -2
  77. data/bundler/lib/bundler/resolver.rb +72 -33
  78. data/bundler/lib/bundler/rubygems_ext.rb +98 -10
  79. data/bundler/lib/bundler/rubygems_gem_installer.rb +35 -2
  80. data/bundler/lib/bundler/rubygems_integration.rb +16 -2
  81. data/bundler/lib/bundler/runtime.rb +1 -1
  82. data/bundler/lib/bundler/self_manager.rb +22 -2
  83. data/bundler/lib/bundler/settings.rb +22 -16
  84. data/bundler/lib/bundler/setup.rb +6 -0
  85. data/bundler/lib/bundler/shared_helpers.rb +6 -4
  86. data/bundler/lib/bundler/source/git/git_proxy.rb +8 -0
  87. data/bundler/lib/bundler/source/git.rb +14 -0
  88. data/bundler/lib/bundler/source/metadata.rb +2 -0
  89. data/bundler/lib/bundler/source/path.rb +0 -13
  90. data/bundler/lib/bundler/source/rubygems.rb +31 -30
  91. data/bundler/lib/bundler/source_list.rb +26 -2
  92. data/bundler/lib/bundler/spec_set.rb +15 -13
  93. data/bundler/lib/bundler/stub_specification.rb +8 -0
  94. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
  95. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -3
  96. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
  97. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +1 -0
  98. data/bundler/lib/bundler/vendored_net_http.rb +20 -5
  99. data/bundler/lib/bundler/vendored_timeout.rb +7 -3
  100. data/bundler/lib/bundler/version.rb +1 -1
  101. data/bundler/lib/bundler/yaml_serializer.rb +1 -8
  102. data/bundler/lib/bundler.rb +26 -1
  103. data/exe/update_rubygems +1 -1
  104. data/lib/rubygems/basic_specification.rb +27 -0
  105. data/lib/rubygems/bundler_version_finder.rb +1 -1
  106. data/lib/rubygems/command.rb +1 -1
  107. data/lib/rubygems/command_manager.rb +2 -1
  108. data/lib/rubygems/commands/build_command.rb +2 -11
  109. data/lib/rubygems/commands/help_command.rb +2 -2
  110. data/lib/rubygems/commands/pristine_command.rb +12 -9
  111. data/lib/rubygems/commands/rdoc_command.rb +1 -8
  112. data/lib/rubygems/commands/rebuild_command.rb +264 -0
  113. data/lib/rubygems/commands/setup_command.rb +2 -0
  114. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  115. data/lib/rubygems/commands/update_command.rb +8 -9
  116. data/lib/rubygems/config_file.rb +33 -16
  117. data/lib/rubygems/defaults.rb +4 -4
  118. data/lib/rubygems/dependency.rb +3 -15
  119. data/lib/rubygems/dependency_list.rb +1 -1
  120. data/lib/rubygems/deprecate.rb +79 -77
  121. data/lib/rubygems/ext/cargo_builder.rb +2 -17
  122. data/lib/rubygems/gemcutter_utilities/webauthn_poller.rb +3 -1
  123. data/lib/rubygems/gemcutter_utilities.rb +1 -1
  124. data/lib/rubygems/gemspec_helpers.rb +19 -0
  125. data/lib/rubygems/installer.rb +9 -8
  126. data/lib/rubygems/package/tar_header.rb +20 -4
  127. data/lib/rubygems/package.rb +13 -8
  128. data/lib/rubygems/platform.rb +3 -2
  129. data/lib/rubygems/remote_fetcher.rb +1 -1
  130. data/lib/rubygems/request.rb +1 -1
  131. data/lib/rubygems/request_set.rb +1 -1
  132. data/lib/rubygems/requirement.rb +2 -2
  133. data/lib/rubygems/resolver/spec_specification.rb +7 -0
  134. data/lib/rubygems/s3_uri_signer.rb +1 -1
  135. data/lib/rubygems/safe_yaml.rb +10 -1
  136. data/lib/rubygems/security.rb +1 -1
  137. data/lib/rubygems/specification.rb +55 -124
  138. data/lib/rubygems/specification_policy.rb +26 -6
  139. data/lib/rubygems/specification_record.rb +212 -0
  140. data/lib/rubygems/stub_specification.rb +21 -0
  141. data/lib/rubygems/uninstaller.rb +27 -20
  142. data/lib/rubygems/util/licenses.rb +68 -0
  143. data/lib/rubygems/vendor/molinillo/lib/molinillo/dependency_graph.rb +1 -1
  144. data/lib/rubygems/vendored_net_http.rb +5 -0
  145. data/lib/rubygems/vendored_timeout.rb +5 -0
  146. data/lib/rubygems/yaml_serializer.rb +1 -8
  147. data/lib/rubygems.rb +28 -15
  148. data/rubygems-update.gemspec +1 -1
  149. metadata +12 -7
  150. data/lib/rubygems/net/http.rb +0 -3
  151. data/lib/rubygems/timeout.rb +0 -3
  152. /data/lib/rubygems/{optparse.rb → vendored_optparse.rb} +0 -0
  153. /data/lib/rubygems/{tsort.rb → vendored_tsort.rb} +0 -0
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,159 @@
1
+ # 2.5.16 (July 18, 2024)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix platform removal regression when `platforms:` used in the Gemfile [#7864](https://github.com/rubygems/rubygems/pull/7864)
6
+ - Fix standalone script when default gems with extensions are used [#7870](https://github.com/rubygems/rubygems/pull/7870)
7
+ - Fix another case of `bundle lock --add-platform` doing nothing [#7848](https://github.com/rubygems/rubygems/pull/7848)
8
+ - Fix bad error messages when using `bundle add` with frozen mode set [#7845](https://github.com/rubygems/rubygems/pull/7845)
9
+ - Fix generic platform gems getting incorrectly removed from lockfile [#7833](https://github.com/rubygems/rubygems/pull/7833)
10
+
11
+ ## Performance:
12
+
13
+ - Use `caller_locations` instead of splitting `caller` [#7708](https://github.com/rubygems/rubygems/pull/7708)
14
+
15
+ # 2.5.15 (July 9, 2024)
16
+
17
+ ## Enhancements:
18
+
19
+ - Support `--no-test`, `--no-ci`, and `--no-linter` options [#7780](https://github.com/rubygems/rubygems/pull/7780)
20
+ - Allow bundle command in new gems with invalid metadata [#7707](https://github.com/rubygems/rubygems/pull/7707)
21
+
22
+ ## Bug fixes:
23
+
24
+ - Protect creating RubyGems binstubs with a file lock [#7841](https://github.com/rubygems/rubygems/pull/7841)
25
+ - Only allow valid values for `--test`, `--ci`, and `--linter` options [#7801](https://github.com/rubygems/rubygems/pull/7801)
26
+ - Fix `bundle lock --add-platform <current_platform>` doing nothing [#7803](https://github.com/rubygems/rubygems/pull/7803)
27
+ - Print a proper error when bin dir does not have writable permission bit [#7794](https://github.com/rubygems/rubygems/pull/7794)
28
+
29
+ ## Documentation:
30
+
31
+ - Regenerate bundler docs for June 2024 [#7787](https://github.com/rubygems/rubygems/pull/7787)
32
+
33
+ # 2.5.14 (June 21, 2024)
34
+
35
+ ## Bug fixes:
36
+
37
+ - Fix credentials being re-added when re-resolving without a full unlock [#7767](https://github.com/rubygems/rubygems/pull/7767)
38
+ - Fix `bundle update <gem_name>` edge case [#7770](https://github.com/rubygems/rubygems/pull/7770)
39
+ - Fix `bundle fund` when the gemfile contains optional groups [#7758](https://github.com/rubygems/rubygems/pull/7758)
40
+
41
+ # 2.5.13 (June 14, 2024)
42
+
43
+ ## Bug fixes:
44
+
45
+ - Fix funding metadata not being printed in some situations [#7746](https://github.com/rubygems/rubygems/pull/7746)
46
+ - Make sure to not re-resolve when a not fully specific local platform is locked [#7751](https://github.com/rubygems/rubygems/pull/7751)
47
+ - Don't print bug report template when bin dir is not writable [#7748](https://github.com/rubygems/rubygems/pull/7748)
48
+
49
+ # 2.5.12 (June 13, 2024)
50
+
51
+ ## Enhancements:
52
+
53
+ - Keep credentials in lockfile if they are already there [#7720](https://github.com/rubygems/rubygems/pull/7720)
54
+ - Auto switch to locked bundler version even when using binstubs [#7719](https://github.com/rubygems/rubygems/pull/7719)
55
+ - Don't validate local gemspecs twice unnecessarily [#7725](https://github.com/rubygems/rubygems/pull/7725)
56
+ - Improve default gem handling by treating default gems as any other gem [#7673](https://github.com/rubygems/rubygems/pull/7673)
57
+
58
+ ## Bug fixes:
59
+
60
+ - Fix slow and incorrect resolution when adding `sorbet` to a Gemfile and the lockfile only includes "RUBY" in the platforms section [#7731](https://github.com/rubygems/rubygems/pull/7731)
61
+ - Fix duplicated config keys generated when `fallback_timeout` uri option is used [#7704](https://github.com/rubygems/rubygems/pull/7704)
62
+ - Fix `bundle exec` no longer working in truffleruby after explicit `require` of `pathname` was removed [#7703](https://github.com/rubygems/rubygems/pull/7703)
63
+ - Don't let `bundle config` report a path without a Gemfile as "local app" [#7687](https://github.com/rubygems/rubygems/pull/7687)
64
+
65
+ ## Documentation:
66
+
67
+ - Clarify BUNDLE_USER_CONFIG is a file [#7668](https://github.com/rubygems/rubygems/pull/7668)
68
+
69
+ # 2.5.11 (May 28, 2024)
70
+
71
+ ## Deprecations:
72
+
73
+ - Deprecate Bundler constants [#7653](https://github.com/rubygems/rubygems/pull/7653)
74
+
75
+ ## Enhancements:
76
+
77
+ - Bump `bundle gem` generated COC to Contributor Covenant 2.1 [#7692](https://github.com/rubygems/rubygems/pull/7692)
78
+ - Retry a full clone when git server does not support shallow capabilities [#7649](https://github.com/rubygems/rubygems/pull/7649)
79
+
80
+ ## Bug fixes:
81
+
82
+ - Fix regression when caching gems from secondary sources [#7659](https://github.com/rubygems/rubygems/pull/7659)
83
+ - Fix error when Bundler installation is corrupted [#7642](https://github.com/rubygems/rubygems/pull/7642)
84
+ - Fix crash caused by RubyGems `require` gem activation logic running before Bundler can properly register its own monkeypatches [#7647](https://github.com/rubygems/rubygems/pull/7647)
85
+
86
+ ## Performance:
87
+
88
+ - Update cache checksums to decrease string allocations [#7637](https://github.com/rubygems/rubygems/pull/7637)
89
+ - Fix performance regression in applications with a local cache [#7680](https://github.com/rubygems/rubygems/pull/7680)
90
+
91
+ ## Documentation:
92
+
93
+ - Recommend `bin/rake` over `rake` in contributing docs [#7648](https://github.com/rubygems/rubygems/pull/7648)
94
+ - Monthly man update for May 2024 [#7640](https://github.com/rubygems/rubygems/pull/7640)
95
+ - Clarify Bundler support policy [#7633](https://github.com/rubygems/rubygems/pull/7633)
96
+
97
+ # 2.5.10 (May 3, 2024)
98
+
99
+ ## Security:
100
+
101
+ - Never write credentials to lockfiles [#7560](https://github.com/rubygems/rubygems/pull/7560)
102
+
103
+ ## Enhancements:
104
+
105
+ - Add auto_install support to require "bundler/setup" [#6561](https://github.com/rubygems/rubygems/pull/6561)
106
+ - Add `--glob` flag to `bundle add` [#7557](https://github.com/rubygems/rubygems/pull/7557)
107
+
108
+ ## Bug fixes:
109
+
110
+ - Make sure `bundle update <specific_gems>` can always update to the latest resolvable version of each requested gem [#7558](https://github.com/rubygems/rubygems/pull/7558)
111
+ - Show better error when installed gemspecs are unreadable [#7603](https://github.com/rubygems/rubygems/pull/7603)
112
+ - Fix `bundle update` not working on an out of sync lockfile [#7607](https://github.com/rubygems/rubygems/pull/7607)
113
+ - Don't upcase Windows ENV before backing it up [#7574](https://github.com/rubygems/rubygems/pull/7574)
114
+ - Properly resolve aliases when `bundle help` is run [#7601](https://github.com/rubygems/rubygems/pull/7601)
115
+ - Fix issue installing gems with linux-musl variant on non musl linux [#7583](https://github.com/rubygems/rubygems/pull/7583)
116
+
117
+ ## Documentation:
118
+
119
+ - Clarify `bundle check` behaviour in docs [#7613](https://github.com/rubygems/rubygems/pull/7613)
120
+
121
+ # 2.5.9 (April 12, 2024)
122
+
123
+ ## Bug fixes:
124
+
125
+ - Fix installing plugins via relative paths [#7571](https://github.com/rubygems/rubygems/pull/7571)
126
+
127
+ # 2.5.8 (April 11, 2024)
128
+
129
+ ## Enhancements:
130
+
131
+ - Allow installing plugins from path via CLI [#6960](https://github.com/rubygems/rubygems/pull/6960)
132
+ - Improve validation of `bundle plugin install` options [#7529](https://github.com/rubygems/rubygems/pull/7529)
133
+
134
+ ## Bug fixes:
135
+
136
+ - Fix resolver error message when it runs out of versions due to `--strict --patch` filtering out everything [#7527](https://github.com/rubygems/rubygems/pull/7527)
137
+ - Fix incorrect `bundle update --bundler` message [#7516](https://github.com/rubygems/rubygems/pull/7516)
138
+
139
+ # 2.5.7 (March 22, 2024)
140
+
141
+ ## Deprecations:
142
+
143
+ - Deprecate `bundle plugin install --local-git=` [#7048](https://github.com/rubygems/rubygems/pull/7048)
144
+
145
+ ## Enhancements:
146
+
147
+ - Ignore commented out keys in config file [#7514](https://github.com/rubygems/rubygems/pull/7514)
148
+ - Fix exclusion of `.gemspec` file itself in `bundle gem` generated gemspec file [#7488](https://github.com/rubygems/rubygems/pull/7488)
149
+ - Remove redundant configs from `bundle gem` generated rubocop configuration [#7478](https://github.com/rubygems/rubygems/pull/7478)
150
+ - Add `gitlab:` git source shorthand [#7449](https://github.com/rubygems/rubygems/pull/7449)
151
+ - Use full path for `instance_eval` in `Bundler::DSL#eval_gemfile` [#7471](https://github.com/rubygems/rubygems/pull/7471)
152
+
153
+ ## Documentation:
154
+
155
+ - Use https instead of http in documentation links [#7481](https://github.com/rubygems/rubygems/pull/7481)
156
+
1
157
  # 2.5.6 (February 6, 2024)
2
158
 
3
159
  ## Deprecations:
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2024-02-06".freeze
8
- @git_commit_sha = "7ac045dcaa".freeze
7
+ @built_at = "2024-07-18".freeze
8
+ @git_commit_sha = "f49d3d48c9".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -45,7 +45,7 @@ module Bundler
45
45
  next
46
46
  end
47
47
 
48
- Bundler.settings.temporary(path: (Bundler.settings[:path] || Bundler.root)) do
48
+ Bundler.settings.temporary(path: Bundler.settings[:path] || Bundler.root) do
49
49
  installer.generate_standalone_bundler_executable_stubs(spec, installer_opts)
50
50
  end
51
51
  else
@@ -16,7 +16,7 @@ module Bundler
16
16
  deps = if groups.any?
17
17
  Bundler.definition.dependencies_for(groups)
18
18
  else
19
- Bundler.definition.current_dependencies
19
+ Bundler.definition.requested_dependencies
20
20
  end
21
21
 
22
22
  fund_info = deps.each_with_object([]) do |dep, arr|
@@ -32,7 +32,6 @@ module Bundler
32
32
 
33
33
  validate_ext_name if @extension
34
34
  validate_rust_builder_rubygems_version if @extension == "rust"
35
- travis_removal_info
36
35
  end
37
36
 
38
37
  def run
@@ -276,6 +275,7 @@ module Bundler
276
275
  end
277
276
 
278
277
  def ask_and_set_test_framework
278
+ return if skip?(:test)
279
279
  test_framework = options[:test] || Bundler.settings["gem.test"]
280
280
 
281
281
  if test_framework.to_s.empty?
@@ -301,6 +301,10 @@ module Bundler
301
301
  test_framework
302
302
  end
303
303
 
304
+ def skip?(option)
305
+ options.key?(option) && options[option].nil?
306
+ end
307
+
304
308
  def hint_text(setting)
305
309
  if Bundler.settings["gem.#{setting}"] == false
306
310
  "Your choice will only be applied to this gem."
@@ -311,6 +315,7 @@ module Bundler
311
315
  end
312
316
 
313
317
  def ask_and_set_ci
318
+ return if skip?(:ci)
314
319
  ci_template = options[:ci] || Bundler.settings["gem.ci"]
315
320
 
316
321
  if ci_template.to_s.empty?
@@ -342,6 +347,7 @@ module Bundler
342
347
  end
343
348
 
344
349
  def ask_and_set_linter
350
+ return if skip?(:linter)
345
351
  linter_template = options[:linter] || Bundler.settings["gem.linter"]
346
352
  linter_template = deprecated_rubocop_option if linter_template.nil?
347
353
 
@@ -448,19 +454,6 @@ module Bundler
448
454
  "1.3"
449
455
  end
450
456
 
451
- # TODO: remove at next minor release
452
- def travis_removal_info
453
- if options[:ci] == "travis"
454
- Bundler.ui.error "Support for Travis CI was removed from gem skeleton generator."
455
- exit 1
456
- end
457
-
458
- if Bundler.settings["gem.ci"] == "travis"
459
- Bundler.ui.error "Support for Travis CI was removed from gem skeleton generator, but it is present in bundle config. Please configure another provider using `bundle config set gem.ci SERVICE` (where SERVICE is one of github/gitlab/circle) or unset configuration using `bundle config unset gem.ci`."
460
- exit 1
461
- end
462
- end
463
-
464
457
  def validate_rust_builder_rubygems_version
465
458
  if Gem::Version.new(rust_builder_required_rubygems_version) > Gem.rubygems_version
466
459
  Bundler.ui.error "Your RubyGems version (#{Gem.rubygems_version}) is too old to build Rust extension. Please update your RubyGems using `gem update --system` or any other way and try again."
@@ -14,7 +14,7 @@ module Bundler
14
14
 
15
15
  Bundler.self_manager.install_locked_bundler_and_restart_with_it_if_needed
16
16
 
17
- Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Bundler::FREEBSD
17
+ Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Gem.freebsd_platform?
18
18
 
19
19
  # Disable color in deployment mode
20
20
  Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment]
@@ -5,14 +5,15 @@ module Bundler
5
5
  class CLI::Plugin < Thor
6
6
  desc "install PLUGINS", "Install the plugin from the source"
7
7
  long_desc <<-D
8
- Install plugins either from the rubygems source provided (with --source option) or from a git source provided with --git (for remote repos) or --local_git (for local repos). If no sources are provided, it uses Gem.sources
8
+ Install plugins either from the rubygems source provided (with --source option), from a git source provided with --git, or a local path provided with --path. If no sources are provided, it uses Gem.sources
9
9
  D
10
10
  method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from"
11
11
  method_option "version", type: :string, default: nil, banner: "The version of the plugin to fetch"
12
12
  method_option "git", type: :string, default: nil, banner: "URL of the git repo to fetch from"
13
- method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from"
13
+ method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (deprecated)"
14
14
  method_option "branch", type: :string, default: nil, banner: "The git branch to checkout"
15
15
  method_option "ref", type: :string, default: nil, banner: "The git revision to check out"
16
+ method_option "path", type: :string, default: nil, banner: "Path of a local gem to directly use"
16
17
  def install(*plugins)
17
18
  Bundler::Plugin.install(plugins, options)
18
19
  end
@@ -5,6 +5,7 @@ require_relative "vendored_thor"
5
5
  module Bundler
6
6
  class CLI < Thor
7
7
  require_relative "cli/common"
8
+ require_relative "cli/install"
8
9
 
9
10
  package_name "Bundler"
10
11
 
@@ -64,12 +65,12 @@ module Bundler
64
65
  Bundler.reset_settings_and_root!
65
66
  end
66
67
 
67
- Bundler.self_manager.restart_with_locked_bundler_if_needed
68
+ Bundler.auto_switch
68
69
 
69
70
  Bundler.settings.set_command_option_if_given :retry, options[:retry]
70
71
 
71
72
  current_cmd = args.last[:current_command].name
72
- auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
73
+ Bundler.auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
73
74
  rescue UnknownArgumentError => e
74
75
  raise InvalidOption, e.message
75
76
  ensure
@@ -114,6 +115,8 @@ module Bundler
114
115
  class_option "verbose", type: :boolean, desc: "Enable verbose output mode", aliases: "-V"
115
116
 
116
117
  def help(cli = nil)
118
+ cli = self.class.all_aliases[cli] if self.class.all_aliases[cli]
119
+
117
120
  case cli
118
121
  when "gemfile" then command = "gemfile"
119
122
  when nil then command = "bundle"
@@ -347,6 +350,7 @@ module Bundler
347
350
  method_option "github", type: :string
348
351
  method_option "branch", type: :string
349
352
  method_option "ref", type: :string
353
+ method_option "glob", type: :string, banner: "The location of a dependency's .gemspec, expanded within Ruby (single quotes recommended)"
350
354
  method_option "skip-install", type: :boolean, banner: "Adds gem to the Gemfile but does not install it"
351
355
  method_option "optimistic", type: :boolean, banner: "Adds optimistic declaration of version to gem"
352
356
  method_option "strict", type: :boolean, banner: "Adds strict declaration of version to gem"
@@ -546,10 +550,13 @@ module Bundler
546
550
  method_option :rubocop, type: :boolean, desc: "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`."
547
551
  method_option :changelog, type: :boolean, desc: "Generate changelog file. Set a default with `bundle config set --global gem.changelog true`."
548
552
  method_option :test, type: :string, lazy_default: Bundler.settings["gem.test"] || "", aliases: "-t", banner: "Use the specified test framework for your library",
553
+ enum: %w[rspec minitest test-unit],
549
554
  desc: "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
550
555
  method_option :ci, type: :string, lazy_default: Bundler.settings["gem.ci"] || "",
556
+ enum: %w[github gitlab circle],
551
557
  desc: "Generate CI configuration, either GitHub Actions, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|gitlab|circle)`"
552
558
  method_option :linter, type: :string, lazy_default: Bundler.settings["gem.linter"] || "",
559
+ enum: %w[rubocop standard],
553
560
  desc: "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
554
561
  method_option :github_username, type: :string, default: Bundler.settings["gem.github_username"], banner: "Set your username on GitHub", desc: "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
555
562
 
@@ -620,7 +627,7 @@ module Bundler
620
627
  method_option "major", type: :boolean, banner: "If updating, prefer updating to next major version (default)"
621
628
  method_option "pre", type: :boolean, banner: "If updating, always choose the highest allowed version, regardless of prerelease status"
622
629
  method_option "strict", type: :boolean, banner: "If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
623
- method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
630
+ method_option "conservative", type: :boolean, banner: "If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
624
631
  method_option "bundler", type: :string, lazy_default: "> 0.a", banner: "Update the locked version of bundler"
625
632
  def lock
626
633
  require_relative "cli/lock"
@@ -682,7 +689,6 @@ module Bundler
682
689
  exec_used = args.index {|a| exec_commands.include? a }
683
690
 
684
691
  command = args.find {|a| bundler_commands.include? a }
685
- command = all_aliases[command] if all_aliases[command]
686
692
 
687
693
  if exec_used && help_used
688
694
  if exec_used + help_used == 1
@@ -735,26 +741,6 @@ module Bundler
735
741
 
736
742
  private
737
743
 
738
- # Automatically invoke `bundle install` and resume if
739
- # Bundler.settings[:auto_install] exists. This is set through config cmd
740
- # `bundle config set --global auto_install 1`.
741
- #
742
- # Note that this method `nil`s out the global Definition object, so it
743
- # should be called first, before you instantiate anything like an
744
- # `Installer` that'll keep a reference to the old one instead.
745
- def auto_install
746
- return unless Bundler.settings[:auto_install]
747
-
748
- begin
749
- Bundler.definition.specs
750
- rescue GemNotFound, GitError
751
- Bundler.ui.info "Automatically installing missing gems."
752
- Bundler.reset!
753
- invoke :install, []
754
- Bundler.reset!
755
- end
756
- end
757
-
758
744
  def current_command
759
745
  _, _, config = @_initializer
760
746
  config[:current_command]
@@ -784,13 +770,10 @@ module Bundler
784
770
 
785
771
  return unless SharedHelpers.md5_available?
786
772
 
787
- latest = Fetcher::CompactIndex.
788
- new(nil, Source::Rubygems::Remote.new(Gem::URI("https://rubygems.org")), nil, nil).
789
- send(:compact_index_client).
790
- instance_variable_get(:@cache).
791
- dependencies("bundler").
792
- map {|d| Gem::Version.new(d.first) }.
793
- max
773
+ require_relative "vendored_uri"
774
+ remote = Source::Rubygems::Remote.new(Gem::URI("https://rubygems.org"))
775
+ cache_path = Bundler.user_cache.join("compact_index", remote.cache_slug)
776
+ latest = Bundler::CompactIndexClient.new(cache_path).latest_version("bundler")
794
777
  return unless latest
795
778
 
796
779
  current = Gem::Version.new(VERSION)
@@ -7,114 +7,89 @@ module Bundler
7
7
  class Cache
8
8
  attr_reader :directory
9
9
 
10
- def initialize(directory)
10
+ def initialize(directory, fetcher = nil)
11
11
  @directory = Pathname.new(directory).expand_path
12
- info_roots.each {|dir| mkdir(dir) }
13
- mkdir(info_etag_root)
12
+ @updater = Updater.new(fetcher) if fetcher
13
+ @mutex = Thread::Mutex.new
14
+ @endpoints = Set.new
15
+
16
+ @info_root = mkdir("info")
17
+ @special_characters_info_root = mkdir("info-special-characters")
18
+ @info_etag_root = mkdir("info-etags")
14
19
  end
15
20
 
16
21
  def names
17
- lines(names_path)
22
+ fetch("names", names_path, names_etag_path)
18
23
  end
19
24
 
20
- def names_path
21
- directory.join("names")
25
+ def versions
26
+ fetch("versions", versions_path, versions_etag_path)
22
27
  end
23
28
 
24
- def names_etag_path
25
- directory.join("names.etag")
26
- end
29
+ def info(name, remote_checksum = nil)
30
+ path = info_path(name)
27
31
 
28
- def versions
29
- versions_by_name = Hash.new {|hash, key| hash[key] = [] }
30
- info_checksums_by_name = {}
31
-
32
- lines(versions_path).each do |line|
33
- name, versions_string, info_checksum = line.split(" ", 3)
34
- info_checksums_by_name[name] = info_checksum || ""
35
- versions_string.split(",") do |version|
36
- delete = version.delete_prefix!("-")
37
- version = version.split("-", 2).unshift(name)
38
- if delete
39
- versions_by_name[name].delete(version)
40
- else
41
- versions_by_name[name] << version
42
- end
43
- end
32
+ if remote_checksum && remote_checksum != SharedHelpers.checksum_for_file(path, :MD5)
33
+ fetch("info/#{name}", path, info_etag_path(name))
34
+ else
35
+ Bundler::CompactIndexClient.debug { "update skipped info/#{name} (#{remote_checksum ? "versions index checksum is nil" : "versions index checksum matches local"})" }
36
+ read(path)
44
37
  end
45
-
46
- [versions_by_name, info_checksums_by_name]
47
- end
48
-
49
- def versions_path
50
- directory.join("versions")
51
38
  end
52
39
 
53
- def versions_etag_path
54
- directory.join("versions.etag")
40
+ def reset!
41
+ @mutex.synchronize { @endpoints.clear }
55
42
  end
56
43
 
57
- def checksums
58
- checksums = {}
59
-
60
- lines(versions_path).each do |line|
61
- name, _, checksum = line.split(" ", 3)
62
- checksums[name] = checksum
63
- end
64
-
65
- checksums
66
- end
44
+ private
67
45
 
68
- def dependencies(name)
69
- lines(info_path(name)).map do |line|
70
- parse_gem(line)
71
- end
72
- end
46
+ def names_path = directory.join("names")
47
+ def names_etag_path = directory.join("names.etag")
48
+ def versions_path = directory.join("versions")
49
+ def versions_etag_path = directory.join("versions.etag")
73
50
 
74
51
  def info_path(name)
75
52
  name = name.to_s
53
+ # TODO: converge this into the info_root by hashing all filenames like info_etag_path
76
54
  if /[^a-z0-9_-]/.match?(name)
77
55
  name += "-#{SharedHelpers.digest(:MD5).hexdigest(name).downcase}"
78
- info_roots.last.join(name)
56
+ @special_characters_info_root.join(name)
79
57
  else
80
- info_roots.first.join(name)
58
+ @info_root.join(name)
81
59
  end
82
60
  end
83
61
 
84
62
  def info_etag_path(name)
85
63
  name = name.to_s
86
- info_etag_root.join("#{name}-#{SharedHelpers.digest(:MD5).hexdigest(name).downcase}")
64
+ @info_etag_root.join("#{name}-#{SharedHelpers.digest(:MD5).hexdigest(name).downcase}")
87
65
  end
88
66
 
89
- private
90
-
91
- def mkdir(dir)
92
- SharedHelpers.filesystem_access(dir) do
93
- FileUtils.mkdir_p(dir)
67
+ def mkdir(name)
68
+ directory.join(name).tap do |dir|
69
+ SharedHelpers.filesystem_access(dir) do
70
+ FileUtils.mkdir_p(dir)
71
+ end
94
72
  end
95
73
  end
96
74
 
97
- def lines(path)
98
- return [] unless path.file?
99
- lines = SharedHelpers.filesystem_access(path, :read, &:read).split("\n")
100
- header = lines.index("---")
101
- header ? lines[header + 1..-1] : lines
102
- end
75
+ def fetch(remote_path, path, etag_path)
76
+ if already_fetched?(remote_path)
77
+ Bundler::CompactIndexClient.debug { "already fetched #{remote_path}" }
78
+ else
79
+ Bundler::CompactIndexClient.debug { "fetching #{remote_path}" }
80
+ @updater&.update(remote_path, path, etag_path)
81
+ end
103
82
 
104
- def parse_gem(line)
105
- @dependency_parser ||= GemParser.new
106
- @dependency_parser.parse(line)
83
+ read(path)
107
84
  end
108
85
 
109
- def info_roots
110
- [
111
- directory.join("info"),
112
- directory.join("info-special-characters"),
113
- ]
86
+ def already_fetched?(remote_path)
87
+ @mutex.synchronize { !@endpoints.add?(remote_path) }
114
88
  end
115
89
 
116
- def info_etag_root
117
- directory.join("info-etags")
90
+ def read(path)
91
+ return unless path.file?
92
+ SharedHelpers.filesystem_access(path, :read, &:read)
118
93
  end
119
94
  end
120
95
  end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ class CompactIndexClient
5
+ class Parser
6
+ # `compact_index` - an object responding to #names, #versions, #info(name, checksum),
7
+ # returning the file contents as a string
8
+ def initialize(compact_index)
9
+ @compact_index = compact_index
10
+ @info_checksums = nil
11
+ @versions_by_name = nil
12
+ @available = nil
13
+ @gem_parser = nil
14
+ end
15
+
16
+ def names
17
+ lines(@compact_index.names)
18
+ end
19
+
20
+ def versions
21
+ @versions_by_name ||= Hash.new {|hash, key| hash[key] = [] }
22
+ @info_checksums = {}
23
+
24
+ lines(@compact_index.versions).each do |line|
25
+ name, versions_string, checksum = line.split(" ", 3)
26
+ @info_checksums[name] = checksum || ""
27
+ versions_string.split(",") do |version|
28
+ delete = version.delete_prefix!("-")
29
+ version = version.split("-", 2).unshift(name)
30
+ if delete
31
+ @versions_by_name[name].delete(version)
32
+ else
33
+ @versions_by_name[name] << version
34
+ end
35
+ end
36
+ end
37
+
38
+ @versions_by_name
39
+ end
40
+
41
+ def info(name)
42
+ data = @compact_index.info(name, info_checksums[name])
43
+ lines(data).map {|line| gem_parser.parse(line).unshift(name) }
44
+ end
45
+
46
+ def available?
47
+ return @available unless @available.nil?
48
+ @available = !info_checksums.empty?
49
+ end
50
+
51
+ private
52
+
53
+ def info_checksums
54
+ @info_checksums ||= lines(@compact_index.versions).each_with_object({}) do |line, checksums|
55
+ parse_version_checksum(line, checksums)
56
+ end
57
+ end
58
+
59
+ def lines(data)
60
+ return [] if data.nil? || data.empty?
61
+ lines = data.split("\n")
62
+ header = lines.index("---")
63
+ header ? lines[header + 1..-1] : lines
64
+ end
65
+
66
+ def gem_parser
67
+ @gem_parser ||= GemParser.new
68
+ end
69
+
70
+ # This is mostly the same as `split(" ", 3)` but it avoids allocating extra objects.
71
+ # This method gets called at least once for every gem when parsing versions.
72
+ def parse_version_checksum(line, checksums)
73
+ return unless (name_end = line.index(" ")) # Artifactory bug causes blank lines in artifactor index files
74
+ return unless (checksum_start = line.index(" ", name_end + 1) + 1)
75
+ checksum_end = line.size - checksum_start
76
+
77
+ line.freeze # allows slicing into the string to not allocate a copy of the line
78
+ name = line[0, name_end]
79
+ checksum = line[checksum_start, checksum_end]
80
+ checksums[name.freeze] = checksum # freeze name since it is used as a hash key
81
+ end
82
+ end
83
+ end
84
+ end