Skip to content

Commit 3203981

Browse files
committed
Don't link public/assets if public is linked
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".
1 parent 2232734 commit 3203981

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# [master][]
22

33
* Your contribution here!
4+
* [#200](https://github.com/capistrano/rails/pull/200): Don't link public/assets if public is already linked - [@mattbrictson](https://github.com/mattbrictson)
45

56
# [1.2.2][] (Jan 10 2017)
67

lib/capistrano/tasks/assets.rake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ end
120120
# as assets_prefix will always have a default value
121121
namespace :deploy do
122122
task :set_linked_dirs do
123-
set :linked_dirs, fetch(:linked_dirs, []).push("public/#{fetch(:assets_prefix)}").uniq
123+
linked_dirs = fetch(:linked_dirs, [])
124+
unless linked_dirs.include?('public')
125+
linked_dirs << "public/#{fetch(:assets_prefix)}"
126+
set :linked_dirs, linked_dirs.uniq
127+
end
124128
end
125129
end
126130

0 commit comments

Comments
 (0)