
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Supply Chain Security
Vulnerability
Quality
Maintenance
License
A simple tree structure for working with FilePath objects in ruby. I simply took the simple_tree module from https://github.com/ealdent/simple-tree and hacked it into Pathname from the std-lib. This means you get all the awesome features of working with Pathname, as well as making it easy to examine a filepath's ancestors and descendants.
install with: gem install filetree
require "filetree"
tree = FileTree.new('/home/user/test/test1/test2')
# => #<FileTree:/home/user/test/test1/test2>
tree.parent
# => #<FileTree:/home/user/test/test1>
tree.ancestors
# => [#<FileTree:/home/user/test>,
# #<FileTree:/home/user>,
# #<FileTree:/home>,
# #<FileTree:/>]
tree.descendants
# => [#<FileTree:/home/user/test/test1/test2/testee>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg/test4>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg/test4/myfile.txt>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg/test3>,
# #<FileTree:/home/user/test/test1/test2/testee/testeggg/test3/no>,
# #<FileTree:/home/user/test/test1/test2/testee/test4>,
# #<FileTree:/home/user/test/test1/test2/testee/test4/myfile.txt>,
# #<FileTree:/home/user/test/test1/test2/testee/test3>,
# #<FileTree:/home/user/test/test1/test2/testee/test3/no>]
des_arr = tree.descendants.map { |e| FileTree.new(e.relative_path_from(FileTree.new('/home/user'))) }
# => [#<FileTree:test/test1/test2/testee>,
# #<FileTree:test/test1/test2/testee/testeggg>,
# #<FileTree:test/test1/test2/testee/testeggg/test4>,
# #<FileTree:test/test1/test2/testee/testeggg/test4/myfile.txt>,
# #<FileTree:test/test1/test2/testee/testeggg/test3>,
# #<FileTree:test/test1/test2/testee/testeggg/test3/no>,
# #<FileTree:test/test1/test2/testee/test4>,
# #<FileTree:test/test1/test2/testee/test4/myfile.txt>,
# #<FileTree:test/test1/test2/testee/test3>,
# #<FileTree:test/test1/test2/testee/test3/no>]
des_arr.first
# => #<FileTree:test/test1/test2/testee>
des_arr.last.ancestors # infinite loop. "ancestors" depends on hitting "/" to stop.
# the "tree_rep" method provides prettyprinting for creating your own to_s methods
puts tree.tree_rep
# => nil
# >> #<FileTree:/home/user/test/test1/test2>
# >> \- #<FileTree:/home/user/test/test1/test2/testee>
# >> \- #<FileTree:/home/user/test/test1/test2/testee/testeggg>
# >> | \- #<FileTree:/home/user/test/test1/test2/testee/testeggg/test4>
# >> | | \- #<FileTree:/home/user/test/test1/test2/testee/testeggg/test4/myfile.txt>
# >> | \- #<FileTree:/home/user/test/test1/test2/testee/testeggg/test3>
# >> | | \- #<FileTree:/home/user/test/test1/test2/testee/testeggg/test3/no>
# >> \- #<FileTree:/home/user/test/test1/test2/testee/test4>
# >> | \- #<FileTree:/home/user/test/test1/test2/testee/test4/myfile.txt>
# >> \- #<FileTree:/home/user/test/test1/test2/testee/test3>
# >> | \- #<FileTree:/home/user/test/test1/test2/testee/test3/no>
View the docs.
All credit belongs to the following persons, I just cobbled this together from their work:
Distributed under the BSD license, please see LICENSE for more information.
FAQs
Unknown package
We found that filetree demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.