You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2018/10/30 12:14:52 UTC
[camel] 02/09: CAMEL-11492 New Camel website
This is an automated email from the ASF dual-hosted git repository.
zregvart pushed a commit to branch website
in repository https://gitbox.apache.org/repos/asf/camel.git
commit a214f6c1f3b3021ff115e560203c590866747a95
Author: Zoran Regvart <zr...@apache.org>
AuthorDate: Mon Jul 3 23:42:35 2017 +0200
CAMEL-11492 New Camel website
Improve gulp watch task to take into account only changed files and
reuse the pipe from the component tasks.
---
camel-website/gulpfile.js | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/camel-website/gulpfile.js b/camel-website/gulpfile.js
index 75b7ed5..5b36839 100644
--- a/camel-website/gulpfile.js
+++ b/camel-website/gulpfile.js
@@ -21,16 +21,23 @@ const replace = require('gulp-replace');
const version = process.env.npm_package_version.replace(/-.*/, '');
-gulp.task('docs', ['component-doc']);
-
-gulp.task('component-doc', () => {
- gulp.src('../components/readme.adoc')
- .pipe(replace(/link:.*\/(.*).adoc(\[.*)/g, `link:components/${version}/$1$2`))
- .pipe(rename('components.adoc'))
- .pipe(gulp.dest('content'));
- gulp.src('../components/**/src/main/docs/*.adoc')
- .pipe(rename({dirname: ''}))
- .pipe(gulp.dest(`content/components/${version}`));
+gulp.task('docs', ['components-readme', 'components']);
+
+const components = (path) => gulp.src(path || '../components/**/src/main/docs/*.adoc')
+ .pipe(rename({dirname: ''}))
+ .pipe(gulp.dest(`content/components/${version}`));
+
+gulp.task('components', () => {
+ return components();
+});
+
+const componentReadme = () => gulp.src('../components/readme.adoc')
+ .pipe(replace(/link:.*\/(.*).adoc(\[.*)/g, `link:components/${version}/$1$2`))
+ .pipe(rename('components.adoc'))
+ .pipe(gulp.dest('content'));
+
+gulp.task('components-readme', () => {
+ return componentReadme();
});
gulp.task('asciidoctor-shim', () => {
@@ -43,6 +50,11 @@ gulp.task('asciidoctor-shim', () => {
gulp.task('default', ['docs', 'asciidoctor-shim']);
gulp.task('watch', () => {
- gulp.watch('../**/*.adoc', ['docs']);
-});
+ gulp.watch(['../components/**/*.adoc', '!../components/readme.adoc'], (event) => {
+ components(event.path);
+ });
+ gulp.watch('../components/readme.adoc', (event) => {
+ componentReadme();
+ });
+});