Skip to content

Commit 69cb9ea

Browse files
committed
Merge branch 'master' of github.com:defunkt/resque
2 parents b786038 + 51e8841 commit 69cb9ea

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

README.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,13 @@ install and run Redis for you:
497497
$ rake redis:install dtach:install
498498
$ rake redis:start
499499

500+
Or, if you don't have admin access on your machine:
501+
502+
$ git clone git://github.com/defunkt/resque.git
503+
$ cd resque
504+
$ PREFIX=<your_prefix> rake redis:install dtach:install
505+
$ rake redis:start
506+
500507
You now have Redis running on 6379. Wait a second then hit ctrl-\ to
501508
detach and keep it running in the background.
502509

tasks/redis.rake

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ class RedisRunner
99
end
1010

1111
def self.redisconfdir
12-
'/etc/redis.conf'
12+
server_dir = File.dirname(`which redis-server`)
13+
conf_file = "#{server_dir}/../etc/redis.conf"
14+
unless File.exists? conf_file
15+
conf_file = "#{server_dir}/../../etc/redis.conf"
16+
end
17+
conf_file
1318
end
1419

1520
def self.dtach_socket
@@ -65,17 +70,19 @@ namespace :redis do
6570
RedisRunner.attach
6671
end
6772

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

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

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!"
82+
ENV['PREFIX'] and conf_dir = "#{ENV['PREFIX']}/etc" or conf_dir = '/etc'
83+
unless File.exists?("#{conf_dir}")
84+
sh "cp /tmp/redis/redis.conf #{conf_dir}"
85+
puts "Installed redis.conf to #{conf_dir} \n You should look at this file!"
7986
end
8087
end
8188

@@ -115,11 +122,12 @@ namespace :dtach do
115122
system('tar xzf dtach-0.8.tar.gz')
116123
end
117124

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

122-
puts 'Dtach successfully installed to /usr/bin.'
130+
puts "Dtach successfully installed to #{bin_dir}"
123131
end
124132
end
125133

0 commit comments

Comments
 (0)