lucee.Componentcommandbox.system.util.Watcher
Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com I am a watcher that will run code any time files in a directory change. I am intended to be used as a transient. Create a new instance of me for each watch operation. getInstance( 'watcher' ) .paths( '**.cfc' ) .inDirectory( getCWD() ) .onChange( function( changeData ) { // changeData.added // changeData.removed // changeData.changed command( 'testbox run' ) .run(); } ) .start();
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
string
|
baseDirectory
|
true
|
false
|
|
struct
|
changeData
|
true
|
false
|
|
string
|
changeHash
|
true
|
false
|
|
function
|
changeUDF
|
true
|
false
|
|
commandbox.system.util.number
|
delayMS
|
true
|
false
|
|
struct
|
fileIndex
|
true
|
false
|
|
any
|
fileSeparator
|
true
|
false
|
|
any
|
fileSystemUtil
|
true
|
false
|
|
any
|
pathPatternMatcher
|
true
|
false
|
|
array
|
pathsToWatch
|
true
|
false
|
|
any
|
print
|
true
|
false
|
|
any
|
shell
|
true
|
false
|
|
boolean
|
watcherRun
|
true
|
false
|
Method Summary | |
---|---|
private any
|
calculateHashes()
|
private any
|
changeDetected()
|
string
|
getBaseDirectory()
|
string
|
getChangeData()
|
string
|
getChangeHash()
|
string
|
getChangeUDF()
|
string
|
getDelayMS()
|
string
|
getFileIndex()
|
string
|
getFileSeparator()
|
string
|
getFileSystemUtil()
|
string
|
getPathPatternMatcher()
|
string
|
getPathsToWatch()
|
string
|
getPrint()
|
string
|
getShell()
|
string
|
getWatcherRun()
|
any
|
inDirectory([any baseDirectory])
Pass in the base directory that the globbing patterns are relative to. |
any
|
onChange([any changeUDF])
Pass in a UDF refernce to be executed when the watcher senses a chnage on the file system. |
any
|
onDIComplete()
|
any
|
paths()
Pass in an array of file globbing paths or any numberof string globbing arguments. |
any
|
setBaseDirectory(string baseDirectory)
|
any
|
setChangeData(struct changeData)
|
any
|
setChangeHash(string changeHash)
|
any
|
setChangeUDF(function changeUDF)
|
any
|
setDelayMS(commandbox.system.util.number delayMS)
|
any
|
setFileIndex(struct fileIndex)
|
any
|
setFileSeparator(any fileSeparator)
|
any
|
setFileSystemUtil(any fileSystemUtil)
|
any
|
setPathPatternMatcher(any pathPatternMatcher)
|
any
|
setPathsToWatch(array pathsToWatch)
|
any
|
setPrint(any print)
|
any
|
setShell(any shell)
|
any
|
setWatcherRun(boolean watcherRun)
|
any
|
start()
Call to start the watcher. |
any
|
withDelay([any delayMS])
Pass in the number of miliseconds to wait between polls. |
Methods inherited from class lucee.Component |
---|
None |
Property Detail |
---|
access
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- fileSeparator@constantsserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- FileSystemserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- provider:pathPatternMatcher@globberserializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- PrintBufferserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- shellserializable
- trueaccess
- publicrequired
- falsereturntype
- anyserializable
- trueMethod Detail |
---|
Pass in the base directory that the globbing patterns are relative to
baseDirectory
Pass in a UDF refernce to be executed when the watcher senses a chnage on the file system
changeUDF
Pass in an array of file globbing paths or any numberof string globbing arguments.
baseDirectory
changeData
changeHash
changeUDF
delayMS
fileIndex
fileSeparator
fileSystemUtil
pathPatternMatcher
pathsToWatch
print
shell
watcherRun
Call to start the watcher. This method will block until the user ends it with Ctrl+C
Pass in the number of miliseconds to wait between polls
delayMS