Module: OverridesPermissions
- Included in:
- Target::Deb::DebianSourceWrapper
- Defined in:
- lib/gpm/source/files_providers/overrides_permissions.rb
Overview
This module is intended as a mixin, you still need to implement the respective methods, i.e. base_provider and permission_overrides
Instance Method Summary collapse
Instance Method Details
#file_contents ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gpm/source/files_providers/overrides_permissions.rb', line 7 def file_contents #Beware: Deep magic here. result = base_provider.file_contents.map do |,content| _,override = .map do |condition,| # Find the length of the longest match for the current regexp. longest = .scan(condition).map do |match| match = match.join if match.kind_of? Array match.length end.max # return the length of the longest match and the associated permission # or nil if there was no match [longest,] if longest end.compact.max_by(&:first) #Get the Array with the greatest length in the first component. = FilePathAndPermissions.new(,override) if override [,content] end Hash[*result.flatten] end |
#files ⇒ Object
26 27 28 |
# File 'lib/gpm/source/files_providers/overrides_permissions.rb', line 26 def files file_contents.keys end |