diff options
author | Sam Potts <me@sampotts.me> | 2015-03-03 19:57:46 +1100 |
---|---|---|
committer | Sam Potts <me@sampotts.me> | 2015-03-03 19:57:46 +1100 |
commit | 27a0ec9424978d3df5d029df528ca077b3a908dd (patch) | |
tree | 182732cb74825b0ad7f42e47d2440565023b1c9e /gulpfile.js | |
parent | 6520a466f361c28ad49aa4635a40adf769c0bdbb (diff) | |
download | plyr-27a0ec9424978d3df5d029df528ca077b3a908dd.tar.lz plyr-27a0ec9424978d3df5d029df528ca077b3a908dd.tar.xz plyr-27a0ec9424978d3df5d029df528ca077b3a908dd.zip |
Open docs site on publish
Diffstat (limited to 'gulpfile.js')
-rw-r--r-- | gulpfile.js | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/gulpfile.js b/gulpfile.js index 0bd79d64..7b530d25 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,6 +2,7 @@ // Gulp build script // ========================================================================== /*global require, __dirname*/ +/*jshint -W079 */ var fs = require("fs"), path = require("path"), @@ -20,7 +21,8 @@ var fs = require("fs"), rename = require("gulp-rename"), s3 = require("gulp-s3"), gzip = require("gulp-gzip"), - replace = require("gulp-replace"); + replace = require("gulp-replace"), + open = require("gulp-open"); var root = __dirname, paths = { @@ -190,13 +192,12 @@ gulp.task("watch", function () { gulp.watch(paths.docs.src.templates, "js"); }); -// Publish the docs site -try { - var aws = loadJSON(path.join(root, "aws.json")); -} -catch (e) { } +// Publish a version to CDN and docs +// -------------------------------------------- -var version = package.version, +// Some options +var aws = loadJSON(path.join(root, "aws.json")), +version = package.version, maxAge = 31536000, // seconds 1 year options = { cdn: { @@ -216,6 +217,7 @@ options = { }, cdnpath = new RegExp(aws.cdn.bucket + "\/(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)","gi"); +// Publish version to CDN bucket gulp.task("cdn", function () { console.log("Uploading " + version + " to " + aws.cdn.bucket); @@ -228,6 +230,7 @@ gulp.task("cdn", function () { .pipe(s3(aws.cdn, options.cdn)); }); +// Publish to Docs bucket gulp.task("docs", function () { console.log("Uploading " + version + " docs to " + aws.docs.bucket); @@ -244,6 +247,20 @@ gulp.task("docs", function () { .pipe(s3(aws.cdn, options.docs)); }); +// Open the docs site to check it's sweet +gulp.task("open", function () { + console.log("Opening " + aws.docs.bucket + "..."); + + // A file must be specified or gulp will skip the task + // Doesn't matter which file since we set the URL above + // Weird, I know... + gulp.src([paths.docs.root + "index.html"]) + .pipe(open("", { + url: "http://" + aws.docs.bucket + })); +}); + +// Do everything gulp.task("publish", function () { - run("templates", tasks.js, tasks.less, "sprite", "cdn", "docs"); + run("templates", tasks.js, tasks.less, "sprite", "cdn", "docs", "open"); });
\ No newline at end of file |