Method: Buildr::Unzip::FromPath#map

Defined in:
lib/buildr/packaging/ziptask.rb

#map(entries) ⇒ Object



258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/buildr/packaging/ziptask.rb', line 258

def map(entries)
  includes = @include || ['**/*']
  excludes = @exclude || []
  entries.inject({}) do |map, entry|
    if entry.name =~ /^#{@path}/
      short = entry.name.sub(@path, '')
      if includes.any? { |pat| File.fnmatch(pat, short, File::FNM_PATHNAME) } &&
         !excludes.any? { |pat| File.fnmatch(pat, short, File::FNM_PATHNAME) }
        map[short] = entry
      end
    end
    map
  end
end