From 77804673d7bf7f3df455bb42c479203e9455c68d Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 14 Jan 2012 16:12:03 -0800 Subject: [PATCH] Move packaging info into its own file. --- node/utils/Minify.js | 19 ++++++------------ node/utils/tar.json | 47 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 node/utils/tar.json diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 588456fd..330c5810 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -32,9 +32,8 @@ var gzip = require('gzip'); var server = require('../server'); var os = require('os'); -var padJS = ["jquery.min.js", "pad_utils.js", "plugins.js", "undo-xpopup.js", "json2.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "ace.js", "collab_client.js", "pad_userlist.js", "pad_impexp.js", "pad_savedrevs.js", "pad_connectionstatus.js", "pad2.js", "jquery-ui.js", "chat.js", "excanvas.js", "farbtastic.js"]; - -var timesliderJS = ["jquery.min.js", "plugins.js", "undo-xpopup.js", "json2.js", "colorutils.js", "draggable.js", "pad_utils.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "pad_impexp.js", "easysync2_client.js", "domline_client.js", "linestylefilter_client.js", "cssmanager_client.js", "broadcast.js", "broadcast_slider.js", "broadcast_revisions.js"]; +var TAR_PATH = path.join(__dirname, 'tar.json'); +var tar = JSON.parse(fs.readFileSync(TAR_PATH, 'utf8')); /** * creates the minifed javascript for the given minified name @@ -46,16 +45,10 @@ exports.minifyJS = function(req, res, jsFilename) res.header("Content-Type","text/javascript"); //choose the js files we need - if(jsFilename == "pad.js") - { - jsFiles = padJS; - } - else if(jsFilename == "timeslider.js") - { - jsFiles = timesliderJS; - } - else - { + var jsFiles = undefined; + if (Object.prototype.hasOwnProperty.call(tar, jsFilename)) { + jsFiles = tar[jsFilename]; + } else { throw new Error("there is no profile for creating " + name); } diff --git a/node/utils/tar.json b/node/utils/tar.json new file mode 100644 index 00000000..7cb60694 --- /dev/null +++ b/node/utils/tar.json @@ -0,0 +1,47 @@ +{ + "pad.js": [ + "jquery.min.js" + , "pad_utils.js" + , "plugins.js" + , "undo-xpopup.js" + , "json2.js" + , "pad_cookie.js" + , "pad_editor.js" + , "pad_editbar.js" + , "pad_docbar.js" + , "pad_modals.js" + , "ace.js" + , "collab_client.js" + , "pad_userlist.js" + , "pad_impexp.js" + , "pad_savedrevs.js" + , "pad_connectionstatus.js" + , "pad2.js" + , "jquery-ui.js" + , "chat.js" + , "excanvas.js" + , "farbtastic.js" + ] +, "timeslider.js": [ + "jquery.min.js" + , "plugins.js" + , "undo-xpopup.js" + , "json2.js" + , "colorutils.js" + , "draggable.js" + , "pad_utils.js" + , "pad_cookie.js" + , "pad_editor.js" + , "pad_editbar.js" + , "pad_docbar.js" + , "pad_modals.js" + , "pad_impexp.js" + , "easysync2_client.js" + , "domline_client.js" + , "linestylefilter_client.js" + , "cssmanager_client.js" + , "broadcast.js" + , "broadcast_slider.js" + , "broadcast_revisions.js" + ] +}