forked from velesin/jasmine-jquery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
49 lines (41 loc) · 1.17 KB
/
Gruntfile.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
/* jshint node: true */
module.exports = function (grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json')
, jshint: {
all: [
"Gruntfile.js"
, "lib/**/*.js"
, "spec/**/*.js"
]
, options: {
jshintrc: '.jshintrc'
},
}
, jasmine: {
src: "lib/**/*.js"
, options: {
specs: "spec/**/*.js"
, vendor: "vendor/**/*.js"
, version: '2.0.0'
}
}
})
grunt.loadNpmTasks('grunt-contrib-jshint')
grunt.loadNpmTasks('grunt-contrib-jasmine')
grunt.registerTask('syncversion', "Sync the versions between files.", function () {
var json = require('./package.json')
var fs = require('fs')
var file = './lib/jasmine-jquery.js'
fs.readFile(file, 'utf8', function (err, data) {
if (err) return console.log(err)
var res = data.replace(/^Version .*$/m, 'Version ' + json.version)
fs.writeFile(file, res, 'utf8', function (err) {
if (err) return console.log(err)
})
})
})
grunt.registerTask('test', ['jshint', 'jasmine'])
grunt.registerTask('default', ['syncversion', 'test'])
};