Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option ':assets_manifests' to support custom manifest file path #216

Merged
merged 4 commits into from
May 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# [master][]

* Your contribution here!
* Added option ':assets_manifests' to support custom manifest file path ([#216](https://github.com/capistrano/rails/pull/216))

# [1.3.1][] (Nov 21 2017)

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ set :assets_roles, [:web, :app]
# This should match config.assets.prefix in your rails config/application.rb
set :assets_prefix, 'prepackaged-assets'

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

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

Expand Down
13 changes: 7 additions & 6 deletions lib/capistrano/tasks/assets.rake
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,8 @@ namespace :deploy do
end

def detect_manifest_path
%w(
.sprockets-manifest*
manifest*.*
).each do |pattern|
candidate = release_path.join('public', fetch(:assets_prefix), pattern)
return capture(:ls, candidate).strip.gsub(/(\r|\n)/,' ') if test(:ls, candidate)
fetch(:assets_manifests).each do |candidate|
return capture(:ls, candidate).strip.gsub(/(\r|\n)/, ' ') if test(:ls, candidate)
end
msg = 'Rails assets manifest file not found.'
warn msg
Expand All @@ -134,5 +130,10 @@ namespace :load do
task :defaults do
set :assets_roles, fetch(:assets_roles, [:web])
set :assets_prefix, fetch(:assets_prefix, 'assets')
set :assets_manifests, -> {
%w[.sprockets-manifest* manifest*.*].map do |pattern|
release_path.join("public", fetch(:assets_prefix), pattern)
end
}
end
end