1 # Inspired by rabbitmq.rake the Redbox project at http://github.com/rick/redbox/tree/master
18 # Just check for existance of dtach socket
20 File
.exists
? dtach_socket
24 puts
'Detach with Ctrl+\ Re-attach with rake redis
:attach'
26 exec "dtach -A #{dtach_socket} redis-server #{redisconfdir}"
30 exec "dtach -a #{dtach_socket}"
34 sh 'killall redis-server
'
43 puts "\nSee http://code.google.com/p/redis/ for information about redis.\n\n"
62 desc 'Attach to redis dtach socket
'
67 desc 'Install the lastest redis from svn
'
68 task :install => [:about, :download, :make] do
69 %w(redis-benchmark redis-cli redis-server).each do |bin|
70 sh "sudo cp /tmp/redis/#{bin} /usr/bin/"
73 puts "Installed redis-benchmark, redis-cli and redis-server to /usr/bin/"
75 unless File.exists?('/etc/redis
.conf
')
76 sh 'sudo cp
/tmp/redis
/redis
.conf
/etc
/'
77 puts "Installed redis.conf to /etc/ \n You should look at this file!"
82 sh "cd
#{RedisRunner.redisdir} && make clean
"
83 sh "cd
#{RedisRunner.redisdir} && make
"
86 desc "Download package
"
88 sh 'rm -rf /tmp/redis/' if File.exists?("#{RedisRunner.redisdir}/.svn
")
89 sh 'git clone git://github.com/antirez/redis.git /tmp/redis' unless File.exists?(RedisRunner.redisdir)
90 sh "cd
#{RedisRunner.redisdir} && git pull
" if File.exists?("#{RedisRunner.redisdir}/.git
")
99 puts "\nSee http
://dtach
.sourceforge
.net
/ for information about dtach
.\n\n"
102 desc 'Install dtach 0.8 from source'
103 task :install => [:about] do
106 unless File.exists?('/tmp/dtach-0.8.tar.gz')
109 Net::HTTP.start('superb-west.dl.sourceforge.net') do |http|
110 resp = http.get('/sourceforge/dtach/dtach-0.8.tar.gz')
111 open('/tmp/dtach-0.8.tar.gz', 'wb') do |file| file.write(resp.body) end
115 unless File.directory?('/tmp/dtach-0.8')
116 system('tar xzf dtach-0.8.tar.gz')
119 Dir.chdir('/tmp/dtach-0.8/')
120 sh 'cd /tmp/dtach-0.8/ && ./configure && make'
121 sh 'sudo cp /tmp/dtach-0.8/dtach /usr/bin/'
123 puts 'Dtach successfully installed to /usr/bin.'