Update nodejs, sudo and users cookbooks

This commit is contained in:
Greg Karékinian
2018-04-17 13:18:09 +02:00
parent ff2f424ddb
commit 157ccdc8b7
37 changed files with 862 additions and 523 deletions

View File

@@ -1,8 +1,8 @@
# [nodejs-cookbook](https://github.com/redguide/nodejs)
[![CK Version](http://img.shields.io/cookbook/v/nodejs.svg?branch=master)](https://supermarket.getchef.com/cookbooks/nodejs) [![Build Status](https://img.shields.io/travis/redguide/nodejs.svg)](https://travis-ci.org/redguide/nodejs) [![Gitter chat](https://badges.gitter.im/redguide/nodejs.svg)](https://gitter.im/redguide/nodejs)
[![CK Version](http://img.shields.io/cookbook/v/nodejs.svg?branch=master)](https://supermarket.chef.io/cookbooks/nodejs) [![Build Status](https://img.shields.io/travis/redguide/nodejs.svg)](https://travis-ci.org/redguide/nodejs) [![Gitter chat](https://badges.gitter.im/redguide/nodejs.svg)](https://gitter.im/redguide/nodejs)
Installs node.js/io.js and manages npm
Installs node.js/npm and includes a resource for managing npm packages
## Requirements
@@ -10,20 +10,18 @@ Installs node.js/io.js and manages npm
- Debian/Ubuntu
- RHEL/CentOS/Scientific/Amazon/Oracle
- openSUSE
Note: Source installs require GCC 4.8+, which is not included on older distro releases
### Chef
- Chef 11+
- Chef 12.14+
### Cookbooks
- yum-epel
- build-essential
- ark
- apt
- homebrew
## Usage
@@ -33,17 +31,6 @@ Include the nodejs recipe to install node on your system based on the default in
include_recipe "nodejs"
```
### Engine
You can select different engine by setting `node['nodejs']['engine']`
```
node['nodejs']['engine'] => 'node' # default
node['nodejs']['engine'] => 'iojs'
```
You can also use recipes `nodejs::nodejs` or `nodejs::iojs`.
### Install methods
#### Package
@@ -57,7 +44,7 @@ include_recipe "nodejs"
include_recipe "nodejs::nodejs_from_package"
```
Note that only apt (Ubuntu, Debian) appears to have up to date packages available. Centos, RHEL, etc are non-functional (try `nodejs_from_binary` for those).
By default this will setup deb/rpm repositories from nodesource.com, which include up to date NodeJS packages. If you prefer to use distro provided package you can disable this behavior by setting `node['nodejs']['install_repo']` to `false`.
#### Binary
@@ -66,12 +53,19 @@ Install node from official prebuilt binaries:
```chef
node['nodejs']['install_method'] = 'binary'
include_recipe "nodejs"
# Or
include_recipe "nodejs::nodejs_from_binary"
# Or set a specific version of nodejs to be installed
node.default['nodejs']['install_method'] = 'binary'
node.default['nodejs']['version'] = '5.9.0'
node.default['nodejs']['binary']['checksum'] = '99c4136cf61761fac5ac57f80544140a3793b63e00a65d4a0e528c9db328bf40'
# Or fetch the binary from your own location
node.default['nodejs']['install_method'] = 'binary'
node.default['nodejs']['binary']['url'] = 'https://s3.amazonaws.com/my-bucket/node-v7.8.0-linux-x64.tar.gz'
node.default['nodejs']['binary']['checksum'] = '0bd86f2a39221b532172c7d1acb57f0b0cba88c7b82ea74ba9d1208b9f6f9697'
```
#### Source
@@ -95,22 +89,24 @@ include_recipe "nodejs::npm"
_Warning:_ This recipe will include the `nodejs` recipe, which by default includes `nodejs::nodejs_from_package` if you did not set `node['nodejs']['install_method']`.
## Custom Resources (Providers)
## Resources
### nodejs_npm
### npm_package
`nodejs_npm` let you install npm packages from various sources:
note: This resource was previously named nodejs_npm. Calls to that resource name will still function, but cookbooks should be updated for the new npm_package resource name.
`npm_package` let you install npm packages from various sources:
- npm registry:
- name: `attribute :package`
- version: `attribute :version` (optional)
- name: `property :package`
- version: `property :version` (optional)
- url: `attribute :url`
- url: `property :url`
- for git use `git://{your_repo}`
- from a json (package.json by default): `attribute :json`
- from a json (package.json by default): `property :json`
- use `true` for default
- use a `String` to specify json file
@@ -129,27 +125,27 @@ This LWRP attempts to use vanilla npm as much as possible (no custom wrapper).
### Packages
```ruby
nodejs_npm "express"
npm_package 'express'
nodejs_npm "async" do
version "0.6.2"
npm_package 'async' do
version '0.6.2'
end
nodejs_npm "request" do
url "github mikeal/request"
npm_package 'request' do
url 'github mikeal/request'
end
nodejs_npm "grunt" do
path "/home/random/grunt"
npm_package 'grunt' do
path '/home/random/grunt'
json true
user "random"
user 'random'
end
nodejs_npm "my_private_module" do
path "/home/random/myproject" # The root path to your project, containing a package.json file
npm_package 'my_private_module' do
path '/home/random/myproject' # The root path to your project, containing a package.json file
json true
npm_token "12345-abcde-e5d4c3b2a1"
user "random"
npm_token '12345-abcde-e5d4c3b2a1'
user 'random'
options ['--production'] # Only install dependencies. Skip devDependencies
end
```
@@ -186,7 +182,7 @@ Or add packages via attributes (which accept the same attributes as the LWRP abo
**Author:** Marius Ducea (marius@promethost.com) **Author:** Nathan L Smith (nlloyds@gmail.com) **Author:** Guilhem Lettron (guilhem@lettron.fr) **Author:** Barthelemy Vessemont (bvessemont@gmail.com)
**Copyright:** 2008-2016, Chef Software, Inc.
**Copyright:** 2008-2017, Chef Software, Inc.
```
Licensed under the Apache License, Version 2.0 (the "License");