Sha256: 44c53b6ecb5a96c95999afcb79d694e304c5660cf914ef184d6160eb96cc8f7d

Contents?: true

Size: 859 Bytes

Versions: 12

Compression:

Stored size: 859 Bytes

Contents

# typed: true
# frozen_string_literal: true

require 'pathname'
require 'shellwords'

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

      class << self
        extend(T::Sig)

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

        sig { returns(String) }
        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
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
tapioca-0.4.27 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.26 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.25 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.24 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.23 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.22 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.21 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.20 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.19 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.18 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.17 lib/tapioca/compilers/sorbet.rb
tapioca-0.4.16 lib/tapioca/compilers/sorbet.rb