File tree Expand file tree Collapse file tree 4 files changed +12
-13
lines changed Expand file tree Collapse file tree 4 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -290,9 +290,10 @@ def configure_generated_assets_dirs_deprecation
290290 return if generated_assets_dirs . blank?
291291
292292 packer_public_output_path = ReactOnRails ::PackerUtils . packer_public_output_path
293- Rails . logger . warn "You specified generated_assets_dirs in `config/initializers/react_on_rails.rb` with Shakapacker. " \
294- "Remove this configuration as the output path is automatically determined by " \
295- "`public_output_path` in shakapacker.yml (currently: #{ packer_public_output_path } )."
293+ Rails . logger . warn "You specified generated_assets_dirs in `config/initializers/react_on_rails.rb` " \
294+ "with Shakapacker. Remove this configuration as the output path is automatically " \
295+ "determined by `public_output_path` in shakapacker.yml " \
296+ "(currently: #{ packer_public_output_path } )."
296297 end
297298
298299 def ensure_webpack_generated_files_exists
Original file line number Diff line number Diff line change 33module ReactOnRails
44 module PackerUtils
55 def self . packer
6- return @packer if defined? ( @packer )
7-
8- @packer = begin
6+ @packer ||= begin
97 require "shakapacker"
108 ::Shakapacker
11- rescue LoadError => e
12- raise ReactOnRails ::Error , "Shakapacker gem is required but not available. Please add 'shakapacker' to your Gemfile. Error: #{ e . message } "
139 end
1410 end
1511
@@ -50,8 +46,8 @@ def self.supports_basic_pack_generation?
5046 end
5147
5248 def self . supports_auto_registration?
53- packer . config . respond_to? ( :nested_entries? ) &&
54- shakapacker_version_requirement_met? ( ReactOnRails :: PacksGenerator :: MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_REGISTRATION )
49+ min_version = ReactOnRails :: PacksGenerator :: MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_REGISTRATION
50+ packer . config . respond_to? ( :nested_entries? ) && shakapacker_version_requirement_met? ( min_version )
5551 end
5652
5753 # This returns either a URL for the webpack-dev-server, non-server bundle or
Original file line number Diff line number Diff line change 77require "active_support/core_ext/string"
88
99module ReactOnRails
10- module Utils # rubocop:disable Metrics/ModuleLength
10+ module Utils
1111 TRUNCATION_FILLER = "\n ... TRUNCATED #{
1212 Rainbow ( 'To see the full output, set FULL_TEXT_ERRORS=true.' ) . red
1313 } ...\n ". freeze
Original file line number Diff line number Diff line change @@ -149,10 +149,12 @@ module ReactOnRails
149149
150150 it "ensures version requirements are logically consistent" do
151151 basic_version = Gem ::Version . new ( ReactOnRails ::PacksGenerator ::MINIMUM_SHAKAPACKER_VERSION )
152- auto_reg_version = Gem ::Version . new ( ReactOnRails ::PacksGenerator ::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_REGISTRATION )
152+ auto_reg_version = Gem ::Version . new (
153+ ReactOnRails ::PacksGenerator ::MINIMUM_SHAKAPACKER_VERSION_FOR_AUTO_REGISTRATION
154+ )
153155
154156 expect ( auto_reg_version ) . to be >= basic_version ,
155- "Auto-registration version should be >= basic pack generation version"
157+ "Auto-registration version should be >= basic pack generation version"
156158 end
157159
158160 it "validates version checks are cached properly" do
You can’t perform that action at this time.
0 commit comments