Sha256: 0af2b0b6b9192a787412090fa26a09908e54bb136aa323fbd954bf2f12b0a0ed

Contents?: true

Size: 1.25 KB

Versions: 19

Compression:

Stored size: 1.25 KB

Contents

Capistrano::Configuration.instance(:must_exist).load do
  
  define_recipe :symlinks do
    # 
    # Callbacks
    # 
    after "deploy:update_code", "symlinks:create"
  
    # 
    # Configuration
    #
    set :symlink_dirs,          []
    set :symlink_absolute_dirs, []
  
    #
    # Tasks
    #
    namespace :symlinks do

      desc "fix symlinks to shared directory"
      task :fix, :roles => [:app, :web] do
        # for folders stored under public
        symlink_dirs.each do |share|
          run "rm -rf #{current_path}/#{share}"
          run "mkdir -p #{shared_path}/#{share}"
          run "ln -nfs #{shared_path}/#{share} #{current_path}/#{share}"
        end
      end

      desc "create symlinks to shared directory"
      task :create, :roles => [:app, :web] do
        # for folders stored under public
        symlink_dirs.each do |share|
          run "rm -rf #{release_path}/#{share}"
          run "mkdir -p #{shared_path}/#{share}"
          run "ln -nfs #{shared_path}/#{share} #{release_path}/#{share}"
        end

        symlink_absolute_dirs.each do |share|
          run "rm -rf #{share[:symlink]}"
          run "mkdir -p #{share[:source]}"
          run "ln -nfs #{share[:source]} #{share[:symlink]}"
        end
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
factorylabs-fdlcap-0.2.0 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.2.1 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.2.2 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.2.3 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.2.4 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.2.5 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.2.6 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.2.7 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.0 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.1 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.10 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.2 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.3 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.4 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.5 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.6 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.7 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.8 lib/fdlcap/recipes/symlinks.rb
factorylabs-fdlcap-0.3.9 lib/fdlcap/recipes/symlinks.rb