forked from redis/try.redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
55 lines (45 loc) · 1.22 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# encoding: utf-8
task :default => :test
REDIS_DIR = File.expand_path(File.join("..", "test"), __FILE__)
REDIS_CNF = File.join(REDIS_DIR, "test.conf")
REDIS_PID = File.join(REDIS_DIR, "db", "redis.pid")
REDIS_PORT = 6381
desc "Start the Redis server"
task :start do
redis_running = \
begin
File.exists?(REDIS_PID) && Process.kill(0, File.read(REDIS_PID).to_i)
rescue Errno::ESRCH
FileUtils.rm REDIS_PID
false
end
unless redis_running
unless system("which redis-server")
STDERR.puts "redis-server not in PATH"
exit 1
end
unless system("redis-server #{REDIS_CNF}")
STDERR.puts "could not start redis-server"
exit 1
end
end
ENV['REDIS_PORT'] = REDIS_PORT.to_s
end
desc "Stop the Redis server"
task :stop do
if File.exists?(REDIS_PID)
Process.kill "INT", File.read(REDIS_PID).to_i
FileUtils.rm REDIS_PID
end
end
require 'rake/testtask'
Rake::TestTask.new do |t|
t.options = "-v"
t.test_files = FileList["test/test_*.rb"]
end
GROUPED_HELP_FILE = "redis-doc/grouped_help.json"
HELP_FILE = "~/code/redis/src/help.h"
desc "Generate grouped help file"
task :generate_help do
sh "./utils/parse_help_groups.rb #{HELP_FILE} > #{GROUPED_HELP_FILE}"
end