1
0
Fork 0

Added git hooks to run tests and lint on commit

This commit is contained in:
Michaël Lemaire 2015-02-09 01:00:00 +01:00
parent de81186faf
commit 728119877b
4 changed files with 19 additions and 4 deletions

7
git_hooks/pre-commit Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
set -e
git_root=$(git rev-parse --show-toplevel)
PATH=${PATH}:${git_root}/bin ${git_root}/bin/gulp strict

View file

@ -75,6 +75,11 @@ gulp.task('tslint', function () {
emitError: false
}));
});
gulp.task('tslintstrict', function () {
return gulp.src(['src/scripts/game/**/*.ts', 'src/scripts/view/**/*.ts'])
.pipe(tslint())
.pipe(tslint.report('verbose'));
});
gulp.task('processhtml', function () {
return gulp.src(paths.index)
@ -121,7 +126,7 @@ gulp.task('minifyCss', ['less'], function () {
gulp.task('deploy', function () {
return gulp.src('./dist/**/*')
.pipe(deploy({
remoteUrl: "git@github.com:thunderk/spacetac.git",
remoteUrl: "git@github.com:thunderk/spacetac.git"
}));
});
@ -131,3 +136,6 @@ gulp.task('default', function () {
gulp.task('build', function () {
return runSequence('clean', ['typescript', 'tslint', 'less', 'copy', 'minifyJs', 'minifyCss', 'processhtml']);
});
gulp.task('strict', function () {
return runSequence('clean', ['typescript', 'tslintstrict', 'tests']);
});

View file

@ -92,11 +92,11 @@ module SpaceTac.Game {
var alive_fleets = this.countAliveFleets();
if (alive_fleets == 0) {
if (alive_fleets === 0) {
// It's a draw
this.ended = true;
this.log.add(new EndBattleEvent(null));
} else if (alive_fleets == 1) {
} else if (alive_fleets === 1) {
// We have a winner
var winner: Player = null;
this.fleets.forEach((fleet: Fleet) => {

View file

@ -153,7 +153,7 @@ module SpaceTac.Game {
var ship1 = new Ship(fleet1, "F1S1");
var ship2 = new Ship(fleet1, "F1S2");
var ship3 = new Ship(fleet2, "F2S1");
new Ship(fleet2, "F2S1");
var battle = new Battle(fleet1, fleet2);