deployment - Capistrano 3: Relative symlink instead of absolute for current, linked_dirs and linked_files -
i need have relative symlink instead of absolute symlink when deploying.
i think tree tasks need overwritten are.
rake::task["deploy:symlink:linked_dirs"] rake::task["deploy:symlink:linked_files"] rake::task["deploy:symlink:release"]
what dsl can drop in deploy.rb when i'm deploying created links relative.
you can juste use in deploy.rb overwrite default behaviour
## use relative path instead of absolute rake::task["deploy:symlink:linked_dirs"].clear rake::task["deploy:symlink:linked_files"].clear rake::task["deploy:symlink:release"].clear namespace :deploy namespace :symlink desc 'symlink release current' task :release on release_roles :all tmp_current_path = release_path.parent.join(current_path.basename) execute :ln, '-s', release_path.relative_path_from(current_path.dirname), tmp_current_path execute :mv, tmp_current_path, current_path.parent end end desc 'symlink files , directories shared release' task :shared invoke 'deploy:symlink:linked_files' invoke 'deploy:symlink:linked_dirs' end desc 'symlink linked directories' task :linked_dirs next unless any? :linked_dirs on release_roles :all execute :mkdir, '-p', linked_dir_parents(release_path) fetch(:linked_dirs).each |dir| target = release_path.join(dir) source = shared_path.join(dir) unless test "[ -l #{target} ]" if test "[ -d #{target} ]" execute :rm, '-rf', target end execute :ln, '-s', source.relative_path_from(target.dirname), target end end end end desc 'symlink linked files' task :linked_files next unless any? :linked_files on release_roles :all execute :mkdir, '-p', linked_file_dirs(release_path) fetch(:linked_files).each |file| target = release_path.join(file) source = shared_path.join(file) unless test "[ -l #{target} ]" if test "[ -f #{target} ]" execute :rm, target end execute :ln, '-s', source.relative_path_from(target.dirname), target end end end end end end
Comments
Post a Comment