Method: Buildr::ArchiveTask#path
- Defined in:
- lib/buildr/packaging/archive.rb
#path(name) ⇒ Object
:call-seq:
path(name) => Path
Returns a path object. Use the path object to include files under a path, for example, to include the file ‘foo’ as ‘bar/foo’:
zip(..).path('bar').include('foo')
Returns a Path object. The Path object implements all the same methods, like include, exclude, merge and so forth. It also implements path and root, so that:
path('foo').path('bar') == path('foo/bar')
path('foo').root == root
388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/buildr/packaging/archive.rb', line 388 def path(name) return @paths[''] if name.nil? normalized = name.split('/').inject([]) do |path, part| case part when '.', nil, '' path when '..' path[0...-1] else path << part end end.join('/') @paths[normalized] ||= Path.new(self, normalized) end |