-
Notifications
You must be signed in to change notification settings - Fork 128
How does Tapioca compare to `srb rbi`?
srb | tapioca |
---|---|
srb init |
tapioca init |
srb rbi config |
tapioca config |
srb rbi sorbet-typed |
tapioca annotations |
srb rbi gems |
tapioca gems |
srb rbi hidden-definitions |
Partially covered by tapioca dsl
|
srb rbi todo |
tapioca todo |
srb rbi suggest-typed |
Delegated to spoom bump
|
srb rbi find-gem-rbis |
Folded inside tapioca gems
|
The description of each Tapioca command can be found in the README.
srb rbi gems
does indeed generate RBI files for gems and historically both tapioca
and the srb
tool date back to the same in-house Stripe code snippet for generating RBIs for gems. So, there are a lot of overlaps.
However, we have taken a slightly different route in building tapioca gems
than the Sorbet team has with srb rbi gems
that we feel make a big difference.
-
With
tapioca
, you are in complete control over which gems get loaded and how. We provide bothprerequire
andpostrequire
files that can dorequire
calls so that you have the option to load all the code that you need RBI generation for into memory.tapioca
handles the rest. You will need this for any gem that is markedrequire: false
in theGemfile
and/or for any non-default part of a gem that you are requiring in your codebase explicitly.In contrast, this hard-coded lookup table is what
srb rbi gems
provides. We didn't feel like maintaining a set of such lookup tables was going to be maintainable or desirable, so went a different way. -
tapioca
tries really hard to load all of your gem dependencies regardless ofgroups
or other conditions, so that we can generate RBI files for all of your dependencies regardless of which environment you are using for RBI generation. I am not sure ifsrb
does anything similar, but the last time we checked, it wasn't. -
tapioca
also does not rely on a pre-defined set of constants to start discovering other constants from like howsrb
does (again via the same lookup table). Instead,tapioca
internally uses Sorbet to parse all of the code inside a gem to discover the statically analyzable types that is defines, and starts walking over those to do a better job of spanning all of type definitions in the gem.srb
, by design, might miss some, since it depends on the internally defined constants. -
tapioca
, again, tries really hard to figure out which gem each type belongs to and generates individual and versioned RBI files for each gem. In contrast,srb
generates individual RBI files but primarily relies on Tracepoint to decide on which file a type belongs to. This might not create the best solution in the most general case. -
Due to the versioning of RBI files generated by
tapioca
, it can, in most cases, only generate the RBI files of gems that have been added/updated and can remove the files that no longer have a matching gem definition. -
tapioca
can generate extension methods to built-in types and AFAIK,srb
does not currently do that (or ends up generating all the methods on the extended core class and not just the ones that were added). -
As of the most recent version,
tapioca
can generate RBI files with signatures if the source gem has inline signatures. We have not seen thesrb
tooling do that yet.