]> git.gir.st - VimFx.git/blob - gulpfile.coffee
Replace Makefile with gulp
[VimFx.git] / gulpfile.coffee
1 ###
2 # Copyright Simon Lydell 2014.
3 #
4 # This file is part of VimFx.
5 #
6 # VimFx is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # VimFx is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with VimFx. If not, see <http://www.gnu.org/licenses/>.
18 ###
19
20 fs = require('fs')
21 path = require('path')
22 request = require('request')
23 gulp = require('gulp')
24 changed = require('gulp-changed')
25 coffee = require('gulp-coffee')
26 coffeelint = require('gulp-coffeelint')
27 util = require('gulp-util')
28 zip = require('gulp-zip')
29 rimraf = require('rimraf')
30
31 DEST = 'build'
32 XPI = 'VimFx.xpi'
33
34 gulp.task('default', ['push'])
35
36 gulp.task('clean', (callback) ->
37 rimraf(DEST, callback)
38 )
39
40 gulp.task('copy', ->
41 gulp.src(['extension/**/!(*.coffee)', 'COPYING'])
42 .pipe(changed(DEST))
43 .pipe(gulp.dest(DEST))
44 )
45
46 gulp.task('coffee', ->
47 gulp.src('extension/**/*.coffee')
48 .pipe(changed(DEST, {extension: '.coffee'}))
49 .pipe(coffee({bare: true}).on('error', util.log))
50 .pipe(gulp.dest(DEST))
51 )
52
53 gulp.task('build', ['copy', 'coffee'])
54
55 gulp.task('xpi', ['build'], ->
56 gulp.src("#{ DEST }/**/!(#{ XPI })")
57 .pipe(zip(XPI, {compress: false}))
58 .pipe(gulp.dest(DEST))
59 )
60
61 gulp.task('push', ['xpi'], ->
62 body = fs.readFileSync(path.join(DEST, XPI))
63 request.post({url: 'http://localhost:8888', body })
64 )
65
66 gulp.task('lint', ->
67 gulp.src(['extension/**/*.coffee', 'gulpfile.coffee'])
68 .pipe(coffeelint())
69 .pipe(coffeelint.reporter())
70 )
Imprint / Impressum