diff --git a/lib/generators/react_on_rails/base_generator.rb b/lib/generators/react_on_rails/base_generator.rb index c926b1583..996305386 100644 --- a/lib/generators/react_on_rails/base_generator.rb +++ b/lib/generators/react_on_rails/base_generator.rb @@ -77,7 +77,7 @@ def add_base_gems_to_gemfile end def add_yarn_dependencies - major_minor_patch_only = /\A\d+\.\d+\.\d+\z/.freeze + major_minor_patch_only = /\A\d+\.\d+\.\d+\z/ if ReactOnRails::VERSION.match?(major_minor_patch_only) run "yarn add react-on-rails@#{ReactOnRails::VERSION} --exact" else diff --git a/lib/react_on_rails/packs_generator.rb b/lib/react_on_rails/packs_generator.rb index 716681101..a48bf04c5 100644 --- a/lib/react_on_rails/packs_generator.rb +++ b/lib/react_on_rails/packs_generator.rb @@ -5,7 +5,7 @@ module ReactOnRails # rubocop:disable Metrics/ClassLength class PacksGenerator - CONTAINS_CLIENT_OR_SERVER_REGEX = /\.(server|client)($|\.)/.freeze + CONTAINS_CLIENT_OR_SERVER_REGEX = /\.(server|client)($|\.)/ MINIMUM_SHAKAPACKER_VERSION = [6, 5, 1].freeze def self.instance diff --git a/lib/react_on_rails/utils.rb b/lib/react_on_rails/utils.rb index e032ecae0..7f3529b98 100644 --- a/lib/react_on_rails/utils.rb +++ b/lib/react_on_rails/utils.rb @@ -189,7 +189,7 @@ def self.smart_trim(str, max_length = 1000) to_remove = str.length - max_length lstrip = (to_remove / 2.0).ceil rstrip = to_remove - lstrip - str[0..(midpoint - lstrip - 1)] + TRUNCATION_FILLER + str[(midpoint + rstrip)..-1] + str[0..(midpoint - lstrip - 1)] + TRUNCATION_FILLER + str[(midpoint + rstrip)..] end def self.find_most_recent_mtime(files) diff --git a/lib/react_on_rails/version_checker.rb b/lib/react_on_rails/version_checker.rb index e22c6d62d..93e1550f0 100644 --- a/lib/react_on_rails/version_checker.rb +++ b/lib/react_on_rails/version_checker.rb @@ -6,7 +6,7 @@ module ReactOnRails class VersionChecker attr_reader :node_package_version - MAJOR_MINOR_PATCH_VERSION_REGEX = /(\d+)\.(\d+)\.(\d+)/.freeze + MAJOR_MINOR_PATCH_VERSION_REGEX = /(\d+)\.(\d+)\.(\d+)/ def self.build new(NodePackageVersion.build) diff --git a/rakelib/examples.rake b/rakelib/examples.rake index ddc0c201f..559f50b5a 100644 --- a/rakelib/examples.rake +++ b/rakelib/examples.rake @@ -15,7 +15,7 @@ namespace :examples do # rubocop:disable Metrics/BlockLength include ReactOnRails::TaskHelpers # Loads data from examples_config.yml and instantiates corresponding ExampleType objects examples_config_file = File.expand_path("examples_config.yml", __dir__) - examples_config = symbolize_keys(YAML.safe_load(File.read(examples_config_file))) + examples_config = symbolize_keys(YAML.safe_load_file(examples_config_file)) examples_config[:example_type_data].each { |example_type_data| ExampleType.new(**symbolize_keys(example_type_data)) } # Define tasks for each example type diff --git a/spec/dummy/spec/packs_generator_spec.rb b/spec/dummy/spec/packs_generator_spec.rb index ff0d2cdd5..3fc078326 100644 --- a/spec/dummy/spec/packs_generator_spec.rb +++ b/spec/dummy/spec/packs_generator_spec.rb @@ -4,7 +4,7 @@ # rubocop:disable Metrics/ModuleLength module ReactOnRails - GENERATED_PACKS_CONSOLE_OUTPUT_REGEX = /Generated Packs:/.freeze + GENERATED_PACKS_CONSOLE_OUTPUT_REGEX = /Generated Packs:/ # rubocop:disable Metrics/BlockLength describe PacksGenerator do diff --git a/spec/dummy/spec/rails_helper.rb b/spec/dummy/spec/rails_helper.rb index a894911cb..3a9277fa7 100644 --- a/spec/dummy/spec/rails_helper.rb +++ b/spec/dummy/spec/rails_helper.rb @@ -38,7 +38,7 @@ # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. -Dir[Rails.root.join("spec", "support", "**", "*.rb")].sort.each { |f| require f } +Dir[Rails.root.join("spec", "support", "**", "*.rb")].each { |f| require f } RSpec.configure do |config| # Ensure that if we are running js tests, we are using latest webpack assets diff --git a/spec/react_on_rails/support/generator_spec_helper.rb b/spec/react_on_rails/support/generator_spec_helper.rb index f3f8f3545..ba0510667 100644 --- a/spec/react_on_rails/support/generator_spec_helper.rb +++ b/spec/react_on_rails/support/generator_spec_helper.rb @@ -4,9 +4,9 @@ require_relative "../simplecov_helper" require "generator_spec/test_case" -Dir["#{File.expand_path('../support/shared_examples', __dir__)}/*.rb"].sort.each { |file| require file } +Dir["#{File.expand_path('../support/shared_examples', __dir__)}/*.rb"].each { |file| require file } generators_glob = File.expand_path("../../../lib/generators/react_on_rails/*_generator.rb", __dir__) -Dir[generators_glob.to_s].sort.each { |file| require file } +Dir[generators_glob.to_s].each { |file| require file } include ReactOnRails::Generators # rubocop:disable Style/MixinUsage RSpec.configure do |config|