2016-01-23 12:26:56 -05:00
|
|
|
/*
|
|
|
|
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
|
|
|
|
* http://paperjs.org/
|
|
|
|
*
|
2020-05-23 16:24:42 -04:00
|
|
|
* Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey
|
|
|
|
* http://juerglehni.com/ & https://puckey.studio/
|
2016-01-23 12:26:56 -05:00
|
|
|
*
|
|
|
|
* Distributed under the MIT license. See LICENSE file for details.
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2016-01-31 08:45:34 -05:00
|
|
|
var execSync = require('child_process').execSync,
|
|
|
|
// Require the __options object, so we have access to the version number and
|
|
|
|
// make amendments, e.g. the release date.
|
2016-09-20 17:07:38 -04:00
|
|
|
options = require('../../src/options.js'),
|
|
|
|
argv = require('minimist')(process.argv.slice(2));
|
2016-01-23 12:26:56 -05:00
|
|
|
|
2016-01-31 08:45:34 -05:00
|
|
|
function git(command) {
|
|
|
|
return execSync('git ' + command).toString().trim();
|
2016-01-23 12:26:56 -05:00
|
|
|
}
|
|
|
|
|
2016-07-09 14:56:58 -04:00
|
|
|
options.date = git('log -1 --pretty=format:%ad');
|
|
|
|
options.branch = git('rev-parse --abbrev-ref HEAD');
|
|
|
|
|
2016-09-20 17:07:38 -04:00
|
|
|
// If a specific branch is requested, quit without errors if we don't match.
|
2019-04-11 14:01:31 -04:00
|
|
|
var ensureBranch = argv['ensure-branch'];
|
|
|
|
if (ensureBranch && ensureBranch !== options.branch) {
|
|
|
|
console.log('Branch "' + options.branch + '" does not match requested "' +
|
|
|
|
ensureBranch + '". There is nothing to do here.');
|
2016-09-20 17:07:38 -04:00
|
|
|
process.exit(0);
|
|
|
|
}
|
|
|
|
|
2016-01-23 12:26:56 -05:00
|
|
|
// Get the date of the last commit from this branch for release date:
|
2016-07-09 14:56:58 -04:00
|
|
|
var version = options.version,
|
|
|
|
branch = options.branch;
|
|
|
|
|
2017-12-04 18:34:59 -05:00
|
|
|
// Take this out for now to reduce changes every build
|
|
|
|
// // If we're not on the master branch, use the branch name as a suffix:
|
|
|
|
// if (branch !== 'master')
|
|
|
|
// options.version += '-' + branch;
|
2016-01-31 08:45:34 -05:00
|
|
|
|
2016-07-09 14:56:58 -04:00
|
|
|
// Allow the removal of the suffix again, as needed by the publish task.
|
|
|
|
options.resetVersion = function() {
|
|
|
|
options.version = version;
|
|
|
|
}
|
2016-01-23 12:26:56 -05:00
|
|
|
|
2016-07-09 14:56:58 -04:00
|
|
|
module.exports = options;
|