Skip to content

Commit

Permalink
doc: Add documentation generation now that TypeDoc has been updated
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Apr 18, 2016
1 parent b2f9986 commit 9691d88
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 1 deletion.
65 changes: 65 additions & 0 deletions build/doc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
var gulp = require('gulp'),
git = require('gulp-git'),
typedoc = require('gulp-typedoc'),
runSequence = require('run-sequence'),
fs = require('fs');

var paths = require('./paths');

gulp.task('doc', function() {
return runSequence('doc-build', 'doc-publish');
});

gulp.task('doc-build', function() {
return runSequence('doc-checkout', 'doc-compile', ['doc-submodule', 'doc-attributes']);
});

gulp.task('doc-checkout', function(cb) {
return git.checkout('gh-pages', { cwd: 'doc', quiet: true }, cb);
});

gulp.task('doc-submodule', function(cb) {
fs.writeFile('doc/.git', 'gitdir: ../.git/modules/doc', cb);
});

gulp.task('doc-attributes', function(cb) {
fs.writeFile('doc/.gitattributes', '* text=auto', cb);
});

gulp.task('doc-publish', function (cb) {
setTimeout(function () {
git.exec({ args: 'diff-files --quiet', quiet: true, cwd: 'doc' }, function(err) {
if(err && err.code === 1) runSequence('doc-commit', 'doc-update-ref', 'doc-push', cb);
else cb();
});
}, 5000);
});

gulp.task('doc-commit', function() {
return gulp.src('**', { cwd: 'doc' })
.pipe(git.commit('Updated documentation', { cwd: 'doc' }));
});

gulp.task('doc-update-ref', function() {
return gulp.src('.')
.pipe(git.commit('Updated documentation'));
});

gulp.task('doc-push', function(cb) {
git.push('origin', 'gh-pages', { cwd: 'doc' }, cb);
});

gulp.task('doc-compile', function() {
return gulp.src(paths.docSourceFiles).pipe(typedoc({
module: 'commonjs',
target: 'es5',
mode: 'file',
entryPoint: 'iridium',

out: './doc',

name: "Iridium",
plugin: ['decorator'],
ignoreCompilerErrors: true
}));
});
25 changes: 25 additions & 0 deletions build/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,30 @@ module.exports = {

builtTestFiles: 'dist/test/*.js',
builtFiles: ["dist/lib/**/*.js", "dist/index.js"],

docSourceFiles: [
"typings/main.d.ts",
"lib/Core.ts",
"lib/Model.ts",
"lib/Instance.ts",

"lib/Decorators.ts",

"lib/Plugins.ts",
"lib/Schema.ts",
"lib/Cache.ts",
"lib/CacheDirector.ts",
"lib/ModelOptions.ts",
"lib/Configuration.ts",
"lib/Hooks.ts",
"lib/Transforms.ts",

"lib/caches/MemoryCache.ts",
"lib/caches/NoOpCache.ts",

"lib/cacheControllers/IDDirector.ts",

"lib/utils/ObjectID.ts"
],
testSupportFiles: ['dist/test/support/chai']
};
1 change: 1 addition & 0 deletions build/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ gulp.task('version-push-tags', function (cb) {

gulp.task('version', function (callback) {
runSequence(
'doc',
'version-bump',
'version-commit',
'version-tag',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"semver": "^5.1.0",
"tick": "~0.1.1",
"tslint": "^3.5.0",
"typedoc": "~0.3.12",
"typedoc": "sierrasoftworks/typedoc",
"typescript": "~1.8.7",
"typings-core": "^0.2.16",
"underscore": "~1.8.3"
Expand Down

0 comments on commit 9691d88

Please sign in to comment.