Comparing version 1.1.4 to 1.1.5
@@ -45,3 +45,4 @@ var hogan = require('hogan.js'); | ||
postInstallCommands: getPostInstallCommands(pkg), | ||
version: pkg.version | ||
version: pkg.version, | ||
license: pkg.license | ||
}, | ||
@@ -48,0 +49,0 @@ getExecutableFiles(pkg), |
{ | ||
"name": "speculate", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Automatically generates an RPM Spec file for your Node.js project", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -79,4 +79,55 @@ # speculate | ||
## Directory Structure | ||
### Install your dependencies _first_ | ||
Speculate assumes that you've _already installed your npm dependencies_ when it is run. This means that you don't need to worry about running `npm install` inside a clean RPM-building environment like _mock_. | ||
The generated spec file instructs your RPM building tool to run [`npm rebuild`](https://docs.npmjs.com/cli/rebuild) as part of the build process. This ensures that any native modules are rebuilt for your target environment, even if they were originally installed on a different platform. | ||
A typical speculate build looks like this: | ||
```bash | ||
npm install | ||
npm test | ||
speculate | ||
# build the RPM (using rpmbuild, mock etc.) | ||
``` | ||
### Local installation | ||
To avoid the need to install speculate globally, we recommend installing it _locally_ and creating an [npm script](https://docs.npmjs.com/misc/scripts) in your `package.json` file: | ||
``` | ||
npm install --save-dev speculate | ||
``` | ||
```json | ||
{ | ||
"scripts": { | ||
"spec": "speculate" | ||
} | ||
} | ||
``` | ||
You can then run `npm run spec` to generate your spec file in an environment where speculate isn't installed globally (like your CI server.) | ||
### `npm start` script | ||
The systemd service file that Speculate generates uses the `npm start` script to start your application. Make sure that you've defined this script in your `package.json` file. | ||
```json | ||
{ | ||
"scripts": { | ||
"start": "node server.js" | ||
} | ||
} | ||
``` | ||
### Node versions | ||
The spec file that speculate generates _isn't_ tied to a particular Node version. It simply requires the `nodejs` package. It's up to you to make the package available when you install the RPM using `yum`. | ||
We **strongly recommend** that you use the [Nodesource binary distributions](https://github.com/nodesource/distributions) to install a modern version of Node.js for both your RPM building environment and your target server. Follow the setup instructions for [Enterprise Linux](https://github.com/nodesource/distributions#rpm) and then run `yum install nodejs`. | ||
### Directory Structure | ||
Speculate creates the following directories for your application: | ||
@@ -83,0 +134,0 @@ |
@@ -51,5 +51,11 @@ var createSpecFile = require('../lib/spec'); | ||
var spec = createSpecFile(pkg); | ||
assert.equal(spec, expected); | ||
}); | ||
it('sets the license from the package.json', function () { | ||
var pkg = require('./fixtures/my-cool-api-with-diff-licence'); | ||
var expected = loadFixture('my-cool-api-with-diff-licence.spec'); | ||
var spec = createSpecFile(pkg); | ||
assert.equal(spec, expected); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
34258
42
515
194
9