-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
58 lines (46 loc) · 1.38 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
/**
* Created by saidatrahouchecharrouti on 10/11/15.
*/
var gulp = require('gulp');
var jasmine = require('gulp-jasmine');
var isTravis = process.env.TRAVIS || false;
var minimist = require('minimist');
var args = minimist(process.argv.slice(2));
var gulpsftp = require('gulp-sftp');
var publics = ['public/**/*.html',
'public/**/*.js',
'public/**/*.css',
'public/**/*.json',
'public/**/*.jpg',
'public/**/*.png',
'public/**/*.wav'];
var server = ['server/*.js'];
var test = ['spec/**.js'];
var root = ['app.js', 'ecosystem.json', 'package.json']
var modules = ['modules/*.js'];
gulp.task('default', ['test', 'deploy']);
gulp.task('test', function(){
return gulp.src(test)
.pipe(jasmine())
});
//nombre de la tarea, dependencias, funcion. Tambien se puede hacer con stream off
//Si la tarea de la que depende sale con error, no se ejecuta
gulp.task('deploy', function(){
gulp.src(publics)
.pipe(gulpsftp(generatePath('public')));
gulp.src(server)
.pipe(gulpsftp(generatePath('server')));
gulp.src(root)
.pipe(gulpsftp(generatePath('')));
gulp.src(modules)
.pipe(gulpsftp(generatePath('modules')));
});
function generatePath(path){
return {
host: '46.101.214.219',
port: '22',
user: args.user,
password: args.password,
remotePath: '/root/GameVoting/' + path
};
}