Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit a7291f7

Browse files
committed
Merge pull request #48 from platanus/rewrite
rewrite based on boxen/puppet-ruby
2 parents 004d1f6 + 158d939 commit a7291f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1288
-797
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
/.ruby-version
33
/spec/fixtures/.librarian
44
/spec/fixtures/.tmp
5-
/spec/fixtures/Puppetfile.lock
65
/spec/fixtures/modules
76
/spec/fixtures/vendor

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
script: "./script/cibuild"
33
gemfile: "this/does/not/exist"
4+
sudo: false
45
rvm:
56
- "1.8.7"
6-
- "1.9.3"
7+
- "2.0.0"

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
source "https://rubygems.org"
22

33
gem "cardboard", "~> 2.1"
4+
gem "deep_merge", "~> 1.0"
5+
gem "puppet", "< 3.4.0"
6+
gem "boxen", "~> 2.4.0"
7+
gem "librarian-puppet", "< 0.9.15"

Gemfile.lock

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,69 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (2.2.8)
54
addressable (2.3.6)
65
ansi (1.4.3)
7-
boxen (2.6.0)
6+
boxen (2.4.0)
87
ansi (~> 1.4)
98
hiera (~> 1.0)
109
highline (~> 1.6)
1110
json_pure (>= 1.7.7, < 2.0)
12-
librarian-puppet (~> 1.0.0)
13-
octokit (~> 2.7, >= 2.7.1)
11+
librarian-puppet (~> 0.9.10)
12+
octokit (~> 2.3.0)
1413
puppet (~> 3.0)
1514
cardboard (2.1.0)
1615
boxen (~> 2.1)
1716
puppet-lint (~> 0.3)
1817
puppetlabs_spec_helper (~> 0.4)
1918
rspec-puppet (~> 1.0)
19+
deep_merge (1.0.1)
2020
diff-lcs (1.2.5)
21-
facter (2.0.2)
22-
CFPropertyList (~> 2.2.6)
21+
facter (1.7.5)
2322
faraday (0.9.0)
2423
multipart-post (>= 1.2, < 3)
25-
hiera (1.3.4)
24+
hiera (1.3.2)
2625
json_pure
2726
highline (1.6.21)
2827
json (1.8.1)
2928
json_pure (1.8.1)
3029
librarian (0.1.2)
3130
highline
3231
thor (~> 0.15)
33-
librarian-puppet (1.0.3)
32+
librarian-puppet (0.9.14)
3433
json
3534
librarian (>= 0.1.2)
35+
open3_backport
3636
metaclass (0.0.4)
37-
mocha (1.1.0)
37+
mocha (1.0.0)
3838
metaclass (~> 0.0.1)
3939
multipart-post (2.0.0)
40-
octokit (2.7.2)
41-
sawyer (~> 0.5.2)
42-
puppet (3.6.2)
43-
facter (> 1.6, < 3)
40+
octokit (2.3.1)
41+
sawyer (~> 0.5.1)
42+
open3_backport (0.0.3)
43+
open4 (~> 1.3.0)
44+
open4 (1.3.3)
45+
puppet (3.3.2)
46+
facter (~> 1.6)
4447
hiera (~> 1.0)
45-
json_pure
4648
rgen (~> 0.6.5)
4749
puppet-lint (0.3.2)
48-
puppetlabs_spec_helper (0.5.2)
49-
mocha
50-
puppet-lint
50+
puppetlabs_spec_helper (0.4.1)
51+
mocha (>= 0.10.5)
5152
rake
52-
rspec
53-
rspec-puppet
54-
rake (10.3.2)
53+
rspec (>= 2.9.0)
54+
rspec-puppet (>= 0.1.1)
55+
rake (10.3.1)
5556
rgen (0.6.6)
56-
rspec (3.0.0)
57-
rspec-core (~> 3.0.0)
58-
rspec-expectations (~> 3.0.0)
59-
rspec-mocks (~> 3.0.0)
60-
rspec-core (3.0.2)
61-
rspec-support (~> 3.0.0)
62-
rspec-expectations (3.0.2)
63-
diff-lcs (>= 1.2.0, < 2.0)
64-
rspec-support (~> 3.0.0)
65-
rspec-mocks (3.0.2)
66-
rspec-support (~> 3.0.0)
57+
rspec (2.14.1)
58+
rspec-core (~> 2.14.0)
59+
rspec-expectations (~> 2.14.0)
60+
rspec-mocks (~> 2.14.0)
61+
rspec-core (2.14.8)
62+
rspec-expectations (2.14.5)
63+
diff-lcs (>= 1.1.3, < 2.0)
64+
rspec-mocks (2.14.6)
6765
rspec-puppet (1.0.1)
6866
rspec
69-
rspec-support (3.0.2)
7067
sawyer (0.5.4)
7168
addressable (~> 2.3.5)
7269
faraday (~> 0.8, < 0.10)
@@ -76,4 +73,8 @@ PLATFORMS
7673
ruby
7774

7875
DEPENDENCIES
76+
boxen (~> 2.4.0)
7977
cardboard (~> 2.1)
78+
deep_merge (~> 1.0)
79+
librarian-puppet (< 0.9.15)
80+
puppet (< 3.4.0)

README.md

Lines changed: 85 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,74 @@
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
50110
It is **required** that you include
@@ -55,10 +115,3 @@ definitions will be automatically loaded, but can be overridden easily in your
55115
own hierarchy.
56116

57117
You 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)

data/Darwin.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
nodejs::version::env:
3+
Darwin:
4+
BOXEN_S3_HOST: "%{::boxen_s3_host}"
5+
BOXEN_S3_BUCKET: "%{::boxen_s3_bucket}"
6+
CFLAGS: "-I%{::homebrew::config::installdir}/include -march=core2 -O3"
7+
LDFLAGS: "-L%{::homebrew::config::installdir}/lib"
8+
9+
nodejs::prefix: "%{::boxen::config::home}"
10+
nodejs::user: "%{::boxen_user}"

data/common.yaml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
---
2-
nodejs::version::compile:
3-
v0.12: false
4-
v0.10: false
5-
v0.8: false
6-
v0.6: true
7-
v0.4: true
2+
# nodejs::version::env:
83

94
nodejs::version::alias:
10-
v0.12: v0.12.0
11-
v0.10: v0.10.31
12-
v0.8: v0.8.26
13-
v0.6: v0.6.20
14-
v0.4: v0.4.10
5+
"0.8": "0.8.26"
6+
"0.6": "0.6.20"
7+
"0.4": "0.4.10"
8+
"0.10": "0.10.36"
9+
"0.12": "0.12.0"
10+
"iojs-1.0": "iojs-1.0.4"
11+
"iojs-1.1": "iojs-1.1.0"
12+
"iojs-1.2": "iojs-1.2.0"
13+
"iojs-1.3": "iojs-1.3.0"
14+
"iojs-1.4": "iojs-1.4.3"
15+
"iojs-1.5": "iojs-1.5.1"
16+
"iojs-1.6": "iojs-1.6.2"
17+
18+
nodejs::prefix: '/opt'
19+
nodejs::provider: 'nodenv'
20+
nodejs::user: "%{::id}"
21+
22+
nodejs::build::ensure: 'f18b3d67756d1cb25ba6e35044f816fd67211b33'
23+
nodejs::build::prefix: "%{hiera('nodejs::prefix')}/node-build"
24+
nodejs::build::user: "%{hiera('nodejs::user')}"
25+
26+
nodejs::nodenv::ensure: v0.2.0
27+
nodejs::nodenv::prefix: "%{hiera('nodejs::prefix')}/nodenv"
28+
nodejs::nodenv::user: "%{hiera('nodejs::user')}"
29+

data/hiera.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
22
:hierarchy:
3+
- "%{::osfamily}/%{::macosx_productversion_major}"
4+
- "%{::osfamily}/%{::lsbdistcodename}"
5+
- "%{::osfamily}"
36
- common
47

58
:merge_behavior: deeper

files/definitions/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)