diff --git a/lib/tapioca/commands/dsl_generate.rb b/lib/tapioca/commands/dsl_generate.rb index 530cfb067..5fbb01496 100644 --- a/lib/tapioca/commands/dsl_generate.rb +++ b/lib/tapioca/commands/dsl_generate.rb @@ -18,6 +18,9 @@ def execute load_application if @only_bootsnap_rbs_cache + unless ENV["TAPIOCA_RBS_CACHE"] == "1" + say_error("Warning: --only-bootsnap-rbs-cache has no effect without TAPIOCA_RBS_CACHE=1", :yellow) + end say("Bootsnap RBS cache populated, exiting before RBI generation.", :green) return end diff --git a/spec/tapioca/cli/dsl_spec.rb b/spec/tapioca/cli/dsl_spec.rb index bc1c595da..3f35192f7 100644 --- a/spec/tapioca/cli/dsl_spec.rb +++ b/spec/tapioca/cli/dsl_spec.rb @@ -669,13 +669,33 @@ class Post end RB - result = @project.tapioca("dsl --only-bootsnap-rbs-cache Post") + result = @project.tapioca("dsl --only-bootsnap-rbs-cache Post", env: { "TAPIOCA_RBS_CACHE" => "1" }) assert_stdout_includes(result, <<~OUT) Bootsnap RBS cache populated, exiting before RBI generation. OUT - assert_empty_stderr(result) + assert_stderr_includes(result, "bootsnap miss:") + refute_project_file_exist("sorbet/rbi/dsl/post.rbi") + assert_success_status(result) + end + + it "warns when --only-bootsnap-rbs-cache is set without TAPIOCA_RBS_CACHE=1" do + @project.write!("lib/post.rb", <<~RB) + require "smart_properties" + + class Post + include SmartProperties + property :title, accepts: String + end + RB + + result = @project.tapioca("dsl --only-bootsnap-rbs-cache Post") + + assert_stderr_includes( + result, + "Warning: --only-bootsnap-rbs-cache has no effect without TAPIOCA_RBS_CACHE=1", + ) refute_project_file_exist("sorbet/rbi/dsl/post.rbi") assert_success_status(result) end