<commit_before># RPM Builder
Builds [RPM](http://www.rpm.org/) packages using Node.js.


## Installation
```
$ npm install rpm-builder
```


## Requirements
This module requires the `rpmbuild` tool to be installed:
```
$ yum install rpmdevtools
```


## Usage
```js
var buildRpm = require('rpm-builder');

var options = {
  name: 'my-project',
  summary: 'My summary',
  description: 'My description',
  version: '0.0.0',
  release: '1',
  license: 'MIT',
  vendor: 'Vendor',
  group: 'Development/Tools',
  buildArch: 'noarch',
  tempDir: './tmp'
}

buildRpm(options, function(err, rpm) {
  if (err) {
    throw err;
  }
  
  console.log(rpm);
  // /path/to/my-project-0.0.0-1.noarch.rpm
});
```


## Options

#### tempDir
`String` (default: `'tmp-<auto_gen_id>'`)

Sets the temporary path name that stores the folder structure required by the `rpmbuild` command. Note that this is used for setting up and building the package and does not affect the RPM itself.

#### keepTemp

`Boolean` (default: `false`)

If true will keep the temporary folder used to build the RPM. Useful for debugging.


### RPM Spec related

#### name
`String` (default: `'no-name'`)

Sets the name tag in the RPM package. It's also used in the RPM file name.

#### version
`String` (default: `'0.0.0'`)
<commit_msg>Add usage info to the README<commit_after># RPM Builder
Builds [RPM](http://www.rpm.org/) packages using Node.js.


## Installation
```
$ npm install rpm-builder
```


## Requirements
This module requires the `rpmbuild` tool to be installed:
```
$ yum install rpmdevtools
```


## Usage

### Basic
```js
var buildRpm = require('rpm-builder');

var options = {
  name: 'my-project',
  version: '0.0.0',
  release: '1',
  buildArch: 'noarch',
  files: [
    // will output files to
    // /dist/dev/file1.txt
    // /dist/dev/file2.txt
    // /dist/dev/file3.txt
    // /dist/dev/img1.png
    // /dist/dev/img2.png
    // /dist/dev/img3.png
    {src: './dev/file1.txt', dest: '/dist/'},
    {src: './dev/file2.txt', dest: '/dist/'}
    {src: './dev/file3.txt', dest: '/dist/'}
    {src: './dev/img1.png', dest: '/dist/'}
    {src: './dev/img2.png', dest: '/dist/'}
    {src: './dev/img3.png', dest: '/dist/'}
  ]
};

buildRpm(options, function(err, rpm) {
  if (err) {
    throw err;
  }
  
  console.log(rpm);
  // /path/to/my-project-0.0.0-1.noarch.rpm
});
```

### CWD (current working directory)
The `cwd` attribute is used to define the working directory for an individual or set of files. When this attribute is set, `src` entries are relative to the `cwd` path.
```js
var options = {
  name: 'my-project',
  version: '0.0.0',
  release: '1',
  buildArch: 'noarch',
  files: [
    // will output files to
    // /dist/dev/file1.txt
    // /dist/dev/file2.txt
    // /dist/dev/file3.txt
    // /dist/img1.png
    // /dist/img2.png
    // /dist/img3.png
    {src: './dev/file1.txt', dest: '/dist/'},
    {src: './dev/file2.txt', dest: '/dist/'}
    {src: './dev/file3.txt', dest: '/dist/'}
    {cwd: './dev/', src: 'img1.png', dest: '/dist/'}
    {cwd: './dev/', src: 'img2.png', dest: '/dist/'}
    {cwd: './dev/', src: 'img3.png', dest: '/dist/'}
  ]
};
```

### Globs
Files can also be listed using the patterns that shell uses (we're relying on [globby](https://github.com/sindresorhus/globby) for this.
```js
var options = {
  name: 'my-project',
  version: '0.0.0',
  release: '1',
  buildArch: 'noarch',
  files: [
    // will output files to
    // /dist/dev/file1.txt
    // /dist/dev/file2.txt
    // /dist/dev/file3.txt
    {src: './dev/*.txt', dest: '/dist/'},
  ]
};
```

### Excluding files
```js
var options = {
  name: 'my-project',
  version: '0.0.0',
  release: '1',
  buildArch: 'noarch',
  files: [
    // will output files to
    // /dist/dev/img1.png
    // /dist/dev/img2.png
    // /dist/dev/img3.png
    {src: './dev/img1.png', dest: '/dist/'},
    {src: './dev/img2.png', dest: '/dist/'},
    {src: './dev/img3.png', dest: '/dist/'},
    {src: './dev/file1.txt', dest: '/dist/'},
    {src: './dev/file2.txt', dest: '/dist/'}
    {cwd: './dev/', src: 'file3.txt', dest: '/dist/'}
  ],
  excludeFiles: [
    './dev/*.txt'
  ]
};
```


## Options

#### tempDir
`String` (default: `'tmp-<auto_gen_id>'`)

Sets the temporary path name that stores the folder structure required by the `rpmbuild` command. Note that this is used for setting up and building the package and does not affect the RPM itself.

#### keepTemp

`Boolean` (default: `false`)

If true will keep the temporary folder used to build the RPM. Useful for debugging.


### RPM Spec related

#### name
`String` (default: `'no-name'`)

Sets the name tag in the RPM package. It's also used in the RPM file name.

#### version
`String` (default: `'0.0.0'`)

{'fraction_non_alphanumeric': 0.19961977186311788, 'fraction_numerical': 0.014786649767638362, 'mean_word_length': 2.840227088402271, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2780380', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1749, 'n_words': 499}