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"
56 desc 'Attach to redis dtach socket
'
61 desc 'Install the lastest redis from svn
'
62 task :install => [:about, :download, :make] do
63 sh 'sudo cp
/tmp/redis
/redis-server
/usr
/bin
/'
64 sh 'sudo cp
/tmp/redis
/redis-benchmark
/usr
/bin
/'
65 puts 'Installed redis-server
and redis-benchmark to
/usr/bin
/'
66 unless File.exists?('/etc/redis
.conf
')
67 sh 'sudo cp
/tmp/redis
/redis
.conf
/etc
/'
68 puts "Installed redis.conf to /etc/ \n You should look at this file!"
73 sh "cd
#{RedisRunner.redisdir} && make clean
"
74 sh "cd
#{RedisRunner.redisdir} && make
"
77 desc "Download package
"
79 system 'svn checkout http://redis.googlecode.com/svn/trunk /tmp/redis' unless File.exists?(RedisRunner.redisdir)
80 system 'svn up' if File.exists?("#{RedisRunner.redisdir}/.svn
")
89 puts "\nSee http
://dtach
.sourceforge
.net
/ for information about dtach
.\n\n"
92 desc 'Install dtach 0.8 from source'
93 task :install => [:about] do
96 unless File.exists?('/tmp/dtach-0.8.tar.gz')
99 Net::HTTP.start('superb-west.dl.sourceforge.net') do |http|
100 resp = http.get('/sourceforge/dtach/dtach-0.8.tar.gz')
101 open('/tmp/dtach-0.8.tar.gz', 'wb') do |file| file.write(resp.body) end
105 unless File.directory?('/tmp/dtach-0.8')
106 system('tar xzf dtach-0.8.tar.gz')
109 Dir.chdir('/tmp/dtach-0.8/')
110 sh 'cd /tmp/dtach-0.8/ && ./configure && make'
111 sh 'sudo cp /tmp/dtach-0.8/dtach /usr/bin/'
113 puts 'Dtach successfully installed to /usr/bin.'