Commit graph

14659 commits

Author SHA1 Message Date
David Rodríguez
bb511c3f10 [rubygems/rubygems] Don't try to remove previous install folder if it's empty
Ruby ships with empty directories for default gems. If Ruby
installations has unsafe world-writable permissions, we will complain
when about to install a gem that happens to be also a default gem,
because we'll start by removing the previous install folder and that's
supposed to be insecure due to too loose permissions.

However, if the folder is empty, we don't actually need to remove
anything, so we can skip the whole thing, avoiding the errors.

2f3cd8ac4e
2024-09-02 14:01:15 +00:00
David Rodríguez
b00b0d5f8f [rubygems/rubygems] Improve insecure gem overwrite message
7c71dac22e
2024-09-02 14:01:14 +00:00
Hiroshi SHIBATA
745b4775c5 [ruby/logger] Bump up 1.6.1
bda937b4cc
2024-09-02 02:29:24 +00:00
Hiroshi SHIBATA
4aa3491bd2 Skip RDoc related feature if Gem::RDoc is not available 2024-09-01 20:00:13 +09:00
Durable Programming Team
d6fc8f3d57 [rubygems/rubygems] fix @license typo preventing licenses from being correctly unmarshalled
d6ba7ef79f
2024-08-31 18:30:25 +00:00
Hiroshi SHIBATA
7900128ab2 [ruby/uri] Bump up 0.13.1
31ec9cea66
2024-08-31 05:14:54 +00:00
Mari Imaizumi
a2b3cb65ea [ruby/reline] Implement re-read-init-file
(https://github.com/ruby/reline/pull/740)

59e4ade807
2024-08-31 03:26:50 +00:00
Matt Brictson
830ff66e2c [rubygems/rubygems] Emit progress to stderr when --parseable is passed to bundle outdated
Before, `bundle outdated --parseable` (or `--porcelain`) caused output
to be completely silenced during definition resolution, so nothing was
printed at all until the table of outdated gems was printed.

With this change, `--parseable`/`--porcelain` now prints progress to
stderr during resolution. E.g.:

```
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
```

This provides a better user experience, especially when
`outdated --parseable` takes several seconds or more.

The report of outdated gems is still printed to stdout, and the exit
status codes are unchanged, so the fundamental contract with other tools
consuming the `outdated --parseable` result should not be affected.

7d4bb43570
2024-08-30 10:36:08 +00:00
David Rodríguez
08b92b67ff [rubygems/rubygems] Don't blow up when explicit version is removed from some git sources
`version` is actually an attribute of the dependency, not of the git
source. Sometimes it's passed to the git source to be able to fake a
gemspec in case there's no gemspec in the source, but it should not be
used for source comparison.

d936fbd78e
2024-08-30 10:16:29 +00:00
Koichi ITO
af65b41e07 [ruby/prism] Remove deprecated lib/prism/translation/parser/rubocop.rb file
Follow up https://github.com/ruby/prism/pull/2558.

This PR removes deprecated lib/prism/translation/parser/rubocop.rb file.

The file was a workaround to allow setting `TargetRubyVersion: 80_82_73_83_77.xx` until Prism (`Prism::Translation::Parser`) is integrated into RuboCop.
RuboCop already supports Prism (`Prism::Translation::Parser`) as of https://github.com/rubocop/rubocop/pull/12724.

It has been several months since the file was deprecated in ruby/prism#2558.
And, yesterday, Prism 1.0.0 was released, but perhaps the file should have been removed before then.

Although this might be seen as incompatible with semver 1.0.0, I think there is no longer a reason to keep the file.

646a10270e
2024-08-29 20:04:55 +00:00
tomoya ishida
b74e0c5f6b [ruby/reline] Calculate mbchar width with bsearch
(https://github.com/ruby/reline/pull/632)

0851e93640
2024-08-29 17:34:31 +00:00
David Rodríguez
871ba3e9e3 [rubygems/rubygems] Add a note about "platforms" in Gemfile vs "platforms" in Gemfile.lock
0dd4bd59b4
2024-08-29 09:59:26 +00:00
David Rodríguez
6dee0d3fb0 [rubygems/rubygems] Reject unknown platforms when running bundle lock --add-platform
1f93a2bdc5
2024-08-29 09:59:26 +00:00
Kevin Newton
ad737a8d0f
[PRISM] Sync version update 2024-08-28 15:43:32 -04:00
Kevin Newton
45f32e3a50 [ruby/prism] Reverse-sync ruby/ruby and deprecate old fields
bc21c9f3ee
2024-08-28 19:07:16 +00:00
Kevin Newton
417bb8d4fd [PRISM] Field renaming
Rename some fields that do not quite make sense.

* CaseMatchNode#consequent -> CaseMatchNode#else_clause
* CaseNode#consequent -> CaseNode#else_clause
* IfNode#consequent -> IfNode#subsequent
* RescueNode#consequent -> RescueNode#subsequent
* UnlessNode#consequent -> UnlessNode#else_clause
2024-08-28 15:06:53 -04:00
tomoya ishida
ce6b0c4425 [ruby/irb] Colorize command input
(https://github.com/ruby/irb/pull/983)

0e64136e76
2024-08-28 16:16:31 +00:00
Olle Jonsson
b5646124b3 [ruby/timeout] timeout.rb: Update documentation
This is a followup to #49.

683fdb45ee
2024-08-28 10:58:23 +00:00
Stan Lo
87fa75c5db [ruby/irb] Move parse_command method to Context
(https://github.com/ruby/irb/pull/993)

Since Context dictates whether a line is a command or an expression,
moving the parse_command method to Context makes the relationship
more explicit.

9a4487af61
2024-08-27 12:49:23 +00:00
Mari Imaizumi
a431f4ecc4 [ruby/reline] Remove unused variables
(https://github.com/ruby/reline/pull/739)

14784eddee
2024-08-27 12:46:45 +00:00
Hiroshi SHIBATA
04ca75ea69 [ruby/uri] Also warn URI::RFC3986_PARSER.extract
0f6b945557
2024-08-27 02:39:52 +00:00
Hiroshi SHIBATA
e5295644c9 [ruby/fileutils] Update license files same as ruby/ruby
9e32a88573
2024-08-27 00:39:24 +00:00
Stan Lo
ec61dbd98e [ruby/rdoc] Make darkfish more responsive and readable on mobile
devices
(https://github.com/ruby/rdoc/pull/1162)

- Make the sidebar toggle fixed on all devices
- Prevent default zooming on mobile devices
- Improve sidebar opening on mobile devices

95b6cfb64f
2024-08-26 22:02:33 +00:00
Matt Brictson
7c794c287e [rubygems/rubygems] Emit progress to stderr when --print is passed to bundle lock
`bundle lock --print --update` can take a long time to fetch sources and
resolve the lock file.

Before, `--print` caused output to be completely silenced, so nothing
was printed at all until the resolved lock file is finally emitted to
stdout.

With this change, `--print` now prints progress to stderr. E.g.:

```
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
```

This provides a better user experience, especially when
`lock --print --update` takes several seconds or more.

The lock file is still printed to stdout, so tools consuming the lock
file on stdout will not be affected.

6719baa700
2024-08-26 14:56:26 +00:00
Matt Brictson
2066482684 [rubygems/rubygems] Fix newline=false being ignored by Shell#warn
e021ff33a8
2024-08-26 14:56:26 +00:00
Matt Brictson
cfad1f95d5 [rubygems/rubygems] Fix missing 'msg' parameter in Shell#no?
ffe89a099a
2024-08-26 14:56:25 +00:00
Nobuyoshi Nakada
136cbf0441 [ruby/tempfile] Support anonymous tempfile on earlier than Ruby 3.2
7052805029
2024-08-26 02:49:02 +00:00
Ufuk Kayserilioglu
519152db6d [ruby/rdoc] Make the summary triangle appear in the correct place
when the summary text overflows to next line.
(https://github.com/ruby/rdoc/pull/1160)

f2eb62f6f8
2024-08-24 18:15:21 +00:00
Stan Lo
6717b69067 [ruby/rdoc] Modernize RDoc Darkfish template CSS
(https://github.com/ruby/rdoc/pull/1157)

- Update color scheme with muted green tones and improved contrast
- Enhance readability by adjusting font sizes and weights
- Improve code block styling with a light gray background
- Refactor layout for better responsiveness and sidebar presentation
- Standardize link styles across the document
- Implement CSS variables for easier theme customization
- Adjust heading styles for better visual hierarchy
- Enhance table and list styling for improved readability
- Optimize search field and navigation toggle appearance
- Improve method detail and documentation section styling
- Reorganize css and overhaul the sidebar design
- Improve code block's syntax highlighting

6cde9edadb
2024-08-24 11:07:28 +00:00
David Rodríguez
9f5860407f [rubygems/rubygems] Fix error message when Bundler refuses to install due to frozen being set without a lockfile
0857d62ca6
2024-08-23 07:00:30 +00:00
Hiroshi SHIBATA
7812732e2c [ruby/tempfile] File.new(fileno, mode: mode, path: path) is provided from Ruby 3.2
67ce897727
2024-08-23 06:07:40 +00:00
David Rodríguez
2569413b1c [rubygems/rubygems] Fix --prefer-local flag
The original implementation of this flag was too naive and all it did
was restricting gems to locally installed versions if there are any
local versions installed.

However, it should be much smarter. For example:

* It should fallback to remote versions if locally installed version
  don't satisfy the requirements.
* It should pick locally installed versions even for subdependencies not
  yet discovered.

This commit fixes both issues by using a smarter approach similar to how
we resolve prereleases:

* First resolve optimistically using only locally installed gems.
* If any conflicts are found, scan those conflicts, allow remote
  versions for the specific gems that run into conflicts, and
  re-resolve.

607a3bf479

Co-authored-by: Gourav Khunger <gouravkhunger18@gmail.com>
2024-08-22 11:48:32 +00:00
David Rodríguez
203051d839 [rubygems/rubygems] Fix bad grammar in log message
bea4c1ad79
2024-08-22 11:48:31 +00:00
David Rodríguez
669d1f79d8 [rubygems/rubygems] Restore support for passing relative paths to :git
The `file://` protocol does not really work with relative paths and it's
not necessary anyways. So restore support for that by not using
`file://`.

16a68998ce
2024-08-21 14:47:57 +00: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
David Rodríguez
54b6025887 [rubygems/rubygems] Regeneration previous git application caches that didn't include bare repos
417319ecb1
2024-08-21 12:06:28 +00:00
Hiroshi SHIBATA
71c14c8889 Don't show script name when bundle exec and call ruby script directly. 2024-08-21 16:48:35 +09:00
Hiroshi SHIBATA
c97dc7739e Skip to show script name with using ruby -r option 2024-08-21 16:48:35 +09:00
Hiroshi SHIBATA
5fedf1c3ac Show correct script name with sub-feature case 2024-08-21 16:48:35 +09:00
Hiroshi SHIBATA
b41d79962a Reapply "[ruby/uri] Warn compatibility methods in RFC3986_PARSER"
This reverts commit 3da7e440e9.
2024-08-21 14:52:29 +09:00
Hiroshi SHIBATA
592b90328a
Generate parsers of RDoc with Racc 1.8.1 2024-08-21 13:30:01 +09:00
Michael Chui
014708ad5a [ruby/logger] Guarantee level_override exists
Some Ruby apps subclass Logger without running the superclass
constructor, which means that `@level_override` isn't initialized
properly. This can be fixed in some cases, but the gem should maintain
backwards compatibility.

3246f38328
2024-08-21 01:10:56 +00:00
Peter Zhu
1d68a735a2 [ruby/tempfile] Don't unlink in finalizer when already unlinked
f677941ea2
2024-08-20 18:37:53 +00:00
Peter Zhu
a68331e703 [ruby/tempfile] Add FinalizerManager to manage finalizers
As @jeremyevans pointed out for commit eb2d8b1:

> Each Tempfile instance has a separate File instance and file descriptor:
>
>   t = Tempfile.new
>   t.to_i # => 6
>   t.dup.to_i => 7

FinalizerManager will keep track of the open File objects for the
particular file and will only unlink the file when all of the File objects
have been closed.

753ab16642
2024-08-20 18:07:42 +00:00
Peter Zhu
41b427a264 [ruby/tempfile] Ensure finalizer order in Tempfile
The Closer and Remover finalizers are defined on different objects in
Tempfile. The Closer is defined on the Tempfile object while the Remover
is defined on the finalizer_obj. This means that there is no guarantee
of the finalizer order.

On Windows, we must close the file before removing it because we cannot
remove an open file. But since the order is not guaranteed, the GC may
run the Remover finalizer first, which will fail with an Errno::EACCES
(Permission denied @ apply2files).

This commit changes it so that both the Closer and Remover finalizers
are defined on the finalizer_obj, which guarantees the order that it is
ran.

eb2d8b1175
2024-08-20 13:28:36 +00:00
Hiroshi SHIBATA
72d016e97b [ruby/reline] typofix
d44fbf9f7b
2024-08-20 11:03:13 +00:00
David Rodríguez
786d000652 [ruby/rdoc] Avoid potentially loading the same extension from different versions of the same gem
Avoids warnings like

```
/path/to/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rbs-3.4.0/lib/rdoc/discover.rb:10: warning: method redefined; discarding old scan
/path/to/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rdoc/discover.rb:10: warning: previous definition of scan was here
```

e47920d8f3
2024-08-19 11:48:42 +00:00
Marco Roth
7061359564 [rubygems/rubygems] Change new gem README template to have copyable code blocks
c805e9b558
2024-08-19 00:04:48 +00:00
Stan Lo
923e36ab21 [ruby/rdoc] Fix sidebar scroll again and add missing footer back
(https://github.com/ruby/rdoc/pull/1154)

* Add missing footers

In #1152 the footer partial was only added to the index.rhtml file.
This commit adds the footer partial to the other template files.

* Remove unnecessary middle divs in nav

* Simplify sidebar's overflow settings

Because sidebar needs to be scrollable, its overflow should default to auto.
Currently it's set to hidden and force individual elements to set overflow auto,
which overcomplicates things.

b8c2bcd8db
2024-08-15 13:33:00 +00:00
Kentaro Takeyama
2a933609e7 Delete unnecessary rubocop disable comment 2024-08-15 17:16:25 +09:00