# Reusable recipes
set :asset_folders, %W(images files)
namespace :deploy do
desc "Link the asset folders from the shared folder into our site"
task :finalize_update, :except => { :no_release => true } do
logger.info 'finalizing update with custom method'
run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
asset_folders.each do |asset|
run "rm -rf #{release_path}/#{asset}"
run "ln -nfs #{shared_path}/#{asset} #{release_path}/#{asset}"
end
end
desc "Set up the expected application directory structure on all boxes"
task :setup, :except => { :no_release => true } do
run <<-CMD
umask 02 &&
mkdir -p #{deploy_to} #{releases_path} #{shared_path}
CMD
asset_folders.each do |asset|
run "rm -rf #{release_path}/#{asset}"
run "ln -nfs #{shared_path}/#{asset} #{release_path}/#{asset}"
end
end
task :set_permissions, :except => { :no_release => true } do
# do nothing
end
task :restart do
# do nothing
end
end
namespace :drupal do
desc <<-DESC
Grab the specified version of drupal and install it
This presumes that the variables drupal_version and drupal_path have been set
DESC
task :install do
run "cd #{shared_path} && curl -O http://ftp.drupal.org/files/projects/drupal-#{drupal_version}.tar.gz"
run "cd #{shared_path} && tar xzvf drupal-#{drupal_version}.tar.gz"
run "rm -rf #{shared_path}/drupal-#{drupal_version}/sites"
run "cd #{drupal_path} && rm -rf !(sites)"
run "mv #{shared_path}/drupal-#{drupal_version}/* #{drupal_path}"
run "mv #{shared_path}/drupal-#{drupal_version}/.htaccess #{drupal_path}/.htaccess"
run "rm -rf #{shared_path}/drupal-#{drupal_version}"
end
end
after "deploy:setup", "drupal:install"
set :drupal_path, File.join(deploy_to, '../')
# You should only need to change the details below this line
set :drupal_version, "5.8" # Or whatever version you want to install
set :deploy_to, '/path/to/your/drupal/sites'
set :site_name, 'staging.scodigo.com' # The domain name of your app
role :web, "your.server.com"
set :repository, "svn://your.svn.com/path/to/repos/trunk"
# You probably won't need to change this piece
set :current_path, "#{deploy_to}/#{site_name}"
set :shared_path, "#{deploy_to}/shared/#{site_name}"