Sha256: e1247848c96ed47e19ec4ee0dc90dba0996b3058e5993034e425c5e383866b26
Contents?: true
Size: 844 Bytes
Versions: 15
Compression:
Stored size: 844 Bytes
Contents
require_relative 'generate_site_vcl' require_relative 'generate_site_assets_vcl' module Odania class GenerateSitesVcl attr_accessor :domains, :template, :default_subdomains def initialize(domains, default_subdomains) self.domains = domains self.default_subdomains = default_subdomains self.template = File.new("#{BASE_DIR}/templates/varnish/sites.vcl.erb").read end def render Erubis::Eruby.new(self.template).result(binding) end def write(out_dir) File.write("#{out_dir}/sites.vcl", self.render) Dir.mkdir "#{out_dir}/sites" unless File.directory? "#{out_dir}/sites" self.domains.each_pair do |domain_name, domain| out = GenerateSiteVcl.new(domain, default_subdomains) out.write out_dir out = GenerateSiteAssetsVcl.new(domain, default_subdomains) out.write out_dir end end end end
Version data entries
15 entries across 15 versions & 1 rubygems