Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/tapioca/commands/dsl_generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 22 additions & 2 deletions spec/tapioca/cli/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading