forked from ichord/At.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
103 lines (91 loc) · 3.12 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
var gulp = require('gulp'),
coffee = require('gulp-coffee'),
concat = require('gulp-concat'),
umd = require('gulp-umd'),
uglify = require('gulp-uglify'),
rename = require("gulp-rename"),
cssmin = require('gulp-cssmin'),
jasmine = require('gulp-jasmine-phantom'),
bump = require('gulp-bump'),
header = require('gulp-header'),
debug = require('gulp-debug'),
util = require('gulp-util');
var name = 'jquery.atwho';
gulp.task('coffee', function() {
gulp.src('src/*.coffee')
.pipe(coffee({bare: true}).on('error', util.log))
.pipe(gulp.dest('./build/js'));
});
gulp.task('concat', function() {
fileList = [
'build/js/default.js',
'build/js/app.js',
'build/js/controller.js',
'build/js/textareaController.js',
'build/js/editableController.js',
'build/js/model.js',
'build/js/view.js',
'build/js/api.js'
]
gulp.src(fileList)
.pipe(concat(name + ".js"))
.pipe(gulp.dest('build'));
});
gulp.task('umd', function() {
gulp.src('build/' + name + ".js")
.pipe(umd({template: "umd.template.js"}))
.pipe(gulp.dest('build/js'));
});
gulp.task('bump', function() {
gulp.src(['bower.json', 'component.json', 'package.json'])
.pipe(bump({version: "1.5.0"}))
.pipe(gulp.dest('./'));
});
gulp.task("mark", function() {
var pkg = require('./package.json');
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.version %>',
' * Copyright (c) <%= year %> <%= pkg.author.name %> <<%= pkg.author.email %>>;',
' * Homepage: <%= pkg.homepage %>',
' * License: <%= pkg.license %>',
' */',
''].join('\n');
gulp.src('build/js/' + name + '.js')
.pipe(header(banner, { pkg : pkg, year: (new Date).getFullYear()}))
.pipe(gulp.dest('dist/js/'))
});
gulp.task('compress', function() {
gulp.src('dist/js/' + name + '.js')
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist/js'));
gulp.src('src/jquery.atwho.css').pipe(gulp.dest('dist/css'))
gulp.src('dist/css/' + name + '.css')
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist/css'));
});
gulp.task('test', function () {
gulp.src('spec/**/*.coffee')
.pipe(coffee({bare: true}).on('error', util.log))
.pipe(debug({title: "compiled specs"}))
.pipe(gulp.dest('spec/build'))
gulp.src('spec/build/javascripts/*.spec.js')
.pipe(jasmine({
integration: true,
specHtml: "specRunner.html"
/* TODO: have to add css to spec
vendor: [
'bower_components/jquery/dist/jquery.js',
'bower_components/Caret.js/dist/jquery.caret.js',
'dist/js/jquery.atwho.js',
'node_modules/jasmine-jquery/lib/*.js',
'node_modules/jasmine-ajax/lib/*.js',
'spec/helpers/*.js',
'spec/build/spec_helper.js'
],
*/
}));
});
gulp.task('compile', ['coffee', 'umd', 'concat']);
gulp.task('default', ['compile', 'bump', 'mark', 'compress']);