updating code to not use a hardcoded version number, but rather read the #

from package.json
v1.18.x
Julian Lam 12 years ago
parent 0e854119c6
commit 41b3eabf1a

@ -20,9 +20,9 @@
var fs = require('fs'), var fs = require('fs'),
path = require('path'), path = require('path'),
utils = require('./public/src/utils.js'), utils = require('./public/src/utils.js'),
pkg = require('./package.json'),
url = require('url'), url = require('url'),
args = {}; args = {};
global.ver = '0.0.2';
// Runtime environment // Runtime environment
global.env = process.env.NODE_ENV || 'production', global.env = process.env.NODE_ENV || 'production',
@ -36,7 +36,7 @@ process.argv.slice(2).forEach(function(value) {
}); });
// Log GNU copyright info along with server info // Log GNU copyright info along with server info
console.log('Info: NodeBB v' + global.ver + ' Copyright (C) 2013 DesignCreatePlay Inc.'); console.log('Info: NodeBB v' + pkg.version + ' Copyright (C) 2013 DesignCreatePlay Inc.');
console.log('Info: This program comes with ABSOLUTELY NO WARRANTY.'); console.log('Info: This program comes with ABSOLUTELY NO WARRANTY.');
console.log('Info: This is free software, and you are welcome to redistribute it under certain conditions.'); console.log('Info: This is free software, and you are welcome to redistribute it under certain conditions.');
console.log('Info: ==='); console.log('Info: ===');
@ -47,7 +47,7 @@ fs.readFile(path.join(__dirname, 'config.json'), function(err, data) {
global.config.url = global.config.base_url + (global.config.use_port ? ':' + global.config.port : '') + '/'; global.config.url = global.config.base_url + (global.config.use_port ? ':' + global.config.port : '') + '/';
global.config.upload_url = global.config.url + 'uploads/'; global.config.upload_url = global.config.url + 'uploads/';
console.log('Info: Initializing NodeBB v' + global.ver + ', on port ' + global.config.port + ', using Redis store at ' + global.config.redis.host + ':' + global.config.redis.port + '.'); console.log('Info: Initializing NodeBB v' + pkg.version + ', on port ' + global.config.port + ', using Redis store at ' + global.config.redis.host + ':' + global.config.redis.port + '.');
console.log('Info: Base Configuration OK.'); console.log('Info: Base Configuration OK.');
var meta = require('./src/meta.js'); var meta = require('./src/meta.js');

@ -25,7 +25,7 @@
"license": "GPLv3 or later", "license": "GPLv3 or later",
"name": "NodeBB", "name": "NodeBB",
"description": "NodeBB Forum", "description": "NodeBB Forum",
"version": "0.0.1", "version": "0.0.2",
"homepage": "http://www.nodebb.org", "homepage": "http://www.nodebb.org",
"repository": { "repository": {
"type": "git", "type": "git",

@ -8,6 +8,7 @@ var express = require('express'),
redisServer = redis.createClient(global.config.redis.port, global.config.redis.host), redisServer = redis.createClient(global.config.redis.port, global.config.redis.host),
marked = require('marked'), marked = require('marked'),
utils = require('../public/src/utils.js'), utils = require('../public/src/utils.js'),
pkg = require('../package.json'),
fs = require('fs'), fs = require('fs'),
user = require('./user.js'), user = require('./user.js'),
@ -304,7 +305,7 @@ var express = require('express'),
async.each(data.categories, iterator, function(err) { async.each(data.categories, iterator, function(err) {
data.motd_class = (config.show_motd === '1' || config.show_motd === undefined) ? '' : 'none'; data.motd_class = (config.show_motd === '1' || config.show_motd === undefined) ? '' : 'none';
data.motd = marked(config.motd || "# NodeBB v" + global.ver + "\nWelcome to NodeBB, the discussion platform of the future.\n\n<a target=\"_blank\" href=\"http://www.nodebb.org\" class=\"btn btn-large\"><i class=\"icon-comment\"></i> Get NodeBB</a> <a target=\"_blank\" href=\"https://github.com/designcreateplay/NodeBB\" class=\"btn btn-large\"><i class=\"icon-github-alt\"></i> Fork us on Github</a> <a target=\"_blank\" href=\"https://twitter.com/dcplabs\" class=\"btn btn-large\"><i class=\"icon-twitter\"></i> @dcplabs</a>"); data.motd = marked(config.motd || "# NodeBB v" + pkg.version + "\nWelcome to NodeBB, the discussion platform of the future.\n\n<a target=\"_blank\" href=\"http://www.nodebb.org\" class=\"btn btn-large\"><i class=\"icon-comment\"></i> Get NodeBB</a> <a target=\"_blank\" href=\"https://github.com/designcreateplay/NodeBB\" class=\"btn btn-large\"><i class=\"icon-github-alt\"></i> Fork us on Github</a> <a target=\"_blank\" href=\"https://twitter.com/dcplabs\" class=\"btn btn-large\"><i class=\"icon-twitter\"></i> @dcplabs</a>");
res.json(data); res.json(data);
}); });

Loading…
Cancel
Save