1 | module.exports = function(grunt) {
|
2 | var pkg = require("./package.json");
|
3 | global.jasmineVersion = pkg.version;
|
4 | var versionString = 'v' + pkg.version;
|
5 |
|
6 | grunt.initConfig({
|
7 | pkg: pkg,
|
8 | jshint: {all: ['lib/**/*.js', 'spec/**/*.js']}
|
9 | });
|
10 |
|
11 | var shell = require('shelljs');
|
12 | function runCommands(commands, done) {
|
13 | var command = commands.shift();
|
14 |
|
15 | if (command) {
|
16 | shell.exec(command, function(exitCode) {
|
17 | if (exitCode !== 0) {
|
18 | grunt.fail.fatal("Command `" + command + "` failed", exitCode);
|
19 | done();
|
20 | } else {
|
21 | runCommands(commands, done);
|
22 | }
|
23 | });
|
24 | } else {
|
25 | done();
|
26 | }
|
27 | }
|
28 |
|
29 |
|
30 | grunt.registerTask('release',
|
31 | 'Create tag ' + versionString + ' and push jasmine-' + pkg.version + ' to NPM',
|
32 | function() {
|
33 | var done = this.async(),
|
34 | commands = ['git tag ' + versionString, 'git push origin master --tags', 'npm publish'];
|
35 |
|
36 | runCommands(commands, done);
|
37 | });
|
38 |
|
39 | grunt.loadNpmTasks('grunt-contrib-jshint');
|
40 |
|
41 | grunt.loadTasks('tasks');
|
42 |
|
43 | grunt.registerTask('default', ['jshint:all', 'specs']);
|
44 | };
|