Class: PoolParty::Plugin::VirtualHost
- Inherits:
-
Plugin
- Object
- PoolParty::PoolPartyBaseClass
- Service
- Plugin
- PoolParty::Plugin::VirtualHost
- Defined in:
- lib/poolparty/plugins/apache2/virtual_host.rb
Instance Attribute Summary
Attributes inherited from PoolParty::PoolPartyBaseClass
#init_opts, #ordered_resources
Instance Method Summary collapse
- #listen(port = "80") ⇒ Object
- #loaded(opts = {}, parent = self) ⇒ Object
- #virtual_host_entry(file) ⇒ Object
Methods inherited from Plugin
#after_create, #before_load, #bootstrap_commands, #bootstrap_gems, #calls, #cloud, #configure_commands, #enable, inherited, #initialize, #is_plugin?
Methods included from Callbacks
Methods included from DependencyResolverCloudExtensions
Methods included from CloudResourcer
#dependency_resolver, #instances, #plugin_directory, #run_stored_block, #store_block, #stored_block, #using
Methods inherited from Service
add_has_and_does_not_have_methods_for, #cloud, #to_properties_hash
Methods inherited from PoolParty::PoolPartyBaseClass
add_has_and_does_not_have_methods_for, #add_resource, add_resource_lookup_method, #add_service, #add_to_parent_if_parent_exists_and_is_a_service, #get_local_resource, #get_name_from_options_and_extra_options, #get_resource, #handle_option_values, #in_local_resources?, #initialize, #inspect, #is_a_resource?, #is_plugin?, #plugin_store, #resource, #resources, #run_in_context, #run_with_callbacks, #search_in_known_locations, #store_in_local_resources, #to_hash, #to_json
Methods included from SearchablePaths
Constructor Details
This class inherits a constructor from PoolParty::Plugin::Plugin
Instance Method Details
#listen(port = "80") ⇒ Object
5 6 7 8 |
# File 'lib/poolparty/plugins/apache2/virtual_host.rb', line 5 def listen(port="80") has_variable(:name => "port", :value => port) port port end |
#loaded(opts = {}, parent = self) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/poolparty/plugins/apache2/virtual_host.rb', line 24 def loaded(opts={}, parent=self) has_directory(:name => "/var/www", :owner => www_user, :mode=>'0744') has_directory(:name => "/var/www/#{name}", :owner => www_user, :mode=>'0744') has_directory(:name => "/var/www/#{name}/logs", :owner => www_user, :mode=>'0744') has_variable(:name => "sitename", :value => "#{name}") unless @virtual_host_entry virtual_host_entry <<-eof <VirtualHost *:#{port}> ServerName #{name} DocumentRoot /var/www/#{name} </VirtualHost> eof end has_exec(:name => "insert-site-#{name}", :command => "/usr/sbin/a2ensite #{name}", :calls => get_exec("reload-apache2"), :requires => get_file("/etc/apache2/sites-available/#{name}")) do requires get_package("apache2") if_not "/bin/sh -c '[ -L /etc/apache2/sites-enabled/#{parent.name} ] && [ /etc/apache2/sites-enabled/#{parent.name} -ef /etc/apache2/sites-available/#{parent.name} ]'" end end |
#virtual_host_entry(file) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/poolparty/plugins/apache2/virtual_host.rb', line 10 def virtual_host_entry(file) @virtual_host_entry = true if ::File.file?(file) has_file(.merge({:name => "/etc/apache2/sites-available/#{name}", :template => file, :requires => get_package("apache2")})) else has_file(.merge({:content => file, :name => "/etc/apache2/sites-available/#{name}", :requires => get_package("apache2")})) end end |