rubygems-update 3.6.9 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +853 -790
  3. data/CONTRIBUTING.md +9 -0
  4. data/Manifest.txt +4 -21
  5. data/README.md +1 -1
  6. data/SECURITY.md +7 -0
  7. data/bundler/CHANGELOG.md +1093 -1033
  8. data/bundler/README.md +7 -7
  9. data/bundler/bundler.gemspec +2 -2
  10. data/bundler/lib/bundler/build_metadata.rb +10 -11
  11. data/bundler/lib/bundler/cli/common.rb +1 -1
  12. data/bundler/lib/bundler/cli/config.rb +2 -2
  13. data/bundler/lib/bundler/cli/gem.rb +62 -30
  14. data/bundler/lib/bundler/cli/install.rb +4 -4
  15. data/bundler/lib/bundler/cli/outdated.rb +1 -1
  16. data/bundler/lib/bundler/cli/update.rb +2 -2
  17. data/bundler/lib/bundler/cli.rb +10 -14
  18. data/bundler/lib/bundler/compact_index_client.rb +1 -5
  19. data/bundler/lib/bundler/current_ruby.rb +27 -3
  20. data/bundler/lib/bundler/definition.rb +21 -22
  21. data/bundler/lib/bundler/dependency.rb +1 -1
  22. data/bundler/lib/bundler/dsl.rb +33 -23
  23. data/bundler/lib/bundler/feature_flag.rb +15 -12
  24. data/bundler/lib/bundler/fetcher/dependency.rb +2 -1
  25. data/bundler/lib/bundler/fetcher/downloader.rb +33 -7
  26. data/bundler/lib/bundler/fetcher.rb +49 -19
  27. data/bundler/lib/bundler/friendly_errors.rb +2 -1
  28. data/bundler/lib/bundler/index.rb +7 -2
  29. data/bundler/lib/bundler/installer.rb +5 -4
  30. data/bundler/lib/bundler/lazy_specification.rb +9 -7
  31. data/bundler/lib/bundler/lockfile_parser.rb +21 -5
  32. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  33. data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
  34. data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
  35. data/bundler/lib/bundler/man/bundle-check.1 +1 -1
  36. data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
  37. data/bundler/lib/bundler/man/bundle-config.1 +172 -126
  38. data/bundler/lib/bundler/man/bundle-config.1.ronn +91 -91
  39. data/bundler/lib/bundler/man/bundle-console.1 +1 -1
  40. data/bundler/lib/bundler/man/bundle-doctor.1 +43 -4
  41. data/bundler/lib/bundler/man/bundle-doctor.1.ronn +48 -4
  42. data/bundler/lib/bundler/man/bundle-env.1 +1 -1
  43. data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
  44. data/bundler/lib/bundler/man/bundle-fund.1 +1 -1
  45. data/bundler/lib/bundler/man/bundle-gem.1 +67 -44
  46. data/bundler/lib/bundler/man/bundle-gem.1.ronn +8 -4
  47. data/bundler/lib/bundler/man/bundle-help.1 +1 -1
  48. data/bundler/lib/bundler/man/bundle-info.1 +1 -1
  49. data/bundler/lib/bundler/man/bundle-init.1 +1 -1
  50. data/bundler/lib/bundler/man/bundle-inject.1 +2 -2
  51. data/bundler/lib/bundler/man/bundle-inject.1.ronn +1 -1
  52. data/bundler/lib/bundler/man/bundle-install.1 +1 -1
  53. data/bundler/lib/bundler/man/bundle-issue.1 +1 -1
  54. data/bundler/lib/bundler/man/bundle-licenses.1 +1 -1
  55. data/bundler/lib/bundler/man/bundle-list.1 +1 -1
  56. data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
  57. data/bundler/lib/bundler/man/bundle-open.1 +1 -1
  58. data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
  59. data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
  60. data/bundler/lib/bundler/man/bundle-plugin.1 +1 -1
  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 +1 -1
  69. data/bundler/lib/bundler/match_platform.rb +31 -12
  70. data/bundler/lib/bundler/materialization.rb +2 -2
  71. data/bundler/lib/bundler/resolver/package.rb +1 -1
  72. data/bundler/lib/bundler/resolver.rb +1 -3
  73. data/bundler/lib/bundler/rubygems_ext.rb +116 -120
  74. data/bundler/lib/bundler/rubygems_integration.rb +11 -6
  75. data/bundler/lib/bundler/runtime.rb +1 -1
  76. data/bundler/lib/bundler/self_manager.rb +32 -42
  77. data/bundler/lib/bundler/settings/validator.rb +0 -23
  78. data/bundler/lib/bundler/settings.rb +4 -6
  79. data/bundler/lib/bundler/shared_helpers.rb +6 -4
  80. data/bundler/lib/bundler/source/git/git_proxy.rb +3 -3
  81. data/bundler/lib/bundler/source/path.rb +7 -0
  82. data/bundler/lib/bundler/source_list.rb +1 -5
  83. data/bundler/lib/bundler/source_map.rb +1 -1
  84. data/bundler/lib/bundler/spec_set.rb +7 -3
  85. data/bundler/lib/bundler/templates/Executable +0 -11
  86. data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -0
  87. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -5
  88. data/bundler/lib/bundler/ui/shell.rb +2 -2
  89. data/bundler/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
  90. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +2 -1
  91. data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +81 -42
  92. data/bundler/lib/bundler/version.rb +10 -2
  93. data/bundler/lib/bundler/worker.rb +1 -1
  94. data/bundler/lib/bundler.rb +14 -12
  95. data/doc/bundler/UPGRADING.md +137 -127
  96. data/doc/rubygems/CONTRIBUTING.md +1 -1
  97. data/lib/rubygems/basic_specification.rb +7 -0
  98. data/lib/rubygems/commands/pristine_command.rb +9 -12
  99. data/lib/rubygems/commands/setup_command.rb +2 -2
  100. data/lib/rubygems/core_ext/kernel_require.rb +5 -2
  101. data/lib/rubygems/ext/cargo_builder.rb +4 -0
  102. data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +10 -3
  103. data/lib/rubygems/gemcutter_utilities.rb +1 -1
  104. data/lib/rubygems/installer.rb +45 -50
  105. data/lib/rubygems/platform.rb +142 -39
  106. data/lib/rubygems/remote_fetcher.rb +3 -3
  107. data/lib/rubygems/request_set.rb +3 -6
  108. data/lib/rubygems/resolver/best_set.rb +1 -1
  109. data/lib/rubygems/resolver/source_set.rb +1 -1
  110. data/lib/rubygems/resolver.rb +1 -1
  111. data/lib/rubygems/s3_uri_signer.rb +5 -3
  112. data/lib/rubygems/source.rb +28 -22
  113. data/lib/rubygems/specification.rb +2 -2
  114. data/lib/rubygems/uri_formatter.rb +2 -1
  115. data/lib/rubygems/util/licenses.rb +21 -0
  116. data/lib/rubygems/vendor/net-http/lib/net/http.rb +14 -19
  117. data/lib/rubygems/vendor/resolv/lib/resolv.rb +50 -22
  118. data/lib/rubygems.rb +65 -7
  119. data/rubygems-update.gemspec +2 -2
  120. data/setup.rb +1 -1
  121. metadata +7 -24
  122. data/bundler/lib/bundler/gem_helpers.rb +0 -144
  123. data/bundler/lib/bundler/templates/Executable.bundler +0 -109
  124. data/bundler/lib/bundler/vendor/fileutils/.document +0 -1
  125. data/bundler/lib/bundler/vendor/net-http-persistent/.document +0 -1
  126. data/bundler/lib/bundler/vendor/pub_grub/.document +0 -1
  127. data/bundler/lib/bundler/vendor/securerandom/.document +0 -1
  128. data/bundler/lib/bundler/vendor/thor/.document +0 -1
  129. data/bundler/lib/bundler/vendor/tsort/.document +0 -1
  130. data/bundler/lib/bundler/vendor/uri/.document +0 -1
  131. data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem +0 -21
  132. data/lib/rubygems/vendor/molinillo/.document +0 -1
  133. data/lib/rubygems/vendor/net-http/.document +0 -1
  134. data/lib/rubygems/vendor/net-protocol/.document +0 -1
  135. data/lib/rubygems/vendor/optparse/.document +0 -1
  136. data/lib/rubygems/vendor/resolv/.document +0 -1
  137. data/lib/rubygems/vendor/securerandom/.document +0 -1
  138. data/lib/rubygems/vendor/timeout/.document +0 -1
  139. data/lib/rubygems/vendor/tsort/.document +0 -1
  140. data/lib/rubygems/vendor/uri/.document +0 -1
  141. /data/lib/rubygems/ssl_certs/rubygems.org/{GlobalSignRootCA_R3.pem → GlobalSign.pem} +0 -0
  142. /data/{bundler/lib/bundler/vendor/connection_pool → lib/rubygems/vendor}/.document +0 -0
@@ -1,150 +1,85 @@
1
1
  # Upgrading
2
2
 
3
- ## Bundler 3
3
+ ## Bundler 4
4
4
 
5
- The following is a summary of the changes that we plan to introduce in Bundler
6
- 3, why we will be making those changes, and what the deprecation process will
7
- look like. All these deprecations are printed by default in the Bundler 2.1 release.
8
-
9
- If you don't want to deal with deprecations right now and want to toggle them
10
- off, you can do it through configuration. Set the `BUNDLE_SILENCE_DEPRECATIONS`
11
- environment variable to "true", or configure it through `bundle config` either
12
- globally through `bundle config set --global silence_deprecations true` command, or
13
- locally through `bundle config set --local silence_deprecations true`. From now
14
- on in this document we will assume that all three of these configuration options
15
- are available, but will only mention `bundle config set <option> <value>`.
16
-
17
- As a general note, these changes are intended to improve the experience using
18
- bundler for _new_ users, who have no existing usage routines nor possibly biased
19
- opinions about how the tool should work based on how it has historically worked.
20
- We do understand that changing behaviour that have been existing for years can
21
- be annoying for old users, that's why we intend to make this process as smooth
22
- as possible for everyone.
23
-
24
- I'll be dividing the deprecations into four groups: CLI deprecations, Helper
25
- deprecations, DSL deprecations, and misc deprecations. Let's dive into each of
26
- them.
27
-
28
- ### CLI deprecations
29
-
30
- The CLI defines a set of commands and options that can be used by our users to
31
- create command lines that bundler can understand. There's a number of changes
32
- in the upcoming 3 version.
33
-
34
- * Flags passed to `bundle install` that relied on being remembered across invocations have been deprecated.
35
-
36
- In particular, the `--clean`, `--deployment`, `--frozen`,
37
- `--no-prune`, `--path`, `--shebang`, `--system`, `--without`, and `--with`
38
- options to `bundle install`.
39
-
40
- Remembering CLI options has been a source of historical confusion and bug
41
- reports, not only for beginners but also for experienced users. A CLI tool
42
- should not behave differently across exactly the same invocations _unless_
43
- explicitly configured to do so. This is what configuration is about after all,
44
- and things should never be silently configured without the user knowing about
45
- it.
46
-
47
- The problem with changing this behavior is that very common workflows are
48
- relying on it. For example, when you run `bundle install --without
49
- development:test` in production, those flags are persisted in the app's
50
- configuration file and further `bundle` invocations will happily ignore
51
- development and test gems. This magic will disappear from bundler 3, and
52
- you will explicitly need to configure it, either through environment
53
- variables, application configuration, or machine configuration. For example,
54
- with `bundle config set --local without development test`.
55
-
56
- The removal of this kind of flag also applies to analogous commands, for
57
- example, to `bundle check --path`.
58
-
59
- * The `--force` flag to `bundle install` and `bundle update` has been renamed to `--redownload`.
60
-
61
- This is just a simple rename of the flag, to make more apparent what it
62
- actually does. This flag forces redownloading every gem, it doesn't "force"
63
- anything else.
64
-
65
- * `bundle viz` will be removed and extracted to a plugin.
66
-
67
- This is the only bundler command requiring external dependencies, both an OS
68
- dependency (the `graphviz` package) and a gem dependency (the `ruby-graphviz`
69
- gem). Removing these dependencies will make development easier and it was also
70
- seen by the bundler team as an opportunity to develop a bundler plugin that
71
- it's officially maintained by the bundler team, and that users can take as a
72
- reference to develop their own plugins. The plugin will contain the same code
73
- as the old core command, the only difference being that the command is now
74
- implemented as `bundle graph` which is much easier to understand. However, the
75
- details of the plugin are under discussion. See [#3333](https://github.com/rubygems/rubygems/issues/3333).
5
+ In order to prepare for Bundler 4, you can easily configure Bundler 2.7 to
6
+ behave exactly like Bundler 4 will behave. To do so, set the environment
7
+ variable `BUNDLE_SIMULATE_VERSION` to `4`. Alternatively, you can use `bundle
8
+ config` and enable "Bundler 4 mode" either globally through `bundle config set
9
+ --global simulate_version 4`, or locally through `bundle config set --local
10
+ simulate_version 4`. From now on in this document we will assume that all three
11
+ of these configuration options are available, but will only mention `bundle
12
+ config set <option> <value>`.
76
13
 
77
- * The `bundle console` will be removed and replaced with `bin/console`.
14
+ The following is a summary of the changes that we plan to introduce in Bundler
15
+ 4, and why we will be making those changes. Some of them should be well known
16
+ already by existing users, because we have been printing deprecation messages
17
+ for years, but some of them are defaults that will be switched in Bundler 4 and
18
+ needs some heads up.
78
19
 
79
- Over time we found `bundle console` hard to maintain because every user would
80
- want to add her own specific tweaks to it. In order to ease maintenance and
81
- reduce bikeshedding discussions, we're removing the `bundle console` command
82
- in favor of a `bin/console` script created by `bundle gem` on gem generation
83
- that users can tweak to their needs.
20
+ ### Running just `bundle` will print help usage
84
21
 
22
+ We're changing this default to make Bundler more friendly for new users. We do
23
+ understand that long time users already know how Bundler works and find useful
24
+ that just `bundle` defaults to `bundle install`. Those users can keep the
25
+ existing default by configuring
85
26
 
86
- * The `bundle install` command will no longer accept a `--binstubs` flag.
27
+ ```
28
+ bundle config default_cli_command install
29
+ ```
87
30
 
88
- The `--binstubs` option has been removed from `bundle install` and replaced
89
- with the `bundle binstubs` command. The `--binstubs` flag would create
90
- binstubs for all executables present inside the gems in the project. This was
91
- hardly useful since most users will only use a subset of all the binstubs
92
- available to them. Also, it would force the introduction of a bunch of most
93
- likely unused files into source control. Because of this, binstubs now must
94
- be created and checked into version control individually.
95
-
96
-
97
- * The `bundle inject` command is deprecated and replaced with `bundle add`.
98
-
99
- We believe the new command fits the user's mental model better and it supports
100
- a wider set of use cases. The interface supported by `bundle inject` works
101
- exactly the same in `bundle add`, so it should be easy to migrate to the new
102
- command.
31
+ ### Bundler will install to a `.bundle` folder relative to repository root by default
103
32
 
104
- #### Cancelled CLI deprecations
33
+ We're making this change to improve isolation.
105
34
 
106
- These deprecations have been initially announced before, but the deprecations
107
- were cancelled before the release of Bundler 2.1.0 in [rubygems/bundler#7475](https://github.com/rubygems/bundler/pull/7475).
35
+ The previous default of installing to system changes can be kept with `bundle
36
+ config path.system true`.
108
37
 
109
- * ~The `bundle update` command will no longer update all gems, you'll need to pass `--all` to it.~ (postponed)
38
+ Related to this change, and to alleviate potential bad consequences from it,
39
+ we're also shipping some related changes:
110
40
 
111
- * ~The `bundle config` command will no longer accept old subcommand-based interface before Bundler 2.1.~ (postponed)
41
+ * To keep disk usage under control, Bundler will cleanup unused gems when
42
+ installing gems per application using the new default. This new behavior can
43
+ be disabled by toggling back installing to system gems as explained before, or
44
+ by configuring `bundle config clean false`.
112
45
 
113
- ### Helper deprecations
46
+ * To avoid duplicate downloads of `.gem` packages and recompilation of
47
+ extensions, Bundler will keep a global cache of gem packages and compiled
48
+ extensions. This new behaviour can be disabled with `bundle config
49
+ global_gem_cache false`, or by toggling back installing to system gems as
50
+ explained before.
114
51
 
115
- * `Bundler.clean_env`, `Bundler.with_clean_env`, `Bundler.clean_system`, and `Bundler.clean_exec` are deprecated.
52
+ ### Flags passed to `bundle install` that relied on being remembered across invocations will be removed
116
53
 
117
- All of these helpers ultimately use `Bundler.clean_env` under the hood, which
118
- makes sure all bundler-related environment are removed inside the block it
119
- yields.
54
+ In particular, the `--clean`, `--deployment`, `--frozen`, `--no-prune`,
55
+ `--path`, `--shebang`, `--system`, `--without`, and `--with` options to `bundle
56
+ install`.
120
57
 
121
- After quite a lot user reports, we noticed that users don't usually want this
122
- but instead want the bundler environment as it was before the current process
123
- was started. Thus, `Bundler.with_original_env`, `Bundler.original_system`, and
124
- `Bundler.original_exec` were born. They all use the new `Bundler.original_env`
125
- under the hood.
58
+ Remembering CLI options has been a source of historical confusion and bug
59
+ reports, not only for beginners but also for experienced users. A CLI tool
60
+ should not behave differently across exactly the same invocations _unless_
61
+ explicitly configured to do so. This is what configuration is about after all,
62
+ and things should never be silently configured without the user knowing about
63
+ it.
126
64
 
127
- There's however some specific cases where the good old `Bundler.clean_env`
128
- behavior can be useful. For example, when testing Rails generators, you really
129
- want an environment where `bundler` is out of the picture. This is why we
130
- decided to keep the old behavior under a new more clear name, because we
131
- figured the word "clean" was too ambiguous. So we have introduced
132
- `Bundler.unbundled_env`, `Bundler.with_unbundled_env`,
133
- `Bundler.unbundled_system`, and `Bundler.unbundled_exec`.
65
+ The problem with changing this behavior is that very common workflows are
66
+ relying on it. For example, when you run `bundle install --without
67
+ development:test` in production, those flags are persisted in the app's
68
+ configuration file and further `bundle` invocations will happily ignore
69
+ development and test gems. This magic will disappear from bundler 4, and you
70
+ will explicitly need to configure it, either through environment variables,
71
+ application configuration, or machine configuration. For example, with `bundle
72
+ config set --local without development test`.
134
73
 
135
- * `Bundler.environment` is deprecated in favor of `Bundler.load`.
74
+ ### Bundler will include checksums in the lockfile by default
136
75
 
137
- We're not sure how people might be using this directly but we have removed the
138
- `Bundler::Environment` class which was instantiated by `Bundler.environment`
139
- since we realized the `Bundler::Runtime` class was the same thing. During the
140
- transition `Bundler.environment` will delegate to `Bundler.load`, which holds
141
- the reference to the `Bundler::Environment`.
76
+ We shipped this security feature recently and we believe it's time to turn it on
77
+ by default, so that everyone benefits from the extra security assurances by default.
142
78
 
143
- #### DSL deprecations
79
+ ### Strict source pinning in Gemfile is enforced by default
144
80
 
145
- The following deprecations in bundler's DSL are meant to prepare for the strict
146
- source pinning in bundler 3, where the source for every dependency will be
147
- unambiguously defined.
81
+ In bundler 4, the source for every dependency will be unambiguously defined, and
82
+ Bundler will refuse to run otherwise.
148
83
 
149
84
  * Multiple global Gemfile sources will no longer be supported.
150
85
 
@@ -207,7 +142,82 @@ unambiguously defined.
207
142
  end
208
143
  ```
209
144
 
210
- #### Misc deprecations
145
+ #### Notable CLI changes
146
+
147
+ * The `--force` flag to `bundle install` and `bundle update` will be renamed to `--redownload`.
148
+
149
+ This is just a simple rename of the flag, to make more apparent what it
150
+ actually does. This flag forces redownloading every gem, it doesn't "force"
151
+ anything else.
152
+
153
+ * `bundle viz` will be removed and extracted to a plugin.
154
+
155
+ This is the only bundler command requiring external dependencies, both an OS
156
+ dependency (the `graphviz` package) and a gem dependency (the `ruby-graphviz`
157
+ gem). Removing these dependencies will make development easier and it was also
158
+ seen by the bundler team as an opportunity to develop a bundler plugin that
159
+ it's officially maintained by the bundler team, and that users can take as a
160
+ reference to develop their own plugins. The plugin will contain the same code
161
+ as the old core command, the only difference being that the command is now
162
+ implemented as `bundle graph` which is much easier to understand. However, the
163
+ details of the plugin are under discussion. See [#3333](https://github.com/rubygems/rubygems/issues/3333).
164
+
165
+ * The `bundle install` command will no longer accept a `--binstubs` flag.
166
+
167
+ The `--binstubs` option has been removed from `bundle install` and replaced
168
+ with the `bundle binstubs` command. The `--binstubs` flag would create
169
+ binstubs for all executables present inside the gems in the project. This was
170
+ hardly useful since most users will only use a subset of all the binstubs
171
+ available to them. Also, it would force the introduction of a bunch of most
172
+ likely unused files into source control. Because of this, binstubs now must
173
+ be created and checked into version control individually.
174
+
175
+ * The `bundle inject` command will be replaced with `bundle add`
176
+
177
+ We believe the new command fits the user's mental model better and it supports
178
+ a wider set of use cases. The interface supported by `bundle inject` works
179
+ exactly the same in `bundle add`, so it should be easy to migrate to the new
180
+ command.
181
+
182
+ ### Other notable changes
183
+
184
+ * Git and Path gems will be included in `vendor/cache` by default
185
+
186
+ We're unsure why these gems were treated specially so we'll start caching them
187
+ normally.
188
+
189
+ * Bundler will use cached local data if available when network issues are found
190
+ during resolution.
191
+
192
+ Just trying to provide a more resilient behavior here.
193
+
194
+ * `Bundler.clean_env`, `Bundler.with_clean_env`, `Bundler.clean_system`, and `Bundler.clean_exec` will be removed
195
+
196
+ All of these helpers ultimately use `Bundler.clean_env` under the hood, which
197
+ makes sure all bundler-related environment are removed inside the block it
198
+ yields.
199
+
200
+ After quite a lot user reports, we noticed that users don't usually want this
201
+ but instead want the bundler environment as it was before the current process
202
+ was started. Thus, `Bundler.with_original_env`, `Bundler.original_system`, and
203
+ `Bundler.original_exec` were born. They all use the new `Bundler.original_env`
204
+ under the hood.
205
+
206
+ There's however some specific cases where the good old `Bundler.clean_env`
207
+ behavior can be useful. For example, when testing Rails generators, you really
208
+ want an environment where `bundler` is out of the picture. This is why we
209
+ decided to keep the old behavior under a new more clear name, because we
210
+ figured the word "clean" was too ambiguous. So we have introduced
211
+ `Bundler.unbundled_env`, `Bundler.with_unbundled_env`,
212
+ `Bundler.unbundled_system`, and `Bundler.unbundled_exec`.
213
+
214
+ * `Bundler.environment` is deprecated in favor of `Bundler.load`.
215
+
216
+ We're not sure how people might be using this directly but we have removed the
217
+ `Bundler::Environment` class which was instantiated by `Bundler.environment`
218
+ since we realized the `Bundler::Runtime` class was the same thing. During the
219
+ transition `Bundler.environment` will delegate to `Bundler.load`, which holds
220
+ the reference to the `Bundler::Environment`.
211
221
 
212
222
  * Deployment helpers for `vlad` and `capistrano` are being removed.
213
223
 
@@ -52,7 +52,7 @@ To run commands like `gem install` from the repo:
52
52
 
53
53
  To run commands like `bundle install` from the repo:
54
54
 
55
- ruby bundler/spec/support/bundle.rb install
55
+ bundler/bin/bundle install
56
56
 
57
57
  ### Running Tests
58
58
 
@@ -256,6 +256,13 @@ class Gem::BasicSpecification
256
256
  raise NotImplementedError
257
257
  end
258
258
 
259
+ def installable_on_platform?(target_platform) # :nodoc:
260
+ return true if [Gem::Platform::RUBY, nil, target_platform].include?(platform)
261
+ return true if Gem::Platform.new(platform) === target_platform
262
+
263
+ false
264
+ end
265
+
259
266
  def raw_require_paths # :nodoc:
260
267
  raise NotImplementedError
261
268
  end
@@ -137,11 +137,14 @@ extensions will be restored.
137
137
  specs.group_by(&:full_name_with_location).values.each do |grouped_specs|
138
138
  spec = grouped_specs.find {|s| !s.default_gem? } || grouped_specs.first
139
139
 
140
- unless only_executables_or_plugins?
140
+ only_executables = options[:only_executables]
141
+ only_plugins = options[:only_plugins]
142
+
143
+ unless only_executables || only_plugins
141
144
  # Default gemspecs include changes provided by ruby-core installer that
142
145
  # can't currently be pristined (inclusion of compiled extension targets in
143
146
  # the file list). So stick to resetting executables if it's a default gem.
144
- options[:only_executables] = true if spec.default_gem?
147
+ only_executables = true if spec.default_gem?
145
148
  end
146
149
 
147
150
  if options.key? :skip
@@ -151,14 +154,14 @@ extensions will be restored.
151
154
  end
152
155
  end
153
156
 
154
- unless spec.extensions.empty? || options[:extensions] || only_executables_or_plugins?
157
+ unless spec.extensions.empty? || options[:extensions] || only_executables || only_plugins
155
158
  say "Skipped #{spec.full_name_with_location}, it needs to compile an extension"
156
159
  next
157
160
  end
158
161
 
159
162
  gem = spec.cache_file
160
163
 
161
- unless File.exist?(gem) || only_executables_or_plugins?
164
+ unless File.exist?(gem) || only_executables || only_plugins
162
165
  require_relative "../remote_fetcher"
163
166
 
164
167
  say "Cached gem for #{spec.full_name_with_location} not found, attempting to fetch..."
@@ -194,10 +197,10 @@ extensions will be restored.
194
197
  bin_dir: bin_dir,
195
198
  }
196
199
 
197
- if options[:only_executables]
200
+ if only_executables
198
201
  installer = Gem::Installer.for_spec(spec, installer_options)
199
202
  installer.generate_bin
200
- elsif options[:only_plugins]
203
+ elsif only_plugins
201
204
  installer = Gem::Installer.for_spec(spec, installer_options)
202
205
  installer.generate_plugins
203
206
  else
@@ -208,10 +211,4 @@ extensions will be restored.
208
211
  say "Restored #{spec.full_name_with_location}"
209
212
  end
210
213
  end
211
-
212
- private
213
-
214
- def only_executables_or_plugins?
215
- options[:only_executables] || options[:only_plugins]
216
- end
217
214
  end
@@ -7,8 +7,8 @@ require_relative "../command"
7
7
  # RubyGems checkout or tarball.
8
8
 
9
9
  class Gem::Commands::SetupCommand < Gem::Command
10
- HISTORY_HEADER = %r{^#\s*[\d.a-zA-Z]+\s*/\s*\d{4}-\d{2}-\d{2}\s*$}
11
- VERSION_MATCHER = %r{^#\s*([\d.a-zA-Z]+)\s*/\s*\d{4}-\d{2}-\d{2}\s*$}
10
+ HISTORY_HEADER = %r{^##\s*[\d.a-zA-Z]+\s*/\s*\d{4}-\d{2}-\d{2}\s*$}
11
+ VERSION_MATCHER = %r{^##\s*([\d.a-zA-Z]+)\s*/\s*\d{4}-\d{2}-\d{2}\s*$}
12
12
 
13
13
  ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
14
14
 
@@ -64,8 +64,11 @@ module Kernel
64
64
  rp
65
65
  end
66
66
 
67
- Kernel.send(:gem, name, Gem::Requirement.default_prerelease) unless
68
- resolved_path
67
+ next if resolved_path
68
+
69
+ Kernel.send(:gem, name, Gem::Requirement.default_prerelease)
70
+
71
+ Gem.load_bundler_extensions(Gem.loaded_specs[name].version) if name == "bundler"
69
72
 
70
73
  next
71
74
  end
@@ -158,6 +158,10 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
158
158
  # mkmf work properly.
159
159
  def linker_args
160
160
  cc_flag = self.class.shellsplit(makefile_config("CC"))
161
+ # Avoid to ccache like tool from Rust build
162
+ # see https://github.com/rubygems/rubygems/pull/8521#issuecomment-2689854359
163
+ # ex. CC="ccache gcc" or CC="sccache clang --any --args"
164
+ cc_flag.shift if cc_flag.size >= 2 && !cc_flag[1].start_with?("-")
161
165
  linker = cc_flag.shift
162
166
  link_args = cc_flag.flat_map {|a| ["-C", "link-arg=#{a}"] }
163
167
 
@@ -85,10 +85,17 @@ module Gem::GemcutterUtilities
85
85
  end
86
86
 
87
87
  def parse_otp_from_uri(uri)
88
- require "cgi"
88
+ query = uri.query
89
+ return unless query && !query.empty?
89
90
 
90
- return if uri.query.nil?
91
- CGI.parse(uri.query).dig("code", 0)
91
+ query.split("&") do |param|
92
+ key, value = param.split("=", 2)
93
+ if value && Gem::URI.decode_www_form_component(key) == "code"
94
+ return Gem::URI.decode_www_form_component(value)
95
+ end
96
+ end
97
+
98
+ nil
92
99
  end
93
100
 
94
101
  class SocketResponder
@@ -319,7 +319,7 @@ module Gem::GemcutterUtilities
319
319
  end
320
320
 
321
321
  def get_scope_params(scope)
322
- scope_params = { index_rubygems: true }
322
+ scope_params = { index_rubygems: true, push_rubygem: true }
323
323
 
324
324
  if scope
325
325
  scope_params = { scope => true }
@@ -228,8 +228,7 @@ class Gem::Installer
228
228
  ruby_executable = true
229
229
  existing = io.read.slice(/
230
230
  ^\s*(
231
- gem \s |
232
- load \s Gem\.bin_path\( |
231
+ Gem\.activate_and_load_bin_path\( |
233
232
  load \s Gem\.activate_bin_path\(
234
233
  )
235
234
  (['"])(.*?)(\2),
@@ -749,54 +748,53 @@ class Gem::Installer
749
748
  def app_script_text(bin_file_name)
750
749
  # NOTE: that the `load` lines cannot be indented, as old RG versions match
751
750
  # against the beginning of the line
752
- <<-TEXT
753
- #{shebang bin_file_name}
754
- #
755
- # This file was generated by RubyGems.
756
- #
757
- # The application '#{spec.name}' is installed as part of a gem, and
758
- # this file is here to facilitate running it.
759
- #
760
-
761
- require 'rubygems'
762
- #{gemdeps_load(spec.name)}
763
- version = "#{Gem::Requirement.default_prerelease}"
764
-
765
- str = ARGV.first
766
- if str
767
- str = str.b[/\\A_(.*)_\\z/, 1]
768
- if str and Gem::Version.correct?(str)
769
- #{explicit_version_requirement(spec.name)}
770
- ARGV.shift
771
- end
772
- end
751
+ <<~TEXT
752
+ #{shebang bin_file_name}
753
+ #
754
+ # This file was generated by RubyGems.
755
+ #
756
+ # The application '#{spec.name}' is installed as part of a gem, and
757
+ # this file is here to facilitate running it.
758
+ #
759
+
760
+ require 'rubygems'
761
+ #{gemdeps_load(spec.name)}
762
+ version = "#{Gem::Requirement.default_prerelease}"
763
+
764
+ str = ARGV.first
765
+ if str
766
+ str = str.b[/\\A_(.*)_\\z/, 1]
767
+ if str and Gem::Version.correct?(str)
768
+ #{explicit_version_requirement(spec.name)}
769
+ ARGV.shift
770
+ end
771
+ end
773
772
 
774
- if Gem.respond_to?(:activate_bin_path)
775
- load Gem.activate_bin_path('#{spec.name}', '#{bin_file_name}', version)
776
- else
777
- gem #{spec.name.dump}, version
778
- load Gem.bin_path(#{spec.name.dump}, #{bin_file_name.dump}, version)
779
- end
780
- TEXT
773
+ if Gem.respond_to?(:activate_and_load_bin_path)
774
+ Gem.activate_and_load_bin_path('#{spec.name}', '#{bin_file_name}', version)
775
+ else
776
+ load Gem.activate_bin_path('#{spec.name}', '#{bin_file_name}', version)
777
+ end
778
+ TEXT
781
779
  end
782
780
 
783
781
  def gemdeps_load(name)
784
782
  return "" if name == "bundler"
785
783
 
786
- <<-TEXT
784
+ <<~TEXT
787
785
 
788
- Gem.use_gemdeps
789
- TEXT
786
+ Gem.use_gemdeps
787
+ TEXT
790
788
  end
791
789
 
792
790
  def explicit_version_requirement(name)
793
791
  code = "version = str"
794
792
  return code unless name == "bundler"
795
793
 
796
- code += <<-TEXT
794
+ code += <<~TEXT
797
795
 
798
- ENV['BUNDLER_VERSION'] = str
799
- TEXT
796
+ ENV['BUNDLER_VERSION'] = str
797
+ TEXT
800
798
  end
801
799
 
802
800
  ##
@@ -811,9 +809,9 @@ TEXT
811
809
 
812
810
  if File.exist?(File.join(bindir, ruby_exe))
813
811
  # stub & ruby.exe within same folder. Portable
814
- <<-TEXT
815
- @ECHO OFF
816
- @"%~dp0#{ruby_exe}" "%~dpn0" %*
812
+ <<~TEXT
813
+ @ECHO OFF
814
+ @"%~dp0#{ruby_exe}" "%~dpn0" %*
817
815
  TEXT
818
816
  elsif bindir.downcase.start_with? rb_topdir.downcase
819
817
  # stub within ruby folder, but not standard bin. Portable
@@ -821,16 +819,16 @@ TEXT
821
819
  from = Pathname.new bindir
822
820
  to = Pathname.new "#{rb_topdir}/bin"
823
821
  rel = to.relative_path_from from
824
- <<-TEXT
825
- @ECHO OFF
826
- @"%~dp0#{rel}/#{ruby_exe}" "%~dpn0" %*
822
+ <<~TEXT
823
+ @ECHO OFF
824
+ @"%~dp0#{rel}/#{ruby_exe}" "%~dpn0" %*
827
825
  TEXT
828
826
  else
829
827
  # outside ruby folder, maybe -user-install or bundler. Portable, but ruby
830
828
  # is dependent on PATH
831
- <<-TEXT
832
- @ECHO OFF
833
- @#{ruby_exe} "%~dpn0" %*
829
+ <<~TEXT
830
+ @ECHO OFF
831
+ @#{ruby_exe} "%~dpn0" %*
834
832
  TEXT
835
833
  end
836
834
  end
@@ -953,11 +951,8 @@ TEXT
953
951
  end
954
952
 
955
953
  def ensure_writable_dir(dir) # :nodoc:
956
- begin
957
- Dir.mkdir dir, *[options[:dir_mode] && 0o755].compact
958
- rescue SystemCallError
959
- raise unless File.directory? dir
960
- end
954
+ require "fileutils"
955
+ FileUtils.mkdir_p dir, mode: options[:dir_mode] && 0o755
961
956
 
962
957
  raise Gem::FilePermissionError.new(dir) unless File.writable? dir
963
958
  end