From ee0f9d2bbe9408d8271153d55b8c17b491567946 Mon Sep 17 00:00:00 2001 From: Micheil Smith Date: Fri, 14 Feb 2014 17:11:25 +0000 Subject: [PATCH] Rename themes_dir to themes_path for consistency with other configuration options --- app.js | 10 +++++----- src/meta.js | 4 ++-- src/webserver.js | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app.js b/app.js index 58390f1930..a42ecda794 100644 --- a/app.js +++ b/app.js @@ -87,20 +87,20 @@ function start() { }); nconf.defaults({ - themes_dir: path.join(__dirname, 'node_modules') + themes_path: path.join(__dirname, 'node_modules') }); nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path')); nconf.set('upload_url', path.join(path.sep, nconf.get('relative_path'), 'uploads', path.sep)); nconf.set('base_dir', __dirname); - // Ensure themes_dir is a full filepath - nconf.set('themes_dir', path.resolve(__dirname, nconf.get('themes_dir'))); + // Ensure themes_path is a full filepath + nconf.set('themes_path', path.resolve(__dirname, nconf.get('themes_path'))); winston.info('Time: ' + new Date()); winston.info('Initializing NodeBB v' + pkg.version); winston.info('* using ' + nconf.get('database') +' store at ' + nconf.get(nconf.get('database') + ':host') + ':' + nconf.get(nconf.get('database') + ':port')); - winston.info('* using themes stored in: ' + nconf.get('themes_dir')); + winston.info('* using themes stored in: ' + nconf.get('themes_path')); if (process.env.NODE_ENV === 'development') { winston.info('Base Configuration OK.'); @@ -130,7 +130,7 @@ function start() { translator.loadServer(); - var customTemplates = meta.config['theme:templates'] ? path.join(nconf.get('themes_dir'), meta.config['theme:id'], meta.config['theme:templates']) : false; + var customTemplates = meta.config['theme:templates'] ? path.join(nconf.get('themes_path'), meta.config['theme:id'], meta.config['theme:templates']) : false; utils.walk(path.join(__dirname, 'public/templates'), function (err, tplsToLoad) { templates.init(tplsToLoad, customTemplates); diff --git a/src/meta.js b/src/meta.js index 14f3d87b5b..bd77781b17 100644 --- a/src/meta.js +++ b/src/meta.js @@ -85,7 +85,7 @@ var fs = require('fs'), Meta.themes = { get: function (callback) { - var themePath = nconf.get('themes_dir'); + var themePath = nconf.get('themes_path'); fs.readdir(themePath, function (err, files) { async.filter(files, function (file, next) { fs.stat(path.join(themePath, file), function (err, fileStat) { @@ -132,7 +132,7 @@ var fs = require('fs'), case 'local': async.waterfall([ function(next) { - fs.readFile(path.join(nconf.get('themes_dir'), data.id, 'theme.json'), function(err, config) { + fs.readFile(path.join(nconf.get('themes_path'), data.id, 'theme.json'), function(err, config) { if (!err) { config = JSON.parse(config.toString()); next(null, config); diff --git a/src/webserver.js b/src/webserver.js index f70687d6d5..6d69600733 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -255,7 +255,7 @@ module.exports.server = server; // Theme's static directory if (themeData['theme:staticDir']) { - app.use('/css/assets', express.static(path.join(nconf.get('themes_dir'), themeData['theme:id'], themeData['theme:staticDir']), { + app.use('/css/assets', express.static(path.join(nconf.get('themes_path'), themeData['theme:id'], themeData['theme:staticDir']), { maxAge: app.enabled('cache') ? 5184000000 : 0 })); if (process.env.NODE_ENV === 'development') { @@ -264,7 +264,7 @@ module.exports.server = server; } if (themeData['theme:templates']) { - app.use('/templates', express.static(path.join(nconf.get('themes_dir'), themeData['theme:id'], themeData['theme:templates']), { + app.use('/templates', express.static(path.join(nconf.get('themes_path'), themeData['theme:id'], themeData['theme:templates']), { maxAge: app.enabled('cache') ? 5184000000 : 0 })); if (process.env.NODE_ENV === 'development') { @@ -273,7 +273,7 @@ module.exports.server = server; } app.use(require('less-middleware')({ - src: path.join(nconf.get('themes_dir'), themeId), + src: path.join(nconf.get('themes_path'), themeId), dest: path.join(__dirname, '../public/css'), prefix: nconf.get('relative_path') + '/css', yuicompress: app.enabled('minification') ? true : false @@ -287,7 +287,7 @@ module.exports.server = server; } app.use(require('less-middleware')({ - src: path.join(nconf.get('themes_dir'), '/nodebb-theme-vanilla'), + src: path.join(nconf.get('themes_path'), '/nodebb-theme-vanilla'), dest: path.join(__dirname, '../public/css'), prefix: nconf.get('relative_path') + '/css', yuicompress: app.enabled('minification') ? true : false @@ -303,7 +303,7 @@ module.exports.server = server; async.each(themes, function(themeObj, next) { if (themeObj.screenshot) { - screenshotPath = path.join(nconf.get('themes_dir'), themeObj.id, themeObj.screenshot); + screenshotPath = path.join(nconf.get('themes_path'), themeObj.id, themeObj.screenshot); (function(id, path) { fs.exists(path, function(exists) { if (exists) {