Capistrano and new lines in command

I hope someone can help with a capistrano problem.
I have been using Capistrano to deploy a rails 3.2 app for a little
while with no problems. Having upgraded the app to rails 4.2.5,
however, I have a problem when I try to deploy it using
cap production deploy
All runs well until it tries to run a command:

cd /site/releases/20151119150821 && /usr/bin/env cp
/site/releases/20151119150821/public/assets/manifest-72e5c145db1ffed834c05d9e2e69721e.json
/site/releases/20151119150821/public/assets/manifest.yml
/site/releases/20151119150821/assets_manifest_backup

The problem is that there appears to be a newline after .json so the result is:

DEBUG [c1a8b7a9] cp:
DEBUG [c1a8b7a9] missing destination file operand after
'/site/releases/20151119150821/public/assets/manifest-72e5c145db1ffed834c05d9e2e69721e.json'
DEBUG [c1a8b7a9]
DEBUG [c1a8b7a9] Try 'cp --help' for more information.
DEBUG [c1a8b7a9] bash: line 1:
/site/releases/20151119150821/public/assets/manifest.yml: Permission
denied

I have not enough experience with capistrano to have any idea where to
even start looking for the problem so any help will be much
appreciated.

Google has been of little help to me in this.

rails 4.2.5, capistrano 3.4.0

Colin

If you are getting a permission denied have you double checked your working directory on the server to make sure your deploy user has full perms? Also in capistrano are you using deploy as sudo or just a non-elevated user?

Perms is where I would start looking just to eliminate that possibility. I will do some searching and see what else I can come up with.

-James

If you are getting a permission denied have you double checked your working directory on the server to make sure your deploy user has full perms? Also in capistrano are you using deploy as sudo or just a non-elevated user?

Perms is where I would start looking just to eliminate that possibility. I will do some searching and see what else I can come up with.

The permissions error was caused by the fact that it was trying to
execute the second line of the cp command. In fact I have solved it,
in Gemfile I had

gem 'sass-rails', '~> 4.0.2'
gem 'coffee-rails', '~> 4.0.0'

I noticed that if I made a new rails 4.2.5 app then it generated

gem 'sass-rails', '~> 5.0'
gem 'coffee-rails', '~> 4.1.0'

Changing Gemfile accordingly and running bundle update fixed the
problem, though I am not sure why.

Anyway, thanks for looking.

Cheers

Colin