lib/ash/drupal.rb in capistrano-ash-1.0.0 vs lib/ash/drupal.rb in capistrano-ash-1.1.0
- old
+ new
@@ -1,7 +1,8 @@
# Require our base library.
require 'ash/base'
+require 'railsless-deploy'
configuration = Capistrano::Configuration.respond_to?(:instance) ?
Capistrano::Configuration.instance(:must_exist) :
Capistrano.configuration(:must_exist)
@@ -29,29 +30,31 @@
# --------------------------------------------
namespace :deploy do
desc "Setup shared application directories and permissions after initial setup"
task :setup_shared, :roles => :web do
# remove Capistrano specific directories
- run "rm -Rf #{shared_path}/log"
- run "rm -Rf #{shared_path}/pids"
- run "rm -Rf #{shared_path}/system"
+ run<<-CMD
+ rm -Rf #{shared_path}/log &&
+ rm -Rf #{shared_path}/pids &&
+ rm -Rf #{shared_path}/system
+ CMD
# create shared directories
multisites.each_pair do |folder, url|
- run "mkdir -p #{shared_path}/#{url}/files"
+ run "mkdir -p #{shared_path}/#{url}/files"
end
# set correct permissions
run "chmod -R 777 #{shared_path}/*"
end
desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
task :finalize_update, :except => { :no_release => true } do
# remove shared directories
multisites.each_pair do |folder, url|
- run "mv #{latest_release}/sites/#{folder} #{latest_release}/sites/#{url}"
- run "rm -Rf #{latest_release}/sites/#{url}/files"
+ run "mv #{latest_release}/sites/#{folder} #{latest_release}/sites/#{url}"
+ run "rm -Rf #{latest_release}/sites/#{url}/files"
end
end
namespace :web do
desc "Disable the application and show a message screen"
@@ -73,11 +76,11 @@
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 dirrectory)
+ # 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
end
@@ -88,12 +91,14 @@
# --------------------------------------------
namespace :drupal do
desc "Symlink shared directories"
task :symlink, :except => { :no_release => true } do
multisites.each_pair do |folder, url|
- run "ln -nfs #{shared_path}/#{url}/files #{current_release}/sites/#{url}/files"
- run "ln -nfs #{latest_release}/sites/#{url}/settings.php.#{stage} #{latest_release}/sites/#{url}/settings.php"
- run "#{drush_bin} -l #{url} -r #{current_path} vset --yes file_directory_path sites/#{url}/files"
+ run<<-CMD
+ ln -nfs #{shared_path}/#{url}/files #{latest_release}/sites/#{url}/files &&
+ ln -nfs #{latest_release}/sites/#{url}/settings.php.#{stage} #{latest_release}/sites/#{url}/settings.php &&
+ #{drush_bin} -l #{url} -r #{current_path} vset --yes file_directory_path sites/#{url}/files
+ CMD
end
end
desc "Replace local database paths with remote paths"
task :updatedb, :except => { :no_release => true } do