From 22c7b5cd25d9ec532528eee80f293e489d862a36 Mon Sep 17 00:00:00 2001 From: Jay Traband Date: Fri, 25 Sep 2015 01:28:36 -0700 Subject: [PATCH] added check-deploy gulp task --- gulpfile.js | 32 ++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 33 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 4721cc5af0..35e8d910a4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,6 +14,9 @@ var Minimatch = require("minimatch").Minimatch; var Dgeni = require('dgeni'); var fsExtra = require('fs-extra'); var fs = fsExtra; +var exec = require('child_process').exec; +var execPromise = Q.denodeify(exec); +var prompt = require('prompt'); var docShredder = require('./public/doc-shredder/doc-shredder'); @@ -164,6 +167,35 @@ gulp.task('git-changed-examples', ['_shred-devguide-examples'], function(){ }); }); +gulp.task('check-deploy', function() { + return execPromise(['harp compile . ./deploy'], {}).then(function() { + execPromise('live-server', {cwd: './deploy'}); + return askDeploy(); + }).then(function(shouldDeploy) { + if (shouldDeploy) { + console.log("Sorry! Deploy to Firebase has not yet been implemented.") + } + return; + }); +}); + +// returns a promise; +function askDeploy() { + + prompt.start(); + var schema = { + name: 'shouldDeploy', + description: 'Deploy to Firebase? (y/n): ', + type: 'string', + pattern: /Y|N|y|n/, + message: "Respond with either a 'y' or 'n'", + required: true + } + var getPromise = Q.denodeify(prompt.get); + return getPromise([schema]).then(function(result) { + return result.shouldDeploy.toLowerCase() === 'y'; + }); +} gulp.task('test-api-builder', function (cb) { diff --git a/package.json b/package.json index 9dccdc375b..e3d82398fa 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "node-html-encoder": "0.0.2", "nodegit": "^0.4.1", "path": "^0.11.14", + "prompt": "^0.2.14", "q": "^1.4.1", "typescript": "~1.5.3", "yargs": "^3.23.0"