Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 22c7b5c

Browse files
committed
added check-deploy gulp task
1 parent c7e6265 commit 22c7b5c

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

gulpfile.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ var Minimatch = require("minimatch").Minimatch;
1414
var Dgeni = require('dgeni');
1515
var fsExtra = require('fs-extra');
1616
var fs = fsExtra;
17+
var exec = require('child_process').exec;
18+
var execPromise = Q.denodeify(exec);
19+
var prompt = require('prompt');
1720

1821

1922
var docShredder = require('./public/doc-shredder/doc-shredder');
@@ -164,6 +167,35 @@ gulp.task('git-changed-examples', ['_shred-devguide-examples'], function(){
164167
});
165168
});
166169

170+
gulp.task('check-deploy', function() {
171+
return execPromise(['harp compile . ./deploy'], {}).then(function() {
172+
execPromise('live-server', {cwd: './deploy'});
173+
return askDeploy();
174+
}).then(function(shouldDeploy) {
175+
if (shouldDeploy) {
176+
console.log("Sorry! Deploy to Firebase has not yet been implemented.")
177+
}
178+
return;
179+
});
180+
});
181+
182+
// returns a promise;
183+
function askDeploy() {
184+
185+
prompt.start();
186+
var schema = {
187+
name: 'shouldDeploy',
188+
description: 'Deploy to Firebase? (y/n): ',
189+
type: 'string',
190+
pattern: /Y|N|y|n/,
191+
message: "Respond with either a 'y' or 'n'",
192+
required: true
193+
}
194+
var getPromise = Q.denodeify(prompt.get);
195+
return getPromise([schema]).then(function(result) {
196+
return result.shouldDeploy.toLowerCase() === 'y';
197+
});
198+
}
167199

168200

169201
gulp.task('test-api-builder', function (cb) {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"node-html-encoder": "0.0.2",
5050
"nodegit": "^0.4.1",
5151
"path": "^0.11.14",
52+
"prompt": "^0.2.14",
5253
"q": "^1.4.1",
5354
"typescript": "~1.5.3",
5455
"yargs": "^3.23.0"

0 commit comments

Comments
 (0)