-
Notifications
You must be signed in to change notification settings - Fork 13
/
gulpfile.ls
executable file
·192 lines (160 loc) · 5.49 KB
/
gulpfile.ls
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
require! <[tiny-lr]>
require! <[gulp gulp-util gulp-stylus gulp-mocha gulp-karma gulp-livereload]>
gutil = gulp-util
{protractor, webdriver_update} = require \gulp-protractor
livescript = require \gulp-livescript
livereload-server = require(\tiny-lr)!
livereload = -> gulp-livereload livereload-server
gulp.task 'server' ->
gulp.src './server/*.ls'
.pipe livescript({+bare}).on 'error', gutil.log
.pipe gulp.dest './server/'
var http-server
gulp.task \httpServer <[server]> ->
{lyserver} = require \./server/app
app = require('express')!
app.use require('connect-livereload')!
# use http-server here so we can close after protractor finishes
http-server := require \http .create-server lyserver app
port = 3333
http-server.listen port, ->
console.log "Running on http://localhost:#port"
gulp.task \webdriver_update, webdriver_update
gulp.task \protractor <[webdriver_update httpServer]> ->
gulp.src ["./test/e2e/app/*.ls"]
.pipe protractor configFile: "./test/protractor.conf.ls"
.on \error ->
throw it
gulp.task 'test:e2e' <[protractor]> ->
httpServer.close!
gulp.task 'protractor:sauce' <[webdriver_update build httpServer]> ->
args =
'--selenium-address'
''
'--sauce-user'
process.env.SAUCE_USERNAME
'--sauce-key'
process.env.SAUCE_ACCESS_KEY
'--capabilities.build'
process.env.TRAVIS_BUILD_NUMBER
if process.env.TRAVIS_JOB_NUMBER
#args['capabilities.tunnel-identifier'] = that
args.push '--capabilities.tunnel-identifier'
args.push that
gulp.src ["./test/e2e/app/*.ls"]
.pipe protractor do
configFile: "./test/protractor.conf.ls"
args: args
.on \error ->
throw it
gulp.task 'test:sauce' <[protractor:sauce]> ->
httpServer.close!
gulp.task 'build' <[template bower assets js:vendor js:app css]>
gulp.task 'test:unit' <[build]> ->
gulp.start 'test:karma'
gulp.start 'test:util'
gulp.task 'test:karma' ->
gulp.src [
* "_public/js/vendor.js"
* "_public/js/app.templates.js"
* "_public/js/app.js"
* "bower_components/angular-mocks/angular-mocks.js"
* "node_modules/timecop/timecop.js"
* "test/unit/fixtures/**/*.json"
* "test/unit/**/*.spec.ls"
]
.pipe gulp-karma do
config-file: 'test/karma.conf.ls'
action: 'run'
browsers: <[PhantomJS]>
.on \error ->
throw it
gulp.task 'test:util' ->
gulp.src 'test/unit/util/**/*.ls'
.pipe gulp-mocha compilers: 'ls:LiveScript'
gulp.task 'dev' <[httpServer template assets js:vendor js:app css]> ->
#gulp.start 'test:karma'
#gulp.start 'test:util'
LIVERELOADPORT = 35729
livereload-server.listen LIVERELOADPORT, ->
return gutil.log it if it
gulp.start 'watch'
gulp.task 'watch' ->
gulp.watch ['app/partials/**/*.jade', 'app/diff/*.jade', 'app/spy/*.jade'] <[template]>
gulp.watch ['app/**/*.ls', 'app/**/*.jsenv'] <[js:app]>
gulp.watch 'app/assets/**' <[assets]>
gulp.watch 'app/**/*.styl' <[css]>
require! <[gulp-angular-templatecache gulp-jade]>
gulp.task 'template' ->
gulp.src ['app/partials/**/*.jade', 'app/diff/*.jade', 'app/spy/*.jade']
.pipe gulp-jade!
.pipe gulp-angular-templatecache 'app.templates.js' do
base: process.cwd()
filename: 'app.templates.js'
module: 'app.templates'
standalone: true
.pipe gulp.dest '_public/js'
.pipe livereload!
require! <[gulp-bower gulp-bower-files gulp-filter gulp-uglify gulp-cssmin]>
require! <[gulp-concat gulp-json-editor gulp-commonjs gulp-insert]>
gulp.task 'bower' ->
gulp-bower!
gulp.task 'js:app' ->
env = gulp.src 'app/**/*.jsenv'
.pipe gulp-json-editor (json) ->
for key of json when process.env[key]?
json[key] = that
json
.pipe gulp-insert.prepend 'module.exports = '
.pipe gulp-commonjs!
app = gulp.src 'app/**/*.ls'
.pipe livescript({+bare}).on 'error', gutil.log
s = streamqueue { +objectMode }
.done env, app
.pipe gulp-concat 'app.js'
s .= pipe gulp-uglify! if gutil.env.env is \production
s.pipe gulp.dest '_public/js'
.pipe livereload!
gulp.task 'js:vendor' <[bower]> ->
bower = gulp-bower-files!
.pipe gulp-filter -> it.path is /\.js$/
s = streamqueue { +objectMode }
.done bower, gulp.src 'vendor/scripts/*.js'
.pipe gulp-concat 'vendor.js'
s .= pipe gulp-uglify! if gutil.env.env is \production
s .pipe gulp.dest '_public/js'
.pipe livereload!
gulp.task 'css' <[bower]> ->
bower = gulp-bower-files!
.pipe gulp-filter -> it.path is /\.css$/
styl = gulp.src './app/styles/**/*.styl'
.pipe gulp-filter -> it.path isnt /\/_[^/]+\.styl$/
.pipe gulp-stylus use: <[nib]>
s = streamqueue { +objectMode }
.done bower, styl, gulp.src 'app/styles/**/*.css'
.pipe gulp-concat 'app.css'
s .= pipe gulp-cssmin! if gutil.env.env is \production
s .pipe gulp.dest './_public/css'
.pipe livereload!
gulp.task 'assets' ->
gulp.src 'app/assets/**'
.pipe gulp.dest '_public'
gulp.task 'ly-diff' <[ly-diff:js ly-diff:css]>
require! <[streamqueue gulp-concat]>
gulp.task 'ly-diff:js' ->
js = gulp.src <[app/utils/diff.ls app/diff.ls]>
.pipe livescript({+bare}).on 'error', gutil.log
templates = gulp.src 'app/diff/diff.jade'
.pipe gulp-jade!
.pipe gulp-angular-templatecache do
base: process.cwd()
filename: 'app.templates.js'
module: 'ly.diff'
streamqueue { +objectMode }
.done js, templates
.pipe gulp-concat 'ly-diff.js'
.pipe gulp.dest '_public/js'
gulp.task 'ly-diff:css' ->
gulp.src './app/styles/ly-diff.styl'
.pipe gulp-stylus use: <[nib]>
.pipe gulp.dest './_public/css'