Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #38 from grafjo/patch-9
Browse files Browse the repository at this point in the history
Updated README.md
  • Loading branch information
willdurand committed Feb 1, 2014
2 parents 4528a04 + 394bc78 commit 5dd0f9d
Showing 1 changed file with 51 additions and 42 deletions.
93 changes: 51 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,88 +12,97 @@ This module allows to install [Node.js](http://nodejs.org/) and
Installation
------------

Get the module by cloning the repository:
### Manuall installation

git clone git://github.com/willdurand/puppet-nodejs.git modules/nodejs

Or use the Puppet Module Tool:
This modules depends on
[puppetlabs/stdlib](https://github.com/puppetlabs/puppetlabs-stdlib) and [maestrodev/puppet-wget](https://github.com/maestrodev/puppet-wget).
so all repositories have to be checked out:

puppet module install willdurand/nodejs
```bash
git clone git://github.com/willdurand/puppet-nodejs.git modules/nodejs
git clone git://github.com/puppetlabs/puppetlabs-stdlib.git modules/stdlib
git clone git://github.com/maestrodev/puppet-wget.git modules/wget
```

### Puppet Module Tool:

Requirements
------------

This modules depends on
[puppetlabs/stdlib](https://github.com/puppetlabs/puppetlabs-stdlib) and [maestrodev/puppet-wget](https://github.com/maestrodev/puppet-wget). You MUST
clone them if you don't use the Puppet Module Tool:
puppet module install willdurand/nodejs

git clone git://github.com/puppetlabs/puppetlabs-stdlib.git modules/stdlib
git clone git://github.com/maestrodev/puppet-wget.git modules/wget
### Librarian-puppet

mod 'willdurand/nodejs', '1.6.0'

Usage
-----

Include the `nodejs` class:
There are a few ways how to use this puppet module. The easiest one is just using the class definition

```puppet
include nodejs
class { 'nodejs':
version => 'v0.10.25',
}
```
This will compile and install Node.js version `v0.10.25` to your machine. `node` and `npm` will be available in your `$PATH` via `/usr/local/bin` so you can just start using `node`.

You can specify a Node.js version by specifing it:
Shortcuts are provided to easily install the `latest` or `stable` release by setting the `version` parameter to `latest` or `stable`. It will automatically look for the last release available on http://nodejs.org.

```puppet
class { 'nodejs':
version => 'v0.10.17',
version => 'stable',
}
```

You can install different versions of Node.js thanks to the `nodejs::install`
definition:
### Setup using pre-built installer

To use the pre-built installer version provided via http://nodejs.org/download you have to set `make_install` to `false`

```puppet
nodejs::install { 'v0.10.17':
version => 'v0.10.17',
class { 'nodejs':
version => 'stable',
make_install => false,
}
```

Shortcuts are provided to easily install the 'latest' or 'stable' release by
setting the `version` parameter to `latest` or `stable`. It will
automatically look for the last release available.
### Setup multiple versions of Node.js

If you need mode than one installed version of Node.js on your machine, you can just do it using the `nodejs::install` puppet define.

```puppet
class { 'nodejs':
version => 'stable',
nodejs::install { 'v0.10.17':
version => 'v0.10.17',
}
nodejs::install { 'v0.10.25':
version => 'v0.10.25',
}
```

This snippet will install version `v0.10.17` and `v0.10.25` on your machine. Keep in mind that a Node.js version installed via `nodejs::install` will provide only versioned binaries inside `/usr/local/bin`!

```
/usr/local/bin/node-v0.10.17
/usr/local/bin/npm-v0.10.17
/usr/local/bin/node-v0.10.25
/usr/local/bin/npm-v0.10.25
```

By default, this module creates a symlink for the node binary (and npm) with Node.js version appended into `/usr/local/bin` e.g. `/usr/local/bin/node-v0.10.17`.
You can change this behavior by using the `target_dir` parameter.
Using the nodejs class, binary files are exposed to the system $PATH without a version string appended.
All parameters available in the `class` definition are also available for `nodejs::install`.

Also, this module installs [NPM](https://npmjs.org/) by default. You can set the
`with_npm` parameter to `false` to not install it.
### Binary path

This module will `make install` Node.js by default, to use prebuilt versions
distributed by Node.js on http://nodejs.org/dist/ set the `make_install`
parameter to `false`.
`node` and `npm` are linked to `/usr/local/bin` to be available in your system `$PATH` by default. To link those binaries to e.g `/bin`, just set the parameter `target_dir`.

```puppet
class { 'nodejs':
version => 'v0.10.17',
make_install => false,
version => 'stable',
target_dir => '/bin',
}
```

or
### NPM

```puppet
nodejs::install { 'v0.10.17':
version => 'v0.10.17',
make_install => false,
}
```
Also, this module installs [NPM](https://npmjs.org/) by default. Since versions `v0.6.3` of Node.js `npm` is included in every installation! For older versions, you can set parameter `with_npm => false` to not install `npm`.


### NPM Provider
Expand Down

0 comments on commit 5dd0f9d

Please sign in to comment.