forked from redis-store/redis-store
/
Rakefile
52 lines (44 loc) · 1.41 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
$:.unshift 'lib'
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'spec/rake/spectask'
REDIS_STORE_VERSION = "0.3.0"
task :default => :spec
desc 'Build and install the gem (useful for development purposes).'
task :install do
system "gem build redis-store.gemspec"
system "sudo gem uninstall redis-store"
system "sudo gem install --local --no-rdoc --no-ri redis-store-#{REDIS_STORE_VERSION}.gem"
system "rm redis-store-*.gem"
end
Spec::Rake::SpecTask.new do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = %w(-fs --color)
end
desc 'Show the file list for the gemspec file'
task :files do
puts "Files:\n #{Dir['**/*'].reject {|f| File.directory?(f)}.sort.inspect}"
puts "Test files:\n #{Dir['spec/**/*_spec.rb'].reject {|f| File.directory?(f)}.sort.inspect}"
end
namespace :redis do
desc 'Start the Redis cluster'
task :start => :clean do
system "redis-server spec/config/single.conf"
system "redis-server spec/config/master.conf"
system "redis-server spec/config/slave.conf"
end
desc 'Stop the Redis cluster'
task :stop do
# TODO replace with:
# system "kill -9 `tmp/redis-single.pid`"
# system "kill -9 `tmp/redis-master.pid`"
# system "kill -9 `tmp/redis-slave.pid`"
system "ps -eo pid,comm | grep redis | xargs kill -9"
end
desc 'Clean the tmp/ directory'
task :clean do
system "rm tmp/*" rescue nil
end
end