diff options
-rw-r--r-- | dist/s_wtstats | 31 | ||||
-rw-r--r-- | tools/template/README.md | 2 | ||||
-rw-r--r-- | tools/template/gulpfile.js | 4 |
3 files changed, 34 insertions, 3 deletions
diff --git a/dist/s_wtstats b/dist/s_wtstats new file mode 100644 index 00000000000..4545b81b765 --- /dev/null +++ b/dist/s_wtstats @@ -0,0 +1,31 @@ +#! /bin/sh + +# Create wtstats.template.html file + +t=__wt.$$ +trap 'rm -f $t; exit 0' 0 1 2 3 13 15 + +out=wtstats.html.template +# We require npm which may not be installed. +type npm > /dev/null 2>&1 || { + echo 's_wtstats: npm not found' >&2 + echo ' npm is part of node.js from http://nodejs.org' >&2 + exit 1 +} + +cd ../tools/template || exit 1 +rm -f ./$out +npm run build >$t 2>&1 || { + echo "s_wtstats: npm failed" >&2 + cat $t + exit 1 +} +test -f ./$out || { + echo "s_wtstats: $out not created" >&2 + cat $t + exit 1 +} +f=../$out +cmp ./$out $f > /dev/null 2>&1 || + (echo "Building tools/$out" && rm -f $f && cp ./$out $f) +exit 0 diff --git a/tools/template/README.md b/tools/template/README.md index 4e2cb348dd7..14d2f91d185 100644 --- a/tools/template/README.md +++ b/tools/template/README.md @@ -14,7 +14,7 @@ Once you have `npm` installed, follow these steps: 2. run `npm install` to install all missing dependencies. 3. run `npm run build` to build the template. -The build script packs everything into a single HTML file and copies it to its parent folder as `./tools/wtstats.html.template`. +The build script packs everything into a single HTML file and copies it to `./tools/template/wtstats.html.template`. ### Usage diff --git a/tools/template/gulpfile.js b/tools/template/gulpfile.js index e03be8dcaf3..d2da47ec388 100644 --- a/tools/template/gulpfile.js +++ b/tools/template/gulpfile.js @@ -135,7 +135,7 @@ gulp.task('styles', function() { /** * 'gulp pack' will build all targets, then run packify to bundle everything into - * a single .html file, and save this template in the tools directory. + * a single .html file, and save this template in the templates directory. */ gulp.task('pack', ['default'], function() { process.chdir('./' + BUILD) @@ -144,7 +144,7 @@ gulp.task('pack', ['default'], function() { } packify(opts, function (err, packed) { if (err) return console.error(err); - fs.writeFileSync('../../wtstats.html.template', packed); + fs.writeFileSync('../wtstats.html.template', packed); }); }); |