-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (69 loc) · 2.28 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var gulp = require('gulp');
var exit = require("gulp-exit");
var jasmine = require('gulp-jasmine');
var Knex = require("knex");
var Promise = require("bluebird");
var travisdb = require("./knexfile.js").staging;
var localdb = require("./knexfile.js").development;
gulp.task('travis_build',function(){
var knex = Knex(travisdb);
return knex.migrate.latest()
.then(function(){
return new Promise(function(resolve,rejected){
setTimeout(function readySeed(){
knex.schema.hasTable("users").then(function(exist){
if(!exist) setTimeout(readySeed,1000);
else resolve(knex);
});
},1000);
});
})
.then(function(knex){
return knex.seed.run();
})
.then(function(){
return new Promise(function(resolve,rejected){
setTimeout(function readyTest(){
knex.schema.hasColumn("users","account").then(function(exist){
if(!exist) setTimeout(readyTest,500);
else resolve("Ready to Test!!");
});
},500);
});
})
.then(function(message){
console.log(message);
return gulp.src('spec/travisSpec.js').pipe(jasmine()).pipe(exit());
});
});
gulp.task('local_build',function(){
var knex = Knex(localdb);
return knex.migrate.latest()
.then(function(){
return new Promise(function(resolve,rejected){
setTimeout(function genSeed(){
knex.schema.hasTable("users").then(function(exist){
if(!exist) setTimeout(genSeed,100);
else resolve(knex);
});
},100);
});
})
.then(function(knex){
return knex.seed.run();
})
.then(function(){
return new Promise(function(resolve,rejected){
setTimeout(function test(){
knex.schema.hasColumn("users","account").then(function(exist){
if(!exist) setTimeout(test,100);
else resolve("Ready to Test!!");
});
},100);
});
})
.then(function(message){
console.log(message);
return gulp.src('spec/localSpec.js').pipe(jasmine()).pipe(exit());;
});
});