lib/hanami/assets/bundler.rb in hanami-assets-0.3.0 vs lib/hanami/assets/bundler.rb in hanami-assets-0.4.0
- old
+ new
@@ -36,28 +36,24 @@
# @since 0.1.0
# @api private
def initialize(configuration, duplicates)
@manifest = Hash[]
@configuration = configuration
- @configurations = if duplicates.empty?
- [@configuration]
- else
- duplicates.map(&:configuration)
- end
+ @duplicates = duplicates
end
# Start the process.
#
# For each asset contained in the sources and third party gems, it will:
#
# * Compress
- # * Create a checksum version
- # * Generate an integrity digest
+ # * Create a fingerprinted version of the file
+ # * Generate a subresource integrity digest
#
- # At the end it will generate a digest manifest
+ # At the end it will generate a manifest
#
- # @see Hanami::Assets::Configuration#digest
+ # @see Hanami::Assets::Configuration#fingerprint
# @see Hanami::Assets::Configuration#manifest
# @see Hanami::Assets::Configuration#manifest_path
def run
assets.each do |path|
unless File.directory?(path)
@@ -130,17 +126,27 @@
# @since 0.3.0
# @api private
def _configuration_for(asset)
url = _convert_to_url(asset)
- @configurations.find { |config| url.start_with?(config.prefix) } ||
+ configurations.find { |config| url.start_with?(config.prefix) } ||
@configuration
end
# @since 0.1.0
# @api private
def public_directory
@configuration.public_directory
+ end
+
+ # @since 0.4.0
+ # @api private
+ def configurations
+ if @duplicates.empty?
+ [@configuration]
+ else
+ @duplicates.map { |dup| dup.respond_to?(:configuration) ? dup.configuration : dup }
+ end
end
end
end
end