Skip to content

Commit e038121

Browse files
justin808claude
andcommitted
Improve method naming and warning message clarity
- Rename supports_auto_registration? to supports_autobundling? for consistency with auto_load_bundle config - Improve system checker warning message to be more descriptive about nested_entries requirement - Update all references in tests and configuration files - Remove redundant ModuleLength disable directive (auto-fixed by RuboCop) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent da9420e commit e038121

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

lib/react_on_rails/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def check_autobundling_requirements
203203
ReactOnRails::PackerUtils.supports_basic_pack_generation?
204204

205205
# Additional checks for advanced features requiring nested entries
206-
if ReactOnRails::PackerUtils.supports_auto_registration?
206+
if ReactOnRails::PackerUtils.supports_autobundling?
207207
ReactOnRails::PackerUtils.raise_nested_entries_disabled unless ReactOnRails::PackerUtils.nested_entries?
208208
else
209209
# Warn users about missing advanced features but don't block basic functionality

lib/react_on_rails/packer_utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def self.supports_basic_pack_generation?
4545
shakapacker_version_requirement_met?(ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION)
4646
end
4747

48-
def self.supports_auto_registration?
48+
def self.supports_autobundling?
4949
min_version = ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_REGISTRATION
5050
packer.config.respond_to?(:nested_entries?) && shakapacker_version_requirement_met?(min_version)
5151
end

lib/react_on_rails/system_checker.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,11 @@ def report_shakapacker_version_with_threshold
621621
# Validate version string format
622622
Gem::Version.new(version)
623623

624-
if ReactOnRails::PackerUtils.supports_auto_registration?
624+
if ReactOnRails::PackerUtils.supports_autobundling?
625625
add_success("✅ Shakapacker #{version} (supports React on Rails auto-registration)")
626626
else
627-
add_warning("⚠️ Shakapacker #{version} - Version 7.0+ needed for auto-registration (nested entries)")
627+
add_warning("⚠️ Shakapacker #{version} - Version 7.0+ with nested_entries support needed " \
628+
"for React on Rails auto-registration")
628629
end
629630
rescue ArgumentError
630631
# Fallback for invalid version strings

spec/react_on_rails/configuration_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ module ReactOnRails
187187
describe "RSC configuration options" do
188188
before do
189189
allow(ReactOnRails::PackerUtils).to receive_messages(
190-
supports_auto_registration?: true,
190+
supports_autobundling?: true,
191191
nested_entries?: true
192192
)
193193
end
@@ -335,7 +335,7 @@ module ReactOnRails
335335

336336
it "calls raise_missing_components_subdirectory if auto_load_bundle = true & components_subdirectory is not set" do
337337
allow(ReactOnRails::PackerUtils).to receive_messages(
338-
supports_auto_registration?: true,
338+
supports_autobundling?: true,
339339
nested_entries?: true
340340
)
341341

@@ -350,15 +350,15 @@ module ReactOnRails
350350
allow(ReactOnRails::PackerUtils).to receive_messages(
351351
shakapacker_version_requirement_met?: true,
352352
nested_entries?: true,
353-
supports_auto_registration?: true
353+
supports_autobundling?: true
354354
)
355355

356356
ReactOnRails.configure do |config|
357357
config.auto_load_bundle = true
358358
config.components_subdirectory = "something"
359359
end
360360

361-
expect(ReactOnRails::PackerUtils).to have_received(:supports_auto_registration?)
361+
expect(ReactOnRails::PackerUtils).to have_received(:supports_autobundling?)
362362
expect(ReactOnRails::PackerUtils).to have_received(:nested_entries?)
363363
end
364364

spec/react_on_rails/packer_utils_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ module ReactOnRails
107107
end
108108
end
109109

110-
describe ".supports_auto_registration?" do
110+
describe ".supports_autobundling?" do
111111
let(:mock_config) { instance_double("Shakapacker::Config") } # rubocop:disable RSpec/VerifiedDoubleReference
112112
let(:mock_packer) { instance_double("Shakapacker", config: mock_config) } # rubocop:disable RSpec/VerifiedDoubleReference
113113

@@ -120,23 +120,23 @@ module ReactOnRails
120120
allow(described_class).to receive(:shakapacker_version_requirement_met?)
121121
.with(ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_REGISTRATION).and_return(true)
122122

123-
expect(described_class.supports_auto_registration?).to be(true)
123+
expect(described_class.supports_autobundling?).to be(true)
124124
end
125125

126126
it "returns false when Shakapacker < 7.0.0" do
127127
allow(mock_config).to receive(:respond_to?).with(:nested_entries?).and_return(true)
128128
allow(described_class).to receive(:shakapacker_version_requirement_met?)
129129
.with(ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_REGISTRATION).and_return(false)
130130

131-
expect(described_class.supports_auto_registration?).to be(false)
131+
expect(described_class.supports_autobundling?).to be(false)
132132
end
133133

134134
it "returns false when nested_entries method is not available" do
135135
allow(mock_config).to receive(:respond_to?).with(:nested_entries?).and_return(false)
136136
allow(described_class).to receive(:shakapacker_version_requirement_met?)
137137
.with(ReactOnRails::PacksGenerator::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_REGISTRATION).and_return(true)
138138

139-
expect(described_class.supports_auto_registration?).to be(false)
139+
expect(described_class.supports_autobundling?).to be(false)
140140
end
141141
end
142142
end

spec/react_on_rails/test_helper/webpack_assets_status_checker_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
allow(ReactOnRails::Utils).to receive(:generated_assets_full_path).and_return(generated_assets_full_path)
2525
allow(ReactOnRails::PackerUtils).to receive_messages(
2626
packer_public_output_path: generated_assets_full_path,
27-
supports_auto_registration?: true,
27+
supports_autobundling?: true,
2828
nested_entries?: true
2929
)
3030
end

0 commit comments

Comments
 (0)