Skip to content

Commit

Permalink
renamed run module to director
Browse files Browse the repository at this point in the history
  • Loading branch information
Caolan McMahon committed Apr 26, 2010
1 parent 01103b9 commit 9828235
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
File renamed without changes.
10 changes: 5 additions & 5 deletions lib/petrify.js
@@ -1,7 +1,7 @@
var fs = require('fs'),
sys = require('sys'),
path = require('path'),
run = require('run'),
director = require('director'),
events = require('events'),
behaviours = require('behaviours'),
jsontemplate = require('json-template'),
Expand Down Expand Up @@ -86,7 +86,7 @@ exports.runViews = function(opts){
var tasks = Object.keys(opts.views).reduce(function(a,k){
var view = opts.views[k];
emits_pending[k] = 0;
a[k] = run.requires(view.requires, function(task){
a[k] = director.requires(view.requires, function(task){
var viewEnv = {
emit: function(path, data){
emits_pending[k]++;
Expand Down Expand Up @@ -140,7 +140,7 @@ exports.runViews = function(opts){
});
return a;
}, {});
run.auto(tasks, function(){
director.auto(tasks, function(){
process.nextTick(function(){emitter.emit('finished');});
});
return emitter;
Expand Down Expand Up @@ -265,7 +265,7 @@ exports.loadTemplates = function(template_dir){
// builds a site
exports.run = function(opt){
var emitter = new events.EventEmitter();
run.auto({
director.auto({
templates: function(task){
emitter.templates = exports.loadTemplates(opt.template_dir);
emitter.templates.addListener('error', function(err, templates){
Expand Down Expand Up @@ -307,7 +307,7 @@ exports.run = function(opt){
else task.done();
});
},
mkdir: run.requires(['removedir'], function(task){
mkdir: director.requires(['removedir'], function(task){
child_process.exec('mkdir ' + opt.output_dir, function(err){
if(err) emitter.emit('error', err);
task.done();
Expand Down
6 changes: 3 additions & 3 deletions test/test-run.js → test/test-director.js
@@ -1,10 +1,10 @@
var run = require('run');
var director = require('director');


exports.testRequires = function(test){
var fn = function(){return 'test';};
test.same(
run.requires(['task1','task2'], fn),
director.requires(['task1','task2'], fn),
{requires: ['task1','task2'], run: fn}
);
test.done();
Expand All @@ -13,7 +13,7 @@ exports.testRequires = function(test){
exports.testAuto = function(test){
var callOrder = [];
var testdata = [{test: 'test'}];
run.auto({
director.auto({
task1: {
requires: ['task2'],
run: function(task){
Expand Down
1 change: 1 addition & 0 deletions test/test-petrify.js
Expand Up @@ -602,6 +602,7 @@ exports.testRunErrors = function(test){
var emitter = new events.EventEmitter();
process.nextTick(function(){
emitter.emit('error', 'runViews_error', 'view');
emitter.emit('finished');
});
return emitter;
};
Expand Down

0 comments on commit 9828235

Please sign in to comment.