Skip to content

Commit 4c93dbb

Browse files
authored
Fix doctor rake task LoadError with excluded task_helpers (#1795)
Resolves critical LoadError in `rake react_on_rails:doctor` when using the packaged gem. **Problem:** - The doctor.rake task (added in 27dba50) required "../../rakelib/task_helpers" - The rakelib directory has been excluded from gem packaging since 2c04db6 (1.5+ years ago) - This caused `LoadError: cannot load such file -- rakelib/task_helpers` in packaged gems **Solution:** - Remove unnecessary require_relative "../../rakelib/task_helpers" from doctor.rake - Remove unused include ReactOnRails::TaskHelpers line - Add test coverage to prevent future regressions **Impact:** - ✅ Doctor task now works correctly in packaged gems - ✅ No functionality lost - TaskHelpers was not actually used - ✅ Added regression test to ensure rake file loads without missing dependencies - ✅ All existing tests pass This fix enables users to run `rake react_on_rails:doctor` successfully in production environments and when using the published gem, restoring critical diagnostic functionality.
1 parent f129062 commit 4c93dbb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/tasks/doctor.rake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require_relative "../../rakelib/task_helpers"
43
require_relative "../react_on_rails"
54
require_relative "../react_on_rails/doctor"
65

@@ -38,8 +37,6 @@ rescue LoadError
3837
end
3938

4039
namespace :react_on_rails do
41-
include ReactOnRails::TaskHelpers
42-
4340
desc "Diagnose React on Rails setup and configuration"
4441
task :doctor do
4542
verbose = ENV["VERBOSE"] == "true"

spec/lib/react_on_rails/doctor_rake_task_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
expect(Rake::Task.task_defined?("react_on_rails:doctor")).to be true
1717
end
1818

19+
it "can be loaded without requiring missing task_helpers" do
20+
# This test ensures the rake file doesn't try to require excluded files
21+
# that would cause LoadError in packaged gems
22+
expect { load rake_file }.not_to raise_error
23+
end
24+
1925
it "can be invoked without errors" do
2026
# Mock the Doctor class to avoid actual diagnosis
2127
doctor_instance = instance_double(ReactOnRails::Doctor)

0 commit comments

Comments
 (0)