Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

prepare for npm release

* grunt support (I especially use "release")
* travis support
  • Loading branch information...
commit 694fd7227ee1556bef0e9b22e1d3fb05ad7a9599 1 parent 00cde3d
Masakazu Ohtsuka authored
Showing with 47 additions and 1 deletion.
  1. +5 −0 .travis.yml
  2. +38 −0 Gruntfile.js
  3. +4 −1 package.json
5 .travis.yml
View
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - "0.10"
+ - "0.8"
+ - "0.6"
38 Gruntfile.js
View
@@ -0,0 +1,38 @@
+module.exports = function(grunt) {
+ grunt.initConfig({
+ pkg: grunt.file.readJSON('package.json'),
+ clean: []
+ });
+ grunt.loadNpmTasks('grunt-release'); // dry run: grunt --no-write -v release
+
+ grunt.registerTask('default', ['test']);
+
+ grunt.registerTask('test', 'run tests', function() {
+ var done = this.async(),
+ numberOfTests = 3;
+
+ require('child_process').exec(
+ 'make test',
+ function(error, stdout, stderr) {
+ grunt.log.verbose.writeln(stdout);
+ grunt.log.verbose.writeln(stderr);
+ if (error) {
+ grunt.log.error(error);
+ done(false);
+ }
+ else {
+ // detect "Result: PASS"
+ // of each tests
+ var passLines = stdout.match(/Result: PASS/g);
+ if ( ! passLines || (passLines.length != numberOfTests) ) {
+ grunt.fail.warn( "some tests failed, see log with -v flag" );
+ done(false);
+ return;
+ }
+ grunt.log.oklns( "All "+ numberOfTests +" tests successful." ).ok();
+ done(true);
+ }
+ }
+ );
+ });
+};
5 package.json
View
@@ -20,6 +20,9 @@
"dependencies" : {
},
"devDependencies" : {
- "async" : "*"
+ "async" : "*",
+ "grunt" : "~0.4.1",
+ "grunt-release" : "~0.3.5",
+ "grunt-contrib-clean" : "~0.4.1"
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.