From 82ddb9b16f49ef4ef48694338f02155193e5bdda Mon Sep 17 00:00:00 2001 From: Pete Brousalis Date: Sun, 17 Jul 2016 14:50:50 -0500 Subject: [PATCH] [BUGFIX] beef up error checking on release --- gulpfile.js/config.js | 2 +- gulpfile.js/tasks/release.js | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gulpfile.js/config.js b/gulpfile.js/config.js index 71f15ef..0caef77 100644 --- a/gulpfile.js/config.js +++ b/gulpfile.js/config.js @@ -84,7 +84,7 @@ var settings = { ] }, - github: { // Options for github release + release: { // Options for github release upstream: 'origin', // The "upstream" branch to fetch changes from branch: 'master', // Which branch to push the created release and tags to }, diff --git a/gulpfile.js/tasks/release.js b/gulpfile.js/tasks/release.js index b40d556..a8f4790 100644 --- a/gulpfile.js/tasks/release.js +++ b/gulpfile.js/tasks/release.js @@ -42,7 +42,7 @@ gulp.task('bump', function(callback) { // Fetches tags gulp.task('fetch', function(callback) { - git.fetch(config.github.upstream, '', {quiet: true}, callback); + git.fetch(config.release.upstream, '', {quiet: true}, callback); }); // Commits the manifest with the bumped version number @@ -58,7 +58,7 @@ gulp.task('commit', function(callback) { gulp.task('push', function (callback) { util.log(gutil.colors.yellow('Pushing version bump to ' + manifest.version())); - git.push(config.github.upstream, config.github.branch, callback); + git.push(config.release.upstream, config.release.branch, callback); }); // Takes the zip'd up build folder and posts it to a GitHub release @@ -71,8 +71,9 @@ gulp.task('github-release', function(callback) { var dest = config.paths.build; - if (config.build.archive) + if (config.build.archive) { dest = path.join(config.paths.build, config.build.archiveName) + } return gulp.src(dest) .pipe(githubRelease({ @@ -88,12 +89,17 @@ gulp.task('github-release', function(callback) { function release(callback) { if (process.env.GITHUB_TOKEN === '' || process.env.GITHUB_TOKEN === undefined) { - util.errorHandler('deploy')(new Error('Missing GITHUB_TOKEN environment variable')); + util.errorHandler('release')(new Error('Missing GITHUB_TOKEN environment variable.')); return false; } if (!util.fileExists(config.paths.build)) { - util.errorHandler('deploy')(new Error('You need to build the application first. Run `gulp build`')); + util.errorHandler('release')(new Error('You need to build the application first. Run `gulp build`.')); + return; + } + + if (!manifest.repo()) { + util.errorHandler('release')(new Error('You need to fix your `package.json` url and repo fields.')); return; }