1- # nodejs Puppet Module for Boxen
1+ # Node Puppet Module for Boxen
22
33[ ![ Build Status] ( https://travis-ci.org/boxen/puppet-nodejs.svg?branch=master )] ( https://travis-ci.org/boxen/puppet-nodejs )
4+ [ ![ GitHub release] ( https://img.shields.io/github/release/boxen/puppet-nodejs.svg )] ( http://github.com/boxen/puppet-nodejs/releases )
45
5- Using nodenv for nodejs version management,
6- automates installation and configuration of nodejs versions.
6+ Requires the following boxen modules:
7+
8+ * ` boxen >= 3.2.0 `
9+ * ` repository >= 2.1 `
10+ * [ ripienaar/puppet-module-data] ( https://github.com/ripienaar/puppet-module-data )
11+
12+ ## About
13+
14+ This module supports node version management with nodenv from [ OiNutter] ( http://github.com/OiNutter/nodenv ) .
15+ Is heavily based on the official boxen's [ ruby module] ( http://github.com/boxen/puppet-ruby ) .
16+ All node versions are installed into ` /opt/nodes ` .
17+
18+ ## About node-build version
19+
20+ Occasional bumps to the default node-build version are fine, on this module, but not essential.
21+ The node-build version is something you should be managing in your own boxen repository,
22+ rather than depending on this module to update for you. See examples on how to change the node-build
23+ version in the Hiera section.
24+
25+ You can find a release list of versions for node-build [ here] ( https://github.com/OiNutter/node-build/releases ) .
26+
27+ ## Breakages since last major version
28+
29+ * nodes now live in ` /opt/nodes ` instead of ` /opt/boxen/nodenv/versions `
30+ * the module-data module is now ** required**
31+ * use of [ OiNutter/nodenv] ( http://github.com/OiNutter/nodenv ) instead of wfarr's version
32+ * use of [ OiNutter/node-build] ( http://github.com/OiNutter/node-build )
33+ * npm packages are installed with ` npm_module ` instead of ` nodejs::module `
34+ * node versions are defined without the leading ` v ` (` 0.10.36 ` instead of ` v0.10.36 ` )
735
836## Usage
937
10- ``` puppet
11- # include short version aliases
12- nodejs::version { 'v0.10': }
38+ ``` puppet
39+ # Set the global default node (auto-installs it if it can)
40+ class { 'nodejs::global':
41+ version => '0.12'
42+ }
43+
44+ # ensure a certain node version is used in a dir
45+ nodejs::local { '/path/to/some/project':
46+ version => '0.12'
47+ }
48+
49+ # ensure a npm module is installed for a certain node version
50+ # note, you can't have duplicate resource names so you have to name like so
51+ $version = "0.12"
52+ npm_module { "bower for ${version}":
53+ module => 'bower',
54+ version => '~> 1.4.1',
55+ node_version => $version,
56+ }
1357
14- # install any arbitrary nodejs version
15- nodejs::version { 'v0.10.1': }
58+ # ensure a module is installed for all ruby versions
59+ npm_module { 'bower for all nodes':
60+ module => 'bower',
61+ version => '~> 1.4.1',
62+ node_version => '*',
63+ }
1664
17- # set the global nodejs version
18- class { ' nodejs::global': version => 'v0.10.1' }
65+ # install a node version
66+ nodejs::version { '0.12.2': }
1967
20- # install some npm modules
21- nodejs::module { 'bower':
22- node_version => 'v0.10'
68+ # Installing nodenv plugin
69+ nodejs::nodenv::plugin { 'nodenv-vars':
70+ ensure => 'ee42cd9db3f3fca2a77862ae05a410947c33ba09',
71+ source => 'OiNutter/nodenv-vars'
2372}
2473```
2574
@@ -29,22 +78,33 @@ The following variables may be automatically overridden with Hiera:
2978
3079``` yaml
3180---
32- # Version compile configuration, if not version is defined the default is false
33- # Yyou can define whether to compile from source or not based on long version
34- # and define short versions as a fallback if non long version is defined
35- " nodejs::version::compile " :
36- " v0.10 " : false
37- " v0.4 " : true
38- " v0.6.20" : true
81+
82+ " nodejs::provider " : " nodenv"
83+ " nodejs::user " : " deploy"
84+
85+ " nodejs::build::ensure " : " f18b3d67756d1cb25ba6e35044f816fd67211b33"
86+ " nodejs::nodenv::ensure " : " v0.2.0"
87+
88+ # nodenv plugins
89+ " nodejs::nodenv::plugins " :
90+ " nodenv-vars " :
91+ " ensure " : " ee42cd9db3f3fca2a77862ae05a410947c33ba09"
92+ " source " : " OiNutter/nodenv-vars"
93+
94+
95+ # Environment variables for building specific versions
96+ # You'll want to enable hiera's "deeper" merge strategy
97+ # See http://docs.puppetlabs.com/hiera/1/configuring.html#mergebehavior
98+ " nodejs::version::env " :
99+ " 0.4.2 " :
100+ " CC " : " gcc"
39101
40102# Version aliases, commonly used to bless a specific version
41103# Use the "deeper" merge strategy, as with nodejs::version::env
42104" nodejs::version::alias " :
43- " v0.10 " : " v0.10.31"
44- " v0.8 " : " v0.8.26"
45- " v0.6 " : " v0.6.20"
46- " v0.4 " : " v0.4.10"
47-
105+ " 0.10 " : " 0.10.36"
106+ " 0.12 " : " 0.12.0"
107+ " iojs-1.6 " : " iojs-1.6.2"
48108` ` `
49109
50110It is **required** that you include
@@ -55,10 +115,3 @@ definitions will be automatically loaded, but can be overridden easily in your
55115own hierarchy.
56116
57117You can also use JSON if your Hiera is configured for that.
58-
59- ## Required Puppet Modules
60-
61- * boxen ( OS X only ) > 2.1
62- * repository > 2.2
63- * stdlib >= 3.0.0
64- * [ ripienaar/puppet-module-data] ( https://github.com/ripienaar/puppet-module-data )
0 commit comments