Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodejs::npm::target is required #113

Merged
merged 1 commit into from
Feb 26, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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