module NonDigestAssets

Public Class Methods

assets(asset_list) click to toggle source
# File lib/non-digest-assets.rb, line 34
def assets(asset_list)
  filter_assets(asset_list)
end
copy_file(from, to) click to toggle source

Copy an asset and preserve atime and mtime attributes. If the file exists and is not owned by the calling user, the utime call will fail so we just delete the target file first in any case.

# File lib/non-digest-assets.rb, line 27
def copy_file(from, to)
  return if from == to

  FileUtils.rm_f to
  FileUtils.copy_file from, to, :preserve_attributes
end
filter_assets(asset_list) click to toggle source
# File lib/non-digest-assets.rb, line 12
def filter_assets(asset_list)
  if asset_selectors.empty?
    asset_list
  else
    asset_list.select do |logical_path, _digest_path|
      asset_selectors.any? do |item|
        item === logical_path
      end
    end
  end
end