lib/poolparty/plugins/apache2/passenger_site.rb in fairchild-poolparty-1.2.12 vs lib/poolparty/plugins/apache2/passenger_site.rb in fairchild-poolparty-1.3.5
- old
+ new
@@ -1,65 +1,62 @@
-require File.dirname(__FILE__)+'/apache'
module PoolParty
- module Plugin
+ module Resources
# Usage:
#
- # passengersite do
+ # passenger_site do
# end
- class PassengerSite < Apache
+ class PassengerSite < Resource
default_options(
:dir => "/var/www",
:appended_path => nil,
:owner => 'www-data',
:mode =>'0744',
- :enviornment => 'production',
+ :environment => 'production',
:deploy_dirs => false
)
- def loaded(opts={}, prnt=nil)
+ def after_loaded(opts={})
enable_passenger
port "80" unless self.port
has_directory(:name => dir, :owner => www_user, :mode => '0744')
has_directory(:name => "#{site_directory}", :owner => www_user, :mode => '0744')
has_site_directory 'logs'
- if deploy_dirs || opts[:with_deployment_directories]
+ if dsl_options[:deploy_dirs] || opts[:with_deployment_directories]
has_site_directory "shared"
has_site_directory "shared/public"
has_site_directory "shared/config"
has_site_directory "shared/log"
has_site_directory "releases"
- if !::File.exists?("#{dir}/#{name}/current")
+ if !File.exists?("#{dir}/#{name}/current")
# setup an initial symlink so apache will start even if there have not been any deploys yet
- has_site_directory "releases/initial/public"
+ #has_site_directory "releases/initial/public"
#FIXME the following line is chef specific. It will fail with puppet
- has_symlink({:target_file => "#{dir}/#{name}/current",
- :to => "#{dir}/#{name}/releases/initial"})
+ has_link(:target_file => "#{dir}/#{name}/current", :to => "#{dir}/#{name}/releases/initial")
end
log_dir = "#{site_directory}/shared/log"
appended_path "current"
else
log_dir = "#{site_directory}/log"
end
- passenger_entry <<-EOE
+ pass_entry = <<-EOE
<VirtualHost *:#{port}>
ServerName #{name}
DocumentRoot #{site_directory}/public
- RailsEnv #{enviornment}
+ RailsEnv #{environment}
ErrorLog #{log_dir}/error_log
CustomLog #{log_dir}/access_log common
</VirtualHost>
EOE
- # has_directory(:name => "/var/www")
- # has_directory(:name => "/var/www/#{name}")
- # has_directory(:name => "/var/www/#{name}/log")
- parent.install_site(name, :no_file => true) # we already created the file with #passenger_entry
+ passenger_entry(pass_entry)
+
+ install_site(name, :no_file => true) # we already created the file with #passenger_entry
end
def passenger_entry(file)
if ::File.file?(file)
has_file({:name => "/etc/apache2/sites-available/#{name}", :template => file})
\ No newline at end of file