Skip to content

Commit

Permalink
[dist] Added jsdoc and gh-pages to gulpfile
Browse files Browse the repository at this point in the history
  * Will now build jsdocs as part of build
  * Will now commit and push jsdocs to gh-pages
  • Loading branch information
Marak committed Mar 20, 2016
1 parent dc77d26 commit a41140d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 16 deletions.
16 changes: 14 additions & 2 deletions build/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
*/

var gulp = require('gulp');
var jsdoc = require('gulp-jsdoc3');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var ghPages = require('gulp-gh-pages');
var mustache = require('gulp-mustache');
var browserify = require('browserify');
var transform = require('vinyl-transform');
Expand Down Expand Up @@ -56,6 +58,17 @@ gulp.task('browser-package', function() {
.pipe(rename('../examples/browser/js/faker.min.js'));
});

// pushes jsdoc changes to gh-pages branch
gulp.task('gh-pages', function(cb) {
return gulp.src('../doc/**/*')
.pipe(ghPages());
});

gulp.task('jsdoc', function (cb) {
var config = require('../conf.json');
gulp.src(['../README.md', '../lib/*.js'], {read: false})
.pipe(jsdoc(config, cb));
});

// builds Readme.md file from docs.md and exported faker methods
gulp.task('documentation', function(cb) {
Expand Down Expand Up @@ -104,8 +117,7 @@ gulp.task('documentation', function(cb) {

});

var tasks = ['nodeLocalRequires', 'browser-package', 'documentation'];
// var tasks = [];
var tasks = ['documentation', 'jsdoc', 'nodeLocalRequires', 'browser-package', 'gh-pages'];

var locales = require('../lib/locales');
var localTasks = Object.keys(locales);
Expand Down
50 changes: 37 additions & 13 deletions build/src/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,32 @@ curl http://faker.hook.io?property=name.findName&locale=de

### Faker.fake()

As of version `v3.0.0` faker.js contains a super useful generator method `Faker.fake` for combining faker API methods using a mustache string format.
faker.js contains a super useful generator method `Faker.fake` for combining faker API methods using a mustache string format.

**Example:**

{{=<% %>=}}
``` js
console.log(faker.fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'));
console.log(faker.fake("{{name.lastName}}, {{name.firstName}} {{name.suffix}}"));
// outputs: "Marks, Dean Sr."
```
<%={{ }}=%>

This will interpolate the format string with the value of methods `name.lastName()`, `name.firstName()`, and `name.suffix()`

### JSDoc API Browser

[http://marak.github.io/faker.js/](http://marak.github.io/faker.js/)

### API Methods

{{{API}}}

## Localization

As of version `v2.0.0` faker.js supports over 27 different language definition packs.
As of version `v2.0.0` faker.js has support for multiple localities.

The default language is set to English.
The default language locale is set to English.

Setting a new locale is simple:

Expand Down Expand Up @@ -111,27 +117,45 @@ See: https://github.com/lestoni/faker-cli

### Meteor

#### Meteor installation
#### Meteor Installation

```
meteor add practicalmeteor:faker
```

meteor add practicalmeteor:faker
#### Meteor Usage, both client and server

#### meteor usage, both client and server
```js
var randomName = faker.name.findName(); // Rowan Nikolaus
var randomEmail = faker.internet.email(); // [email protected]
var randomCard = faker.helpers.createCard(); // random contact card containing many properties
```

var randomName = faker.name.findName(); // Rowan Nikolaus
var randomEmail = faker.internet.email(); // [email protected]
var randomCard = faker.helpers.createCard(); // random contact card containing many properties
## Building faker.js

faker uses [gulp](http://gulpjs.com/) to automate it's build process. Running the following build command will generate new browser builds, documentation, and code examples for the project.

```
npm run-script build
```

## Building JSDocs

```
npm run-script doc
```

## Version Release Schedule

faker.js is a popular project used by many organizations and individuals in production settings. Major and Minor version releases are generally on a monthly schedule. Bugs fixes are addressed by severity and fixed as soon as possible.

If you require the absolute latest version of `faker.js` the `master` branch @ http://github.com/marak/faker.js/ should always be up to date and working.

## Authors
## Maintainer

#### Matthew Bergman & Marak Squires
#### Marak Squires

faker.js - Copyright (c) 2014-2015
faker.js - Copyright (c) 2016
Matthew Bergman & Marak Squires
http://github.com/marak/faker.js/

Expand Down
2 changes: 1 addition & 1 deletion conf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"opts": {
"destination": "./doc/"
"destination": "../doc/"
},

"plugins": [
Expand Down

0 comments on commit a41140d

Please sign in to comment.