Skip to content

Commit

Permalink
add instance method to VersionChecker
Browse files Browse the repository at this point in the history
  • Loading branch information
Judahmeek committed Nov 28, 2024
1 parent ceb80a0 commit 5c2164c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/react_on_rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/react_on_rails/version_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c2164c

Please sign in to comment.