summaryrefslogtreecommitdiff
path: root/model_fs.js
diff options
context:
space:
mode:
authorBenjamin Kiessling <mittagessen@l.unchti.me>2012-01-23 15:38:57 +0100
committerBenjamin Kiessling <mittagessen@l.unchti.me>2012-01-23 15:38:57 +0100
commit623d5ec42150b761cb7b3b56c7b7b9eaaf5c1e23 (patch)
treec0a7dbed8e777841d31e10e9ef861d51db01f036 /model_fs.js
parentd09390b08727af716fbe99c3639381ae432e5481 (diff)
More unambiguous names in configuration
Diffstat (limited to 'model_fs.js')
-rw-r--r--model_fs.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/model_fs.js b/model_fs.js
index 1a36986..de2f56f 100644
--- a/model_fs.js
+++ b/model_fs.js
@@ -21,24 +21,23 @@ exports.start = function(config) {
exports.rebuildFiles = function() {
- walker = walk.walk(configuration.dir, { followLinks: false });
+ console.log('rebuilding...');
+ walker = walk.walk(configuration.rootDir, { followLinks: false });
var newSlides = {};
walker.on("directories", function (root, dirAr, next) {
var lastDir = path.join(__dirname, root).split('/');
if((lastDir.length - __dirname.split('/').length) < 2) {
dirAr.forEach(function(dir) {
- newSlides[dir.name] = { name: dir.name, template:
- path.join(configuration.defaultSlides,
- configuration.template) , slides: []};
+ newSlides[dir.name] = { name: dir.name, template: '', slides: []};
});
}
next();
}).on("file", function(root, fileStats, next) {
- if(fileStats.name == configuration.description || fileStats.name == configuration.events) {
+ if(fileStats.name == configuration.descriptionFile || fileStats.name == configuration.eventFile) {
next();
}
- else if(fileStats.name == configuration.template) {
+ else if(fileStats.name == configuration.templateFile) {
var lastDir = root.split('/');
newSlides[lastDir[lastDir.length - 1]]['template'] = path.join(lastDir[lastDir.length - 1], fileStats.name);
next();
@@ -65,7 +64,7 @@ exports.rebuildFiles = function() {
for(var slideset in newSlides) {
/* collects descriptions and adds them to the slideset */
var collectDescs = function(slideset) {
- fs.readFile(path.join(__dirname, configuration.dir, slideset, configuration.description), function(err, data) {
+ fs.readFile(path.join(__dirname, configuration.rootDir, slideset, configuration.descriptionFile), function(err, data) {
if(err) { setSlides(slideset, newSlides[slideset], function(err) { if(err) { throw err}}); return; }
var descs = JSON.parse(data.toString());
for(var file in newSlides[slideset]['slides']) {
@@ -85,7 +84,7 @@ exports.rebuildFiles = function() {
}
/* collect events and adds them to the slideset */
var collectEvents = function(slideset) {
- fs.readFile(path.join(__dirname, configuration.dir, slideset, configuration.events), function(err, data) {
+ fs.readFile(path.join(__dirname, configuration.rootDir, slideset, configuration.eventFile), function(err, data) {
if(err) { return; }
try {
var events = JSON.parse(data.toString());