Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added Buster task for grunt

  • Loading branch information...
commit dbcdf7f56c542e7749eb10f42f97eb9038b5f0ef 1 parent 7fd9344
@thedersen authored
Showing with 58 additions and 6 deletions.
  1. +47 −0 grunt-buster.js
  2. +10 −5 grunt.js
  3. +1 −1  package.json
View
47 grunt-buster.js
@@ -0,0 +1,47 @@
+module.exports = function(grunt) {
+ var childProcess = require('child_process'),
+ log = grunt.log;
+
+ grunt.registerTask('buster', 'runs BusterJS tests.', function() {
+ var done = this.async(),
+ args = [],
+ config = grunt.config('buster');
+
+ for(var arg in config){
+ var value = config[arg];
+ if(value !== false) {
+ args.push('--' + arg);
+ if(value !== true){
+ args.push(value);
+ }
+ }
+ }
+
+ childProcess.exec('command -v buster-test', { env: process.env }, function(error, stdout, stderr) {
+ if (error) {
+ log.writeln('Unknown error occurred when running Buster.js');
+ done(false);
+ }
+ else {
+ var mod = stdout.split("\n")[0];
+
+ var run = childProcess.spawn(mod, args, {
+ env: process.env,
+ setsid: true
+ });
+
+ run.stdout.on('data', function(data) {
+ process.stdout.write(data);
+ });
+
+ run.stderr.on('data', function(data) {
+ process.stderr.write(data);
+ });
+
+ run.on('exit', function(code) {
+ done(code === 0);
+ });
+ }
+ });
+ });
+};
View
15 grunt.js
@@ -1,16 +1,18 @@
+
module.exports = function(grunt) {
+ require('./grunt-buster')(grunt);
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
- banner: '// <%= pkg.title || pkg.name %> v<%= pkg.version %>\n' +
+ banner: '// <%= pkg.title %> v<%= pkg.version %>\n' +
'//\n' +
'// Copyright (c) 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
'// Distributed under MIT License\n' +
'//\n' +
'// Documentation and full license available at:\n' +
- '// <%= pkg.homepage ? pkg.homepage : "" %>'
+ '// <%= pkg.homepage %>'
},
concat: {
browser: {
@@ -26,10 +28,13 @@ module.exports = function(grunt) {
},
watch: {
files: '<config:lint.files>',
- tasks: 'lint'
+ tasks: 'default'
+ },
+ buster: {
+ config: 'buster.js'
},
lint: {
- files: ['grunt.js', 'src/**/*.js', 'tests/**/*.js']
+ files: ['*.js', 'src/**/*.js', 'tests/**/*.js']
},
jshint: {
options: {
@@ -60,6 +65,6 @@ module.exports = function(grunt) {
});
// Default task.
- grunt.registerTask('default', 'concat lint min');
+ grunt.registerTask('default', 'concat lint buster min');
};
View
2  package.json
@@ -22,7 +22,7 @@
"url": "http://github.com/thedersen/backbone.validation.git"
},
"scripts": {
- "test": "buster test",
+ "test": "grunt buster",
"prepublish": "grunt"
},
"main": "./dest/backbone-validation-amd.js",
Please sign in to comment.
Something went wrong with that request. Please try again.