Commit graph

14675 commits

Author SHA1 Message Date
David Rodríguez
b843d4ee14 [rubygems/rubygems] Fix running bundler (with a final r) in a bundle exec context
ad95a1dfaa
2024-10-23 08:52:46 +00:00
David Rodríguez
4790ecc86f [rubygems/rubygems] Do what the comment says, it's simpler
0511d2c08d
2024-10-23 08:52:45 +00:00
David Rodríguez
ffd51926bf [rubygems/rubygems] Remove the need for some bundler monkeypatches
f530f8686d
2024-10-23 08:52:45 +00:00
Jerome Dalbert
ad85354452 Clarify bundler inline’s install parameter 2024-10-23 08:52:19 +00:00
Taketo Takashima
19747c1ca6 [ruby/ipaddr] Drop support for Ruby 2.3
4685fca13d
2024-10-23 04:07:30 +00:00
Guilherme Carreiro
e9ba6c2ea4 [ruby/error_highlight] Adjust truncation, add opt-out mechanism, rename methods, and prepare error highlighting to render on extremely small screens
c565340958
2024-10-23 00:58:50 +00:00
Guilherme Carreiro
e7c9dfb3e9 [ruby/error_highlight] Handle very long lines with errors in the middle of the line
0657bc1afa
2024-10-23 00:58:50 +00:00
Guilherme Carreiro
5aa8b9e3b5 [ruby/error_highlight] Handle very long lines
383490a4b4
2024-10-23 00:58:50 +00:00
David Rodríguez
b39b998a17 [rubygems/rubygems] Remove patches for old TruffleRuby versions
264c61eb8e
2024-10-22 20:32:56 +00:00
Wu
e288604eb3 [ruby/reline] Use IO's encoding instead of Encoding.default_external
(https://github.com/ruby/reline/pull/765)

* use IO's encoding

* refactoring

* remove unused encoding params

* (for retriggering CI) remove unused encoding params

f09772adab
2024-10-22 14:43:18 +00:00
KJ Tsanaktsidis
7d254e4a2e Perform an actual access check in Dir.tmpdir for writability
At the moment, this code is looking at the stat output to determine if a
temp directory can be written to. However, just because the stat bits
say that a directory is writable, does not make it so; and, likewise,
the operating system may in fact grant access to paths that the stat
bits and process UID say should be inaccessible.

These systems include:

* Posix ACL's
* Linux's capabilities like CAP_DAC_OVERRIDE
* Linux Security Modules like SELinux or AppArmor
* Syscall filters like Linux's seccomp
* Granular capability systems like FreeBSD's Capsicum
* OpenBSD's pledge and unveil
* Windows too has a rich ACL system for controlling filesystem access

The best thing to do is simply to try and access the path with
`File.writable?` and let the operating system tell us if the path can be
accessed.
2024-10-22 15:17:52 +11:00
Akinori MUSHA
b101ca598e [ruby/ipaddr] Bump the version to 1.2.7
b44d2a1173
2024-10-19 12:59:03 +00:00
Akinori MUSHA
bfc586b2be [ruby/ipaddr] Use string interpolation instead of format()
1f41cd7320
2024-10-19 12:56:27 +00:00
Tsutomu Katsube
f370a31578 [ruby/irb] Suppress "literal string will be frozen in the future"
warning
(https://github.com/ruby/irb/pull/1019)

* Suppress "literal string will be frozen in the future" warning

Before change:

```console
$ ruby -W -I lib -e 'require "irb"; IRB.setup(nil); IRB::Irb.new.build_statement("1 + 2")'
/Users/zzz/src/github.com/ruby/irb/lib/irb.rb:1135: warning: literal string will be frozen in the future
```

After change:

```console
$ ruby -W -I lib -e 'require "irb"; IRB.setup(nil); IRB::Irb.new.build_statement("1 + 2")'
```

* Making build_statement not modify the given argument

Because improves readability and code quality.

Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com>

---------

3da04b9786

Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com>
2024-10-18 17:15:25 +00:00
tomoya ishida
09ddfd4d1c [ruby/irb] Always use alternate sceen on alt-d
(https://github.com/ruby/irb/pull/988)

db0a923d62
2024-10-18 17:15:11 +00:00
Jerome Dalbert
fce5bbd6a7 [rubygems/rubygems] Add bundle add --quiet option
This option is similar to the `bundle install --quiet` option

3bd773d827
2024-10-18 16:19:31 +00:00
Akinori MUSHA
689f14e255 [ruby/ipaddr] Use string interpolation instead of format()
73f59e111f
2024-10-18 16:03:49 +00:00
Taketo Takashima
eb8cf1d60e [ruby/ipaddr] Added to_json/as_json method
Updated to use cidr method when return address with prefix in #as_json

cf8181d53e
2024-10-18 15:00:37 +00:00
Jerome Dalbert
6b1268c7bf [rubygems/rubygems] Clarify bundle install --quiet documentation
Bundler always exits with a status code.

3a38bd0b12
2024-10-18 14:25:20 +00:00
Hiroshi SHIBATA
8b4df90a24 [ruby/syntax_suggest] Bump up 2.0.1
0b9e4081c0
2024-10-18 02:07:02 +00:00
Hiroshi SHIBATA
4b21fb125f [ruby/syntax_suggest] Removed empty comment
e1d9c83736
2024-10-18 01:48:48 +00:00
Mike Dalessio
0b38e18488 [ruby/rdoc] feature: Render mixed-in methods and constants with
`--embed-mixins`
(https://github.com/ruby/rdoc/pull/842)

* Embed mixed-in methods and constants with `--embed-mixins`

When `--embed-mixins` option is set:

- methods from an `extend`ed module are documented as singleton methods
- attrs from an `extend`ed module are documented as class attributes
- methods from an `include`ed module are documented as instance methods
- attrs from an `include`ed module are documented as instance attributes
- constants from an `include`ed module are documented

Sections are created when needed, and Darkfish's template annotates
each of these mixed-in CodeObjects. We also respect the mixin methods'
visibility.

This feature is inspired by Yard's option of the same name.

* Add comment to document why we set object visibility

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Add the mixin_from attribute to CodeObject's initializer

* Add test coverage for private mixed-in attributes.

---------

481c2ce660

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-10-17 20:40:34 +00:00
Jean Boussier
0e2ac46584 Optimize Ext::Generator::State#configure
If we assume that most of the time the `opts` hash is small
it's faster to go over the provided keys with a `case` than
to test all possible keys one by one.

Before:

```
== Encoding small nested array (121 bytes)
ruby 3.4.0preview2 (2024-10-07 master 32c733f57b) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
                json   156.832k i/100ms
                  oj   209.769k i/100ms
           rapidjson   162.922k i/100ms
Calculating -------------------------------------
                json      1.599M (± 2.5%) i/s  (625.34 ns/i) -      7.998M in   5.005110s
                  oj      2.137M (± 1.5%) i/s  (467.99 ns/i) -     10.698M in   5.007806s
           rapidjson      1.677M (± 3.5%) i/s  (596.31 ns/i) -      8.472M in   5.059515s

Comparison:
                json:  1599141.2 i/s
                  oj:  2136785.3 i/s - 1.34x  faster
           rapidjson:  1676977.2 i/s - same-ish: difference falls within error

== Encoding small hash (65 bytes)
ruby 3.4.0preview2 (2024-10-07 master 32c733f57b) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
                json   216.464k i/100ms
                  oj   661.328k i/100ms
           rapidjson   324.434k i/100ms
Calculating -------------------------------------
                json      2.301M (± 1.7%) i/s  (434.57 ns/i) -     11.689M in   5.081278s
                  oj      7.244M (± 1.2%) i/s  (138.05 ns/i) -     36.373M in   5.021985s
           rapidjson      3.323M (± 2.9%) i/s  (300.96 ns/i) -     16.871M in   5.081696s

Comparison:
                json:  2301142.2 i/s
                  oj:  7243770.3 i/s - 3.15x  faster
           rapidjson:  3322673.0 i/s - 1.44x  faster
```

After:

```
== Encoding small nested array (121 bytes)
ruby 3.4.0preview2 (2024-10-07 master 32c733f57b) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
                json   168.087k i/100ms
                  oj   208.872k i/100ms
           rapidjson   149.909k i/100ms
Calculating -------------------------------------
                json      1.761M (± 1.1%) i/s  (567.90 ns/i) -      8.909M in   5.059794s
                  oj      2.144M (± 0.9%) i/s  (466.37 ns/i) -     10.861M in   5.065903s
           rapidjson      1.692M (± 1.7%) i/s  (591.04 ns/i) -      8.545M in   5.051808s

Comparison:
                json:  1760868.2 i/s
                  oj:  2144205.9 i/s - 1.22x  faster
           rapidjson:  1691941.1 i/s - 1.04x  slower

== Encoding small hash (65 bytes)
ruby 3.4.0preview2 (2024-10-07 master 32c733f57b) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
                json   242.957k i/100ms
                  oj   675.217k i/100ms
           rapidjson   355.040k i/100ms
Calculating -------------------------------------
                json      2.569M (± 1.5%) i/s  (389.22 ns/i) -     12.877M in   5.013095s
                  oj      7.128M (± 2.3%) i/s  (140.30 ns/i) -     35.787M in   5.023594s
           rapidjson      3.656M (± 3.1%) i/s  (273.50 ns/i) -     18.462M in   5.054558s

Comparison:
                json:  2569217.5 i/s
                  oj:  7127705.6 i/s - 2.77x  faster
           rapidjson:  3656285.0 i/s - 1.42x  faster
```
2024-10-17 11:35:33 +00:00
Jean Boussier
43e08133c3 [ruby/json] Convert Generator initialize and configure method into Ruby
This helps very marginally with allocation speed.

25db79dfaa
2024-10-17 11:35:32 +00:00
Stan Lo
fc11579c49 [ruby/rdoc] Use scroll-margin-top on anchor targets
(https://github.com/ruby/rdoc/pull/1190)

This will make the anchor target easier to read.

e2fe4882f4
2024-10-17 10:11:03 +00:00
Mads Ohm Larsen
1f0b540332 [ruby/rdoc] Add scroll-margin-top on all :target elements
(https://github.com/ruby/rdoc/pull/1174)

7398e5b0ad

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-10-17 10:10:36 +00:00
David Rodríguez
d4a18d4a78 [rubygems/rubygems] Allow using gemspec DSL twice with same dependency and compatible requirements
a8d14c1fc2
2024-10-17 07:10:38 +00:00
David Rodríguez
36b7ad3caa [rubygems/rubygems] Fix bundle check sometimes locking gems under the wrong source
1e5780db0a

Co-authored-by: Taylor Thurlow <thurlow@hey.com>
2024-10-16 21:57:52 +00:00
David Rodríguez
def5fdf82a [rubygems/rubygems] Delay and refactor verification of changed sources
d5dce93167
2024-10-16 21:57:51 +00:00
David Rodríguez
cff18256ca [rubygems/rubygems] No reason for Definition#sources to be private
432fe083a6
2024-10-16 21:57:51 +00:00
David Rodríguez
9d5be3d9ed [rubygems/rubygems] Lock definition directly
55eb6630a8
2024-10-16 21:57:50 +00:00
Leo Arnold
e9e66f74e3 [rubygems/rubygems] Add missing comma in documentation
fe9999f2cf
2024-10-16 21:56:56 +00:00
Kevin Newton
550ae745f6 [ruby/prism] Relocation
5ea6042408
2024-10-16 15:56:01 +00:00
Hiroshi SHIBATA
2bf9c82f1b [ruby/yaml] Support old version of Psych
5b39653c52
2024-10-16 08:49:54 +00:00
Hiroshi SHIBATA
c1f6ad561b [ruby/yaml] Also use safe_load on YAML::Store
09691d005f
2024-10-16 08:49:54 +00:00
Hiroshi SHIBATA
21bac99122 [ruby/yaml] Make YAML::DBM optional
f7c44d3fd7
2024-10-16 17:04:37 +09:00
Hiroshi SHIBATA
1d7547f50d [ruby/yaml] Also use safe_load with each_value, values and shift
f47d6123eb
2024-10-16 17:04:36 +09:00
Hiroshi SHIBATA
d45fb19ee5 [ruby/yaml] Prefer to use YAML.safe_load
c3d0f64224
2024-10-16 17:04:35 +09:00
Hiroshi SHIBATA
fdcdc05b42 [ruby/yaml] Removed confused VERSION constant for YAML::DBM
952fd361b1
2024-10-16 17:04:34 +09:00
Vinicius Stock
ed993b5bcc [ruby/rdoc] Generate meta tags based on page's content
(https://github.com/ruby/rdoc/pull/1091)

716bc16a7d
2024-10-15 22:59:33 +00:00
David Rodríguez
8240fe88f3 [rubygems/rubygems] Prevent some test suite warnings about missing extensions
We fixed some issues recently where Bundler would try to activate a
pysch spec with missing extensions and crash. However, as a side effect,
we started printing warnings about missing extensions in situations
where we did not warn before.

It may be interesting to warn on these new situations too, but in order
to minimize changes for now, I'm reverting to printing warnings in the
same situations as before.

51ebff6982
2024-10-14 19:43:39 +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
57404e4369 [rubygems/rubygems] Fix duplicated specs when they have been previously activated
b44bf2ac74
2024-10-14 14:51:20 +00:00
tomoya ishida
cf8388f76c [ruby/irb] Remove bignum check from save_history
(https://github.com/ruby/irb/pull/1018)

IRB need to accept bignum history size, but we don't want explicit bignum checks because threshold of bignum and fixnum depends on platform.

5151467e6a
2024-10-13 13:00:20 +00:00
tomoya ishida
98fce00cab [ruby/reline] Support continuous tab completion
(https://github.com/ruby/reline/pull/761)

Continuous tab completion is possible in GNU Readline.
If dig_perfect_match_proc is set, continuous tab completion will be disabled.

469a52846b
2024-10-13 04:55:41 +00:00
John Bampton
afacb8ada5
[DOC] Fix spelling 2024-10-12 12:48:10 +00:00
Kevin Newton
5f62522d5b [ruby/prism] Prism::StringQuery
Introduce StringQuery to provide methods to access some metadata
about the Ruby lexer.

d3f55b67b9
2024-10-11 19:34:57 +00:00
Gert Goet
95abf679c5 [ruby/irb] Document infinite history
(https://github.com/ruby/irb/pull/1012)

As introduced in 824473e8

15e3f50c3f
2024-10-11 16:34:59 +00:00
Gert Goet
eccfb6e60c [ruby/irb] History refactors (https://github.com/ruby/irb/pull/1013)
* Extract logic save_history in separate helper

* Extract logic history_file in helper

* Allow for readonly history

52307f9026
2024-10-11 16:34:19 +00:00
Nobuyoshi Nakada
047a7750d1 [ruby/time] [DOC] Escape the word "Date" that does not mean Date class
933eccf8d9
2024-10-11 09:59:35 +00:00