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.



278
279
280
281
282
283
284
285
# File 'lib/buildr/packaging/ziptask.rb', line 278

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



295
296
297
298
299
# File 'lib/buildr/packaging/ziptask.rb', line 295

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

#include(*files) ⇒ Object

See UnzipTask#include



288
289
290
291
292
# File 'lib/buildr/packaging/ziptask.rb', line 288

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

#map(entries) ⇒ Object



301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/buildr/packaging/ziptask.rb', line 301

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.



317
318
319
# File 'lib/buildr/packaging/ziptask.rb', line 317

def root
  @unzip
end

#targetObject

The target directory to extract to.



322
323
324
# File 'lib/buildr/packaging/ziptask.rb', line 322

def target
  @unzip.target
end