Gulp: More work on improved publish task for Bower.

This commit is contained in:
Jürg Lehni 2016-07-09 20:56:58 +02:00
parent 1b1b9a1606
commit 0311c267f5
9 changed files with 40 additions and 32 deletions

View file

@ -20,19 +20,20 @@ function git(command) {
return execSync('git ' + command).toString().trim();
}
options.date = git('log -1 --pretty=format:%ad');
options.branch = git('rev-parse --abbrev-ref HEAD');
// Get the date of the last commit from this branch for release date:
var date = git('log -1 --pretty=format:%ad'),
branch = git('rev-parse --abbrev-ref HEAD');
var version = options.version,
branch = options.branch;
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
});
// If we're not on the master branch, use the branch name as a suffix:
if (branch !== 'master')
options.version += '-' + branch;
module.exports = function(opts) {
return extend({}, options, opts && opts.suffix && {
version: options.version + options.suffix
});
};
// Allow the removal of the suffix again, as needed by the publish task.
options.resetVersion = function() {
options.version = version;
}
module.exports = options;