lib/ash/wordpress.rb in capistrano-ash-1.0.0 vs lib/ash/wordpress.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)
@@ -24,41 +25,51 @@
# --------------------------------------------
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
- run "mkdir -p #{shared_path}/uploads"
- run "mkdir -p #{shared_path}/cache"
-
+ run<<-CMD
+ mkdir -p #{shared_path}/uploads &&
+ mkdir -p #{shared_path}/cache
+ CMD
# 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
- run "rm -Rf #{latest_release}/#{uploads_path}"
- run "rm -Rf #{latest_release}/wp-content/cache"
+ run<<-CMD
+ rm -Rf #{latest_release}/#{uploads_path} &&
+ rm -Rf #{latest_release}/wp-content/cache
+ CMD
+
# Removing cruft files.
- run "rm -Rf #{latest_release}/license.txt"
- run "rm -Rf #{latest_release}/readme.html"
+ run<<-CMD
+ rm -Rf #{latest_release}/license.txt &&
+ rm -Rf #{latest_release}/readme.html
+ CMD
end
end
# --------------------------------------------
# Wordpress-specific methods
# --------------------------------------------
namespace :wordpress do
desc "Links the correct settings file"
task :symlink do
- run "ln -nfs #{shared_path}/uploads #{current_release}/#{uploads_path}"
- run "ln -nfs #{shared_path}/cache #{current_release}/wp-content/cache"
- run "ln -nfs #{latest_release}/wp-config.php.#{stage} #{latest_release}/wp-config.php"
+ run<<-CMD
+ ln -nfs #{shared_path}/uploads #{current_release}/#{uploads_path} &&
+ ln -nfs #{shared_path}/cache #{current_release}/wp-content/cache &&
+ ln -nfs #{latest_release}/wp-config.php.#{stage} #{latest_release}/wp-config.php
+ CMD
end
desc "Set URL in database"
task :updatedb do
run "mysql -u #{dbuser} -p #{dbpass} #{dbname} -e 'UPDATE #{dbprefix}options SET option_value = \"#{application}\" WHERE option_name = \"siteurl\" OR option_name = \"home\"'"
\ No newline at end of file