Skip to content

Commit

Permalink
Ci fixes & linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Judahmeek committed Jun 12, 2024
1 parent 131be64 commit d1c75ed
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 0 additions & 2 deletions lib/generators/react_on_rails/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -167,4 +166,3 @@ def add_configure_rspec_to_compile_assets(helper_file)
end
end
end
# rubocop:enable Metrics/ClassLength
20 changes: 10 additions & 10 deletions lib/react_on_rails/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions spec/react_on_rails/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions spec/react_on_rails/utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit d1c75ed

Please sign in to comment.