Skip to content

Instantly share code, notes, and snippets.

@kreeger
Created July 26, 2013 14:48
Show Gist options
  • Select an option

  • Save kreeger/6089447 to your computer and use it in GitHub Desktop.

Select an option

Save kreeger/6089447 to your computer and use it in GitHub Desktop.
A Capistrano recipe for symlinking directories from shared into current/public.
set :public_directories, %w(uploads photos)
namespace :app do
desc "Symlink public directories"
task :symlink_public_directories, :roles => [:app, :db, :web] do
public_directories.each do |directory|
source = File.join(deploy_to, 'shared', directory)
destination = File.join(release_path, 'public', directory)
invoke_command "ln -nfs #{source} #{destination}", :via => run_method
end
end
end
after 'deploy:update_code', 'app:symlink_public_directories'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment