Commit graph

371 commits

Author SHA1 Message Date
Jeremy Evans
51d0e58772
[rubygems/rubygems] Avoid unnecessary splat allocation
Because get_push_scope is a method call, Ruby will allocate an array
for *args even though it is not necessary to do so. Using a local
variable avoids the allocation.

Found by the performance warning in Ruby feature 21274.

0473c0cf32
2025-04-22 11:27:24 +09:00
Ellen Marie Dash
af594f5166 [rubygems/rubygems] Have "gem exec" sort executable names in error message.
This decouples `gem exec` behavior (and tests) from the sort order of
the gemspec.

911cd29159
2025-03-27 13:57:25 +09:00
David Rodríguez
4fe882e2c9 [rubygems/rubygems] Let gem exec raise an error in ambiguous cases
When `gem exec foo` is run, and "foo" is a gem that has multiple
executables, none of them named "foo", raise an error explaining the
situation and telling user to be more specific.

Currently the first command in the executables array is run, but this
may come as surprising sometimes, so better raise an error.

acda5d8f6e
2025-03-24 13:25:07 +09:00
Ellen Marie Dash
d96cc52ef1 [rubygems/rubygems] Add credentials file path to "gem env".
There are 3 possible locations:

- $HOME/.gem/credentials
- $XDG_DATA_HOME/gem/credentials
- $HOME/.local/share/gem/credentials

c51756b96e
2025-01-09 18:13:57 +00:00
David Rodríguez
963f98a94f [rubygems/rubygems] Enable Performance/MapCompact cop
0c3a65871a
2024-11-26 15:11:05 +09:00
David Rodríguez
4addaaf4df [rubygems/rubygems] More aggressive Performance/FlatMap cop configuration
d8d68cc00e
2024-11-26 15:11:05 +09:00
David Rodríguez
77990f6751 [rubygems/rubygems] Remove comment about oldest supported version
That's indeed the ideal behavior but it's a mess to maintain because the
version of RubyGems shipped with each patchlevel of Ruby changes. We
could try looking at the `VERSION` constant in `
RbConfig::CONFIG["rubylibdir"` but for now I calling what's in there now
as good enough.

40ccf2b093
2024-11-25 14:56:09 +00:00
David Rodríguez
4e6ada3ae4 [rubygems/rubygems] Remove unnecessary and out of date ruby version check
We already do this check in `setup.rb` itself, which is run earlier.

160cc3f1c5
2024-11-25 14:56:08 +00:00
David Rodríguez
d2acc71d32 [rubygems/rubygems] Remove now dead code
31fadaf2d2
2024-11-25 14:56:08 +00:00
Adam Daniels
3b5b34e3ae [rubygems/rubygems] Set $0 to exe when running gem exec to fix name in CLI output
The $0 value is used in many CLI libraries to determine the name of the
application, when displaying help and error messages.

Without setting this value, it defaults to `gem` which can be confusing.

Before:

```
$ gem exec kamal help
Commands:
  gem accessory           # Manage accessories (db/redis/search)
  gem app                 # Manage application
  gem audit               # Show audit log from servers
  gem build               # Build application image
  gem config              # Show combined config (including secrets!)
  gem deploy              # Deploy app to servers
  gem details             # Show details about all containers
  gem docs [SECTION]      # Show Kamal configuration documentation
  gem help [COMMAND]      # Describe available commands or one specific command
  gem init                # Create config stub in config/deploy.yml and secrets stub in .kamal
  gem lock                # Manage the deploy lock
  gem proxy               # Manage kamal-proxy
  gem prune               # Prune old application images and containers
  gem redeploy            # Deploy app to servers without bootstrapping servers, starting kamal-proxy, pruning, and registry login
  gem registry            # Login and -out of the image registry
  gem remove              # Remove kamal-proxy, app, accessories, and registry session from servers
  gem rollback [VERSION]  # Rollback app to VERSION
  gem secrets             # Helpers for extracting secrets
  gem server              # Bootstrap servers with curl and Docker
  gem setup               # Setup all accessories, push the env, and deploy app to servers
  gem upgrade             # Upgrade from Kamal 1.x to 2.0
  gem version             # Show Kamal version
```

After:

```
$ gem exec kamal help
Commands:
  kamal accessory           # Manage accessories (db/redis/search)
  kamal app                 # Manage application
  kamal audit               # Show audit log from servers
  kamal build               # Build application image
  kamal config              # Show combined config (including secrets!)
  kamal deploy              # Deploy app to servers
  kamal details             # Show details about all containers
  kamal docs [SECTION]      # Show Kamal configuration documentation
  kamal help [COMMAND]      # Describe available commands or one specific command
  kamal init                # Create config stub in config/deploy.yml and secrets stub in .kamal
  kamal lock                # Manage the deploy lock
  kamal proxy               # Manage kamal-proxy
  kamal prune               # Prune old application images and containers
  kamal redeploy            # Deploy app to servers without bootstrapping servers, starting kamal-proxy, pruning, and registry login
  kamal registry            # Login and -out of the image registry
  kamal remove              # Remove kamal-proxy, app, accessories, and registry session from servers
  kamal rollback [VERSION]  # Rollback app to VERSION
  kamal secrets             # Helpers for extracting secrets
  kamal server              # Bootstrap servers with curl and Docker
  kamal setup               # Setup all accessories, push the env, and deploy app to servers
  kamal upgrade             # Upgrade from Kamal 1.x to 2.0
  kamal version             # Show Kamal version
```

4fd060b96d
2024-11-21 20:41:30 +00:00
Samuel Giddins
b70c1bb150 [rubygems/rubygems] Add --attestation option to gem push
Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

a5412d9a0e
2024-11-20 19:32:49 +00:00
David Rodríguez
1e1a37220b [rubygems/rubygems] Fix gem update --system leaving old default bundler executables around
4b81add54c
2024-10-30 14:22:08 +00:00
David Rodríguez
48fdb9faa0 [rubygems/rubygems] Fix gem contents for default gems
A default gem does not always live in the same place. For example,
Bundler may be installed to `site_dir` when RubyGems have been upgraded.

A more reliable way seems to actually activate the default gem, so that
we can know for sure where it lives.

c69f6dfb18
2024-10-14 17:51:24 +00:00
David Rodríguez
1ad990a366 [rubygems/rubygems] Only pristine executables for default gems
1cfc1d626c
2024-10-10 19:46:44 +00:00
David Rodríguez
9f812522f5 [rubygems/rubygems] Allow gem pristine to reset default gems too
c9e665eb8a
2024-10-09 06:21:30 +00:00
David Rodríguez
82f250af45 [rubygems/rubygems] gem cleanup no longer needs to reset paths
Since `Gem::Uninstaller` no longer changes paths either.

427059d45f
2024-09-30 05:07:58 +00:00
David Rodríguez
155989415b [rubygems/rubygems] Avoid now unnecessary reset
511c7b211b
2024-09-09 08:46:02 +00:00
David Rodríguez
72e80c8f29 [rubygems/rubygems] Make gem exec use the standard GEM_HOME
032b3c518a
2024-09-09 08:46:01 +00:00
David Rodríguez
a304fe00f3 [rubygems/rubygems] Fix gem fetch always exiting with zero status code
5887e6dfa1
2024-09-09 08:44:27 +00:00
David Rodríguez
53f784178a [rubygems/rubygems] Remove unreachable code
Nothing is actually raising this at the moment.

3b824ca7a6
2024-09-06 18:44:36 +00:00
Hiroshi SHIBATA
4aa3491bd2 Skip RDoc related feature if Gem::RDoc is not available 2024-09-01 20:00:13 +09:00
David Rodríguez
419d3221fb [rubygems/rubygems] Fix gem uninstall <name>:<version> failing on shadowed default gems
29357a5dd6
2024-08-21 12:07:10 +00:00
ccmywish
185a6c991e [rubygems/rubygems] Update contents of gem.bat on Windows
(https://github.com/rubygems/rubygems/pull/6483)

41d8cffd2e

Co-Authored-By: MSP-Greg <Greg.mpls@gmail.com>
2024-06-21 02:27:47 +00:00
David Rodríguez
10c256f98f Sychronize with rubygems/rubygems repo 2024-06-01 01:13:55 +09:00
Hiroshi SHIBATA
ba8e6e77fd
Revert "[rubygems/rubygems] Fix gem pristine sometimes failing to pristine user installed gems"
This reverts commit a3edc4abc5.

That commit caused test failure with Windows platform.

* 2556187139
* 2556187306
2024-05-30 12:46:19 +09:00
David Rodriguez
a3edc4abc5 [rubygems/rubygems] Fix gem pristine sometimes failing to pristine user installed gems
0eb6ed8f86
2024-05-29 15:35:04 +00:00
David Rodriguez
c55c11d7d5 [rubygems/rubygems] Fix binstubs sometimes not getting regenerated when --destdir is given
This was only working for gems also installed in the default gem home.

47df02dbd9
2024-05-16 13:34:33 +00:00
David Rodriguez
847fc9af18 [rubygems/rubygems] Fix error message calling method removed a long time ago
5fbe5e43d6
2024-05-16 11:55:52 +00:00
Nobuyoshi Nakada
9b580ee7b6 [rubygems/rubygems] Clear temporary directory
4158034d89
2024-04-21 23:47:47 +00:00
Ellen Marie Dash
174b671699 [rubygems/rubygems] [commands/rebuild] Remove unused DATE_FORMAT constant.
3c4e3fadc9
2024-03-31 02:37:13 +00:00
Ellen Marie Dash
d19744fbd6 [rubygems/rubygems] [build, rebuild] Split common find_gemspec() out to GemspecHelpers.
2f80a595c4
2024-03-29 08:03:40 +00:00
Ellen Marie Dash
d916dbcb84 [rubygems/rubygems] Improve formatting of "gem rebuild --help" output.
701550f9dd
2024-03-29 08:03:40 +00:00
Ellen Marie Dash
54d90e1355 [rubygems/rubygems] [rebuild] If --diff is not passed and a rebuild fails, suggest passing --diff.
7caadd182c
2024-03-29 08:03:39 +00:00
Ellen Marie Dash
dfe83df03e [rubygems/rubygems] [rebuild_command] Bail early if the RubyGems version doesn't match.
a691170dc7
2024-03-29 08:03:39 +00:00
Ellen Marie Dash
88d7be46b5 [rubygems/rubygems] [rebuild_command] Use Gem.* helpers.
8644ce7193
2024-03-29 08:03:39 +00:00
Ellen Marie Dash
fe096f64e8 [rubygems/rubygems] [rebuild_command] Clean up help text.
4446389f2e
2024-03-29 08:03:38 +00:00
Ellen Marie Dash
54e0b8073b [rubygems/rubygems] [rebuild_command] Use temporary directory instead of the working directory.
f2e4e5b56f
2024-03-29 08:03:38 +00:00
Ellen Marie Dash
a28087affc [rubygems/rubygems] [rebuild_command] Add --diff flag to try using diffoscope.
3e9545193a
2024-03-29 08:03:38 +00:00
Ellen Marie Dash
cd12dfd388 [rubygems/rubygems] [rebuild_command] Avoid leaking files.
3b88553d0d
2024-03-29 08:03:37 +00:00
Ellen Marie Dash
e5def27fbf [rubygems/rubygems] Add "gem rebuild" command.
6d661573f0
2024-03-29 08:03:37 +00:00
Hiroshi SHIBATA
08753f2037 [rubygems/rubygems] Use https instead of http
bcbe6f7b7a
2024-02-21 03:30:22 +00:00
David Rodríguez
d64d0b5423
Vendor uri gem in RubyGems 2024-01-29 12:14:21 +09:00
David Rodríguez
6bd997ecfd [rubygems/rubygems] Remove no longer necessary code
b7d2de2ba8
2024-01-24 13:56:07 +09:00
David Rodríguez
0156b7416c [rubygems/rubygems] Always avoid "Updating rubygems-update" message
The fact that under the hood the upgrade is done through a
rubygems-update gem is an implementation detail that does not really
help users to know.

Plus, it reads a bit weird.

0fa5c50258
2024-01-11 13:51:52 +09:00
David Rodríguez
3980cebda5 [rubygems/rubygems] Make gem update --system respect ruby version constraints
36052abbe2
2024-01-11 13:51:52 +09:00
David Rodríguez
aa908aa065 [rubygems/rubygems] Remove old condition no longer necessary
701980b240
2024-01-11 13:51:52 +09:00
Hiroshi SHIBATA
ea31461ba0 [rubygems/rubygems] bin/rubocop -A --only Style/StringLiterals
f25013bcc0
2024-01-11 13:51:52 +09:00
Hiroshi SHIBATA
ff0119354e [rubygems/rubygems] bin/rubocop -A --only Performance/StringInclude
34df962cf4
2024-01-11 13:51:52 +09:00
hyuraku
577bc8254e [rubygems/rubygems] remove useless comments from unpack_command.rb
7576c21295
2024-01-04 00:39:54 +00:00
David Rodríguez
7c72755da8 [rubygems/rubygems] Fix ruby setup.rb leaving traces in source folder
It's the `Gem::Installer` below what installs executables, and the code
being deleted here is now actually creating a `gems/` folder in the root
of the source repo when running `ruby setup.rb`.

0e69a8b0d6
2023-12-15 11:52:38 +00:00