forked from loopj/node-simple-redis-queue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
51 lines (42 loc) · 1.3 KB
/
Gruntfile.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
module.exports = (grunt) ->
# Configuration
grunt.initConfig
# Package information
pkg: grunt.file.readJSON 'package.json'
# Coffeescript compilation
coffee:
compile:
files:
'lib/index.js': 'src/index.coffee'
options:
bare: true
# Version bumping
bump:
options: part: 'patch'
files: ['package.json']
# Mocha tests
simplemocha:
options:
timeout: 4000
ignoreLeaks: false
reporter: 'spec'
all:
src: ['test/*_test.coffee']
# Load tasks from plugins
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-bumpx'
grunt.loadNpmTasks 'grunt-simple-mocha'
# Task to tag a version in git
grunt.registerTask 'git-tag', 'Tags a release in git', ->
exec = require('child_process').exec
done = this.async()
releaseVersion = grunt.template.process('<%= pkg.version %>')
child = exec "git ci -am \"v#{releaseVersion}\" && git tag v#{releaseVersion}", (error, stdout, stderr) ->
console.log "Error running git tag: #{error}" if error?
done(!error?)
# Release meta-task
grunt.registerTask 'release', ['coffee', 'git-tag']
# Test meta-task
grunt.registerTask 'test', ['simplemocha']
# Default meta-task
grunt.registerTask 'default', ['coffee']