1 # Inspired by rabbitmq.rake the Redbox project at http://github.com/rick/redbox/tree/master
19 # Just check for existance of dtach socket
21 File
.exists
? dtach_socket
25 puts
'Detach with Ctrl+\ Re-attach with rake redis
:attach'
27 exec "dtach -A #{dtach_socket} redis-server #{redisconfdir}"
31 exec "dtach -a #{dtach_socket}"
35 sh 'echo
"SHUTDOWN" | nc localhost
6379'
44 puts "\nSee http://code.google.com/p/redis/ for information about redis.\n\n"
63 desc 'Attach to redis dtach socket
'
68 desc 'Install the lastest verison of Redis from
Github (requires git
, duh
)'
69 task :install => [:about, :download, :make] do
70 %w(redis-benchmark redis-cli redis-server).each do |bin|
71 sh "sudo cp /tmp/redis/#{bin} /usr/bin/"
74 puts "Installed redis-benchmark, redis-cli and redis-server to /usr/bin/"
76 unless File.exists?('/etc/redis
.conf
')
77 sh 'sudo cp
/tmp/redis
/redis
.conf
/etc
/'
78 puts "Installed redis.conf to /etc/ \n You should look at this file!"
83 sh "cd
#{RedisRunner.redisdir} && make clean
"
84 sh "cd
#{RedisRunner.redisdir} && make
"
87 desc "Download package
"
89 sh 'rm -rf /tmp/redis/' if File.exists?("#{RedisRunner.redisdir}/.svn
")
90 sh 'git clone git://github.com/antirez/redis.git /tmp/redis' unless File.exists?(RedisRunner.redisdir)
91 sh "cd
#{RedisRunner.redisdir} && git pull
" if File.exists?("#{RedisRunner.redisdir}/.git
")
100 puts "\nSee http
://dtach
.sourceforge
.net
/ for information about dtach
.\n\n"
103 desc 'Install dtach 0.8 from source'
104 task :install => [:about] do
107 unless File.exists?('/tmp/dtach-0.8.tar.gz')
110 url = 'http://downloads.sourceforge.net/project/dtach/dtach/0.8/dtach-0.8.tar.gz'
111 open('/tmp/dtach-0.8.tar.gz', 'wb') do |file| file.write(open(url).read) end
114 unless File.directory?('/tmp/dtach-0.8')
115 system('tar xzf dtach-0.8.tar.gz')
118 Dir.chdir('/tmp/dtach-0.8/')
119 sh 'cd /tmp/dtach-0.8/ && ./configure && make'
120 sh 'sudo cp /tmp/dtach-0.8/dtach /usr/bin/'
122 puts 'Dtach successfully installed to /usr/bin.'