Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
judit-nahaj committed Sep 25, 2017
1 parent 712e6f0 commit 16c0e7e
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
### Added

- Add code to apply preprocessing rules to Gherkin feature files ([#1](https://github.com/judit-nahaj/gherkin-precompiler/issues/1))
- Add predefined preprocessors: replacer ([#2](https://github.com/judit-nahaj/gherkin-precompiler/issues/2))
- Add predefined precompilers: replacer ([#2](https://github.com/judit-nahaj/gherkin-precompiler/issues/2))
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@

[![Build Status](https://travis-ci.org/judit-nahaj/gherkin-precompiler.svg?branch=master)](https://travis-ci.org/judit-nahaj/gherkin-precompiler) [![dependency Status](https://david-dm.org/judit-nahaj/gherkin-precompiler.svg)](https://david-dm.org/judit-nahaj/gherkin-precompiler) [![devDependency Status](https://david-dm.org/judit-nahaj/gherkin-precompiler/dev-status.svg)](https://david-dm.org/judit-nahaj/gherkin-precompiler#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/github/judit-nahaj/gherkin-precompiler/badge.svg?branch=master)](https://coveralls.io/github/judit-nahaj/gherkin-precompiler?branch=master)

Simple pre-processor for Gherkin feature files.
Simple pre-compiler for Gherkin feature files.

It is based on the AST what is provided by [gherkin-assembler](https://www.npmjs.com/package/gherkin-assembler).

## Usage

```javascript
'use strict';
const processor = require('gherkin-precompiler');
const compiler = require('gherkin-precompiler');

let ast = processor.load('./features/src/login.feature');
ast = processor.process(
let ast = compiler.load('./features/src/login.feature');
ast = compiler.process(
ast,
new processor.builtIn.Replacer({
new compiler.builtIn.Replacer({
name: 'Hello'
})
);
processor.save('./features/dist/login.feature', ast, {
compiler.save('./features/dist/login.feature', ast, {
lineBreak: '\r\n'
});
```

### Built-in pre processors
### Built-in pre compilers

* [Replacer](lib/builtIn/Replacer.md)

Expand Down Expand Up @@ -55,12 +55,12 @@ Saves the given AST ast feature file to the given path.

### `process`

Applies the given pre-processors to the given AST.
Applies the given pre-compilers to the given AST.

**Params:**

* `{GherkinDocument} ast` - the AST needs to be processed
* `{...DefaultConfig|Object} pre-processors` - the pre-processors needs to be applied to the given AST
* `{...DefaultConfig|Object} pre-compilers` - the pre-compilers needs to be applied to the given AST

**Returns:** `{GherkinDocument}` the processed AST

Expand All @@ -71,7 +71,7 @@ Formats the given `GherkinDocument` to text.

### Configuration

If you want to create own pre-processor, you only have to extends the `Default` class and override the filter and/or event methods, that you want to use; or create and object with the desired methods.
If you want to create own pre-compiler, you only have to extends the `Default` class and override the filter and/or event methods, that you want to use; or create and object with the desired methods.

#### Event methods

Expand Down
2 changes: 1 addition & 1 deletion lib/DefaultConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
/**
* Base class to create Gherkin feature file pre-processors.
* Base class to create Gherkin feature file pre-compilers.
* @class
*/
class DefaultConfig {
Expand Down
4 changes: 2 additions & 2 deletions lib/PreCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const METHODS = {
};

/**
* Gherkin feature file pre-processors.
* Gherkin feature file pre-compilers.
* @class
*/
class PreCompiler {
Expand All @@ -52,7 +52,7 @@ class PreCompiler {
}

/**
* Applies the pre-processor to the given AST.
* Applies the pre-compiler to the given AST.
*
* @param {GherkinDocument} ast
* @returns {GherkinDocument}
Expand Down
2 changes: 1 addition & 1 deletion lib/builtIn/Replacer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Replacer for Gherkin preprocessor
### Replacer for Gherkin precompiler

This Replacer is responsible for exchanging predefined strings in the
feature files. It inserts the provided text in the place held for them.
Expand Down
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ API.load = pathToFile => {

const PreCompiler = require('./PreCompiler');
/**
* Applies the given pre-processors to the given AST.
* Applies the given pre-compilers to the given AST.
*
* @param {GherkinDocument} ast
* @param {...DefaultConfig|Object} configs
* @returns {GherkinDocument}
*/
API.process = (ast, ...configs) => {
configs.forEach(config => {
const processor = new PreCompiler(config);
ast = processor.applyToAST(ast);
const compiler = new PreCompiler(config);
ast = compiler.applyToAST(ast);
});
return ast;
};
Expand All @@ -57,7 +57,7 @@ API.save = (pathToFile, ast, options) => {
};

/**
* Built-in pre-processors.
* Built-in pre-compilers.
* @type {Object.<String,PreCompiler>}
*/
API.builtIn = {};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gherkin-precompiler",
"version": "1.0.0",
"description": "Simple pre-processor for Gherkin feature files",
"description": "Simple pre-compiler for Gherkin feature files",
"main": "lib/index.js",
"scripts": {
"test": "mocha ./test/*.spec.js ./test/builtIn/*.spec.js",
Expand Down

0 comments on commit 16c0e7e

Please sign in to comment.