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

Commit

Permalink
Merge pull request #48 from platanus/rewrite
Browse files Browse the repository at this point in the history
rewrite based on boxen/puppet-ruby
  • Loading branch information
MikeMcQuaid committed Jul 19, 2015
2 parents 004d1f6 + 158d939 commit a7291f7
Show file tree
Hide file tree
Showing 50 changed files with 1,288 additions and 797 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
/.ruby-version
/spec/fixtures/.librarian
/spec/fixtures/.tmp
/spec/fixtures/Puppetfile.lock
/spec/fixtures/modules
/spec/fixtures/vendor
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
script: "./script/cibuild"
gemfile: "this/does/not/exist"
sudo: false
rvm:
- "1.8.7"
- "1.9.3"
- "2.0.0"
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
source "https://rubygems.org"

gem "cardboard", "~> 2.1"
gem "deep_merge", "~> 1.0"
gem "puppet", "< 3.4.0"
gem "boxen", "~> 2.4.0"
gem "librarian-puppet", "< 0.9.15"
65 changes: 33 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,72 +1,69 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.2.8)
addressable (2.3.6)
ansi (1.4.3)
boxen (2.6.0)
boxen (2.4.0)
ansi (~> 1.4)
hiera (~> 1.0)
highline (~> 1.6)
json_pure (>= 1.7.7, < 2.0)
librarian-puppet (~> 1.0.0)
octokit (~> 2.7, >= 2.7.1)
librarian-puppet (~> 0.9.10)
octokit (~> 2.3.0)
puppet (~> 3.0)
cardboard (2.1.0)
boxen (~> 2.1)
puppet-lint (~> 0.3)
puppetlabs_spec_helper (~> 0.4)
rspec-puppet (~> 1.0)
deep_merge (1.0.1)
diff-lcs (1.2.5)
facter (2.0.2)
CFPropertyList (~> 2.2.6)
facter (1.7.5)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
hiera (1.3.4)
hiera (1.3.2)
json_pure
highline (1.6.21)
json (1.8.1)
json_pure (1.8.1)
librarian (0.1.2)
highline
thor (~> 0.15)
librarian-puppet (1.0.3)
librarian-puppet (0.9.14)
json
librarian (>= 0.1.2)
open3_backport
metaclass (0.0.4)
mocha (1.1.0)
mocha (1.0.0)
metaclass (~> 0.0.1)
multipart-post (2.0.0)
octokit (2.7.2)
sawyer (~> 0.5.2)
puppet (3.6.2)
facter (> 1.6, < 3)
octokit (2.3.1)
sawyer (~> 0.5.1)
open3_backport (0.0.3)
open4 (~> 1.3.0)
open4 (1.3.3)
puppet (3.3.2)
facter (~> 1.6)
hiera (~> 1.0)
json_pure
rgen (~> 0.6.5)
puppet-lint (0.3.2)
puppetlabs_spec_helper (0.5.2)
mocha
puppet-lint
puppetlabs_spec_helper (0.4.1)
mocha (>= 0.10.5)
rake
rspec
rspec-puppet
rake (10.3.2)
rspec (>= 2.9.0)
rspec-puppet (>= 0.1.1)
rake (10.3.1)
rgen (0.6.6)
rspec (3.0.0)
rspec-core (~> 3.0.0)
rspec-expectations (~> 3.0.0)
rspec-mocks (~> 3.0.0)
rspec-core (3.0.2)
rspec-support (~> 3.0.0)
rspec-expectations (3.0.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.0.0)
rspec-mocks (3.0.2)
rspec-support (~> 3.0.0)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6)
rspec-puppet (1.0.1)
rspec
rspec-support (3.0.2)
sawyer (0.5.4)
addressable (~> 2.3.5)
faraday (~> 0.8, < 0.10)
Expand All @@ -76,4 +73,8 @@ PLATFORMS
ruby

DEPENDENCIES
boxen (~> 2.4.0)
cardboard (~> 2.1)
deep_merge (~> 1.0)
librarian-puppet (< 0.9.15)
puppet (< 3.4.0)
117 changes: 85 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,74 @@
# nodejs Puppet Module for Boxen
# Node Puppet Module for Boxen

[![Build Status](https://travis-ci.org/boxen/puppet-nodejs.svg?branch=master)](https://travis-ci.org/boxen/puppet-nodejs)
[![GitHub release](https://img.shields.io/github/release/boxen/puppet-nodejs.svg)](http://github.com/boxen/puppet-nodejs/releases)

Using nodenv for nodejs version management,
automates installation and configuration of nodejs versions.
Requires the following boxen modules:

* `boxen >= 3.2.0`
* `repository >= 2.1`
* [ripienaar/puppet-module-data](https://github.com/ripienaar/puppet-module-data)

## About

This module supports node version management with nodenv from [OiNutter](http://github.com/OiNutter/nodenv).
Is heavily based on the official boxen's [ruby module](http://github.com/boxen/puppet-ruby).
All node versions are installed into `/opt/nodes`.

## About node-build version

Occasional bumps to the default node-build version are fine, on this module, but not essential.
The node-build version is something you should be managing in your own boxen repository,
rather than depending on this module to update for you. See examples on how to change the node-build
version in the Hiera section.

You can find a release list of versions for node-build [here](https://github.com/OiNutter/node-build/releases).

## Breakages since last major version

* nodes now live in `/opt/nodes` instead of `/opt/boxen/nodenv/versions`
* the module-data module is now **required**
* use of [OiNutter/nodenv](http://github.com/OiNutter/nodenv) instead of wfarr's version
* use of [OiNutter/node-build](http://github.com/OiNutter/node-build)
* npm packages are installed with `npm_module` instead of `nodejs::module`
* node versions are defined without the leading `v` (`0.10.36` instead of `v0.10.36`)

## Usage

``` puppet
# include short version aliases
nodejs::version { 'v0.10': }
```puppet
# Set the global default node (auto-installs it if it can)
class { 'nodejs::global':
version => '0.12'
}
# ensure a certain node version is used in a dir
nodejs::local { '/path/to/some/project':
version => '0.12'
}
# ensure a npm module is installed for a certain node version
# note, you can't have duplicate resource names so you have to name like so
$version = "0.12"
npm_module { "bower for ${version}":
module => 'bower',
version => '~> 1.4.1',
node_version => $version,
}
# install any arbitrary nodejs version
nodejs::version { 'v0.10.1': }
# ensure a module is installed for all ruby versions
npm_module { 'bower for all nodes':
module => 'bower',
version => '~> 1.4.1',
node_version => '*',
}
# set the global nodejs version
class { 'nodejs::global': version => 'v0.10.1' }
# install a node version
nodejs::version { '0.12.2': }
# install some npm modules
nodejs::module { 'bower':
node_version => 'v0.10'
# Installing nodenv plugin
nodejs::nodenv::plugin { 'nodenv-vars':
ensure => 'ee42cd9db3f3fca2a77862ae05a410947c33ba09',
source => 'OiNutter/nodenv-vars'
}
```

Expand All @@ -29,22 +78,33 @@ The following variables may be automatically overridden with Hiera:

``` yaml
---
# Version compile configuration, if not version is defined the default is false
# Yyou can define whether to compile from source or not based on long version
# and define short versions as a fallback if non long version is defined
"nodejs::version::compile":
"v0.10": false
"v0.4": true
"v0.6.20" : true

"nodejs::provider": "nodenv"
"nodejs::user": "deploy"

"nodejs::build::ensure": "f18b3d67756d1cb25ba6e35044f816fd67211b33"
"nodejs::nodenv::ensure": "v0.2.0"

# nodenv plugins
"nodejs::nodenv::plugins":
"nodenv-vars":
"ensure": "ee42cd9db3f3fca2a77862ae05a410947c33ba09"
"source": "OiNutter/nodenv-vars"


# Environment variables for building specific versions
# You'll want to enable hiera's "deeper" merge strategy
# See http://docs.puppetlabs.com/hiera/1/configuring.html#mergebehavior
"nodejs::version::env":
"0.4.2":
"CC": "gcc"

# Version aliases, commonly used to bless a specific version
# Use the "deeper" merge strategy, as with nodejs::version::env
"nodejs::version::alias":
"v0.10": "v0.10.31"
"v0.8": "v0.8.26"
"v0.6": "v0.6.20"
"v0.4": "v0.4.10"

"0.10": "0.10.36"
"0.12": "0.12.0"
"iojs-1.6": "iojs-1.6.2"
```
It is **required** that you include
Expand All @@ -55,10 +115,3 @@ definitions will be automatically loaded, but can be overridden easily in your
own hierarchy.

You can also use JSON if your Hiera is configured for that.

## Required Puppet Modules

* boxen ( OS X only ) > 2.1
* repository > 2.2
* stdlib >= 3.0.0
* [ripienaar/puppet-module-data](https://github.com/ripienaar/puppet-module-data)
10 changes: 10 additions & 0 deletions data/Darwin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
nodejs::version::env:
Darwin:
BOXEN_S3_HOST: "%{::boxen_s3_host}"
BOXEN_S3_BUCKET: "%{::boxen_s3_bucket}"
CFLAGS: "-I%{::homebrew::config::installdir}/include -march=core2 -O3"
LDFLAGS: "-L%{::homebrew::config::installdir}/lib"

nodejs::prefix: "%{::boxen::config::home}"
nodejs::user: "%{::boxen_user}"
37 changes: 26 additions & 11 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
---
nodejs::version::compile:
v0.12: false
v0.10: false
v0.8: false
v0.6: true
v0.4: true
# nodejs::version::env:

nodejs::version::alias:
v0.12: v0.12.0
v0.10: v0.10.31
v0.8: v0.8.26
v0.6: v0.6.20
v0.4: v0.4.10
"0.8": "0.8.26"
"0.6": "0.6.20"
"0.4": "0.4.10"
"0.10": "0.10.36"
"0.12": "0.12.0"
"iojs-1.0": "iojs-1.0.4"
"iojs-1.1": "iojs-1.1.0"
"iojs-1.2": "iojs-1.2.0"
"iojs-1.3": "iojs-1.3.0"
"iojs-1.4": "iojs-1.4.3"
"iojs-1.5": "iojs-1.5.1"
"iojs-1.6": "iojs-1.6.2"

nodejs::prefix: '/opt'
nodejs::provider: 'nodenv'
nodejs::user: "%{::id}"

nodejs::build::ensure: 'f18b3d67756d1cb25ba6e35044f816fd67211b33'
nodejs::build::prefix: "%{hiera('nodejs::prefix')}/node-build"
nodejs::build::user: "%{hiera('nodejs::user')}"

nodejs::nodenv::ensure: v0.2.0
nodejs::nodenv::prefix: "%{hiera('nodejs::prefix')}/nodenv"
nodejs::nodenv::user: "%{hiera('nodejs::user')}"

3 changes: 3 additions & 0 deletions data/hiera.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
:hierarchy:
- "%{::osfamily}/%{::macosx_productversion_major}"
- "%{::osfamily}/%{::lsbdistcodename}"
- "%{::osfamily}"
- common

:merge_behavior: deeper
Empty file added files/definitions/.gitkeep
Empty file.
Loading

0 comments on commit a7291f7

Please sign in to comment.