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

Version Path
odania-0.0.32 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.31 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.30 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.29 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.28 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.27 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.26 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.25 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.24 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.23 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.22 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.21 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.20 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.19 lib/odania/varnish/generators/generate_sites_vcl.rb
odania-0.0.18 lib/odania/varnish/generators/generate_sites_vcl.rb