Require gem classes, but out out of require-time side effects?
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Ruby
- 星标
- 1.3k
- 派生
- 146
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ruby/debug 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 68/100
-
Support exceptionOptions in setExceptionBreakpoints to catch arbitrary exception classes via DAP 未关闭
难度 4/5 3-5 天 新手友好度 55/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 52/100
-
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
palladius/rails8-app-on-gcp#145 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
rubocop/rubocop-rspec#2236 ·
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
riscv/riscv-unified-db#2624 · 1 个 reaction ·
-
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 78/100