Sha256: 2f563c5c8ff798519f4037bf64c64635381c9f248b50bd1002986bbc99b005f4

Contents?: true

Size: 976 Bytes

Versions: 4

Compression:

Stored size: 976 Bytes

Contents

Capistrano::Configuration.instance.load do
  # These are set to the same structure in shared <=> current
  set :normal_symlinks, %w(tmp log config/database.yml) unless exists?(:normal_symlinks)
  
  # Weird symlinks go somewhere else. Weird.
  set :weird_symlinks, { 'bundle' => 'vendor/bundle',
                         'pids'   => 'tmp/pids' } unless exists?(:weird_symlinks)

  namespace :symlinks do
    desc "|capistrano-recipes| Make all the symlinks in a single run"
    task :make, :roles => :app, :except => { :no_release => true } do
      commands = normal_symlinks.map do |path|
        "rm -rf #{current_path}/#{path} && \
         ln -s #{shared_path}/#{path} #{current_path}/#{path}"
      end

      commands += weird_symlinks.map do |from, to|
        "rm -rf #{current_path}/#{to} && \
         ln -s #{shared_path}/#{from} #{current_path}/#{to}"
      end

      run <<-CMD
        cd #{current_path} && #{commands.join(" && ")}
      CMD
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dark-capistrano-recipes-0.8.4 lib/recipes/symlinks.rb
dark-capistrano-recipes-0.8.3 lib/recipes/symlinks.rb
dark-capistrano-recipes-0.8.2 lib/recipes/symlinks.rb
dark-capistrano-recipes-0.8.1 lib/recipes/symlinks.rb