Skip to content

Commit

Permalink
Merge pull request voxpupuli#113 from hunner/req_target
Browse files Browse the repository at this point in the history
nodejs::npm::target is required
  • Loading branch information
Morgan Haskel committed Feb 26, 2015
2 parents 69a45e8 + 181f2cd commit 2bc4372
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions manifests/npm.pp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# See README.md for usage information.
define nodejs::npm (
$target,
$ensure = 'present',
$cmd_exe_path = $nodejs::cmd_exe_path,
$install_options = [],
$npm_path = $nodejs::npm_path,
$package = $title,
$source = 'registry',
$target = undef,
$uninstall_options = [],
$user = undef,
) {
Expand All @@ -25,16 +25,14 @@
if $source != 'registry' {
$install_check_package_string = $source
$package_string = $source
}
elsif $ensure =~ /^(present|absent)$/ {
} elsif $ensure =~ /^(present|absent)$/ {
$install_check_package_string = $package
$package_string = $package
}
} else {
# ensure is either a tag, version or 'latest'
# Note that install_check will always return false when 'latest' or a tag is
# provided
# npm ls does not keep track of tags after install
else {
$install_check_package_string = "${package}:${package}@${ensure}"
$package_string = "${package}@${ensure}"
}
Expand All @@ -53,16 +51,14 @@
$npm_command = 'rm'
$options = $uninstall_options_string

exec { "npm_${npm_command}_${name}":
exec { "npm_${npm_command}_${name}":
command => "${npm_path} ${npm_command} ${package_string} ${options}",
onlyif => $install_check,
user => $user,
cwd => $target,
require => Class['nodejs'],
}
}

else {
} else {
$npm_command = 'install'
$options = $install_options_string
# Conditionally require proxy and https-proxy to be set first only if the resource exists.
Expand Down

0 comments on commit 2bc4372

Please sign in to comment.