Only use precommit and prepush hooks when working on develop branch.

This should solve @iconexperience's troubles outlined in https://github.com/paperjs/paper.js/issues/1116#issuecomment-244037792
This commit is contained in:
Jürg Lehni 2016-09-20 17:07:38 -04:00
parent befac6b8da
commit 56cfdd9ab6
3 changed files with 13 additions and 4 deletions

View file

@ -32,7 +32,7 @@ install:
before_script:
- travis/setup-git.sh
- npm set progress=false
- which gulp || npm install -g gulp
- which gulp || npm install -g gulp-cli
- npm install
script:
- gulp jshint

View file

@ -13,7 +13,8 @@
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.
options = require('../../src/options.js');
options = require('../../src/options.js'),
argv = require('minimist')(process.argv.slice(2));
function git(command) {
return execSync('git ' + command).toString().trim();
@ -22,6 +23,13 @@ function git(command) {
options.date = git('log -1 --pretty=format:%ad');
options.branch = git('rev-parse --abbrev-ref HEAD');
// If a specific branch is requested, quit without errors if we don't match.
if (argv.branch && argv.branch !== options.branch) {
console.log('Branch "' + options.branch + '" does not match "' +
argv.branch + '". There is nothing to do here.');
process.exit(0);
}
// Get the date of the last commit from this branch for release date:
var version = options.version,
branch = options.branch;

View file

@ -15,8 +15,8 @@
],
"main": "dist/paper-full.js",
"scripts": {
"precommit": "gulp jshint",
"prepush": "gulp test",
"precommit": "gulp jshint --branch develop",
"prepush": "gulp test --branch develop",
"build": "gulp build",
"dist": "gulp dist",
"zip": "gulp zip",
@ -66,6 +66,7 @@
"jshint": "^2.9.2",
"jshint-summary": "^0.4.0",
"merge-stream": "^1.0.0",
"minimist": "^1.2.0",
"prepro": "^2.4.0",
"qunitjs": "^1.23.0",
"require-dir": "^0.3.0",