-
Notifications
You must be signed in to change notification settings - Fork 310
/
gulpfile.js
74 lines (64 loc) · 1.7 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
pkg = require('./package.json')
argv = require('minimist')(process.argv.slice(2))
gulp = require('gulp')
util = require('gulp-util')
coffee = require('gulp-coffee')
header = require('gulp-header')
concat = require('gulp-concat')
uglify = require('gulp-uglify')
bump = require('gulp-bump')
mocha = require('gulp-mocha-phantomjs')
source = [
'src/rivets.coffee',
'src/util.coffee',
'src/parsers.coffee',
'src/observer.coffee',
'src/view.coffee',
'src/bindings.coffee',
'src/binders.coffee',
'src/formatters.coffee',
'src/adapter.coffee',
'src/export.coffee'
]
manifests = [
'./package.json',
'./bower.json',
'./component.json'
]
banner = function(bundled) {
return [
'// Rivets.js' + (bundled ? ' + Sightglass.js' : ''),
'// version: ' + pkg.version,
'// author: ' + pkg.author,
'// license: ' + pkg.licenses[0].type
].join('\n') + '\n'
}
gulp.task('build', function() {
rivets = gulp.src(source)
.pipe(concat('rivets.js'))
.pipe(coffee().on('error', util.log))
.pipe(header(banner()))
.pipe(gulp.dest('dist'))
rivetsMin = rivets.pipe(concat('rivets.min.js'))
.pipe(uglify())
.pipe(header(banner()))
.pipe(gulp.dest('dist'))
rivets.on('end', function() {
sightglass = 'node_modules/sightglass/index.js'
rivets = 'dist/rivets.js'
gulp.src([sightglass, rivets])
.pipe(uglify())
.pipe(concat('rivets.bundled.min.js'))
.pipe(header(banner(true)))
.pipe(gulp.dest('dist'))
})
})
gulp.task('spec', function() {
gulp.src('spec/runner.html')
.pipe(mocha({reporter: 'dot'}))
})
gulp.task('bump', function() {
gulp.src(manifests)
.pipe(bump({type: argv.t, version: argv.v}))
.pipe(gulp.dest('./'))
})