diff --git a/Gemfile.lock b/Gemfile.lock index 2cfcfd92f..5864f7941 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - react_on_rails (14.0.1) + react_on_rails (14.0.2) addressable connection_pool execjs (~> 2.5) diff --git a/lib/generators/react_on_rails/base_generator.rb b/lib/generators/react_on_rails/base_generator.rb index 24cd10d26..f32600905 100644 --- a/lib/generators/react_on_rails/base_generator.rb +++ b/lib/generators/react_on_rails/base_generator.rb @@ -3,7 +3,6 @@ require "rails/generators" require_relative "generator_messages" require_relative "generator_helper" -# rubocop:disable Metrics/ClassLength module ReactOnRails module Generators class BaseGenerator < Rails::Generators::Base @@ -167,4 +166,3 @@ def add_configure_rspec_to_compile_assets(helper_file) end end end -# rubocop:enable Metrics/ClassLength diff --git a/lib/react_on_rails/configuration.rb b/lib/react_on_rails/configuration.rb index 063aec3b0..795340bb3 100644 --- a/lib/react_on_rails/configuration.rb +++ b/lib/react_on_rails/configuration.rb @@ -174,8 +174,8 @@ def error_if_using_packer_and_generated_assets_dir_not_match_public_output_path packer_public_output_path = ReactOnRails::PackerUtils.packer_public_output_path if File.expand_path(generated_assets_dir) == packer_public_output_path.to_s - Rails.logger.warn("You specified generated_assets_dir in `config/initializers/react_on_rails.rb` "\ - "with #{ReactOnRails::PackerUtils.packer_type}. "\ + Rails.logger.warn("You specified generated_assets_dir in `config/initializers/react_on_rails.rb` " \ + "with #{ReactOnRails::PackerUtils.packer_type}. " \ "Remove this line from your configuration file.") else msg = <<~MSG @@ -214,8 +214,8 @@ def configure_generated_assets_dirs_deprecation if ReactOnRails::PackerUtils.using_packer? packer_public_output_path = ReactOnRails::PackerUtils.packer_public_output_path # rubocop:disable Layout/LineLength - Rails.logger.warn "Error configuring config/initializers/react_on_rails. Define neither the generated_assets_dirs nor "\ - "the generated_assets_dir when using Shakapacker. This is defined by "\ + Rails.logger.warn "Error configuring config/initializers/react_on_rails. Define neither the generated_assets_dirs nor " \ + "the generated_assets_dir when using Shakapacker. This is defined by " \ "public_output_path specified in #{ReactOnRails::PackerUtils.packer_type}.yml = #{packer_public_output_path}." # rubocop:enable Layout/LineLength return @@ -268,13 +268,13 @@ def shakapacker_clean_task def compile_command_conflict_message <<~MSG - React on Rails and Shakapacker error in configuration! - In order to use config/react_on_rails.rb config.build_production_command, - you must edit config/#{ReactOnRails::PackerUtils.packer_type}.yml to include this value in the default configuration: - '#{ReactOnRails::PackerUtils.packer_type}_precompile: false' + React on Rails and Shakapacker error in configuration! + In order to use config/react_on_rails.rb config.build_production_command, + you must edit config/#{ReactOnRails::PackerUtils.packer_type}.yml to include this value in the default configuration: + '#{ReactOnRails::PackerUtils.packer_type}_precompile: false' - Alternatively, remove the config/react_on_rails.rb config.build_production_command and the - default bin/#{ReactOnRails::PackerUtils.packer_type} script will be used for assets:precompile. + Alternatively, remove the config/react_on_rails.rb config.build_production_command and the + default bin/#{ReactOnRails::PackerUtils.packer_type} script will be used for assets:precompile. MSG end diff --git a/lib/react_on_rails/utils.rb b/lib/react_on_rails/utils.rb index 737d955aa..c92067b88 100644 --- a/lib/react_on_rails/utils.rb +++ b/lib/react_on_rails/utils.rb @@ -82,7 +82,7 @@ def self.server_bundle_js_file_path @server_bundle_path = if ReactOnRails::PackerUtils.using_packer? begin bundle_js_file_path(bundle_name) - rescue Webpacker::Manifest::MissingEntryError, Shakapacker::Manifest::MissingEntryError + rescue ReactOnRails::PackerUtils.adapter::Manifest::MissingEntryError File.expand_path( File.join(ReactOnRails::PackerUtils.packer_public_output_path, bundle_name) diff --git a/spec/react_on_rails/configuration_spec.rb b/spec/react_on_rails/configuration_spec.rb index c56aefa2f..606d83738 100644 --- a/spec/react_on_rails/configuration_spec.rb +++ b/spec/react_on_rails/configuration_spec.rb @@ -77,7 +77,7 @@ module ReactOnRails describe ".build_production_command" do context "when using Shakapacker 7" do before do - allow(ReactOnRails::ShakapackerUtils) + allow(ReactOnRails::PackerUtils) .to receive("shakapacker_version") .and_return("7.0.0") end @@ -121,7 +121,7 @@ module ReactOnRails context "when using Shakapacker 8" do before do - allow(ReactOnRails::ShakapackerUtils) + allow(ReactOnRails::PackerUtils) .to receive("shakapacker_version") .and_return("8.0.0") end @@ -267,8 +267,8 @@ module ReactOnRails it "checks that autobundling requirements are met if configuration options for autobundling are set" do allow(ReactOnRails::PackerUtils).to receive_messages(using_packer?: true, - shackapacker_version_requirement_met?: true, - nested_entries?: true) + shakapacker_version_requirement_met?: true, + nested_entries?: true) ReactOnRails.configure do |config| config.auto_load_bundle = true diff --git a/spec/react_on_rails/test_helper/webpack_assets_status_checker_spec.rb b/spec/react_on_rails/test_helper/webpack_assets_status_checker_spec.rb index 9f7b5e118..d1782bd31 100644 --- a/spec/react_on_rails/test_helper/webpack_assets_status_checker_spec.rb +++ b/spec/react_on_rails/test_helper/webpack_assets_status_checker_spec.rb @@ -66,7 +66,7 @@ require "shakapacker" allow(ReactOnRails::PackerUtils).to receive_messages( manifest_exists?: true, - shakapacker_public_output_path: generated_assets_full_path + packer_public_output_path: generated_assets_full_path ) allow(ReactOnRails.configuration).to receive(:server_bundle_js_file).and_return("server-bundle.js") allow(ReactOnRails::Utils).to receive(:bundle_js_file_path) diff --git a/spec/react_on_rails/utils_spec.rb b/spec/react_on_rails/utils_spec.rb index db53b82d5..0b1786ed0 100644 --- a/spec/react_on_rails/utils_spec.rb +++ b/spec/react_on_rails/utils_spec.rb @@ -77,7 +77,7 @@ module ReactOnRails allow(Shakapacker).to receive_message_chain("config.send").with(:data) .and_return({}) - expect(described_class.using_packer_source_path_is_not_defined_and_custom_node_modules?).to eq(false) + expect(described_class.using_packer_source_path_is_not_defined_and_custom_node_modules?).to be(false) end it "returns false if source_path is defined in the config/webpacker.yml and node_modules defined" do @@ -86,7 +86,7 @@ module ReactOnRails allow(Shakapacker).to receive_message_chain("config.send").with(:data) .and_return(source_path: "client/app") - expect(described_class.using_packer_source_path_is_not_defined_and_custom_node_modules?).to eq(false) + expect(described_class.using_packer_source_path_is_not_defined_and_custom_node_modules?).to be(false) end it "returns true if node_modules is not blank and the source_path is not defined in config/webpacker.yml" do @@ -95,7 +95,7 @@ module ReactOnRails allow(Shakapacker).to receive_message_chain("config.send").with(:data) .and_return({}) - expect(described_class.using_packer_source_path_is_not_defined_and_custom_node_modules?).to eq(true) + expect(described_class.using_packer_source_path_is_not_defined_and_custom_node_modules?).to be(true) end end