/ Published in: Other
This snippet is made for textmate (or e editor ?)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
set :application, "${1:application}" set :repository, "${2:svn://}" set :port, "${3:22}" role :web, "${4:host}" #eg "myapp.com" or "123.456.789.10" role :app, "${4:host}" role :db, "${4:host}", :primary => true set :user, '${5:user}' # set :use_sudo, false # turn on if you are on a shared host... set :svn_repository_url, '${2:svn://}' set :checkout, 'export' set :deploy_via, :export set :home_path, "${6:home_path}" set :deploy_to, "#{home_path}/sites/#{application}" set :shared_dir, "shared" set :log, "#{shared_dir}/log" set :etc, "#{shared_dir}/etc" # if you are using apache, here's some stuff to set set :apache_root, "${7:/etc/apache2}" set :apache_vhosts_dir, "#{apache_root}/sites-available" namespace :deploy do task :restart do # no need to restart the app end end namespace :apache do desc 'Setup the vhost and enable the site' task :setup do vhost = <<-HOST <VirtualHost *:80> ServerName ${8:site_name} ServerAlias www.${8:site_name} DocumentRoot #{deploy_to}/current/public </VirtualHost> HOST put vhost, "#{home_path}/#{application}.tmp" sudo "mv #{home_path}/#{application}.tmp #{apache_vhosts_dir}/#{application}" enable_site end desc 'Enables the site' task :enable_site do sudo "a2ensite #{application}" reload end desc 'Reloads apache' task :reload do sudo "${9:/etc/init.d/apache2} reload" end desc 'Restarts apache gracefully' task :restart do sudo "apache2ctl graceful" end end