lib/ash/drupal.rb in capistrano-ash-1.1.4 vs lib/ash/drupal.rb in capistrano-ash-1.1.5
- old
+ new
@@ -9,22 +9,21 @@
configuration.load do
# --------------------------------------------
# Setting defaults
# --------------------------------------------
- proc{_cset( :multisites, {"default" => "#{application}"} )}
+ proc{_cset( :multisites, {"#{application}" => "#{application}"} )}
set :drush_bin, "drush"
# --------------------------------------------
# Calling our Methods
# --------------------------------------------
after "deploy:setup", "deploy:setup_shared"
after "deploy:finalize_update", "ash:fixperms"
- after "ash:fixperms", "drupal:protect"
after "deploy:symlink", "drupal:symlink"
+ after "drupal:symlink","drupal:protect"
after "deploy", "drupal:clearcache"
- after "deploy", "drupal:htaccess"
after "deploy", "deploy:cleanup"
# --------------------------------------------
# Overloaded Methods
# --------------------------------------------
@@ -93,13 +92,37 @@
# --------------------------------------------
namespace :drupal do
desc "Symlink shared directories"
task :symlink, :except => { :no_release => true } do
multisites.each_pair do |folder, url|
+ # symlinks the appropriate environment's settings.php file
+ symlink_config_file
+
run "ln -nfs #{shared_path}/#{url}/files #{latest_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"
end
+ end
+
+ desc <<-DESC
+ Symlinks the appropriate environment's settings file within the proper sites directory
+
+ Assumes the environment's settings file will be in one of two formats:
+ settings.<environment>.php => new default
+ settings.php.<environment> => deprecated
+ DESC
+ task :symlink_config_file, :except => { :no_release => true} do
+ multisites.each_pair do |folder, url|
+ drupal_app_site_dir = " #{latest_release}/sites/#{url}"
+
+ case true
+ when remote_file_exists?("#{drupal_app_site_dir}/settings.#{stage}.php")
+ run "ln -nfs #{drupal_app_site_dir}/settings.#{stage}.php #{drupal_app_site_dir}/settings.php"
+ when remote_file_exists?("#{drupal_app_site_dir}/settings.php.#{stage}")
+ run "ln -nfs #{drupal_app_site_dir}/settings.php.#{stage} #{drupal_app_site_dir}/settings.php"
+ else
+ logger.important "Failed to symlink the settings.php file in #{drupal_app_site_dir} because an unknown pattern was used"
+ end
+ end
end
desc "Replace local database paths with remote paths"
task :updatedb, :except => { :no_release => true } do
multisites.each_pair do |folder, url|