Sha256: ebcfcb49e5a3e01d6d7d98b85c2466e6ec1cb919be9e61530c5831ab356bdb17

Contents?: true

Size: 1.61 KB

Versions: 11

Compression:

Stored size: 1.61 KB

Contents

# find my home
home = [box['/Users/Simon/'], box['/Users/simon/']]
home = home.find { |p| p.exists? }
username = home.name

# create the capricorn root
capricorn_root = home['/capricorn/'].create
home.bash %{ chown #{username}:staff "#{capricorn_root.full_path}" }

# create the host app
application_root = capricorn_root[application[:id]+'/'].create
if application_root['host/'].exists?
  application_root.bash %{ rm -rf host }
end
application_root.bash %{ milkshake create.host "host" --git-data --shared-data "shared" }
capricorn_root.bash %{ chown -R #{username}:staff "#{application_root.full_path}" }

# create the vhost
apache_conf = box['/opt/local/apache2/conf/apps/']
vhost_conf  = apache_conf[application[:id] + ".conf"].create
vhost_conf.write %{
<VirtualHost *>
  ServerName #{application[:domain]}
  #{application[:aliases].collect {|d| 'ServerAlias '+d+"\n  "}}
  
  RailsEnv #{application[:environment]}
  
  ErrorLog   logs/#{application[:id]}.error.log
  CustomLog  logs/#{application[:id]}.access.log common
  DocumentRoot "#{application_root.full_path}/host/public"
  
  ErrorDocument 503 /503.html
  RewriteEngine on
  RewriteCond %{DOCUMENT_ROOT}/../tmp/stop.txt -f
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ /$1 [R=503,L]
  
  <Directory   "#{application_root.full_path}/host/public">
    Options All
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
}

# restart apache
box.bash %{ /opt/local/apache2/bin/apachectl -k restart }

# export variables
set :root_path, application_root.full_path.to_s
set :www_user,  username.to_s
set :www_group, 'staff'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
capricorn-2.0.8 lib/capricorn/recipes/macports.rb
capricorn-2.0.7 lib/capricorn/recipes/macports.rb
capricorn-2.0.6 lib/capricorn/recipes/macports.rb
capricorn-2.0.5 lib/capricorn/recipes/macports.rb
capricorn-2.0.4 lib/capricorn/recipes/macports.rb
capricorn-2.0.3 lib/capricorn/recipes/macports.rb
capricorn-2.0.3.pre2 lib/capricorn/recipes/macports.rb
capricorn-2.0.3.pre lib/capricorn/recipes/macports.rb
capricorn-2.0.2 lib/capricorn/recipes/macports.rb
capricorn-2.0.1 lib/capricorn/recipes/macports.rb
capricorn-2.0.0 lib/capricorn/recipes/macports.rb