mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
nginx map gen into single dir
This commit is contained in:
parent
4c0ddce4bf
commit
71be5eeed7
2 changed files with 9 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -11,6 +11,8 @@ public/site_screenshots_test
|
||||||
public/site_thumbnails_test
|
public/site_thumbnails_test
|
||||||
*.swp
|
*.swp
|
||||||
files/map.txt
|
files/map.txt
|
||||||
|
files/supporter-map.txt
|
||||||
|
files/maps
|
||||||
.sass-cache
|
.sass-cache
|
||||||
.sass-cache/*
|
.sass-cache/*
|
||||||
files/sslsites.zip
|
files/sslsites.zip
|
||||||
|
|
9
Rakefile
9
Rakefile
|
@ -85,13 +85,14 @@ end
|
||||||
|
|
||||||
desc 'Compile nginx mapfiles'
|
desc 'Compile nginx mapfiles'
|
||||||
task :compile_nginx_mapfiles => [:environment] do
|
task :compile_nginx_mapfiles => [:environment] do
|
||||||
File.open('./files/map.txt', 'w') do |file|
|
FileUtils.mkdir_p './files/maps'
|
||||||
|
File.open('./files/maps/domains.txt', 'w') do |file|
|
||||||
Site.exclude(domain: nil).exclude(domain: '').select(:username,:domain).all.each do |site|
|
Site.exclude(domain: nil).exclude(domain: '').select(:username,:domain).all.each do |site|
|
||||||
file.write ".#{site.values[:domain]} #{site.username};\n"
|
file.write ".#{site.values[:domain]} #{site.username};\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open('./files/supporter-map.txt', 'w') do |file|
|
File.open('./files/maps/supporters.txt', 'w') do |file|
|
||||||
Site.select(:username, :domain).exclude(plan_type: 'free').exclude(plan_type: nil).all.each do |parent_site|
|
Site.select(:username, :domain).exclude(plan_type: 'free').exclude(plan_type: nil).all.each do |parent_site|
|
||||||
sites = [parent_site] + parent_site.children
|
sites = [parent_site] + parent_site.children
|
||||||
sites.each do |site|
|
sites.each do |site|
|
||||||
|
@ -102,6 +103,10 @@ task :compile_nginx_mapfiles => [:environment] do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Legacy for existing system
|
||||||
|
FileUtils.cp './files/maps/domains.txt', './files/map.txt'
|
||||||
|
FileUtils.cp './files/maps/supporters.txt', './files/supporter-map.txt'
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Produce SSL config package for proxy'
|
desc 'Produce SSL config package for proxy'
|
||||||
|
|
Loading…
Add table
Reference in a new issue