Class: Buildr::Unzip::FromPath
- Defined in:
- lib/buildr/packaging/ziptask.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#exclude(*files) ⇒ Object
See UnzipTask#exclude.
-
#include(*files) ⇒ Object
See UnzipTask#include.
-
#initialize(unzip, path) ⇒ FromPath
constructor
A new instance of FromPath.
- #map(entries) ⇒ Object
-
#root ⇒ Object
Documented in Unzip.
-
#target ⇒ Object
The target directory to extract to.
Constructor Details
Instance Method Details
#exclude(*files) ⇒ Object
See UnzipTask#exclude
255 256 257 258 259 |
# File 'lib/buildr/packaging/ziptask.rb', line 255 def exclude(*files) #:doc: @exclude ||= [] @exclude |= files self end |
#include(*files) ⇒ Object
See UnzipTask#include
248 249 250 251 252 |
# File 'lib/buildr/packaging/ziptask.rb', line 248 def include(*files) #:doc: @include ||= [] @include |= files self end |
#map(entries) ⇒ Object
261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/buildr/packaging/ziptask.rb', line 261 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 |
#root ⇒ Object
Documented in Unzip.
277 278 279 |
# File 'lib/buildr/packaging/ziptask.rb', line 277 def root @unzip end |
#target ⇒ Object
The target directory to extract to.
282 283 284 |
# File 'lib/buildr/packaging/ziptask.rb', line 282 def target @unzip.target end |