diff --git a/lib/react_on_rails/engine.rb b/lib/react_on_rails/engine.rb index bfbda255d..f6b684f09 100644 --- a/lib/react_on_rails/engine.rb +++ b/lib/react_on_rails/engine.rb @@ -5,8 +5,8 @@ module ReactOnRails class Engine < ::Rails::Engine config.to_prepare do - if VersionChecker.new(NodePackageVersion.new("package.json")).raise_if_gem_and_node_package_versions_differ && - VersionChecker.new(NodePackageVersion.new("client/package.json")).raise_if_gem_and_node_package_versions_differ + if VersionChecker.instance("package.json").raise_if_gem_and_node_package_versions_differ && + VersionChecker.instance("client/package.json").raise_if_gem_and_node_package_versions_differ Rails.logger.warn("No 'react-on-rails' entry found in 'dependencies' in package.json or client/package.json.") end ReactOnRails::ServerRenderingPool.reset_pool diff --git a/lib/react_on_rails/version_checker.rb b/lib/react_on_rails/version_checker.rb index 800d58557..264acafe6 100644 --- a/lib/react_on_rails/version_checker.rb +++ b/lib/react_on_rails/version_checker.rb @@ -12,6 +12,10 @@ def self.build new(NodePackageVersion.build) end + def self.instance(package_json_path) + new(NodePackageVersion.new(package_json_path)) + end + def initialize(node_package_version) @node_package_version = node_package_version end