Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/nodejs/manifests/package.pp

Issue 29483578: #2007 - Introduce nodejs module (Closed)
Patch Set: For comment 8 Created July 12, 2017, 3:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « modules/nodejs/manifests/init.pp ('k') | modules/nodejs/templates/nodesource.gpg.key.erb » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # == Type: nodejs::package
2 #
3 # Manage nodejs packages.
4 #
5 # === Parameters:
6 #
7 # [*ensure*]
8 # Translated directly into the state of installed/uninstalled
9 # package.
10 #
11 define nodejs::package (
12 $ensure = 'present',
13 ) {
14
15 $check_command = [
16 "npm", "list",
17 "--global",
18 "--parseable",
19 $name,
20 ]
21
22 if ensure_state($ensure) {
23 $command = [
24 "npm",
25 "install", "--global",
26 $title,
27 ]
28
29 $unless = shellquote($check_command)
30 $onlyif = undef
31 }
32 else {
33 $command = [
34 "npm",
35 "uninstall", "--global",
36 $title,
37 ]
38
39 $unless = undef
40 $onlyif = shellquote($check_command)
41 }
42
43 exec {"nodejs_package_$title":
44 path => ["/usr/bin", "/bin"],
45 command => shellquote($command),
46 require => Package['nodejs'],
47 onlyif => $onlyif,
48 unless => $unless,
49 }
50 }
51
OLDNEW
« no previous file with comments | « modules/nodejs/manifests/init.pp ('k') | modules/nodejs/templates/nodesource.gpg.key.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld