mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Gulp: Simplify build options handling and remove gitty dependency.
This commit is contained in:
parent
f4b6dc0914
commit
5cbc8ef775
1 changed files with 17 additions and 17 deletions
|
@ -10,29 +10,29 @@
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var gitty = require('gitty'),
|
var execSync = require('child_process').execSync,
|
||||||
extend = require('extend');
|
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
|
function git(command) {
|
||||||
// make amendments, e.g. the release date.
|
return execSync('git ' + command).toString().trim();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the date of the last commit from this branch for release date:
|
// Get the date of the last commit from this branch for release date:
|
||||||
options.date = git('log -1 --pretty=format:%ad');
|
var date = git('log -1 --pretty=format:%ad'),
|
||||||
// If we're not on the master branch, append the branch name to the version:
|
branch = git('rev-parse --abbrev-ref HEAD');
|
||||||
var branch = git('rev-parse --abbrev-ref HEAD'),
|
|
||||||
suffix = branch === 'master' ? '' : '-' + 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
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = function(opts) {
|
module.exports = function(opts) {
|
||||||
return extend({}, options, opts && opts.suffix && {
|
return extend({}, options, opts && opts.suffix && {
|
||||||
version: options.version + suffix
|
version: options.version + options.suffix
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue