mirror of
https://github.com/amark/gun.git
synced 2025-06-10 16:16:49 +00:00
go go go
This commit is contained in:
parent
7876692706
commit
ac4ffec554
14
redis.js
14
redis.js
@ -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);
|
||||
}
|
||||
}}
|
4
shots.js
4
shots.js
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user