forked from McNull/angular-markdown-text
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
94 lines (66 loc) · 2.73 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
#!/usr/bin/env node
// - - - - 8-< - - - - - - - - - - - - - - - - - - -
var config = require('./build-config.js');
var path = require('path');
var clean = require('gulp-rimraf');
// - - - - 8-< - - - - - - - - - - - - - - - - - - -
var gulp = require('gulp');
// - - - - 8-< - - - - - - - - - - - - - - - - - - -
require('./gulp-tasks/bower-task.js')(gulp);
require('./gulp-tasks/index-task.js')(gulp);
require('./gulp-tasks/modules-task.js')(gulp);
// - - - - 8-< - - - - - - - - - - - - - - - - - - -
gulp.task('app-copy-readme', ['app-copy-clean'], function() {
var path = require('path');
return gulp.src('README.md')
.pipe(gulp.dest(path.join(config.folders.dest, 'app')));
});
var appCopy = gulp.tasks['app-copy'];
appCopy.dep.push('app-copy-readme');
// - - - - 8-< - - - - - - - - - - - - - - - - - - -
var karma = require('gulp-karma');
gulp.task('test-run', ['angular-markdown-text'], function () {
return gulp.src([
'bower_components/angular/angular.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/showdown/compressed/showdown.js',
path.join(config.folders.dest, 'angular-markdown-text/angular-markdown-text.min.js'),
path.join(config.folders.src, 'angular-markdown-text/**/*.test.js')
])
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
})).on('error', function (err) {
throw err;
});
});
gulp.task('test-watch', ['angular-markdown-text'], function () {
gulp.src([
'bower_components/angular/angular.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/showdown/compressed/showdown.js',
path.join(config.folders.src, 'angular-markdown-text/angular-markdown-text.js'),
path.join(config.folders.dest, 'angular-markdown-text/angular-markdown-text-templates.js'),
path.join(config.folders.src, 'angular-markdown-text/**/*.js')
])
.pipe(karma({
configFile: 'karma.conf.js',
action: 'watch'
}));
});
// - - - - 8-< - - - - - - - - - - - - - - - - - - -
gulp.task('dist-clean', function () {
return gulp.src('dist/**/*', { read: false }).pipe(clean());
});
gulp.task('dist', ['dist-clean', 'angular-markdown-text', 'test-run'], function () {
var destGlob = path.join(config.folders.dest, 'angular-markdown-text/**/*');
return gulp.src([ destGlob, 'README.md', '!**/angular-markdown-text-templates.js' ])
.pipe(gulp.dest('dist'));
});
// - - - - 8-< - - - - - - - - - - - - - - - - - - -
gulp.task('build', [ 'modules', 'bower', 'index' ]);
gulp.task('watch', [ 'modules-watch']);
gulp.task('default', [ 'build' ]);
// - - - - 8-< - - - - - - - - - - - - - - - - - - -