From d96b19c1481cf6dc90ec6e7e392086496a0b92d5 Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 20 Oct 2014 22:18:45 -0400 Subject: [PATCH] Fixes to tasks for serving docs --- docs.json | 18 ++++++++ gulpfile.js | 71 ++++++++++++++++++++++--------- tasks/defaults.js | 6 ++- tasks/maintainer/docs-files.json | 19 +++++++++ tasks/maintainer/docs-output.json | 19 +++++++++ 5 files changed, 113 insertions(+), 20 deletions(-) create mode 100755 docs.json create mode 100755 tasks/maintainer/docs-files.json create mode 100755 tasks/maintainer/docs-output.json diff --git a/docs.json b/docs.json new file mode 100755 index 000000000..1da2dc1a7 --- /dev/null +++ b/docs.json @@ -0,0 +1,18 @@ +{ + "base": "", + "paths": { + "source": { + "config": "src/theme.config", + "definitions": "src/definitions/", + "site": "src/site/", + "themes": "src/themes/" + }, + "output": { + "packaged": "../docs/docs/dist/", + "uncompressed": "../docs/docs/dist/components/", + "compressed": "../docs/docs/dist/components/", + "themes": "../docs/docs/dist/themes/" + }, + "clean": "../docs/docs/dist/" + } +} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index f2bd4f268..91678d245 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -75,18 +75,11 @@ var *******************************/ try { - // settings + // try to load json var config = require('./semantic.json'), package = require('./package.json') ; - - // shorthand - base = config.base; - clean = config.paths.clean; - output = config.paths.output; - source = config.paths.source; - } catch(error) { var config = false; @@ -97,7 +90,13 @@ catch(error) { *******************************/ var - getDerivedValues = function() { + getConfigValues = function() { + + // shorthand + base = config.base; + clean = config.paths.clean; + output = config.paths.output; + source = config.paths.source; // create glob for matching filenames from selected components componentGlob = (typeof config.components == 'object') @@ -129,7 +128,7 @@ var } ; -getDerivedValues(); +getConfigValues(); /******************************* Tasks @@ -268,9 +267,9 @@ gulp.task('build', 'Builds all files from source', function(callback) { console.info('Building Semantic'); - // get relative asset path (path returns wrong path? hardcoded) + // get relative asset path (path returns wrong path?) // assetPaths.source = path.relative(srcPath, path.resolve(source.themes)); - assetPaths.source = '../../themes'; + assetPaths.source = '../../themes'; // hardcoded // copy assets gulp.src(source.themes + '**/assets/**') @@ -538,7 +537,7 @@ gulp.task('install', 'Set-up project for first time', function () { } if(answers.build == 'yes') { config = require('./semantic.json'); - getDerivedValues(); + getConfigValues(); gulp.start('build'); } })) @@ -553,8 +552,39 @@ gulp.task('install', 'Set-up project for first time', function () { Maintainer ---------------*/ -/* Serve files to an instance of docs hosted adjacent */ -gulp.task('serve', false, function () { +/* Moves watched files to static site generator output */ +gulp.task('serve-docs', false, function () { + config = require('./tasks/maintainer/docs-output.json'); + getConfigValues(); + + // copy source files + gulp + .watch([ + 'src/**/*.*' + ], function(file) { + console.clear(); + return gulp.src(file.path, { base: 'src/' }) + .pipe(gulp.dest(output.less)) + .pipe(print(log.created)) + ; + }) + ; + gulp.start('watch'); +}); + +/* Builds files to docs source */ +gulp.task('build-docs', false, function () { + console.clear(); + // pushes to docpad files + config = require('./tasks/maintainer/docs-output.json'); + getConfigValues(); + gulp.start('build'); + + // copy source + gulp.src('src/**/*.*') + .pipe(gulp.dest(output.less)) + .pipe(print(log.created)) + ; }); @@ -562,15 +592,18 @@ gulp.task('serve', false, function () { /* Bump Version */ gulp.task('bump', false, function () { - // Create RTL Release - - // Create Node Release + // bump package.json + // bump composer.json }); /* Release */ -gulp.task('release', false, function () { +gulp.task('release', false, function() { + +}); + +gulp.task('release all', false, function () { // Create SCSS Version diff --git a/tasks/defaults.js b/tasks/defaults.js index f2484dd5f..81ac58e61 100755 --- a/tasks/defaults.js +++ b/tasks/defaults.js @@ -17,6 +17,10 @@ module.exports = { compressed : 'dist/components/', themes : 'dist/themes/' }, - clean : 'dist/' + clean : 'dist/', + docs : { + source : '../docs/server/files/release/', + output : '../docs/release/' + } } }; \ No newline at end of file diff --git a/tasks/maintainer/docs-files.json b/tasks/maintainer/docs-files.json new file mode 100755 index 000000000..ee8168b62 --- /dev/null +++ b/tasks/maintainer/docs-files.json @@ -0,0 +1,19 @@ +{ + "base": "", + "paths": { + "source": { + "config": "src/theme.config", + "definitions": "src/definitions/", + "site": "src/site/", + "themes": "src/themes/" + }, + "output": { + "less": "../docs/server/files/src/", + "packaged": "../docs/server/files/dist/", + "uncompressed": "../docs/server/files/dist/components/", + "compressed": "../docs/server/files/dist/components/", + "themes": "../docs/server/files/dist/themes/" + }, + "clean": "../docs/server/files/dist/" + } +} \ No newline at end of file diff --git a/tasks/maintainer/docs-output.json b/tasks/maintainer/docs-output.json new file mode 100755 index 000000000..def2e8a3e --- /dev/null +++ b/tasks/maintainer/docs-output.json @@ -0,0 +1,19 @@ +{ + "base": "", + "paths": { + "source": { + "config": "src/theme.config", + "definitions": "src/definitions/", + "site": "src/site/", + "themes": "src/themes/" + }, + "output": { + "less": "../docs/out/src/", + "packaged": "../docs/out/dist/", + "uncompressed": "../docs/out/dist/components/", + "compressed": "../docs/out/dist/components/", + "themes": "../docs/out/dist/themes/" + }, + "clean": "../docs/out/dist/" + } +} \ No newline at end of file