Module: Tapioca::Compilers::Sorbet

Extended by:
T::Sig
Defined in:
lib/tapioca/compilers/sorbet.rb

Constant Summary collapse

SORBET =
Pathname.new(Gem::Specification.find_by_name("sorbet-static").full_gem_path) / "libexec" / "sorbet"
EXE_PATH_ENV_VAR =
"TAPIOCA_SORBET_EXE"

Class Method Summary collapse

Class Method Details

.run(*args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/tapioca/compilers/sorbet.rb', line 17

def run(*args)
  IO.popen(
    [
      sorbet_path,
      "--quiet",
      *args,
    ].join(' '),
    err: "/dev/null"
  ).read
end

.sorbet_pathObject



29
30
31
32
33
# File 'lib/tapioca/compilers/sorbet.rb', line 29

def sorbet_path
  sorbet_path = ENV.fetch(EXE_PATH_ENV_VAR, SORBET)
  sorbet_path = SORBET if sorbet_path.empty?
  sorbet_path.to_s.shellescape
end