Class: S3AssetDeploy::RailsLocalAssetCollector
Instance Method Summary
collapse
#asset_map, #asset_paths, #full_file_path, #initialize, #original_asset_paths
Instance Method Details
#assets ⇒ Object
7
8
9
|
# File 'lib/s3_asset_deploy/rails_local_asset_collector.rb', line 7
def assets
assets_from_manifest + pack_assets
end
|
#assets_from_manifest ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/s3_asset_deploy/rails_local_asset_collector.rb', line 11
def assets_from_manifest
manifest = ::Sprockets::Manifest.new(
::ActionView::Base.assets_manifest.environment,
::ActionView::Base.assets_manifest.dir
)
manifest.assets.values.map do |f|
S3AssetDeploy::RailsLocalAsset.new(
File.join(assets_prefix, f),
remove_fingerprint: @remove_fingerprint
)
end
end
|
#pack_assets ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/s3_asset_deploy/rails_local_asset_collector.rb', line 24
def pack_assets
return [] unless defined?(::Shakapacker) || defined?(::Webpacker)
Dir.chdir(public_path) do
config = defined?(::Shakapacker) ? ::Shakapacker.config : ::Webpacker.config
packs_dir = config.public_output_path.relative_path_from(public_path)
Dir[File.join(packs_dir, "/**/**")]
.select { |path| File.file?(path) }
.reject { |path| path.ends_with?(".gz") || path.ends_with?("manifest.json") }
.map { |path| S3AssetDeploy::RailsLocalAsset.new(path, remove_fingerprint: @remove_fingerprint) }
end
end
|