From 4c424593dfbc217d362845b5dd199e12fe9b4aa2 Mon Sep 17 00:00:00 2001 From: Darren Date: Sat, 29 Mar 2014 14:32:37 +0000 Subject: [PATCH] Client version stored into kiwi.build_version --- client/build.js | 14 ++++++++------ client/src/app.js | 1 + client/src/index.html.tmpl | 3 +++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client/build.js b/client/build.js index 3e55739..4b9df3b 100644 --- a/client/build.js +++ b/client/build.js @@ -1,8 +1,9 @@ -var fs = require('fs'), - uglifyJS = require('uglify-js'), - _ = require('lodash'), - po2json = require('po2json'), - config = require('../server/configuration.js'); +var fs = require('fs'), + uglifyJS = require('uglify-js'), + _ = require('lodash'), + po2json = require('po2json'), + config = require('../server/configuration.js'), + package_json = require('../package.json'); var FILE_ENCODING = 'utf-8', EOL = '\n'; @@ -213,7 +214,8 @@ fs.readdir(__dirname + '/src/translations', function (err, translation_files) { */ var index_src = fs.readFileSync(__dirname + '/src/index.html.tmpl', FILE_ENCODING) - .replace(new RegExp('<%base_path%>', 'g'), config.get().http_base_path || '/kiwi'); + .replace(new RegExp('<%base_path%>', 'g'), config.get().http_base_path || '/kiwi') + .replace(new RegExp('<%build_version%>', 'g'), package_json.version); fs.writeFile(__dirname + '/index.html', index_src, { encoding: FILE_ENCODING }, function (err) { if (!err) { diff --git a/client/src/app.js b/client/src/app.js index 8349f69..5f19c81 100644 --- a/client/src/app.js +++ b/client/src/app.js @@ -15,6 +15,7 @@ _kiwi.applets = {}; * and data (think: plugins) */ _kiwi.global = { + build_version: '', // Kiwi IRC version this is built from (Set from index.html) settings: undefined, // Instance of _kiwi.model.DataStore plugins: undefined, utils: undefined, // TODO: Re-usable methods diff --git a/client/src/index.html.tmpl b/client/src/index.html.tmpl index cb8d6b5..4084154 100644 --- a/client/src/index.html.tmpl +++ b/client/src/index.html.tmpl @@ -490,6 +490,9 @@ // Run after all dependancies have been loaded jobs.onFinish(function startApp() { + // Kiwi IRC version this is built from + kiwi.build_version = '<%build_version%>'; + // Start the app kiwi.start(opts, function() { // Load any plugins -- 2.25.1