Comparing version 0.0.10 to 0.0.11
12
cache.js
@@ -10,8 +10,8 @@ var crypto = require('crypto'); | ||
var SWAP_CATEGORY = 'linted'; | ||
var SWAP_CATEGORY = 'node/phplint'; | ||
module.exports = { | ||
put: function (hash, cb) { | ||
swap.addCached(SWAP_CATEGORY, hash, '', function (err) { | ||
put: function (hash, content, cb) { | ||
swap.addCached(SWAP_CATEGORY, hash, content, function (err) { | ||
if (err) return cb(err); | ||
@@ -22,2 +22,8 @@ cb(); | ||
get: function (hash, cb) { | ||
swap.getCached(SWAP_CATEGORY, hash, function (err, cached) { | ||
cb(err, cached); | ||
}); | ||
}, | ||
has: function (file, cb) { | ||
@@ -24,0 +30,0 @@ fs.readFile(file, function(err, contents) { |
11
index.js
@@ -16,3 +16,10 @@ 'use strict'; | ||
if (isCached) return cb(); | ||
if (isCached) { | ||
if (stdout) { | ||
cache.get(hash, function (err, cached) { | ||
process.stdout.write(cached.contents); | ||
}); | ||
} | ||
return cb(); | ||
} | ||
@@ -24,3 +31,3 @@ exec('php -l '+file, {silent: ! stdout}, function (code, output) { | ||
cache.put(hash, cb); | ||
cache.put(hash, output, cb); | ||
}); | ||
@@ -27,0 +34,0 @@ }); |
{ | ||
"name": "phplint", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "wrapper for php -l", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,3 +23,3 @@ 'use strict'; | ||
it('should call the then method', function (cb) { | ||
var lint = phplint('test/pass.php'); | ||
var lint = phplint('test/pass.php', {stdout: true}); | ||
lint.then(function (msg) { | ||
@@ -26,0 +26,0 @@ cb(); |
5868
110