This commit is contained in:
theory 2014-03-17 05:42:30 -06:00
parent 7876692706
commit ac4ffec554
2 changed files with 10 additions and 8 deletions

View File

@ -1,17 +1,19 @@
module.exports = {install: function(done){
module.exports = {install: function(path, done){
var fs = require('fs')
, child = require('child_process')
, check = (fs.existsSync||require('path').existsSync);
if(!check('./redis-stable')){
child.exec('curl -O http://download.redis.io/redis-stable.tar.gz'
, check = (fs.existsSync||require('path').existsSync)
, server = path + '/redis-stable/src/redis-server';
if(!check(server)){
child.exec('cd ' + path
+ ' && ' + 'curl -O http://download.redis.io/redis-stable.tar.gz'
+ ' && ' + 'tar xvzf redis-stable.tar.gz'
+ ' && ' + 'cd redis-stable'
+ ' && ' + 'make'
, function(e, r){
console.log('>>>>>>>>>>>>>>>>>', e, r);
done();
done(server);
});
} else {
done();
done(server);
}
}}

View File

@ -1,14 +1,14 @@
module.exports = require('theory')
('shot',function(a){
var redis, client;
require('./redis').install(function(){
require('./redis').install('/tmp', function(path){
console.log('>>>>>>>>>>>>>>>>>>>>>>>> DONE <<<<<<<<<<<<<<<<<<<<');
redis = a.redis
, client = redis.createClient();
client.on('error', function(e){
if(!(/ECONNREFUSED/).test(e)){ return }
if(redis.none){ return }
redis.path = '/usr/local/bin/redis-server';
redis.path = path || '/usr/local/bin/redis-server';
if(!(require('fs').existsSync||require('path').existsSync)(redis.path)){
redis.none = true;
return;