Class: Subtrac::Apache
- Inherits:
-
Object
- Object
- Subtrac::Apache
- Defined in:
- lib/subtrac/apache.rb
Instance Method Summary collapse
-
#create_client(client) ⇒ Object
creates the files necessary for a new client.
- #create_project(project) ⇒ Object
- #create_virtual_host ⇒ Object
- #enable_site ⇒ Object
- #force_reload ⇒ Object
- #get_template(name) ⇒ Object
-
#initialize ⇒ Apache
constructor
A new instance of Apache.
Constructor Details
#initialize ⇒ Apache
Returns a new instance of Apache.
10 11 12 |
# File 'lib/subtrac/apache.rb', line 10 def initialize end |
Instance Method Details
#create_client(client) ⇒ Object
creates the files necessary for a new client
23 24 25 26 27 28 29 30 |
# File 'lib/subtrac/apache.rb', line 23 def create_client(client) client_config = File.join(Config.locations_dir,"#{Config.client.path}.conf") if (!File.exists?(client_config)) then template = get_template("location.conf.erb") template.write(client_config) force_reload() end end |
#create_project(project) ⇒ Object
41 42 43 44 |
# File 'lib/subtrac/apache.rb', line 41 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 |
#create_virtual_host ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/subtrac/apache.rb', line 13 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 = get_template("vhost.conf.erb") file_name = File.join(Config.apache_conf_dir,Config.server_hostname) template.write(file_name) enable_site() force_reload() end |
#enable_site ⇒ Object
36 37 38 39 40 |
# File 'lib/subtrac/apache.rb', line 36 def enable_site # tell apache enable site `a2ensite #{Config.server_hostname}` if SUBTRAC_ENV != 'test' puts("Apache site enabled...") end |
#force_reload ⇒ Object
31 32 33 34 35 |
# File 'lib/subtrac/apache.rb', line 31 def force_reload # reload apache configuration `/etc/init.d/apache2 force-reload` if SUBTRAC_ENV != 'test' puts("Apache reloaded...") end |