I find this approach quite good when you want to care about bigger
number of files and directories which need to be properly symlinked.
Comments and ideas how to improve this more than welcomed.

# Configuration

# Symlinks configuration, add to .gitignore as well
set :symlinked_configs, ['database.yml', 'thin.yml']

# name of dir in rails_root => name under shared_path (even with
support for subdirectories)
set :symlinked_dirs, { 'public/files' => 'files/
{events,users,articles,images}',
                       'tmp/uploaded' => 'uploaded',
                       'tmp/backup' => 'backup' }

# Tasks

 desc "Symlink configuration files"
  task :symlink_configuration_files, :roles => :app do
    run "mkdir -p #{shared_path}/config"
    symlinked_configs.each do |name|
      run "ln -nsf #{deploy_to}/#{shared_dir}/config/#{name}
#{current_path}/config/#{name}"
    end
  end

  desc "Symlink directories"
  task :symlink_dirs, :roles => :app do
    symlinked_dirs.each do |key, value|
      link_target = value
      link_target = value.split('/')[0] if value.include?('/')
      run "mkdir -p #{shared_path}/#{value}"
      run "rm -rf #{current_path}/#{key}"
      run "ln -nsf #{shared_path}/#{link_target} #{current_path}/
#{key}"
    end
  end
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to