Skip to content

Commit

Permalink
handle error where react-on-rails package entry missing
Browse files Browse the repository at this point in the history
  • Loading branch information
benjiwheeler committed Nov 16, 2016
1 parent 1174ab5 commit 8f77015
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .delete_by
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20170101
8 changes: 7 additions & 1 deletion lib/react_on_rails/version_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ def initialize(package_json)
end

def raw
JSON.parse(package_json_contents)["dependencies"]["react-on-rails"]
parsed_package_contents = JSON.parse(package_json_contents)
if parsed_package_contents.key?("dependencies") &&
parsed_package_contents["dependencies"].key?("react-on-rails")
parsed_package_contents["dependencies"]["react-on-rails"]
else
raise "no 'react-on-rails' entry in package.json dependencies"
end
end

def relative_path?
Expand Down

0 comments on commit 8f77015

Please sign in to comment.