README.md in tapioca-0.9.4 vs README.md in tapioca-0.10.0
- old
+ new
@@ -28,10 +28,35 @@
* Find useless definitions in shim RBI files from gems generated RBI files
* Find useless definitions in shim RBI files from DSL generated RBI files
* Find useless definitions in shim RBI files from Sorbet's embedded RBI for core and stdlib
* Synchronization validation for your CI
+## Table of Contents <!-- no_toc -->
+<!-- START_TOC -->
+* [Installation](#installation)
+* [Getting started](#getting-started)
+* [Usage](#usage)
+ * [Generating RBI files for gems](#generating-rbi-files-for-gems)
+ * [Manually requiring parts of a gem](#manually-requiring-parts-of-a-gem)
+ * [Excluding a gem from RBI generation](#excluding-a-gem-from-rbi-generation)
+ * [Changing the strictness level of the RBI for a gem](#changing-the-strictness-level-of-the-rbi-for-a-gem)
+ * [Keeping RBI files for gems up-to-date](#keeping-rbi-files-for-gems-up-to-date)
+ * [Pulling RBI annotations from remote sources](#pulling-rbi-annotations-from-remote-sources)
+ * [Basic authentication](#basic-authentication)
+ * [Using a .netrc file](#using-a-netrc-file)
+ * [Changing the typed strictness of annotations files](#changing-the-typed-strictness-of-annotations-files)
+ * [Generating RBI files for Rails and other DSLs](#generating-rbi-files-for-rails-and-other-dsls)
+ * [Keeping RBI files for DSLs up-to-date](#keeping-rbi-files-for-dsls-up-to-date)
+ * [Writing custom DSL compilers](#writing-custom-dsl-compilers)
+ * [RBI files for missing constants and methods](#rbi-files-for-missing-constants-and-methods)
+ * [Generating the RBI file for missing constants](#generating-the-rbi-file-for-missing-constants)
+ * [Manually writing RBI definitions (shims)](#manually-writing-rbi-definitions-shims)
+ * [Configuration](#configuration)
+* [Contributing](#contributing)
+* [License](#license)
+<!-- END_TOC -->
+
## Installation
Add this line to your application's `Gemfile`:
```rb
@@ -154,12 +179,11 @@
# Default: true
[--loc], [--no-loc] # Include comments with source location when generating RBIs
# Default: true
[--exported-gem-rbis], [--no-exported-gem-rbis] # Include RBIs found in the `rbi/` directory of the gem
# Default: true
- -w, [--workers=N] # EXPERIMENTAL: Number of parallel workers to use when generating RBIs
- # Default: 1
+ -w, [--workers=N] # Number of parallel workers to use when generating RBIs (default: auto)
[--auto-strictness], [--no-auto-strictness] # Autocorrect strictness in gem RBIs in case of conflict with the DSL RBIs
# Default: true
--dsl-dir, [--dsl-dir=directory] # The DSL directory used to correct gems strictnesses
# Default: sorbet/rbi/dsl
[--rbi-max-line-length=N] # Set the max line length of generated RBIs. Signatures longer than the max line length will be wrapped
@@ -432,27 +456,27 @@
Usage:
tapioca dsl [constant...]
Options:
- --out, -o, [--outdir=directory] # The output directory for generated DSL RBI files
- # Default: sorbet/rbi/dsl
- [--file-header], [--no-file-header] # Add a "This file is generated" header on top of each generated RBI file
- # Default: true
- [--only=compiler [compiler ...]] # Only run supplied DSL compiler(s)
- [--exclude=compiler [compiler ...]] # Exclude supplied DSL compiler(s)
- [--verify], [--no-verify] # Verifies RBIs are up-to-date
- -q, [--quiet], [--no-quiet] # Suppresses file creation output
- -w, [--workers=N] # EXPERIMENTAL: Number of parallel workers to use when generating RBIs
- # Default: 1
- [--rbi-max-line-length=N] # Set the max line length of generated RBIs. Signatures longer than the max line length will be wrapped
- # Default: 120
- -e, [--environment=ENVIRONMENT] # The Rack/Rails environment to use when generating RBIs
- # Default: development
- -c, [--config=<config file path>] # Path to the Tapioca configuration file
- # Default: sorbet/tapioca/config.yml
- -V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
+ --out, -o, [--outdir=directory] # The output directory for generated DSL RBI files
+ # Default: sorbet/rbi/dsl
+ [--file-header], [--no-file-header] # Add a "This file is generated" header on top of each generated RBI file
+ # Default: true
+ [--only=compiler [compiler ...]] # Only run supplied DSL compiler(s)
+ [--exclude=compiler [compiler ...]] # Exclude supplied DSL compiler(s)
+ [--verify], [--no-verify] # Verifies RBIs are up-to-date
+ -q, [--quiet], [--no-quiet] # Suppresses file creation output
+ -w, [--workers=N] # Number of parallel workers to use when generating RBIs (default: auto)
+ [--rbi-max-line-length=N] # Set the max line length of generated RBIs. Signatures longer than the max line length will be wrapped
+ # Default: 120
+ -e, [--environment=ENVIRONMENT] # The Rack/Rails environment to use when generating RBIs
+ # Default: development
+ -l, [--list-compilers], [--no-list-compilers] # List all loaded compilers
+ -c, [--config=<config file path>] # Path to the Tapioca configuration file
+ # Default: sorbet/tapioca/config.yml
+ -V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
generate RBIs for dynamic methods
```
<!-- END_HELP_COMMAND_DSL -->
@@ -566,11 +590,11 @@
Errors: 5
```
To solve this you will have to create your own DSL compiler able that understands the `Encryptable` DSL and can generate the RBI definitions representing the actual shape of `CreditCard` at runtime.
-To do so, create the new DSL compiler inside the `sorbet/tapioca/compilers` directory of your application with the following contents:
+To do so, you need to create a new DSL compiler similar to the following:
```rb
module Tapioca
module Compilers
class Encryptable < Tapioca::Dsl::Compiler
@@ -601,10 +625,12 @@
end
end
end
```
+In order for this DSL compiler to be discovered by Tapioca, it either needs to be placed inside the `sorbet/tapioca/compilers` directory of your application or be inside a `tapioca/dsl/compilers` folder on the load path. For example, if `Encryptable` was being exposed by a gem, all the gem needs to do is to place the DSL compiler inside the `lib/tapioca/dsl/compilers` folder and it will be automatically discovered and loaded by Tapioca.
+
There are two main parts to the DSL compiler API: `gather_constants` and `decorate`:
* The `gather_constants` class method collects all classes (or modules) that should be processed by this specific DSL compiler.
* The `decorate` method defines how to generate the necessary RBI definitions for the gathered constants.
@@ -740,12 +766,11 @@
# Default: sorbet/rbi/annotations
[--todo-rbi-file=TODO_RBI_FILE] # Path to the generated todo RBI file
# Default: sorbet/rbi/todo.rbi
[--payload], [--no-payload] # Check shims against Sorbet's payload
# Default: true
- -w, [--workers=N] # EXPERIMENTAL: Number of parallel workers
- # Default: 1
+ -w, [--workers=N] # Number of parallel workers (default: auto)
-c, [--config=<config file path>] # Path to the Tapioca configuration file
# Default: sorbet/tapioca/config.yml
-V, [--verbose], [--no-verbose] # Verbose output for debugging purposes
check duplicated definitions in shim RBIs
@@ -793,9 +818,10 @@
verify: false
quiet: false
workers: 1
rbi_max_line_length: 120
environment: development
+ list_compilers: false
gem:
outdir: sorbet/rbi/gems
file_header: true
all: false
prerequire: ''