lib/ash/drupal.rb in capistrano-ash-1.3.4 vs lib/ash/drupal.rb in capistrano-ash-1.3.5
- old
+ new
@@ -13,10 +13,11 @@
#
# $ cap <stage> deploy:check
#
# --------------------------------------------
depend :remote, :command, 'drush'
+ depend :remote, :command, 'rsync'
# --------------------------------------------
# Setting defaults
# --------------------------------------------
proc{_cset( :multisites, {"#{application}" => "#{application}"} )}
@@ -55,11 +56,11 @@
# --------------------------------------------
namespace :deploy do
desc "Setup local files necessary for deployment"
task :setup_local do
# attempt to create files needed for proper deployment
- system("cp .htaccess htaccess.dist")
+ system("cp .htaccess htaccess.dist") unless local_file_exists?("htaccess.dist")
end
desc "Setup shared application directories and permissions after initial setup"
task :setup_shared do
# remove Capistrano specific directories
@@ -128,12 +129,17 @@
namespace :backup do
desc "Perform a backup of database files"
task :db, :roles => :db do
if previous_release
puts "Backing up the database now and putting dump file in the previous release directory"
+
+ # create the temporary copy for the release directory
+ # which we'll tarball in the backup:web task
+ run "mkdir -p #{tmp_backups_path}/#{release_name}"
+
multisites.each_pair do |folder, url|
# define the filename (include the current_path so the dump file will be within the directory)
- filename = "#{current_path}/#{folder}_dump-#{Time.now.to_s.gsub(/ /, "_")}.sql.gz"
+ filename = "#{tmp_backups_path}/#{release_name}/#{folder}_dump-#{Time.now.to_s.gsub(/ /, "_")}.sql.gz"
# dump the database for the proper environment
run "#{drush_bin} -l #{url} -r #{current_path} sql-dump | gzip -c --best > #{filename}"
end
else
logger.important "no previous release to backup; backup of database skipped"