Module: NonDigestAssets
- Defined in:
- lib/non-digest-assets.rb
Defined Under Namespace
Modules: CompileWithNonDigest
Constant Summary collapse
- @@asset_selectors =
[]
Class Method Summary collapse
-
.copy_file(from, to) ⇒ Object
Copy an asset and preserve atime and mtime attributes.
- .filter_assets(asset_list) ⇒ Object
Class Method Details
.copy_file(from, to) ⇒ Object
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.
26 27 28 29 30 31 |
# File 'lib/non-digest-assets.rb', line 26 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) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/non-digest-assets.rb', line 11 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 |