After a huge amount of trial and error, I found that the issue was that;
Need to use execute in cap v3
Need to cd then chain command with && for running directory specific commands
Capistrano needs more documentation...
This is how I got mine working, I think there is a better way of doing it with Capistrano 3 but I could not find adequate documentation describing how anywhere.
#config valid only for Capistrano 3.1
lock '3.1.0'
set :application, 'prism-credentials'
set :repo_url, 'REPO URL'
# Default deploy_to directory is /var/www/my_app
set :deploy_to, 'DEPLOY FOLDER'
# Default value for keep_releases is 5
set :keep_releases, 5
set :branch, "master"
if ENV['branch']
set :branch, ENV['branch']
end
namespace :deploy do
desc "Change HTML Symlink to relative path"
task :create_symlink do
on roles(:app) do
#execute "ls -l"
info "Modifying symlink to be relative"
execute "rm -d #{current_path}"
info "Deleted current symlink"
execute "cd ../DEPLOY FOLDER && ln -s ./releases/#{File.basename release_path} current"
info "Created relative current symlink"
execute "cd ~/../DEPLOY FOLDER && touch env.conf && echo 'live' >> env.conf"
info "Created environment file"
end
end
end
after :deploy, "deploy:create_symlink"