Sha256: 16dd2b3d415a62eef0fb239c77708980054db845062b51e1b9c997a8977d777d
Contents?: true
Size: 1.64 KB
Versions: 7
Compression:
Stored size: 1.64 KB
Contents
#!/usr/bin/env ruby # Copyright (c) 2009, Keith Salisbury (www.globalkeith.com) # All rights reserved. # All the apache stuff should go in here... require 'subtrac/template' module Subtrac class Apache def initialize(binding) @apache_conf_dir = Subtrac::apache_conf_dir @subtrac_path = Subtrac::subtrac_path @server_hostname = Subtrac::server_hostname @locations_dir = Subtrac::locations_dir @binding = binding end def create_virtual_host() puts "\n==== Creating new virtual host ====" # TODO: Place a file in apache2 conf with Include directive which points to our conf folder template = Template.new(File.join(File.dirname(__FILE__), "apache", "vhost.conf.erb")) template.write(File.join(@apache_conf_dir,@server_hostname), @binding) enable_site() force_reload() end # creates the files necessary for a new client def create_client(client) client_config = File.join(@locations_dir,"#{client.path}.conf") if (!File.exists?(client_config)) then template = Template.new(File.join(File.dirname(__FILE__), "apache", "location.conf.erb")) template.write(client_config,@binding) force_reload() end end def force_reload # reload apache configuration `/etc/init.d/apache2 force-reload` if SUBTRAC_ENV != 'test' end def enable_site # tell apache enable site `a2ensite #{@server_hostname}` if SUBTRAC_ENV != 'test' end def create_project(project) # we dont need to do anything for each project, but we do need to ensure a client location exists create_client(project.client) end end end
Version data entries
7 entries across 7 versions & 1 rubygems