lib/ash/drupal.rb in capistrano-ash-1.1.1 vs lib/ash/drupal.rb in capistrano-ash-1.1.2
- old
+ new
@@ -72,15 +72,19 @@
end
namespace :backup do
desc "Perform a backup of database files"
task :db, :roles => :db do
- puts "Backing up the database now and putting dump file in the previous release directory"
- 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"
- # dump the database for the proper environment
- run "#{drush_bin} -l #{url} -r #{current_path} sql-dump | gzip -c --best > #{filename}"
+ if previous_release
+ puts "Backing up the database now and putting dump file in the previous release directory"
+ 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"
+ # 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"
end
end
end
# --------------------------------------------