Sha256: a61dffda4354a0ad1e44bd9d09489bb4f0666c770cd76c4a5c7a4ad5d18972bb
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
module NginxHelper def generate_nginx_config(do_rebuild) vhost_renderer = ERB.new(File.read(File.join(@config.base_dir, 'templates', 'nginx', 'vhost.conf.erb'))) sites = {} grouped_domains.each_pair do |site_name, page_config| full_site_name = "#{site_name}.lvh.me" puts "Writing vhost for: #{full_site_name}" expires = @deploy_config.expires FileUtils.mkdir_p @nginx_conf_dir File.write File.join(@nginx_conf_dir, "#{site_name}.conf"), vhost_renderer.result(binding) sites[site_name] = "#{site_name}.lvh.me:8080" page_config.each do |config| sites["#{site_name}#{config[:baseurl]}"] = "#{site_name}.lvh.me:8080#{config[:baseurl]}" end if page_config.count > 1 end puts 'Generating index.html' FileUtils.mkdir_p @config.output_site_path renderer = ERB.new(File.read(File.join(@config.base_dir, 'templates', 'nginx', 'index.html.erb'))) File.write File.join(@config.output_site_path, 'index.html'), renderer.result(binding) puts 'Copy default vhost' default_vhost_file = 'live'.eql?(@config.environment) ? 'default-live-vhost.conf' : 'default-vhost.conf' FileUtils.cp File.join(@config.base_dir, 'templates', 'nginx', default_vhost_file), File.join(@nginx_conf_dir, 'default.conf') puts 'Copy nginx.conf' FileUtils.cp File.join(@config.base_dir, 'templates', 'nginx', 'nginx.conf'), File.join(@nginx_dir, 'nginx.conf') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
odania-static-pages-0.1.4 | lib/odania_static_pages/helper/nginx.rb |
odania-static-pages-0.1.3 | lib/odania_static_pages/helper/nginx.rb |