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

Add task to reveal the full path of assets #39

Merged
merged 3 commits into from
Dec 5, 2021
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
6 changes: 4 additions & 2 deletions lib/propshaft/assembly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ def compilers
end
end

def reveal
def reveal(path_type = :logical_path)
path_type = path_type.presence_in(%i[ logical_path path ]) || raise(ArgumentError, "Unknown path_type: #{path_type}")

load_path.assets.each do |asset|
Propshaft.logger.info asset.logical_path
Propshaft.logger.info asset.send(path_type)
end
end

Expand Down
9 changes: 8 additions & 1 deletion lib/propshaft/railties/assets.rake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ namespace :assets do

desc "Print all the assets available in config.assets.paths"
task reveal: :environment do
Rails.application.assets.reveal
Rails.application.assets.reveal(:logical_path)
end

namespace :reveal do
desc "Print the full path of assets available in config.assets.paths"
task full: :environment do
Rails.application.assets.reveal(:path)
end
end
end