Class: Buildr::UnzipTask::FromPath
- Inherits:
-
Object
- Object
- Buildr::UnzipTask::FromPath
- Defined in:
- lib/tasks/zip.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#exclude(*files) ⇒ Object
See UnzipTask#exclude.
-
#include(*files) ⇒ Object
See UnzipTask#include.
-
#initialize(path) ⇒ FromPath
constructor
A new instance of FromPath.
-
#map(entries) ⇒ Object
:nodoc:.
Constructor Details
#initialize(path) ⇒ FromPath
Returns a new instance of FromPath.
364 365 366 367 368 369 370 |
# File 'lib/tasks/zip.rb', line 364 def initialize(path) if path @path = path[-1] == ?/ ? path : path + "/" else @path = "" end end |
Instance Method Details
#exclude(*files) ⇒ Object
See UnzipTask#exclude
380 381 382 383 384 |
# File 'lib/tasks/zip.rb', line 380 def exclude(*files) @exclude ||= [] @exclude |= files self end |
#include(*files) ⇒ Object
See UnzipTask#include
373 374 375 376 377 |
# File 'lib/tasks/zip.rb', line 373 def include(*files) @include ||= [] @include |= files self end |
#map(entries) ⇒ Object
:nodoc:
387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/tasks/zip.rb', line 387 def map(entries) includes = @include || ["*"] excludes = @exclude || [] entries.inject({}) do |map, entry| short = entry.name.sub(@path, "") if includes.any? { |pat| File.fnmatch(pat, short) } && !excludes.any? { |pat| File.fnmatch(pat, short) } map[short] = entry end map end end |