chore(gulpfile): duplicate tasks to generate "public" docs
This commit is contained in:
parent
f503c1e9e6
commit
8229d7edc2
81
gulpfile.js
81
gulpfile.js
|
@ -492,17 +492,10 @@ gulp.task('serve/benchmarks_external.dart', pubserve(gulp, gulpPlugins, {
|
||||||
// --------------
|
// --------------
|
||||||
// doc generation
|
// doc generation
|
||||||
var Dgeni = require('dgeni');
|
var Dgeni = require('dgeni');
|
||||||
gulp.task('docs/dgeni', function() {
|
|
||||||
try {
|
|
||||||
var dgeni = new Dgeni([require('./docs/dgeni-package')]);
|
|
||||||
return dgeni.generate();
|
|
||||||
} catch(x) {
|
|
||||||
console.log(x.stack);
|
|
||||||
throw x;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var bower = require('bower');
|
var bower = require('bower');
|
||||||
|
var jasmine = require('gulp-jasmine');
|
||||||
|
var webserver = require('gulp-webserver');
|
||||||
|
|
||||||
gulp.task('docs/bower', function() {
|
gulp.task('docs/bower', function() {
|
||||||
var bowerTask = bower.commands.install(undefined, undefined, { cwd: 'docs' });
|
var bowerTask = bower.commands.install(undefined, undefined, { cwd: 'docs' });
|
||||||
bowerTask.on('log', function (result) {
|
bowerTask.on('log', function (result) {
|
||||||
|
@ -514,36 +507,54 @@ gulp.task('docs/bower', function() {
|
||||||
return bowerTask;
|
return bowerTask;
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('docs/assets', ['docs/bower'], function() {
|
|
||||||
return gulp.src('docs/bower_components/**/*')
|
|
||||||
.pipe(gulp.dest('dist/docs/lib'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('docs/app', function() {
|
function createDocsTasks(public) {
|
||||||
return gulp.src('docs/app/**/*')
|
var dgeniPackage = public ? './docs/public-docs-package' : './docs/dgeni-package';
|
||||||
.pipe(gulp.dest('dist/docs'));
|
var distDocsPath = public ? 'dist/public_docs' : 'dist/docs';
|
||||||
});
|
var taskPrefix = public ? 'public_docs' : 'docs';
|
||||||
|
|
||||||
gulp.task('docs', ['docs/assets', 'docs/app', 'docs/dgeni']);
|
gulp.task(taskPrefix + '/dgeni', function() {
|
||||||
gulp.task('docs/watch', function() {
|
try {
|
||||||
return gulp.watch('docs/app/**/*', ['docs/app']);
|
var dgeni = new Dgeni([require(dgeniPackage)]);
|
||||||
});
|
return dgeni.generate();
|
||||||
|
} catch(x) {
|
||||||
|
console.log(x.stack);
|
||||||
|
throw x;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var jasmine = require('gulp-jasmine');
|
gulp.task(taskPrefix + '/assets', ['docs/bower'], function() {
|
||||||
gulp.task('docs/test', function () {
|
return gulp.src('docs/bower_components/**/*')
|
||||||
return gulp.src('docs/**/*.spec.js')
|
.pipe(gulp.dest(distDocsPath + '/lib'));
|
||||||
.pipe(jasmine({
|
});
|
||||||
includeStackTrace: true
|
|
||||||
|
gulp.task(taskPrefix + '/app', function() {
|
||||||
|
return gulp.src('docs/app/**/*')
|
||||||
|
.pipe(gulp.dest(distDocsPath));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task(taskPrefix, [taskPrefix + '/assets', taskPrefix + '/app', taskPrefix + '/dgeni']);
|
||||||
|
gulp.task(taskPrefix + '/watch', function() {
|
||||||
|
return gulp.watch('docs/app/**/*', [taskPrefix + '/app']);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task(taskPrefix + '/test', function () {
|
||||||
|
return gulp.src('docs/**/*.spec.js')
|
||||||
|
.pipe(jasmine({
|
||||||
|
includeStackTrace: true
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task(taskPrefix + '/serve', function() {
|
||||||
|
gulp.src(distDocsPath + '/')
|
||||||
|
.pipe(webserver({
|
||||||
|
fallback: 'index.html'
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var webserver = require('gulp-webserver');
|
createDocsTasks(true);
|
||||||
gulp.task('docs/serve', function() {
|
createDocsTasks(false);
|
||||||
gulp.src('dist/docs/')
|
|
||||||
.pipe(webserver({
|
|
||||||
fallback: 'index.html'
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
// ------------------
|
// ------------------
|
||||||
// karma tests
|
// karma tests
|
||||||
|
|
Loading…
Reference in New Issue