From 51daca704f27e59462c6d8b1731867007c8fd273 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 20 Jul 2014 11:24:09 -0700 Subject: Precompile all coffeescript --- install.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 install.js (limited to 'install.js') diff --git a/install.js b/install.js new file mode 100644 index 00000000..0e6256df --- /dev/null +++ b/install.js @@ -0,0 +1,40 @@ +(function() { + var bcrypt, db; + + db = require("./redis"); + + bcrypt = require('bcrypt'); + + db.get("user:admin", function(err, res) { + if (!res) { + return bcrypt.hash('admin', 12, function(err, hash) { + db.sadd("users", "user:admin"); + return db.hmset("user:admin", { + username: 'admin', + password: hash + }, function() { + return console.log("Created admin user with password 'admin'"); + }); + }); + } + }); + + db.sismember("mts", "mt:rest", function(err, res) { + if (!res) { + db.hmset("mt:rest", { + code: "rest", + label: "Restaurant/Bar" + }, function() { + return db.sadd("mts", "mt:rest"); + }); + db.hmset("mt:coff", { + code: "rest", + label: "Coffee Shop" + }, function() { + return db.sadd("mts", "mt:coff"); + }); + return console.log("Added merchant types"); + } + }); + +}).call(this); -- cgit v1.2.3