lucee.Component
commandbox.system.modules.globber.models.Globber
Copyright Since 2014 by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com I represent a single globbing pattern and provide a fluent API to access the matching files Unlike the PathPatternMatcher, which only handles comparisons of patterns, this model actually interacts with the file system to resolve a pattern to a list of real file system resources.
| Property Summary | ||||
|---|---|---|---|---|
| type | property | default | serializable | required |
any
|
baseDir
Directory the list was pulled from.
|
true
|
false
|
|
any
|
excludePattern
The file globbing pattern NOT to match.
|
true
|
false
|
|
any
|
format
Return matches as a query instead of an array.
|
array
|
true
|
false
|
any
|
loose
Uses Gitignore rules that match pattern anywhere inside path, not requiring explicit * at the start or end of the pattern.
|
false
|
true
|
false
|
any
|
matchQuery
query of real file system resources that match the pattern.
|
true
|
false
|
|
any
|
matchQueryArray
|
true
|
false
|
|
any
|
notExcludePattern
|
true
|
false
|
|
any
|
pathPatternMatcher
|
true
|
false
|
|
any
|
pattern
The file globbing pattern to match.
|
true
|
false
|
|
any
|
sort
Sort to use.
|
type, name
|
true
|
false
|
| Constructor Summary | |
|---|---|
|
init()
|
|
| Method Summary | |
|---|---|
any
|
addExcludePattern(string excludePattern)
Add additional excludePattern to process. |
any
|
addNotExcludePattern(string notExcludePattern)
Add not excludePattern to process. |
any
|
addPattern(string pattern)
Add additional pattern to process. |
any
|
appendMatchQuery([any matchQuery])
|
any
|
apply(any udf)
Pass a closure to this function to have it. |
any
|
asArray()
Return results as array. |
any
|
asQuery()
Return results as query. |
private any
|
calculateBaseDir(string pattern)
|
private any
|
combineMatchQueries()
|
any
|
copyTo(string targetPath)
Copy all matched paths to a new folder. |
any
|
count()
Get count of matched files. |
private any
|
ensureMatches()
Make sure the MatchQuery has been loaded. |
any
|
findUnmatchedPattern([any thisPattern], [any currentBaseDir])
|
string
|
getBaseDir()
|
any
|
getCleanSort()
The sort function in CFDirectory will simply ignore invalid sort columns so I'm mimicking that here, as much as I dislike it. |
any
|
getExcludePattern()
Always returns a string which is a list of excludePatterns. |
any
|
getExcludePatternArray()
|
string
|
getFormat()
|
string
|
getLoose()
|
string
|
getMatchQuery()
|
string
|
getMatchQueryArray()
|
string
|
getNotExcludePattern()
|
string
|
getPathPatternMatcher()
|
any
|
getPattern()
Always returns a string which is a list of patterns. |
any
|
getPatternArray()
|
string
|
getSort()
|
any
|
inDirectory(string baseDirectory)
Enable loose matching. |
any
|
loose([boolean loose='true'])
Enable loose matching. |
any
|
matches()
Get array of matched file system paths. |
any
|
pathAppend([any base], [any path])
Concatenate a folder or file to an existing base path, taking into account forward or backslashes. |
any
|
pathMayNotBeExcluded([any pathToMatch], [any type], [any currentBaseDir])
|
private any
|
process()
Load matching file from the file system. |
private any
|
processPattern([string pattern], [any baseDir], [any skipExcludes='false'])
|
any
|
setBaseDir(any baseDir)
|
any
|
setExcludePattern(any thisExcludePattern)
Can be list of excludePatterns or array of excludePatterns. |
any
|
setFormat(any format)
|
any
|
setLoose(any loose)
|
any
|
setMatchQuery(any matchQuery)
|
any
|
setMatchQueryArray(any matchQueryArray)
|
any
|
setNotExcludePattern(any notExcludePattern)
|
any
|
setPathPatternMatcher(any pathPatternMatcher)
|
any
|
setPattern(any thisPattern)
Override setter to ensure consistent slashes in pattern. |
any
|
setSort(any sort)
|
any
|
withSort([any thisSort])
Return results as array. |
| Methods inherited from class lucee.Component |
|---|
| None |
| Constructor Detail |
|---|
| Property Detail |
|---|
Directory the list was pulled from
access - publicrequired - falsereturntype - anyserializable - trueThe file globbing pattern NOT to match.
access - publicrequired - falsereturntype - anyserializable - trueReturn matches as a query instead of an array
access - publicrequired - falsereturntype - anyserializable - trueUses Gitignore rules that match pattern anywhere inside path, not requiring explicit * at the start or end of the pattern
access - publicrequired - falsereturntype - anyserializable - truequery of real file system resources that match the pattern
access - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyserializable - trueaccess - publicrequired - falsereturntype - anyinject - pathPatternMatcher@globberserializable - trueThe file globbing pattern to match.
access - publicrequired - falsereturntype - anyserializable - trueSort to use
access - publicrequired - falsereturntype - anyserializable - true| Method Detail |
|---|
Add additional excludePattern to process
excludePatternAdd not excludePattern to process
notExcludePatternAdd additional pattern to process
patternmatchQueryPass a closure to this function to have it applied to each paths matched by the pattern.
udfReturn results as array
Return results as query
patternCopy all matched paths to a new folder
targetPathGet count of matched files
Make sure the MatchQuery has been loaded.
thisPatterncurrentBaseDirThe sort function in CFDirectory will simply ignore invalid sort columns so I'm mimicking that here, as much as I dislike it. The sort should be in the format of "col asc, col2 desc, col3, col4" like a SQL order by If any of the columns or sort directions don't look right, just bail and return the default sort.
Always returns a string which is a list of excludePatterns
Always returns a string which is a list of patterns
Enable loose matching
baseDirectoryEnable loose matching
looseGet array of matched file system paths
Concatenate a folder or file to an existing base path, taking into account forward or backslashes Won't remove leading slashes on *nix. If base is an empty string, path is returned untouched.
base - The base path to append topath - The path segment or segments to add on to the basepathToMatchtypecurrentBaseDirLoad matching file from the file system
patternbaseDirskipExcludesbaseDirCan be list of excludePatterns or array of excludePatterns. Empty excludePatterns will be ignored
thisExcludePatternformatloosematchQuerymatchQueryArraynotExcludePatternpathPatternMatcherOverride setter to ensure consistent slashes in pattern Can be list of patterns or array of patterns. Empty patterns will be ignored
thisPatternsortReturn results as array
thisSort