From bf4c25510cffdd9045c6be9552478c8dd09d4bf0 Mon Sep 17 00:00:00 2001 From: Aurimas Date: Sat, 24 Jan 2015 01:40:47 +0700 Subject: [PATCH] Move from gaze to chokidar (for node 0.11 and io.js support) --- compiler/index.js | 18 ++++++------------ make/dev.js | 20 ++++++-------------- package.json | 2 +- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/compiler/index.js b/compiler/index.js index 651c99dc9a..f7d9a95c64 100755 --- a/compiler/index.js +++ b/compiler/index.js @@ -47,7 +47,7 @@ function help() { var ph = require('path'), sh = require('shelljs'), - gaze = require('gaze'), + chokidar = require('chokidar'), compile = require('./compile') @@ -127,17 +127,11 @@ var self = module.exports = { self.make(opt) - var glob = toRelative(opt.flow[0] == 'f' ? opt.from : ph.join(opt.from, '**/*.tag')) - - gaze(glob, function() { - - log('Watching ' + glob) - - this.on('all', function() { - self.make(opt) - }) - - }) + var glob = opt.flow[0] == 'f' ? opt.from : ph.join(opt.from, '**/*.tag') + + chokidar.watch(glob, { ignoreInitial: true }) + .on('ready', function() { log('Watching ' + toRelative(glob)) }) + .on('all', function(e, path) { self.make(opt) }) } diff --git a/make/dev.js b/make/dev.js index 5343a622a5..a250d46627 100755 --- a/make/dev.js +++ b/make/dev.js @@ -4,23 +4,15 @@ require('shelljs/global') -var gaze = require('gaze'), - compile = require('../compiler/compile') +var chokidar = require('chokidar'), + riot = require('../compiler') // watch and build riot.js -gaze('lib/*.js', function() { - this.on('changed', function() { - exec('make riot') - }) -}) +chokidar + .watch('lib/*.js', { ignoreInitial: true }) + .on('all', function() { exec('make riot') }) // watch and build tags.js for testing -var tags = 'test/tag/*.tag' - -gaze(tags, function() { - this.on('changed', function() { - compile(cat(tags)).to('dist/tags.js') - }) -}) +riot.watch({ from: 'test', to: 'dist/tags.js' }) diff --git a/package.json b/package.json index 02f11199d2..f91ee9b99f 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "riot.js" ], "dependencies": { - "gaze": "~0.6.4", + "chokidar": "~1.0.0-rc2", "minimist": "~1.1.0", "shelljs": "~0.3.0" },