Skip to content

Commit cbe30a5

Browse files
committed
Ensure test.conf is regenerated when template changes.
1 parent ff80100 commit cbe30a5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Rakefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ENV["REDIS_BRANCH"] ||= "unstable"
44

55
REDIS_DIR = File.expand_path(File.join("..", "test"), __FILE__)
66
REDIS_CNF = File.join(REDIS_DIR, "test.conf")
7+
REDIS_CNF_TEMPLATE = File.join(REDIS_DIR, "test.conf.erb")
78
REDIS_PID = File.join(REDIS_DIR, "db", "redis.pid")
89
REDIS_LOG = File.join(REDIS_DIR, "db", "redis.log")
910
REDIS_SOCKET = File.join(REDIS_DIR, "db", "redis.sock")
@@ -65,13 +66,15 @@ file BINARY do
6566
SH
6667
end
6768

68-
file REDIS_CNF do
69+
file REDIS_CNF => [REDIS_CNF_TEMPLATE, __FILE__] do |t|
6970
require 'erb'
70-
template_path = "#{REDIS_CNF}.erb"
71-
template = File.read("#{REDIS_CNF}.erb")
71+
72+
erb = t.prerequisites[0]
73+
template = File.read(erb)
74+
7275
File.open(REDIS_CNF, 'w') do |file|
7376
file.puts "\# This file was auto-generated at #{Time.now}",
74-
"\# from (#{"#{REDIS_CNF}.erb"})",
77+
"\# from (#{erb})",
7578
"\#"
7679
conf = ERB.new(template).result
7780
file << conf

0 commit comments

Comments
 (0)