mirror of
https://github.com/amark/gun.git
synced 2025-06-13 17:46:39 +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')
|
var fs = require('fs')
|
||||||
, child = require('child_process')
|
, child = require('child_process')
|
||||||
, check = (fs.existsSync||require('path').existsSync);
|
, check = (fs.existsSync||require('path').existsSync)
|
||||||
if(!check('./redis-stable')){
|
, server = path + '/redis-stable/src/redis-server';
|
||||||
child.exec('curl -O http://download.redis.io/redis-stable.tar.gz'
|
if(!check(server)){
|
||||||
|
child.exec('cd ' + path
|
||||||
|
+ ' && ' + 'curl -O http://download.redis.io/redis-stable.tar.gz'
|
||||||
+ ' && ' + 'tar xvzf redis-stable.tar.gz'
|
+ ' && ' + 'tar xvzf redis-stable.tar.gz'
|
||||||
+ ' && ' + 'cd redis-stable'
|
+ ' && ' + 'cd redis-stable'
|
||||||
+ ' && ' + 'make'
|
+ ' && ' + 'make'
|
||||||
, function(e, r){
|
, function(e, r){
|
||||||
console.log('>>>>>>>>>>>>>>>>>', e, r);
|
console.log('>>>>>>>>>>>>>>>>>', e, r);
|
||||||
done();
|
done(server);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
done();
|
done(server);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
4
shots.js
4
shots.js
@ -1,14 +1,14 @@
|
|||||||
module.exports = require('theory')
|
module.exports = require('theory')
|
||||||
('shot',function(a){
|
('shot',function(a){
|
||||||
var redis, client;
|
var redis, client;
|
||||||
require('./redis').install(function(){
|
require('./redis').install('/tmp', function(path){
|
||||||
console.log('>>>>>>>>>>>>>>>>>>>>>>>> DONE <<<<<<<<<<<<<<<<<<<<');
|
console.log('>>>>>>>>>>>>>>>>>>>>>>>> DONE <<<<<<<<<<<<<<<<<<<<');
|
||||||
redis = a.redis
|
redis = a.redis
|
||||||
, client = redis.createClient();
|
, client = redis.createClient();
|
||||||
client.on('error', function(e){
|
client.on('error', function(e){
|
||||||
if(!(/ECONNREFUSED/).test(e)){ return }
|
if(!(/ECONNREFUSED/).test(e)){ return }
|
||||||
if(redis.none){ 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)){
|
if(!(require('fs').existsSync||require('path').existsSync)(redis.path)){
|
||||||
redis.none = true;
|
redis.none = true;
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user