README.md in tapioca-0.14.3 vs README.md in tapioca-0.14.4
- old
+ new
@@ -45,10 +45,11 @@
* [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)
+ * [Using DSL compiler options](#using-dsl-compiler-options)
* [Writing custom DSL compilers](#writing-custom-dsl-compilers)
* [Writing custom DSL extensions](#writing-custom-dsl-extensions)
* [RBI files for missing constants and methods](#rbi-files-for-missing-constants-and-methods)
* [Configuration](#configuration)
* [Contributing](#contributing)
@@ -499,10 +500,11 @@
[--app-root=APP_ROOT] # The path to the Rails application
# Default: .
[--halt-upon-load-error], [--no-halt-upon-load-error], [--skip-halt-upon-load-error] # Halt upon a load error while loading the Rails application
# Default: true
[--skip-constant=constant [constant ...]] # Do not generate RBI definitions for the given application constant(s)
+ [--compiler-options=key:value] # Options to pass to the DSL compilers
-c, [--config=<config file path>] # Path to the Tapioca configuration file
# Default: sorbet/tapioca/config.yml
-V, [--verbose], [--no-verbose], [--skip-verbose] # Verbose output for debugging purposes
# Default: false
@@ -543,10 +545,29 @@
system("bundle exec tapioca dsl", exception: true)
end
end
```
+#### Using DSL compiler options
+
+Some DSL compilers are able to change their behaviour based on the options passed to them. For example, the
+`ActiveRecordColumns` compiler can be configured to change how it generates types for method related to Active Record
+column attributes. To pass options during DSL RBI generation, use the `--compiler-options` flag:
+```shell
+$ bin/tapioca dsl --compiler-options=ActiveRecordColumnTypes:untyped
+```
+which will make the `ActiveRecordColumns` compiler generate untyped signatures for column attribute methods.
+
+Compiler options can be passed through the configuration file, as like any other option, and we expect most users to
+configure them this way. For example, to configure the `ActiveRecordColumns` compiler to generate untyped signatures,
+you need to add the following to your `sorbet/tapioca/config.yml` file:
+```yaml
+dsl:
+ compiler_options:
+ ActiveRecordColumnTypes: untyped
+```
+
#### Writing custom DSL compilers
It is possible to create your own compilers for DSLs not supported by Tapioca out of the box.
Let's take for example this `Encryptable` module that uses the [`included` hook](https://ruby-doc.org/core-3.1.1/Module.html#method-i-included) to dynamically add a few methods to the classes that include it:
@@ -933,9 +954,10 @@
environment: development
list_compilers: false
app_root: "."
halt_upon_load_error: true
skip_constant: []
+ compiler_options: {}
gem:
outdir: sorbet/rbi/gems
file_header: true
all: false
prerequire: ''