Skip to content

Commit 1610659

Browse files
committed
Use Sorbet cache, if enabled
1 parent 502c337 commit 1610659

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/tapioca/helpers/sorbet_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ def initialize(spoom_context:)
3131
[key, value]
3232
end.to_h #: Hash[String, String | bool | nil]
3333

34+
# `--cache-dir=""` and `--cache-dir=` both disable the cache. We model that with a `nil` value.
35+
@cache_dir = options["--cache-dir"].presence #: String?
36+
3437
@parser = options["--parser"] == "prism" ? :prism : :original #: Symbol
3538
end
3639

40+
#: String?
41+
attr_reader :cache_dir
42+
3743
#: Symbol
3844
attr_reader :parser
3945

@@ -47,6 +53,10 @@ def parse_with_prism? = @parser == :prism
4753

4854
#: (*String sorbet_args) -> Spoom::ExecResult
4955
def sorbet(*sorbet_args)
56+
if sorbet_config.cache_dir
57+
sorbet_args << "--cache-dir=#{sorbet_config.cache_dir}"
58+
end
59+
5060
if sorbet_config.parse_with_prism?
5161
sorbet_args << "--parser=prism"
5262
end

0 commit comments

Comments
 (0)