forked from jimeh/redistat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
69 lines (53 loc) · 1.18 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require 'bundler'
Bundler::GemHelper.install_tasks
#
# Rspec
#
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
end
RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
spec.rcov_opts = ['--exclude', 'spec']
end
task :default => [:start, :spec, :stop]
#
# Start/stop Redis test server
#
REDIS_DIR = File.expand_path(File.join("..", "spec"), __FILE__)
REDIS_CNF = File.join(REDIS_DIR, "redis-test.conf")
REDIS_PID = File.join(REDIS_DIR, "db", "redis.pid")
desc "Start the Redis test server"
task :start do
unless File.exists?(REDIS_PID)
system "redis-server #{REDIS_CNF}"
end
end
desc "Stop the Redis test server"
task :stop do
if File.exists?(REDIS_PID)
system "kill #{File.read(REDIS_PID)}"
system "rm #{REDIS_PID}"
end
end
#
# Yard
#
begin
require 'yard'
YARD::Rake::YardocTask.new
rescue LoadError
task :yardoc do
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
end
end
#
# Misc.
#
desc "Start an irb console with Redistat pre-loaded."
task :console do
exec "irb -r spec/spec_helper"
end
task :c => :console