Skip to content

Instantly share code, notes, and snippets.

@daften
Last active October 3, 2016 16:07
Show Gist options
  • Save daften/ff54d05dd6dafc4f2d3048be8bb6fdec to your computer and use it in GitHub Desktop.
Save daften/ff54d05dd6dafc4f2d3048be8bb6fdec to your computer and use it in GitHub Desktop.
Guards for chef with or
Chef::Log.info(shell_out("#{node['composer']['bin']} show #{package} #{new_resource.version}").exitstatus)
execute 'Install-composer-for-single-project' do
cwd new_resource.project_dir
command "#{node['composer']['bin']} require #{package}:#{new_resource.version} #{dev} #{prefer_dist}"
environment ({
'COMPOSER_HOME' => Composer.home_dir(node),
'COMPOSER_BIN_DIR' => new_resource.bin_dir
})
action :run
not_if do
shell_out("#{node['composer']['bin']} show #{package} #{new_resource.version}").exitstatus == 0
end
user new_resource.user
group new_resource.group
umask new_resource.umask
end
@daften
Copy link
Author

daften commented Oct 3, 2016

And yes, i needed to change dir for both :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment