Skip to content

Commit 2218eba

Browse files
committed
fix assets_manifest (rename to assets_manifests)
1 parent f6da153 commit 2218eba

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
* Your contribution here!
44

5-
* Added option ':assets_manifest' to support custom manifest file path ([#215](https://github.com/capistrano/rails/pull/215))
5+
* Added option ':assets_manifests' to support custom manifest file path ([#216](https://github.com/capistrano/rails/pull/216))
66

77
# [1.3.1][] (Nov 21 2017)
88

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ set :assets_roles, [:web, :app]
7171
# This should match config.assets.prefix in your rails config/application.rb
7272
set :assets_prefix, 'prepackaged-assets'
7373

74-
# Defaults to nil
74+
# Defaults to ["/path/to/release_path/public/#{fetch(:assets_prefix)}/.sprockets-manifest*", "/path/to/release_path/public/#{fetch(:assets_prefix)}/manifest*.*"]
7575
# This should match config.assets.manifest in your rails config/application.rb
76-
set :assets_manifest, 'app/assets/config/manifest.js'
76+
set :assets_manifests, ['app/assets/config/manifest.js']
7777

7878
# RAILS_GROUPS env value for the assets:precompile task. Default to nil.
7979
set :rails_assets_groups, :assets

lib/capistrano/tasks/assets.rake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ namespace :deploy do
102102
end
103103

104104
def detect_manifest_path
105-
manifests = fetch(:assets_manifest) ? [fetch(:assets_manifest)] : %w[.sprockets-manifest* manifest*.*]
106-
manifests.each do |pattern|
107-
manifest_path = fetch(:assets_manifest) ? [fetch(:assets_manifest)] : ["public", fetch(:assets_prefix), pattern]
108-
candidate = release_path.join(*manifest_path)
105+
fetch(:assets_manifests).each do |candidate|
109106
return capture(:ls, candidate).strip.gsub(/(\r|\n)/, ' ') if test(:ls, candidate)
110107
end
111108
msg = 'Rails assets manifest file not found.'
@@ -133,5 +130,10 @@ namespace :load do
133130
task :defaults do
134131
set :assets_roles, fetch(:assets_roles, [:web])
135132
set :assets_prefix, fetch(:assets_prefix, 'assets')
133+
set :assets_manifests, -> {
134+
%w[.sprockets-manifest* manifest*.*].map do |pattern|
135+
release_path.join("public", fetch(:assets_prefix), pattern)
136+
end
137+
}
136138
end
137139
end

0 commit comments

Comments
 (0)