]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
In deploy process, split version number prompt and replace into two Gulp tasks
authorGeoff Kimball <geoff@zurb.com>
Wed, 2 Dec 2015 23:14:42 +0000 (15:14 -0800)
committerGeoff Kimball <geoff@zurb.com>
Wed, 2 Dec 2015 23:14:42 +0000 (15:14 -0800)
gulp/deploy.js
package.json

index ac3d4e101f310570b3770d506fea83372ab8d636..ad9ddf6cddcf0fcba7f7469d145c86f897e745a7 100644 (file)
@@ -9,6 +9,8 @@ var rsync = require('gulp-rsync');
 var replace = require('gulp-replace');
 var git = require('gitty')('../');
 var octophant = require('octophant');
+var sequence = require('run-sequence');
+var inquirer = require('inquirer');
 
 var VERSIONED_FILES = [
   'bower.json',
@@ -23,17 +25,23 @@ var CURRENT_VERSION = require('../package.json').version;
 var NEXT_VERSION;
 
 gulp.task('deploy', function(cb) {
-  sequence('deploy:version', 'deploy:dist', 'deploy:settings', 'deploy:commit', 'deploy:docs', cb);
+  sequence('deploy:prompt', 'deploy:version', 'deploy:dist', 'deploy:settings', 'deploy:commit', cb);
+});
+
+gulp.task('deploy:prompt', function(cb) {
+  inquirer.prompt([{
+    type: 'input',
+    name: 'version',
+    message: 'What version are we moving to? (Current version is ' + CURRENT_VERSION + ')'
+  }], function(res) {
+    NEXT_VERSION = res.version;
+    cb();
+  });
 });
 
 // Bumps the version number in any file that has one
 gulp.task('deploy:version', function() {
   return gulp.src(VERSIONED_FILES, { base: process.cwd() })
-    .pipe(prompt({
-      type: 'input',
-      name: 'version',
-      message: 'What version are we moving to? (Current version is ' + CURRENT_VERSION + ')'
-    }, setVersionNumber))
     .pipe(replace(CURRENT_VERSION, NEXT_VERSION))
     .pipe(gulp.dest('.'));
 });
@@ -82,10 +90,10 @@ gulp.task('deploy:settings', function(cb) {
 
 // Writes a commit with the changes to the version numbers
 gulp.task('deploy:commit', function(cb) {
-  git.addSync('.');
-  git.commitSync('Bump to version ' + NEW_VERSION);
+  git.commitSync('Bump to version ' + NEW_VERSION, { a: true });
   git.tagSync('v' + NEW_VERSION);
-  git.push('origin', 'develop', cb);
+  // git.push('origin', 'develop', cb);
+  cb();
 });
 
 // Uploads the documentation to the live server
@@ -114,8 +122,3 @@ gulp.task('deploy:custom', ['sass:foundation', 'javascript:foundation'], functio
       .pipe(rename('foundation.min.js'))
       .pipe(gulp.dest('./_build/assets/js'));
 });
-
-// Callback used by Inquirer in the deploy:version task to set the input version number
-function setVersionNumber(res) {
-  NEXT_VERSION = res.version;
-}
index 2209bea7ddf00a7817cdec6f5a14fdc57ffd62d9..03ebb25eec5635b1c9b45c0894410500bc64fec2 100644 (file)
@@ -40,6 +40,7 @@
     "gulp-uglify": "^1.1.0",
     "handlebars": "^3.0.1",
     "highlight.js": "^8.5.0",
+    "inquirer": "^0.11.0",
     "marked": "^0.3.3",
     "mocha": "^2.3.3",
     "motion-ui": "^1.1.0",