Permalink
Browse files

Merge branch 'master' of github.com:defunkt/resque

  • Loading branch information...
2 parents b786038 + 51e8841 commit 69cb9ea218cb42a0e0beb5aa3519552f1d122caf @defunkt defunkt committed Dec 15, 2009
Showing with 24 additions and 9 deletions.
  1. +7 −0 README.markdown
  2. +17 −9 tasks/redis.rake
View
@@ -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.
View
@@ -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
@@ -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
@@ -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.