Added git hooks to run tests and lint on commit
This commit is contained in:
parent
de81186faf
commit
728119877b
7
git_hooks/pre-commit
Executable file
7
git_hooks/pre-commit
Executable 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
|
||||
|
10
gulpfile.js
10
gulpfile.js
|
@ -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']);
|
||||
});
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue