-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
148 lines (133 loc) · 3.88 KB
/
gulpfile.coffee
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
coffee = require 'gulp-coffee'
coffeelint = require 'gulp-coffeelint'
gulp = require 'gulp'
istanbul = require 'gulp-coffee-istanbul'
jade = require 'gulp-jade'
less = require 'gulp-less'
concatCss = require 'gulp-concat-css'
mocha = require 'gulp-mocha'
uglify = require 'gulp-uglify'
gulpFilter = require 'gulp-filter'
guppy = require('git-guppy')(gulp)
plumber = require 'gulp-plumber'
gulp.task 'watch', ['default'], ->
gulp.watch './src/client/**/*.coffee', ['compileAngularCoffee']
gulp.watch './src/client/**/*.jade', ['compileJade']
gulp.watch 'src/client/**/*.less', ['compileCss']
return
gulp.task 'coverage', ->
gulp.src [
'src/server/**/*.coffee'
'!src/server/coffee/providersAPI.coffee'
'!src/server/coffee/oauthCallback.coffee'
]
.pipe istanbul includeUntested: false
.pipe istanbul.hookRequire()
.on 'finish', ->
gulp.src [
'test/server/**/*.coffee'
]
.pipe mocha()
.pipe istanbul.writeReports
reporters: [ 'lcov', 'json' ]
dir: 'coverage/server-report'
.once 'error', -> process.exit 1
gulp.task 'coffeelintNode', ->
opt =
max_line_length:
value: 120
level: 'error'
cyclomatic_complexity:
level: 'error'
space_operators:
level: 'error'
no_unnecessary_double_quotes:
level: 'error'
eol_last:
level: 'error'
no_debugger:
level: 'error'
gulp.src ['src/server/**/*.coffee']
.pipe coffeelint opt
.pipe coffeelint.reporter()
.pipe coffeelint.reporter 'fail'
.on 'error', (code) -> process.exit 1
gulp.task 'pre-commit', ['coffeelintNode', 'coverage']
gulp.task 'minifyServer', ['compileCoffee'], ->
gulp.src ['./temp/server/**/*.js']
.pipe plumber()
.pipe uglify()
.pipe gulp.dest './server'
gulp.task 'minifyClient', ['compileAngularCoffee'], ->
#TODO remove temp files
gulp.src ['./temp/client/**/*.js']
.pipe plumber()
.pipe uglify()
.pipe gulp.dest './public'
gulp.task 'compileCoffee', ->
gulp.src ['./src/server/coffee/**/*.coffee']
.pipe plumber()
.pipe coffee(bare: true).on 'error', (err) ->
console.error 'compileCoffee error: ', err
process.exit 1
.pipe gulp.dest './temp/server'
gulp.task 'compileAngularCoffee', ->
gulp.src ['./src/client/**/*.coffee']
.pipe plumber()
.pipe coffee(bare: true).on 'error', (err) ->
console.error 'compileAngularCoffee error: ', err
process.exit 1
.pipe gulp.dest './public'
gulp.task 'pre-commit-old', guppy.src 'pre-commit', (files) ->
opt =
max_line_length:
value: 120
level: 'error'
cyclomatic_complexity:
level: 'error'
space_operators:
level: 'error'
no_unnecessary_double_quotes:
level: 'error'
eol_last:
level: 'error'
no_debugger:
level: 'error'
console.log 'files? ', files
gulp.src files
.pipe gulpFilter ['.coffee']
.pipe coffeelint opt
.pipe coffeelint.reporter()
.on 'error', ->
process.exit 1
.on 'end', ->
process.exit 0
gulp.task 'compileJade', ->
gulp.src './src/client/**/*.jade'
.pipe plumber()
.pipe jade(locals: {})
.pipe gulp.dest './public/'
gulp.task 'compileLess', ->
gulp.src 'src/client/**/*.less'
.pipe plumber()
.pipe less()
.pipe gulp.dest './temp/css'
gulp.task 'compileCss', ['compileLess'], ->
gulp.src [
'temp/css/*.css'
'public/bower_components/angular-tree-control/css/tree-control.css'
'public/bower_components/angular-tree-control/css/tree-control-attribute.css'
'public/bower_components/ng-tags-input/ng-tags-input.css'
'public/bower_components/angular-chart.js/dist/angular-chart.css'
'public/bower_components/angular-bootstrap-calendar/dist/css/angular-bootstrap-calendar.css'
'public/bower_components/angular-material/angular-material.min.css'
]
.pipe concatCss 'bundle.css'
.pipe gulp.dest 'public/'
gulp.task 'default', [
'coffeelintNode'
'minifyServer'
'compileAngularCoffee'
'compileJade'
'compileCss'
]