forked from raviqqe/nginx-conf.rb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
43 lines (29 loc) · 825 Bytes
/
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
require 'rake/clean'
TMP_DIR = 'tmp'
task :build do
sh %q(gem build *.gemspec)
end
task :push => :build do
sh %q(gem push *.gem)
end
task :install => :build do
sh %q(gem install *.gem)
end
task :test => :install do
rm_rf TMP_DIR
cp_r '/etc/nginx', TMP_DIR
cert, key = %w(cert.pem key.pem).map { |file| File.join TMP_DIR, file }
sh %Q(openssl req -nodes -x509 -newkey rsa:4096 -out #{cert} -keyout #{key} \
-subj /C=/ST=/L=/O=/OU=/CN=foo.com)
Dir.glob('examples/*.rb').each do |file|
conf = File.absolute_path File.join(TMP_DIR, 'nginx.conf')
File.write conf, `ruby #{file}`
sh %Q(sudo nginx -t -c #{conf})
end
Dir.glob('test/no_check/*.rb').each do |file|
ruby file
end
rm_r TMP_DIR
end
task :default => :build
CLEAN.include Dir.glob ['*.gem', 'tmp']