From 5cbc8ef7753e1ac47d6b43d4840573a3f415ac57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 31 Jan 2016 14:45:34 +0100 Subject: [PATCH] Gulp: Simplify build options handling and remove gitty dependency. --- gulp/utils/options.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gulp/utils/options.js b/gulp/utils/options.js index c743c386..1b6b9111 100644 --- a/gulp/utils/options.js +++ b/gulp/utils/options.js @@ -10,29 +10,29 @@ * All rights reserved. */ -var gitty = require('gitty'), - extend = require('extend'); +var execSync = require('child_process').execSync, + extend = require('extend'), + // Require the __options object, so we have access to the version number and + // make amendments, e.g. the release date. + options = require('../../src/options.js'); -// Require the __options object, so we have access to the version number and -// make amendments, e.g. the release date. -var options = require('../../src/options.js'), - repo = gitty('.'); - -function git(param) { - var args = arguments.length === 1 ? param.split(' ') - : [].slice.apply(arguments), - operation = args.shift(); - return new gitty.Command(repo, operation, args).execSync().trim(); +function git(command) { + return execSync('git ' + command).toString().trim(); } // Get the date of the last commit from this branch for release date: -options.date = git('log -1 --pretty=format:%ad'); -// If we're not on the master branch, append the branch name to the version: -var branch = git('rev-parse --abbrev-ref HEAD'), - suffix = branch === 'master' ? '' : '-' + branch; +var date = git('log -1 --pretty=format:%ad'), + branch = git('rev-parse --abbrev-ref HEAD'); + +extend(options, { + date: date, + branch: branch, + // If we're not on the master branch, use the branch name as a suffix: + suffix: branch === 'master' ? '' : '-' + branch +}); module.exports = function(opts) { return extend({}, options, opts && opts.suffix && { - version: options.version + suffix + version: options.version + options.suffix }); };