Permalink
Browse files

Add node.js 0.8 & 0.9 support, precompile for npm.

  • Loading branch information...
1 parent c8ff114 commit b8a13742455fe236137811fff48712391ce9b370 @paulmillr paulmillr committed Jun 29, 2012
Showing with 24 additions and 14 deletions.
  1. +4 −0 .gitignore
  2. +1 −2 .npmignore
  3. +6 −5 package.json
  4. +8 −2 setup.js
  5. +2 −2 test/common.js
  6. +3 −3 test/plugin_test.js
View
@@ -1,2 +1,6 @@
+*~
+*.bak
+.DS_Store
+npm-debug.log
lib/
node_modules/
View
@@ -6,5 +6,4 @@ CVS/
*~
*.bak
.DS_Store
-docs/_build
-lib/
+npm-debug.log
View
@@ -10,18 +10,19 @@
},
"main": "./lib/index",
"scripts": {
+ "prepublish": "coffee -o lib/ src/",
"postinstall": "node setup.js postinstall",
"test": "node setup.js test"
},
"engines": {
- "node": "~0.6.10"
+ "node": "~0.6.10 || 0.8 || 0.9"
},
"dependencies": {
- "coffee-script": "1.2.0",
- "jade": "0.19.0"
+ "coffee-script": "1.3.3",
+ "jade": "0.26.3"
},
"devDependencies": {
- "mocha": "0.12.1",
- "expect.js": "0.1.2"
+ "mocha": "1.2.2",
+ "chai": "1.1.0"
}
}
View
@@ -1,21 +1,27 @@
var exec = require('child_process').exec;
var sysPath = require('path');
+var fs = require('fs');
var mode = process.argv[2];
+var fsExists = fs.exists || sysPath.exists;
+
var execute = function(pathParts, params, callback) {
if (callback == null) callback = function() {};
var path = sysPath.join.apply(null, pathParts);
var command = 'node ' + path + ' ' + params;
console.log('Executing', command);
exec(command, function(error, stdout, stderr) {
if (error != null) return process.stderr.write(stderr.toString());
- process.stdout.write(stdout.toString());
+ console.log(stdout.toString());
});
};
if (mode === 'postinstall') {
- execute(['node_modules', 'coffee-script', 'bin', 'coffee'], '-o lib/ src/');
+ fsExists(sysPath.join(__dirname, 'lib'), function(exists) {
+ if (exists) return;
+ execute(['node_modules', 'coffee-script', 'bin', 'coffee'], '-o lib/ src/');
+ });
} else if (mode === 'test') {
execute(['node_modules', 'mocha', 'bin', 'mocha'],
'--require test/common.js --colors');
View
@@ -1,2 +1,2 @@
-expect = require('expect.js');
-Plugin = require('../lib');
+global.expect = require('chai').expect;
+global.Plugin = require('../lib');
View
@@ -8,19 +8,19 @@ describe('Plugin', function() {
});
it('should be an object', function() {
- expect(plugin).to.be.ok();
+ expect(plugin).to.be.ok;
});
it('should has #compile method', function() {
- expect(plugin.compile).to.be.a(Function);
+ expect(plugin.compile).to.be.an.instanceof(Function);
});
it('should compile and produce valid result', function(done) {
var content = '!!! 5';
var expected = '<!DOCTYPE html>';
plugin.compile(content, 'template.jade', function(error, data) {
- expect(error).not.to.be.ok();
+ expect(error).not.to.be.ok;
expect(eval(data)()).to.equal(expected);
done();
});

0 comments on commit b8a1374

Please sign in to comment.