forked from betsol/angular-input-modified
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
128 lines (102 loc) · 2.52 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
//==============//
// DEPENDENCIES //
//==============//
var del = require('del');
var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var gutil = require('gulp-util');
var deploy = require('gulp-gh-pages');
var debug = require('gulp-debug');
var serverFactory = require('spa-server');
var ngAnnotate = require('gulp-ng-annotate');
var angularProtractor = require('gulp-angular-protractor');
var runSequence = require('run-sequence');
var concat = require('gulp-concat');
//=========//
// GLOBALS //
//=========//
var demoServer;
//=======//
// CLEAN //
//=======//
gulp.task('clean', function (callback) {
del(['dist'], callback);
});
//=======//
// BUILD //
//=======//
gulp.task('build', ['clean'], function () {
gulp
.src([
// This file contains module registration and therefore should go first.
'./src/directive/bsModifiable.js',
'./src/inputModifiedConfig.js',
'./src/directive/form.js',
'./src/directive/ngModel.js'
])
.pipe(concat('angular-input-modified.js'))
.pipe(ngAnnotate({
'single_quotes': true
}))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(rename('angular-input-modified.min.js'))
.pipe(gulp.dest('dist'))
.on('error', gutil.log)
;
});
//===========//
// WEBSERVER //
//===========//
gulp.task('webserver.start', function (callback) {
demoServer = serverFactory.create({
path: './demos',
port: 8888,
serveStaticConfig: {
index: 'index.html'
}
});
demoServer.start(callback);
});
gulp.task('webserver.stop', function (callback) {
demoServer.stop(callback);
});
//=======//
// DEMOS //
//=======//
gulp.task('demo', ['webserver.start']);
gulp.task('demo-deploy', function () {
return gulp.src('./demos/**/*.*')
.pipe(debug({
title: 'Deploy'
}))
.pipe(deploy());
});
//=======//
// TESTS //
//=======//
gulp.task('test', function (callback) {
// Starting web-server, then running end-to-end tests on it.
runSequence('webserver.start', 'test-e2e', 'webserver.stop', callback);
});
//------------//
// TESTS: E2E //
//------------//
gulp.task('test-e2e', function () {
return gulp.src(['./tests/e2e/spec.js'])
.pipe(angularProtractor({
configFile: './tests/e2e/conf.js',
args: ['--baseUrl', 'http://localhost:8888'],
autoStartStopServer: true,
debug: true
}))
.on('error', function (error) {
throw error;
})
;
});
//==============//
// DEFAULT TASK //
//==============//
gulp.task('default', ['build']);