mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-28 17:02:24 -05:00
Some more work on gulp
Change the way versions are handled, and append the branch name if we're not publishing from master.
This commit is contained in:
parent
4351ca310f
commit
eaceb1bfc3
4 changed files with 30 additions and 15 deletions
30
gulpfile.js
30
gulpfile.js
|
@ -22,7 +22,7 @@ var gulp = require('gulp'),
|
|||
merge = require('merge-stream'),
|
||||
del = require('del'),
|
||||
zip = require('gulp-zip'),
|
||||
gitty = require('gitty')('.'),
|
||||
gitty = require('gitty'),
|
||||
fs = require('fs');
|
||||
|
||||
/**
|
||||
|
@ -54,6 +54,30 @@ var acornPath = 'bower_components/acorn/';
|
|||
var buildNames = Object.keys(buildOptions);
|
||||
var docNames = Object.keys(docOptions);
|
||||
|
||||
/**
|
||||
* Git
|
||||
*/
|
||||
|
||||
var gitRepo = gitty('.');
|
||||
|
||||
function git(param) {
|
||||
var args = arguments.length === 1 ? param.split(' ') : [].slice.apply(arguments);
|
||||
var operation = args.shift();
|
||||
return new gitty.Command(gitRepo, operation, args).execSync().trim();
|
||||
}
|
||||
|
||||
var gitDate = git('log -1 --pretty=format:%ad');
|
||||
var gitVersion = git('describe --abbrev=0 --tags');
|
||||
var gitBranch = git('rev-parse --abbrev-ref HEAD');
|
||||
if (gitBranch !== 'master')
|
||||
gitVersion += '-' + gitBranch;
|
||||
|
||||
gulp.task('nop');
|
||||
|
||||
/**
|
||||
* Task: default
|
||||
*/
|
||||
|
||||
gulp.on('error', function(err) {
|
||||
console.error(err.toString());
|
||||
gulp.emit('end');
|
||||
|
@ -120,7 +144,6 @@ gulp.task('build',
|
|||
);
|
||||
|
||||
// Get the date of the last commit from git.
|
||||
var gitLog = gitty.logSync('-1');
|
||||
buildNames.forEach(function(name) {
|
||||
gulp.task('build:' + name, ['build:start'], function() {
|
||||
return gulp.src('src/paper.js')
|
||||
|
@ -128,7 +151,8 @@ buildNames.forEach(function(name) {
|
|||
evaluate: ['src/constants.js', 'src/options.js'],
|
||||
setup: function() {
|
||||
var options = buildOptions[name];
|
||||
options.date = gitLog[0].date;
|
||||
options.version = gitVersion;
|
||||
options.date = gitDate;
|
||||
// This object will be merged into the Prepro.js VM scope,
|
||||
// which already holds a __options object from the above
|
||||
// include statement.
|
||||
|
|
|
@ -45,10 +45,7 @@ if (typeof window === 'object') {
|
|||
// This object will be merged into the Prepro.js VM scope, which already
|
||||
// holds a __options object from the above include statement.
|
||||
return {
|
||||
__options: {
|
||||
version: 'dev',
|
||||
environment: 'node'
|
||||
}
|
||||
__options: { environment: 'node' }
|
||||
};
|
||||
});
|
||||
// Load Paper.js library files.
|
||||
|
|
|
@ -14,14 +14,8 @@
|
|||
// browser based compile-time preprocessing when loading the separate source
|
||||
// files directly through load.js / Prepro.js during development.
|
||||
|
||||
// The paper.js version.
|
||||
// NOTE: Adjust value here before calling publish.sh, which then updates and
|
||||
// publishes the various JSON package files automatically.
|
||||
var version = '0.9.25';
|
||||
|
||||
var __options = {
|
||||
// If this file is loaded in the browser, we're in dev mode through load.js
|
||||
version: typeof window === 'object' ? 'dev' : version,
|
||||
version: 'dev',
|
||||
environment: 'browser',
|
||||
parser: 'acorn',
|
||||
svg: true,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Paper.js v*#=* __options.version - The Swiss Army Knife of Vector Graphics Scripting.
|
||||
* Paper.js *#=* __options.version - The Swiss Army Knife of Vector Graphics Scripting.
|
||||
* http://paperjs.org/
|
||||
*
|
||||
* Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
|
||||
|
|
Loading…
Reference in a new issue