Require gem classes, but out out of require-time side effects?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reproducing the failure with bundle exec tapioca gem debug, both with and without RUBY_DEBUG_ENABLE=0, and inspect the gem's require path and the attach, trap, and fork-interceptor entry points. Done means Tapioca can require debug without side effects and generate an RBS or RBI successfully.
Written by the indexing model from the issue text.
Description
Your proposal
Is it possible to separate out the logic to attempt to attach to a process, and to define all the classes that the library needs?
Additional context
When using type checkers like Sorbet, various tools (srb init, tapioca gem, etc.) attempt to require the gem only to see what classes, methods, and constants the gem defines, so that it can generate either an RBS or RBI file providing annotations for the gem.
It seems that the debug gem does not work for those use cases, because requiring the gem seems to try to attach to the gem:
~/sandbox/default jez@jez-pc-01
❯ cat Gemfile
source 'https://rubygems.org'
gem 'tapioca'
gem 'debug'
~/sandbox/default jez@jez-pc-01
❯ bundle install &> /dev/null && bundle exec tapioca gem debug
Requiring all gems to prepare for compiling... DEBUGGER: Attaching after process 676571 fork to child process 676585
Done
Error: Cannot find gem 'debug'
~/sandbox/default jez@jez-pc-01
❯ export RUBY_DEBUG_ENABLE=0
~/sandbox/default jez@jez-pc-01
❯ bundle install &> /dev/null && bundle exec tapioca gem debug
Requiring all gems to prepare for compiling... Done
Error: Cannot find gem 'debug'
What I would like to be able to do is to have a way to require all the supporting classes/modules/constants/methods that the debug gem defines but not have the gem attempt to do any side effects. For example, I want to require the gem but explicitly opt out of the trap and fork interceptors.
The feature request would be considered complete when it's possible to generate an RBS or RBI for the debug gem without having it fail, as shown in the screenshot above.
- Dominant language
- Ruby
- Stars
- 1.3k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby/debug
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Support exceptionOptions in setExceptionBreakpoints to catch arbitrary exception classes via DAP Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Documentation issues Open
Difficulty 2/5 1-2 days Newbie friendliness 72/100
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
betagouv/acces-cible#722 ·