* com.noccy.watcher: Initial inotify support * ScriptRunner now accepts an array of local vars for expansion when evaluating scripts
Watcher Plugin for Spark
Note: While the plugin currently supports wildcards, it does not scale well. Keep the watched files to a minimum or increase the interval if you experience issues.
Usage
$ spark watch
Installation
- Install Spark with global plugins
- Initialize your project:
spark init - Enable the plugin with
spark plugin --enable com.noccy.watcher - Configure your
.spark/watchers.jsonfile
Configuration
watchers.json
{
"watchers": [
{
"name": "name-of-rule",
"watch": [ "file1", "dir1/*" ],
"initial-trigger": true,
"actions": [
"@build"
]
}
]
}
namecontains an optional name of the rule.initial-triggercontrols whether the rule is triggered on startup. If false or not specified, the actions will be triggered when the file is modified after startup.watchis an array of files or wildcards to watch.actionsare script actions to invoke.
The executed action will have access to the WATCHER_RULE and WATCHER_FILES
variables for expansion.
Known issues
- The inotify monitor will trigger whenever a file is changed in a watched
directory, even if an explicit file is set. For example, changing the file
./templates/index.htmlwill trigger the rule for./templates/style.scss. If you can't live with that, exportSPARK_NO_INOTIFY=1before invoking! - The mtime monitor will poll the mtime of each watched file every check. This works great if you are explicit in what you are watching.