Skip to content

Commit

Permalink
Merge branch 'master' of github.com:defunkt/resque
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Dec 15, 2009
2 parents b786038 + 51e8841 commit 69cb9ea
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
7 changes: 7 additions & 0 deletions README.markdown
Expand Up @@ -497,6 +497,13 @@ install and run Redis for you:
$ rake redis:install dtach:install
$ rake redis:start

Or, if you don't have admin access on your machine:

$ git clone git://github.com/defunkt/resque.git
$ cd resque
$ PREFIX=<your_prefix> rake redis:install dtach:install
$ rake redis:start

You now have Redis running on 6379. Wait a second then hit ctrl-\ to
detach and keep it running in the background.

Expand Down
26 changes: 17 additions & 9 deletions tasks/redis.rake
Expand Up @@ -9,7 +9,12 @@ class RedisRunner
end

def self.redisconfdir
'/etc/redis.conf'
server_dir = File.dirname(`which redis-server`)
conf_file = "#{server_dir}/../etc/redis.conf"
unless File.exists? conf_file
conf_file = "#{server_dir}/../../etc/redis.conf"
end
conf_file
end

def self.dtach_socket
Expand Down Expand Up @@ -65,17 +70,19 @@ namespace :redis do
RedisRunner.attach
end

desc 'Install the lastest verison of Redis from Github (requires git, duh)'
desc 'Install the latest verison of Redis from Github (requires git, duh)'
task :install => [:about, :download, :make] do
ENV['PREFIX'] and bin_dir = "#{ENV['PREFIX']}/bin" or bin_dir = '/usr/bin'
%w(redis-benchmark redis-cli redis-server).each do |bin|
sh "sudo cp /tmp/redis/#{bin} /usr/bin/"
sh "cp /tmp/redis/#{bin} #{bin_dir}"
end

puts "Installed redis-benchmark, redis-cli and redis-server to /usr/bin/"
puts "Installed redis-benchmark, redis-cli and redis-server to #{bin_dir}"

unless File.exists?('/etc/redis.conf')
sh 'sudo cp /tmp/redis/redis.conf /etc/'
puts "Installed redis.conf to /etc/ \n You should look at this file!"
ENV['PREFIX'] and conf_dir = "#{ENV['PREFIX']}/etc" or conf_dir = '/etc'
unless File.exists?("#{conf_dir}")
sh "cp /tmp/redis/redis.conf #{conf_dir}"
puts "Installed redis.conf to #{conf_dir} \n You should look at this file!"
end
end

Expand Down Expand Up @@ -115,11 +122,12 @@ namespace :dtach do
system('tar xzf dtach-0.8.tar.gz')
end

ENV['PREFIX'] and bin_dir = "#{ENV['PREFIX']}/bin" or bin_dir = "/usr/bin"
Dir.chdir('/tmp/dtach-0.8/')
sh 'cd /tmp/dtach-0.8/ && ./configure && make'
sh 'sudo cp /tmp/dtach-0.8/dtach /usr/bin/'
sh "cp /tmp/dtach-0.8/dtach #{bin_dir}"

puts 'Dtach successfully installed to /usr/bin.'
puts "Dtach successfully installed to #{bin_dir}"
end
end

0 comments on commit 69cb9ea

Please sign in to comment.