Skip to content

Commit

Permalink
Don't link public/assets if public is linked
Browse files Browse the repository at this point in the history
If the user has already added "public" to Capistrano's `:linked_dirs`,
then further linking "public/assets" is not only unnecessary, it causes
conflicts and asset precompilation fails as a result.

Fix this by checking if "public" is already linked, and if so, skip
linking "public/assets".
  • Loading branch information
mattbrictson committed Mar 2, 2017
1 parent 2232734 commit 009b20f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/capistrano/tasks/assets.rake
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ end
# as assets_prefix will always have a default value
namespace :deploy do
task :set_linked_dirs do
set :linked_dirs, fetch(:linked_dirs, []).push("public/#{fetch(:assets_prefix)}").uniq
linked_dirs = fetch(:linked_dirs, [])
unless linked_dirs.include?('public')
linked_dirs << "public/#{fetch(:assets_prefix)}"
set :linked_dirs, linked_dirs.uniq
end
end
end

Expand Down

0 comments on commit 009b20f

Please sign in to comment.