Class: Capricorn::Actors::ApacheActor

Inherits:
Capricorn::Actor show all
Defined in:
lib/capricorn/actors/apache_actor.rb

Defined Under Namespace

Modules: Config

Instance Attribute Summary

Attributes inherited from Capricorn::Actor

#satellite, #system

Instance Method Summary collapse

Methods inherited from Capricorn::Actor

#initialize

Methods included from Capricorn::Actor::Actions

included, #run_callbacks!, #run_callbacks_in_fase!

Constructor Details

This class inherits a constructor from Capricorn::Actor

Instance Method Details

#remove_config_fileObject

remove the vhost config file (needs apache restart)



36
37
38
# File 'lib/capricorn/actors/apache_actor.rb', line 36

def remove_config_file
  File.unlink(system.apache_conf_path) if File.exist? system.apache_conf_path
end

#restartObject

restart the apache server



13
14
15
# File 'lib/capricorn/actors/apache_actor.rb', line 13

def restart
  system.run "#{system.apachectl_path} -k restart"
end

#write_config_fileObject

write the vhost config file (needs apache restart)



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/capricorn/actors/apache_actor.rb', line 18

def write_config_file
  config = %{<VirtualHost *>
  ServerName #{satellite.domain}
  
  ErrorLog   logs/#{satellite.domain}.error.log
  CustomLog  logs/#{satellite.domain}.access.log common
  DocumentRoot #{system.satellite_root}/public
  <Directory "#{system.satellite_root}/public">
    Options All
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>}
  File.open(system.apache_conf_path, 'w+') { |f| f.write config }
end