Class: Buildr::Unzip::FromPath

Inherits:
Object
  • Object
show all
Defined in:
lib/buildr/packaging/ziptask.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(unzip, path) ⇒ FromPath

Returns a new instance of FromPath.



309
310
311
312
313
314
315
316
# File 'lib/buildr/packaging/ziptask.rb', line 309

def initialize(unzip, path)
  @unzip = unzip
  if path
    @path = path[-1] == ?/ ? path : path + '/'
  else
    @path = ''
  end
end

Instance Method Details

#exclude(*files) ⇒ Object

See UnzipTask#exclude



326
327
328
329
330
# File 'lib/buildr/packaging/ziptask.rb', line 326

def exclude(*files) #:doc:
  @exclude ||= []
  @exclude |= files
  self
end

#include(*files) ⇒ Object

See UnzipTask#include



319
320
321
322
323
# File 'lib/buildr/packaging/ziptask.rb', line 319

def include(*files) #:doc:
  @include ||= []
  @include |= files
  self
end

#map(entries) ⇒ Object



332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/buildr/packaging/ziptask.rb', line 332

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) } &&
        !excludes.any? { |pat| File.fnmatch(pat, short) }
        map[short] = entry
      end
    end
    map
  end
end

#rootObject

Documented in Unzip.



348
349
350
# File 'lib/buildr/packaging/ziptask.rb', line 348

def root
  @unzip
end

#targetObject

The target directory to extract to.



353
354
355
# File 'lib/buildr/packaging/ziptask.rb', line 353

def target
  @unzip.target
end