Add bin and edit workflow
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s

This commit is contained in:
2026-09-16 13:11:16 -06:00
parent c8ac4fcae5
commit 4cee170d66
17576 changed files with 895740 additions and 2 deletions
@@ -0,0 +1,24 @@
## Dir#ascend
require 'facets/dir/ascend'
path = 'A/B/C'
tmp = []
Dir.ascend(path) do |d|
tmp << d
end
tmp.assert == %w{A/B/C A/B A}
Exclude current path.
tmp = []
Dir.ascend(path, false) do |d|
tmp << d
end
tmp.assert == %w{A/B A}
@@ -0,0 +1,16 @@
## Dir#descend
require 'facets/dir/descend'
Descend thru a file path.
path = 'A/B/C'
tmp = []
Dir.descend(path) do |d|
tmp << d
end
tmp.assert == %w{A A/B A/B/C}
@@ -0,0 +1,41 @@
## Dir#multiglob
Dir#multglob is like Dir#glob but it can handle more than one match
parameter at a time.
Given a directory 'multiglob' containing:
A.txt
A/B.txt
A/B/C.txt
We can use #multglob to find multiple matches.
require 'facets/dir/multiglob'
x = %w{
multiglob/A
multiglob/A.txt
}
r = Dir.multiglob('multiglob/A', 'multiglob/A.*').sort
r.assert == x
## Dir#multiglob_r
Dir#multiglob_r is like #multiglob but automatically searches
directories recrusively.
x = %w{
multiglob/A
multiglob/A/B
multiglob/A.txt
multiglob/A/B.txt
multiglob/A/B/C.txt
}.sort
r = Dir.multiglob_r('multiglob/*').sort
r.assert == x
@@ -0,0 +1,6 @@
## Dir#parent
require 'facets/dir/parent'
Dir.assert.parent?("a/b/c", "a/b/c/d")
@@ -0,0 +1,41 @@
## Dir#recurse
Given a directory 'recurse' containing:
A.txt
A/B.txt
A/B/C.txt
We can use #recurse to gather a complete recursive
list of all the entries.
require 'facets/dir/recurse'
x = %w{
recurse/A
recurse/A.txt
recurse/A/B
recurse/A/B.txt
recurse/A/B/C.txt
}.sort
r = Dir.recurse('recurse').sort
r.assert == x
## Dir#ls_r
Dir#ls_r is an alias for #recurse which can also be used to gather
a complete recursive list of all the entries.
x = %w{
recurse/A
recurse/A.txt
recurse/A/B
recurse/A/B.txt
recurse/A/B/C.txt
}.sort
r = Dir.ls_r('recurse').sort
r.assert == x