diff --git a/generate_commands.js b/generate_commands.js index 60b1df0..b06dd22 100644 --- a/generate_commands.js +++ b/generate_commands.js @@ -21,19 +21,15 @@ http.get({host: "redis.io", path: "/commands.json"}, function(res) { function writeCommandsToFile(commands, path) { console.log("Writing " + path); - var fileContents = "// This file was generated by ./generate_commands.js on "; - fileContents += prettyCurrentTime(); - fileContents += "\nCommands = [\n"; + var fileContents = "// This file was generated by ./generate_commands.js on " + prettyCurrentTime() + "\n"; var lowerCommands = []; for (var command in commands) { - lowerCommands.push(" \"" + command.toLowerCase() + "\""); + lowerCommands.push(command.toLowerCase()); } - fileContents += lowerCommands.join(",\n"); - fileContents += "\n];\n\n" - fileContents += "exports.Commands = Commands;" - + fileContents += "exports.Commands = " + JSON.stringify(lowerCommands, null, " ") + ";\n"; + fs.writeFile(path, fileContents); } diff --git a/lib/commands.js b/lib/commands.js index facd7be..d785a50 100644 --- a/lib/commands.js +++ b/lib/commands.js @@ -1,5 +1,5 @@ -// This file was generated by ./generate_commands.js on Thu Jun 02 2011 21:09:35 GMT-0500 (CDT) -Commands = [ +// This file was generated by ./generate_commands.js on Thu Jun 02 2011 21:50:36 GMT-0500 (CDT) +exports.Commands = [ "append", "auth", "bgrewriteaof", @@ -124,5 +124,3 @@ Commands = [ "zscore", "zunionstore" ]; - -exports.Commands = Commands; \ No newline at end of file