Class: Tap::Tasks::PrintTree
- Inherits:
-
Tap::Task
- Object
- Tap::Task
- Tap::Tasks::PrintTree
- Defined in:
- lib/tap/tasks/print_tree.rb
Overview
:startdoc::manifest print a directory tree
Prints a directory tree using a nice algorithm from www.xxeo.com/archives/2007/06/06/a-simple-directory-tree-printer-in-ruby.html
The output format is like this:
sample
|- MIT-LICENSE
|- README
|- Rakefile
|- lib
| `- sample.rb
|- sample.gemspec
|- tap.yml
`- test
|- sample_test.rb
|- tap_test_helper.rb
`- tap_test_suite.rb
Constant Summary collapse
- ARM_MAP =
Hash.new("| ")
Instance Method Summary collapse
-
#hidden?(path) ⇒ Boolean
Returns true if the path is hidden.
- #process(path = ".", target = $stdout) ⇒ Object
Instance Method Details
#hidden?(path) ⇒ Boolean
Returns true if the path is hidden. If the hidden_files config is specified as true, then hidden? always returns false, indicating that under these conditions no path is considered hidden.
44 45 46 |
# File 'lib/tap/tasks/print_tree.rb', line 44 def hidden?(path) !hidden_files && path.to_s =~ /^\.[^\.]/ end |
#process(path = ".", target = $stdout) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/tap/tasks/print_tree.rb', line 33 def process(path=".", target=$stdout) @target = target visit(Pathname.new("."), "", "", "", Pathname.new(path)) @target = nil target end |