This repository has been archived by the owner on Nov 21, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Rakefile
68 lines (53 loc) · 1.46 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
# -*- ruby -*-
require 'rubygems'
require 'hoe'
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")
task :default => :run
desc "Run tests and manage server start/stop"
task :run => [:start, :test, :stop]
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
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
Hoe.plugin :bundler
Hoe.plugin :gemspec
Hoe.plugin :git
HOE = Hoe.spec 'newrelic-redis' do
developer 'Evan Phoenix', '[email protected]'
license "BSD"
dependency "redis", "< 4.0"
dependency "newrelic_rpm", "~> 3.11"
self.readme_file = "README.md"
end
file "#{HOE.spec.name}.gemspec" => ['Rakefile'] do |t|
puts "Generating #{t.name}"
File.open(t.name, 'wb') { |f| f.write HOE.spec.to_ruby }
end
desc "Generate or update the standalone gemspec file for the project"
task :gemspec => ["#{HOE.spec.name}.gemspec"]
# vim: syntax=ruby