]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/nodejs/providers/package.rb
Update bundle
[chef.git] / cookbooks / nodejs / providers / package.rb
index f726df310734abae51fee954610d0feb238cead4..5e3ca068468a9377f44ca1a0d464b8354cb45edd 100644 (file)
@@ -23,7 +23,7 @@ require "json"
 include Chef::Mixin::ShellOut
 
 def load_current_resource
-  @packages = JSON.parse(shell_out("npm list --global --json").stdout)["dependencies"]
+  @packages = JSON.parse(shell_out("npm list --global --json").stdout)["dependencies"] || {}
 
   @current_resource = Chef::Resource::NodejsPackage.new(new_resource.name)
   @current_resource.package_name(new_resource.package_name)
@@ -40,7 +40,7 @@ action :install do
     package_name = new_resource.package_name
   end
 
-  unless @packages.include?(new_resource.package_name)
+  if !@packages.include?(new_resource.package_name)
     shell_out!("npm install --global #{package_name}")
     new_resource.updated_by_last_action(true)
   else