Skip to content

Commit

Permalink
Done called multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
wlaurance committed Jun 10, 2012
1 parent 2967f7c commit 5bb912e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/glog.js
Expand Up @@ -100,6 +100,7 @@ Glog.prototype.load_plugins = function(options, cb) {
try {
var p = require('../plugins/' + options.plugins[i]);
p.load(GlogPlugin);
console.log(JSON.stringify(p));
} catch(e) {
console.log('Error loading plugins');
console.log(e);
Expand Down Expand Up @@ -187,17 +188,19 @@ Glog.prototype.load_articles = function(options, cb) {
});

// If that was the last article then trigger the callback
if(files.length === articles.length) {
if(files.length === articles.length && fn.articlePlugins.length > 0) {
// Apply plugins
fn.articlePlugins[0] = function(wcb) {
wcb(null, articles);
};
fn.articlePlugins[fn.articlePlugins.length] = function(res) {
console.log('CALLING');
console.log('CALLING ' + JSON.stringify(res));
cb(res.reverse());
};

async.waterfall(fn.articlePlugins);
} else {
cb(articles.reverse());
}

});
Expand Down
3 changes: 2 additions & 1 deletion test/glog_config.json
Expand Up @@ -2,5 +2,6 @@
"blog_repository" : "https://github.com/guyht/Guido.git",
"author" : "Glog",
"blog_title" : "The Glog Blog",
"port" : 8080
"port" : 8080,
"plugins": ["example"]
}

0 comments on commit 5bb912e

Please sign in to comment.