From 304bf0647f20a5989e9d97b30f2bf2bb829395d0 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Sun, 8 Feb 2026 19:00:58 +0100 Subject: [PATCH] Make typechecking work without setting gemfile It's annoying having to set `BUNDLE_GEMFILE` manually for this I tried simply putting it in the main gemfile but that would mean it's not usable with ruby-dev because of nokogiri. --- rakelib/typecheck.rake | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/rakelib/typecheck.rake b/rakelib/typecheck.rake index 5da23ac34f..55a8730106 100644 --- a/rakelib/typecheck.rake +++ b/rakelib/typecheck.rake @@ -1,13 +1,21 @@ # frozen_string_literal: true namespace :typecheck do + def with_gemfile + Bundler.with_original_env do + ENV['BUNDLE_GEMFILE'] = "gemfiles/typecheck/Gemfile" + yield + end + end + task tapioca: :templates do Rake::Task["compile:prism"].invoke - require "tapioca/internal" - Tapioca::Cli.start(["configure"]) - Tapioca::Cli.start(["gems", "--exclude", "prism"]) - Tapioca::Cli.start(["todo"]) + with_gemfile do + sh "bundle", "exec", "tapioca", "configure" + sh "bundle", "exec", "tapioca", "gems", "--exclude", "prism" + sh "bundle", "exec", "tapioca", "todo" + end end desc "Typecheck with Sorbet" @@ -63,11 +71,15 @@ namespace :typecheck do --suppress-error-code=7001 CONFIG - exec "#{::Gem::Specification.find_by_name("sorbet-static").full_gem_path}/libexec/sorbet" + with_gemfile do + sh "bundle", "exec", "srb" + end end desc "Typecheck with Steep" task steep: :templates do - exec Gem.bin_path("steep", "steep"), "check" + with_gemfile do + sh "bundle", "exec", "steep", "check" + end end end