Permalink
Browse files

Important tweaks and fixes to the content-copying recipe, and a fix t…

…o permissions.
  • Loading branch information...
1 parent 87cadb2 commit dd20566a5b7ccec496ca23a54d2d1c519b21d566 @dan dan committed Jun 2, 2009
Showing with 32 additions and 9 deletions.
  1. +32 −9 deploy.rb
View
@@ -12,10 +12,13 @@
# the name of your system directory, which you may have customized
set :ee_system, "system"
-# the path to your virtual-hosts directory on the server up to
-# but NOT including the name of the website, specified above
+# the path to your new deployment directory on the server
+# by default, the name of the application (e.g. "/var/www/sites/example.com")
set :deploy_to, "/var/www/sites/#{application}"
+# the path to the old (non-capistrano) ExpressionEngine installation
+set :ee_previous_path, "/var/www/sites/oldsite"
+
# the git-clone url for your repository
set :repository, "git@github.com:you/project.git"
@@ -85,22 +88,42 @@
run "chmod 777 #{deploy_to}/#{shared_dir}/assets/images/uploads"
end
- desc "Set the correct permissions for the cache folders"
+ desc "Copy user-uploaded content from existing installation to shared directory"
+ task :copy_content, :roles => :app do
+ # copy the content
+ run "cp -n #{ee_previous_path}/images/avatars/uploads/* #{deploy_to}/#{shared_dir}/assets/images/avatars/uploads"
+ run "cp -n #{ee_previous_path}/images/captchas/* #{deploy_to}/#{shared_dir}/assets/images/captchas"
+ run "cp -n #{ee_previous_path}/images/member_photos/* #{deploy_to}/#{shared_dir}/assets/images/member_photos"
+ run "cp -n #{ee_previous_path}/images/pm_attachments/* #{deploy_to}/#{shared_dir}/assets/images/pm_attachments"
+ run "cp -n #{ee_previous_path}/images/signature_attachments/* #{deploy_to}/#{shared_dir}/assets/images/signature_attachments"
+ run "cp -n #{ee_previous_path}/images/uploads/* #{deploy_to}/#{shared_dir}/assets/images/uploads"
+ # reset permissions
+ run "chmod -R 777 #{deploy_to}/#{shared_dir}/assets/images/avatars/uploads"
+ run "chmod -R 777 #{deploy_to}/#{shared_dir}/assets/images/captchas"
+ run "chmod -R 777 #{deploy_to}/#{shared_dir}/assets/images/member_photos"
+ run "chmod -R 777 #{deploy_to}/#{shared_dir}/assets/images/pm_attachments"
+ run "chmod -R 777 #{deploy_to}/#{shared_dir}/assets/images/signature_attachments"
+ run "chmod -R 777 #{deploy_to}/#{shared_dir}/assets/images/uploads"
+ end
+
+ desc "Set the correct permissions for the config files and cache folder"
task :set_permissions, :roles => :app do
+ run "chmod 666 #{current_release}/path.php"
run "chmod 777 #{current_release}/#{ee_system}/cache/"
+ run "chmod 666 #{current_release}/#{ee_system}/config_bak.php"
end
desc "Create symlinks to shared data such as config files and uploaded images"
task :create_symlinks, :roles => :app do
- # the precious config file
+ # the config file
run "ln -s #{deploy_to}/#{shared_dir}/config/config.php #{current_release}/#{ee_system}/config.php"
# standard image upload directories
run "ln -s #{deploy_to}/#{shared_dir}/assets/images/avatars/uploads #{current_release}/images/avatars/uploads"
- run "ln -s #{deploy_to}/#{shared_dir}/assets/images/captchas #{current_release}/images/avatars/captchas"
- run "ln -s #{deploy_to}/#{shared_dir}/assets/images/member_photos #{current_release}/images/avatars/member_photos"
- run "ln -s #{deploy_to}/#{shared_dir}/assets/images/pm_attachments #{current_release}/images/avatars/pm_attachments"
- run "ln -s #{deploy_to}/#{shared_dir}/assets/images/signature_attachments #{current_release}/images/avatars/signature_attachments"
- run "ln -s #{deploy_to}/#{shared_dir}/assets/images/uploads #{current_release}/images/avatars/uploads"
+ run "ln -s #{deploy_to}/#{shared_dir}/assets/images/captchas #{current_release}/images/captchas"
+ run "ln -s #{deploy_to}/#{shared_dir}/assets/images/member_photos #{current_release}/images/member_photos"
+ run "ln -s #{deploy_to}/#{shared_dir}/assets/images/pm_attachments #{current_release}/images/pm_attachments"
+ run "ln -s #{deploy_to}/#{shared_dir}/assets/images/signature_attachments #{current_release}/images/signature_attachments"
+ run "ln -s #{deploy_to}/#{shared_dir}/assets/images/uploads #{current_release}/images/uploads"
end
desc "Clear the ExpressionEngine caches"

0 comments on commit dd20566

Please sign in to comment.