module Tapioca::Compilers::Sorbet

Constants

EXE_PATH_ENV_VAR
FEATURE_REQUIREMENTS
SORBET
SORBET_GEM_SPEC

Public Class Methods

run(*args) click to toggle source
# File lib/tapioca/compilers/sorbet.rb, line 28
def run(*args)
  IO.popen(
    [
      sorbet_path,
      "--quiet",
      *args,
    ].join(" "),
    err: "/dev/null"
  ).read
end
sorbet_path() click to toggle source
# File lib/tapioca/compilers/sorbet.rb, line 40
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
supports?(feature, version: nil) click to toggle source
# File lib/tapioca/compilers/sorbet.rb, line 47
def supports?(feature, version: nil)
  version = SORBET_GEM_SPEC.version unless version
  requirement = FEATURE_REQUIREMENTS[feature]

  raise "Invalid Sorbet feature #{feature}" unless requirement

  requirement.satisfied_by?(version)
end