mirror of
https://github.com/samsonjs/NorthWatcher.git
synced 2026-03-25 09:25:48 +00:00
reduce logging, bump version
This commit is contained in:
parent
f2dba0d902
commit
7dad075876
2 changed files with 4 additions and 16 deletions
|
|
@ -27,10 +27,7 @@ function main() {
|
||||||
|
|
||||||
eachLine(rcFile, function(line) {
|
eachLine(rcFile, function(line) {
|
||||||
// ignore comments and blank lines
|
// ignore comments and blank lines
|
||||||
if (line.match(/^\s*(#.*|)?$/)) {
|
if (line.match(/^\s*(#.*|)?$/)) return
|
||||||
console.log('>>> ignoring: "' + line + '"')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
line = line.trim() // don't want to match \s* everywhere
|
line = line.trim() // don't want to match \s* everywhere
|
||||||
|
|
||||||
|
|
@ -46,7 +43,7 @@ function main() {
|
||||||
}
|
}
|
||||||
if (dir.charAt(0) !== '/') dir = path.resolve(process.env.HOME, dir)
|
if (dir.charAt(0) !== '/') dir = path.resolve(process.env.HOME, dir)
|
||||||
ensureDirectory(dir)
|
ensureDirectory(dir)
|
||||||
console.log('>>> watch line, trigger: ' + trigger + ', dir: ' + dir + ', command: ' + command)
|
console.log('>>> watch ' + line)
|
||||||
watch(dir, options)
|
watch(dir, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,11 +73,9 @@ var watchedDirs = {}
|
||||||
|
|
||||||
function watch(dir, options) {
|
function watch(dir, options) {
|
||||||
if (dir in watchedDirs) {
|
if (dir in watchedDirs) {
|
||||||
console.log('>>> first watcher for ' + dir)
|
|
||||||
watchedDirs[dir].push(options)
|
watchedDirs[dir].push(options)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('>>> adding watcher for ' + dir)
|
|
||||||
watchedDirs[dir] = [options]
|
watchedDirs[dir] = [options]
|
||||||
files[dir] = ls(dir)
|
files[dir] = ls(dir)
|
||||||
fs.watchFile(dir, watcherForDir(dir, options))
|
fs.watchFile(dir, watcherForDir(dir, options))
|
||||||
|
|
@ -117,14 +112,7 @@ function runCommand(options) {
|
||||||
process.env.WATCH_DIR = options.dir
|
process.env.WATCH_DIR = options.dir
|
||||||
process.env.WATCH_CREATED = JSON.stringify(options.created)
|
process.env.WATCH_CREATED = JSON.stringify(options.created)
|
||||||
process.env.WATCH_REMOVED = JSON.stringify(options.removed)
|
process.env.WATCH_REMOVED = JSON.stringify(options.removed)
|
||||||
console.log('WATCH_DIR=' + process.env.WATCH_DIR)
|
spawn(cmd, args)
|
||||||
console.log('WATCH_CREATED=' + process.env.WATCH_CREATED)
|
|
||||||
console.log('WATCH_REMOVED=' + process.env.WATCH_REMOVED)
|
|
||||||
console.log('cmd: ' + cmd)
|
|
||||||
console.log('args: ' + args.join(' '))
|
|
||||||
spawn(cmd, args).stdout.on('data', function(x) {
|
|
||||||
console.log('child>>> ' + x)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ls(dir) {
|
function ls(dir) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{ "name" : "northwatcher"
|
{ "name" : "northwatcher"
|
||||||
, "description" : "NorthWatcher is cron for filesystem changes."
|
, "description" : "NorthWatcher is cron for filesystem changes."
|
||||||
, "version" : "0.1"
|
, "version" : "0.1.1"
|
||||||
, "homepage" : "http://samhuri.net/proj/northwatcher"
|
, "homepage" : "http://samhuri.net/proj/northwatcher"
|
||||||
, "author" : "Sami Samhuri <sami.samhuri@gmail.com>"
|
, "author" : "Sami Samhuri <sami.samhuri@gmail.com>"
|
||||||
, "repository" :
|
, "repository" :
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue