Skip to content

Commit

Permalink
More working :)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemorton committed Jun 1, 2011
1 parent 049e984 commit adcc064
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions example-concat.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
var fs = require('fs'),
p = require('path'),
Orderly = require('./orderly'),
orderly = new Orderly();

Expand All @@ -10,19 +11,27 @@ orderly.queue(['./example/js', './example/css'])
})
.process(function (path, success, error) {
fs.readdir(path, function (err, files) {
if (err) {
error(err);
return;
}
success(files);
});
})/*
.process(function (files, success) {
var fileType = getFileType(files);
concatFiles(files, function (concatStr) {
success([fileType, concatStr]);
if (err) return error(err);
success([path, files]);
});
})
.process(function (path, success) {
var files = path[1],
path = path[0];

// Ooo queues within queues!
orderly.queue(files)
.process(function (file, success, error) {
console.log(path + file);
fs.readFile(path + file, function (err, data) {
success(data);
});
})
.complete(function (data) {
success(data.join(''));
})
.run();
})/*
.process(function (concat, success) {
var newFilename = 'concat.' + concat[0];
strToFile(newFilename, concat[1], function () {
Expand All @@ -32,4 +41,5 @@ orderly.queue(['./example/js', './example/css'])
.complete(function (files) {
console.log('Success');
console.log(files.join("\n"));
});
})
.run();

0 comments on commit adcc064

Please sign in to comment.