35 Commits

Author SHA1 Message Date
Bo Anderson
30c7e6024f
standalone/init: enable more warnings for developers 2025-04-18 17:41:56 +01:00
Mike McQuaid
9560c01453
Enable Bootsnap by default
- do some optimisation of `require`s before Bootsnap
- remove `HOMEBREW_BOOTSTRAP` environment variable as it's set by
  default
- add fast require in `bootsnap.rb` using logic from `ruby.sh`
- cleanup `bootsnap.rb` a bit
- remove setting `HOMEBREW_BOOTSNAP` in GitHub Actions
2025-03-31 17:55:07 +01:00
Bo Anderson
1168ec1feb
Reset Bootsnap after installing gems 2025-03-27 03:37:17 +00:00
Douglas Eichelberger
33d9267d7d Enforce finalized sorbet methods 2024-11-21 18:34:11 -08:00
Bo Anderson
eb5f47637f
Globally silence default gem warnings 2024-09-05 03:37:25 +01:00
Bo Anderson
99ce3094e9
Invalidate Bootsnap cache on Gemfile.lock changes 2024-09-04 04:05:10 +01:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Mike McQuaid
b38e14bce7
Further Portable Ruby cleanup
- Use the `HOMEBREW_PORTABLE_RUBY_VERSION` environment variable to
  determine the version of the Portable Ruby to use in
  `vendor-install.sh` and `ruby.sh`.
- Replace the `docs/.ruby-version` file with a symlink to
 `Library/Homebrew/.ruby-version`.
- Fix an incorrect `HOMEBREW_LIBRARY` comment.
- Use a simpler `HOMEBREW_USING_PORTABLE_RUBY` definition.
2024-06-14 12:22:02 +01:00
Mike McQuaid
9e0cbe0fd7
Rename variable to HOMEBREW_USING_PORTABLE_RUBY 2024-06-14 12:06:06 +01:00
Bo Anderson
fa91edadfd
Portable Ruby 3.3.3 2024-06-14 03:32:38 +01:00
Mike McQuaid
6e9288470e
brew style --fix 2024-05-23 17:15:43 +01:00
Mike McQuaid
bde9afa70e
Portable Ruby 3.3.1
Use the latest version of Portable Ruby.
2024-05-17 00:23:36 +01:00
Markus Reiter
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Issy Long
9cf5334469
Load debug.so extensions along with the debug gem itself
- This doesn't work still, but now for new reasons.

```
     NoMethodError:
       undefined method `b' for #<Binding:0x0000000107a7e088>

             binding.b
                    ^^
     # ./test/migrator_spec.rb:72:in `block (3 levels) in <top (required)>'
```

and if I add `require "debug"` to the spec_helper again it gives:

```
LoadError:
  cannot load such file -- debug
```

but, doing a `require "debug"; binding.b` in `migrator_spec` _does_ work.

Where is the require coming from where it works some of the time but not through all of the layers we have?
2024-04-17 23:26:40 +01:00
Issy Long
073e739005
Use the debug gem from portable Ruby
- This is cleaner than vendoring a whole bunch of new gems and pinning `psych`.
- Thanks for the pointer, Bo!
- It doesn't work, though?

```
❯ brew tests --only=migrator --debug
Error: cannot load such file -- debug/debug.so
Warning: Removed Sorbet lines from backtrace!
Rerun with `--verbose` to see the original backtrace
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:16:in `require'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:16:in `rescue in <module:DEBUGGER__>'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:13:in `<module:DEBUGGER__>'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/frame_info.rb:3:in `<top (required)>'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/session.rb:31:in `require_relative'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug/session.rb:31:in `<top (required)>'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug.rb:3:in `require_relative'
/opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/lib/ruby/gems/3.1.0/gems/debug-1.6.3/lib/debug.rb:3:in `<top (required)>'
/opt/homebrew/Library/Homebrew/dev-cmd/tests.rb:48:in `require'
/opt/homebrew/Library/Homebrew/dev-cmd/tests.rb:48:in `run'
/opt/homebrew/Library/Homebrew/brew.rb:89:in `<main>'
```
2024-04-17 23:26:40 +01:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Douglas Eichelberger
5546f778e5 Extend Module when requiring sorbet 2024-01-19 13:34:52 -08:00
Bo Anderson
ec0434c549
Tweak library load path insertion to be as early as possible 2024-01-18 14:54:14 +00:00
Aaron Lichtman
3d443e2ed3
Fix crash on Ubuntu 23.10
This seems to resolve the issue raised at #5050
2024-01-18 14:06:01 +00:00
Douglas Eichelberger
a218ebb6ca Fix Sorbet/TrueSigil exclusion 2023-12-26 16:52:34 -08:00
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
Bo Anderson
6938fb7781
Merge pull request #16316 from Bo98/goodbye-ruby-2.6
Sayonara Ruby 2.6
2023-12-12 16:15:27 +00:00
Bo Anderson
688d87e839
Remove Ruby 2.6 & macOS system Ruby support code 2023-12-12 03:44:31 +00:00
Bo Anderson
0bc2028c44
Remove vendored Ruby 2.6 gems 2023-12-11 16:30:01 +00:00
Bo Anderson
ea6c37545a
standalone/init: temporary code to retain Ruby 2.6 support 2023-12-04 17:34:27 +00:00
Bo Anderson
c9974cd828
Vendor Ruby 3.1 gems 2023-11-30 06:09:56 +00:00
Bo Anderson
585f5cdeb3
standalone/init: don't pollute environment on Ruby 3 startup 2023-11-17 02:17:13 +00:00
Bo Anderson
c45572ecee
standalone/init: skip initial gem install in child processes 2023-10-27 14:02:33 +01:00
Bo Anderson
daa49a1323
Install gems automatically on newer Ruby 2023-09-29 01:34:39 +01:00
Bo Anderson
1f86ad4b0f
standalone/load_path: rename to init 2023-09-29 01:26:31 +01:00
Bo Anderson
4b7eec6104
standalone/load_path: add Bundler to LOAD_PATH 2023-09-13 14:17:31 +01:00
Bo Anderson
8cb056c657
Remove sitedir from LOAD_PATH 2022-10-24 19:42:49 +01:00
Bo Anderson
a0e784f0ea
Update to Bundler 2 2022-10-14 01:30:38 +01:00
Bo Anderson
e4264c9f35
Replace sorbet-runtime-stub with sorbet-runtime 2022-07-19 23:43:14 +01:00
Bo Anderson
a06d136d2c
Move Sorbet gems into an optional group 2021-06-11 08:10:30 +01:00