Skip to content

Commit 13cea18

Browse files
tkuchikimattbrictson
authored andcommitted
Added option ':assets_manifests' to support custom manifest file path (#216)
* Added option ':assets_manifest' to support custom manifest file path * fix coding style * fix CHANGELOG * fix assets_manifest (rename to assets_manifests)
1 parent 19c51f5 commit 13cea18

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
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+
* Added option ':assets_manifests' to support custom manifest file path ([#216](https://github.com/capistrano/rails/pull/216))
45

56
# [1.3.1][] (Nov 21 2017)
67

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ 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 ["/path/to/release_path/public/#{fetch(:assets_prefix)}/.sprockets-manifest*", "/path/to/release_path/public/#{fetch(:assets_prefix)}/manifest*.*"]
75+
# This should match config.assets.manifest in your rails config/application.rb
76+
set :assets_manifests, ['app/assets/config/manifest.js']
77+
7478
# RAILS_GROUPS env value for the assets:precompile task. Default to nil.
7579
set :rails_assets_groups, :assets
7680

lib/capistrano/tasks/assets.rake

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

104104
def detect_manifest_path
105-
%w(
106-
.sprockets-manifest*
107-
manifest*.*
108-
).each do |pattern|
109-
candidate = release_path.join('public', fetch(:assets_prefix), pattern)
110-
return capture(:ls, candidate).strip.gsub(/(\r|\n)/,' ') if test(:ls, candidate)
105+
fetch(:assets_manifests).each do |candidate|
106+
return capture(:ls, candidate).strip.gsub(/(\r|\n)/, ' ') if test(:ls, candidate)
111107
end
112108
msg = 'Rails assets manifest file not found.'
113109
warn msg
@@ -134,5 +130,10 @@ namespace :load do
134130
task :defaults do
135131
set :assets_roles, fetch(:assets_roles, [:web])
136132
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+
}
137138
end
138139
end

0 commit comments

Comments
 (0)