UNPKG

alpha-one

Version:

ideas about recurring tasks in Web- and Backend-Application building

43 lines (29 loc) 1.16 kB
// Generated by CoffeeScript 1.7.1 (function() { var TRM, alert, badge, debug, help, info, log, redis, rpr, warn, whisper; TRM = require('coffeenode-trm'); rpr = TRM.rpr.bind(TRM); badge = 'α1/validate-redis-is-running'; log = TRM.get_logger('plain', badge); info = TRM.get_logger('info', badge); whisper = TRM.get_logger('whisper', badge); alert = TRM.get_logger('alert', badge); debug = TRM.get_logger('debug', badge); warn = TRM.get_logger('warn', badge); help = TRM.get_logger('help', badge); redis = require('redis'); module.exports = function(options) { var client; client = redis.createClient(options); client.on('error', function(error) { if (/Redis connection to .* failed - connect ECONNREFUSED/.test(error['message'])) { alert("you either forgot to start your Redis instance or it does not match the configuration:\n" + (rpr(options))); help("execute `redis-server` or demonize Redis"); } throw error; }); return client.set('A1-test', 'test', function(error, response) { return info("Redis response: " + (rpr(response))); }); }; }).call(this);