From b60df56157ee1fd0bd4938799bac05a62fda91a1 Mon Sep 17 00:00:00 2001 From: lookshe Date: Sat, 14 Mar 2015 20:45:20 +0100 Subject: initial commit from working version --- .../node_modules/redis/generate_commands.js | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 signaling-server/node_modules/socket.io/node_modules/redis/generate_commands.js (limited to 'signaling-server/node_modules/socket.io/node_modules/redis/generate_commands.js') diff --git a/signaling-server/node_modules/socket.io/node_modules/redis/generate_commands.js b/signaling-server/node_modules/socket.io/node_modules/redis/generate_commands.js new file mode 100644 index 0000000..e6949d3 --- /dev/null +++ b/signaling-server/node_modules/socket.io/node_modules/redis/generate_commands.js @@ -0,0 +1,39 @@ +var http = require("http"), + fs = require("fs"); + +function prettyCurrentTime() { + var date = new Date(); + return date.toLocaleString(); +} + +function write_file(commands, path) { + var file_contents, out_commands; + + console.log("Writing " + Object.keys(commands).length + " commands to " + path); + + file_contents = "// This file was generated by ./generate_commands.js on " + prettyCurrentTime() + "\n"; + + out_commands = Object.keys(commands).map(function (key) { + return key.toLowerCase(); + }); + + file_contents += "module.exports = " + JSON.stringify(out_commands, null, " ") + ";\n"; + + fs.writeFile(path, file_contents); +} + +http.get({host: "redis.io", path: "/commands.json"}, function (res) { + var body = ""; + + console.log("Response from redis.io/commands.json: " + res.statusCode); + + res.on('data', function (chunk) { + body += chunk; + }); + + res.on('end', function () { + write_file(JSON.parse(body), "lib/commands.js"); + }); +}).on('error', function (e) { + console.log("Error fetching command list from redis.io: " + e.message); +}); -- cgit v1.2.3