OLD | NEW |
(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 # [*options*] |
| 12 # A list of zero or more options to install the package. |
| 13 # |
| 14 define nodejs::package ( |
| 15 $ensure = 'present', |
| 16 $options = [], |
| 17 ) { |
| 18 |
| 19 if ensure_state($ensure) { |
| 20 $command = [ |
| 21 "npm", |
| 22 "install", |
| 23 $options, |
| 24 $title, |
| 25 ] |
| 26 |
| 27 $creates = "/usr/bin/${title}" |
| 28 } |
| 29 else { |
| 30 $command = [ |
| 31 "npm", |
| 32 "uninstall", |
| 33 $options, |
| 34 $title, |
| 35 ] |
| 36 |
| 37 $creates = undef |
| 38 } |
| 39 |
| 40 exec {"state_$title": |
| 41 path => ["/usr/bin"], |
| 42 command => shellquote($command), |
| 43 require => Package['nodejs'], |
| 44 creates => $creates, |
| 45 } |
| 46 } |
| 47 |
OLD | NEW |