forked from refractalize/nginx_mod_akamai_g2o
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
43 lines (31 loc) · 1.13 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
require 'fileutils'
include FileUtils
$nginx_version = "1.6.1"
$nginx_dir = "nginx-#{$nginx_version}"
desc 'build, patch and install nginx in this directory'
task :setup_nginx do
rm_rf $nginx_dir
sh("curl http://nginx.org/download/#{$nginx_dir}.tar.gz > #{$nginx_dir}.tar.gz")
sh("tar xzf #{$nginx_dir}.tar.gz")
rm $nginx_dir + '.tar.gz'
mod_dir = Dir.pwd
cd $nginx_dir
sh("./configure --prefix=#{Dir.pwd}/prefix --add-module=#{mod_dir} --with-cc-opt=-Wno-deprecated-declarations")
sh("make install")
sh("patch prefix/conf/nginx.conf ../setup-files/nginx.conf.patch")
make_content_dir 'download'
make_content_dir 'allow_token1'
make_content_dir 'allow_all'
end
def make_content_dir(dir)
mkdir_p "prefix/html/#{dir}"
cp "../setup-files/success_page.html", "prefix/html/#{dir}/stuff.html"
end
desc 'make the configuration patch containing changes for the ngo module'
task :make_conf_patch do
system("diff -u #{$nginx_dir}/prefix/conf/nginx.conf.default #{$nginx_dir}/prefix/conf/nginx.conf", :out => "setup-files/nginx.conf.patch")
end
desc 'run nginx'
task :run_nginx do
sh("#{$nginx_dir}/prefix/sbin/nginx")
end