Sha256: 957e3e4eab43dbfdec17697f2a0b2148d10fca95db6b2fec76c55a40c3673051

Contents?: true

Size: 973 Bytes

Versions: 9

Compression:

Stored size: 973 Bytes

Contents

Capistrano::Configuration.instance.load do
  # These are set to the same structure in shared <=> current
  set :normal_symlinks, %w(tmp log config/mongoid.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

9 entries across 9 versions & 1 rubygems

Version Path
ricodigo-capistrano-recipes-0.1.8 lib/recipes/symlinks.rb
ricodigo-capistrano-recipes-0.1.7 lib/recipes/symlinks.rb
ricodigo-capistrano-recipes-0.1.6 lib/recipes/symlinks.rb
ricodigo-capistrano-recipes-0.1.5 lib/recipes/symlinks.rb
ricodigo-capistrano-recipes-0.1.4 lib/recipes/symlinks.rb
ricodigo-capistrano-recipes-0.1.3 lib/recipes/symlinks.rb
ricodigo-capistrano-recipes-0.1.2 lib/recipes/symlinks.rb
ricodigo-capistrano-recipes-0.1.1 lib/recipes/symlinks.rb
ricodigo-capistrano-recipes-0.1.0 lib/recipes/symlinks.rb