File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,11 @@ def execute
1818 load_application
1919
2020 if @only_bootsnap_rbs_cache
21- say ( "Bootsnap RBS cache populated, exiting before RBI generation." , :green )
21+ if ENV [ "TAPIOCA_RBS_CACHE" ] == "1"
22+ say ( "Bootsnap RBS cache populated, exiting before RBI generation." , :green )
23+ else
24+ say_error ( "Warning: --only-bootsnap-rbs-cache requires TAPIOCA_RBS_CACHE=1 to populate the cache" , :yellow )
25+ end
2226 return
2327 end
2428
Original file line number Diff line number Diff line change @@ -669,13 +669,34 @@ class Post
669669 end
670670 RB
671671
672- result = @project . tapioca ( "dsl --only-bootsnap-rbs-cache Post" )
672+ result = @project . tapioca ( "dsl --only-bootsnap-rbs-cache Post" , env : { "TAPIOCA_RBS_CACHE" => "1" } )
673673
674674 assert_stdout_includes ( result , <<~OUT )
675675 Bootsnap RBS cache populated, exiting before RBI generation.
676676 OUT
677677
678- assert_empty_stderr ( result )
678+ assert_stderr_includes ( result , "bootsnap miss:" )
679+ refute_project_file_exist ( "sorbet/rbi/dsl/post.rbi" )
680+ assert_success_status ( result )
681+ end
682+
683+ it "warns when --only-bootsnap-rbs-cache is set without TAPIOCA_RBS_CACHE=1" do
684+ @project . write! ( "lib/post.rb" , <<~RB )
685+ require "smart_properties"
686+
687+ class Post
688+ include SmartProperties
689+ property :title, accepts: String
690+ end
691+ RB
692+
693+ result = @project . tapioca ( "dsl --only-bootsnap-rbs-cache Post" )
694+
695+ assert_stderr_includes (
696+ result ,
697+ "Warning: --only-bootsnap-rbs-cache requires TAPIOCA_RBS_CACHE=1 to populate the cache" ,
698+ )
699+ refute_includes ( result . out , "Bootsnap RBS cache populated" )
679700 refute_project_file_exist ( "sorbet/rbi/dsl/post.rbi" )
680701 assert_success_status ( result )
681702 end
You can’t perform that action at this time.
0 commit comments