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
252 253 254 255 256 |
# File 'lib/buildr/packaging/ziptask.rb', line 252 def exclude(*files) #:doc: @exclude ||= [] @exclude |= files self end |
#include(*files) ⇒ Object
See UnzipTask#include
245 246 247 248 249 |
# File 'lib/buildr/packaging/ziptask.rb', line 245 def include(*files) #:doc: @include ||= [] @include |= files self end |
#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 |
#root ⇒ Object
Documented in Unzip.
274 275 276 |
# File 'lib/buildr/packaging/ziptask.rb', line 274 def root @unzip end |
#target ⇒ Object
The target directory to extract to.
279 280 281 |
# File 'lib/buildr/packaging/ziptask.rb', line 279 def target @unzip.target end |