first commit
This commit is contained in:
6
build/node_modules/glob-watcher/.npmignore
generated
vendored
Normal file
6
build/node_modules/glob-watcher/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
.DS_Store
|
||||
*.log
|
||||
node_modules
|
||||
build
|
||||
*.node
|
||||
components
|
||||
6
build/node_modules/glob-watcher/.travis.yml
generated
vendored
Normal file
6
build/node_modules/glob-watcher/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.9"
|
||||
- "0.10"
|
||||
after_script:
|
||||
- npm run coveralls
|
||||
20
build/node_modules/glob-watcher/LICENSE
generated
vendored
Executable file
20
build/node_modules/glob-watcher/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2013 Fractal <contact@wearefractal.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
53
build/node_modules/glob-watcher/README.md
generated
vendored
Normal file
53
build/node_modules/glob-watcher/README.md
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# glob-watcher [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][david-image]][david-url]
|
||||
|
||||
## Information
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Package</td><td>glob-watcher</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>Watch globs</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Node Version</td>
|
||||
<td>>= 0.9</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var watch = require('glob-watcher');
|
||||
|
||||
// callback interface
|
||||
watch(["./*.js", "!./something.js"], function(evt){
|
||||
// evt has what file changed and all that jazz
|
||||
});
|
||||
|
||||
// EE interface
|
||||
var watcher = watch(["./*.js", "!./something.js"]);
|
||||
watcher.on('change', function(evt) {
|
||||
// evt has what file changed and all that jazz
|
||||
});
|
||||
|
||||
// add files after it has been created
|
||||
watcher.add("./somefolder/somefile.js");
|
||||
```
|
||||
|
||||
|
||||
[npm-url]: https://npmjs.org/package/glob-watcher
|
||||
[npm-image]: https://badge.fury.io/js/glob-watcher.png
|
||||
|
||||
[travis-url]: https://travis-ci.org/wearefractal/glob-watcher
|
||||
[travis-image]: https://travis-ci.org/wearefractal/glob-watcher.png?branch=master
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/wearefractal/glob-watcher
|
||||
[coveralls-image]: https://coveralls.io/repos/wearefractal/glob-watcher/badge.png
|
||||
|
||||
[depstat-url]: https://david-dm.org/wearefractal/glob-watcher
|
||||
[depstat-image]: https://david-dm.org/wearefractal/glob-watcher.png
|
||||
|
||||
[david-url]: https://david-dm.org/wearefractal/glob-watcher
|
||||
[david-image]: https://david-dm.org/wearefractal/glob-watcher.png?theme=shields.io
|
||||
39
build/node_modules/glob-watcher/index.js
generated
vendored
Normal file
39
build/node_modules/glob-watcher/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var gaze = require('gaze');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
module.exports = function(glob, opts, cb) {
|
||||
var out = new EventEmitter();
|
||||
|
||||
if (typeof opts === 'function') {
|
||||
cb = opts;
|
||||
opts = {};
|
||||
}
|
||||
|
||||
var watcher = gaze(glob, opts, function(err, rwatcher){
|
||||
if (err) out.emit('error', err);
|
||||
rwatcher.on('all', function(evt, path, old){
|
||||
var outEvt = {type: evt, path: path};
|
||||
if(old) outEvt.old = old;
|
||||
out.emit('change', outEvt);
|
||||
if(cb) cb(outEvt);
|
||||
});
|
||||
});
|
||||
|
||||
watcher.on('end', out.emit.bind(out, 'end'));
|
||||
watcher.on('error', out.emit.bind(out, 'error'));
|
||||
watcher.on('ready', out.emit.bind(out, 'ready'));
|
||||
watcher.on('nomatch', out.emit.bind(out, 'nomatch'));
|
||||
|
||||
out.end = function(){
|
||||
return watcher.close();
|
||||
};
|
||||
out.add = function(){
|
||||
return watcher.add.apply(watcher, arguments);
|
||||
};
|
||||
out.remove = function(){
|
||||
return watcher.remove();
|
||||
};
|
||||
out._watcher = watcher;
|
||||
|
||||
return out;
|
||||
};
|
||||
70
build/node_modules/glob-watcher/package.json
generated
vendored
Normal file
70
build/node_modules/glob-watcher/package.json
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"_from": "glob-watcher@^0.0.6",
|
||||
"_id": "glob-watcher@0.0.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=",
|
||||
"_location": "/glob-watcher",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "glob-watcher@^0.0.6",
|
||||
"name": "glob-watcher",
|
||||
"escapedName": "glob-watcher",
|
||||
"rawSpec": "^0.0.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.0.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/pngout-bin/vinyl-fs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz",
|
||||
"_shasum": "b95b4a8df74b39c83298b0c05c978b4d9a3b710b",
|
||||
"_spec": "glob-watcher@^0.0.6",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/pngout-bin/node_modules/vinyl-fs",
|
||||
"author": {
|
||||
"name": "Fractal",
|
||||
"email": "contact@wearefractal.com",
|
||||
"url": "http://wearefractal.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/wearefractal/glob-watcher/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"gaze": "^0.5.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Watch globs",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.6.1",
|
||||
"istanbul": "^0.2.3",
|
||||
"jshint": "^2.4.1",
|
||||
"mkdirp": "^0.3.5",
|
||||
"mocha": "^1.17.0",
|
||||
"mocha-lcov-reporter": "0.0.1",
|
||||
"rimraf": "^2.2.5",
|
||||
"should": "^2.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.9"
|
||||
},
|
||||
"homepage": "http://github.com/wearefractal/glob-watcher",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/wearefractal/glob-watcher/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "./index.js",
|
||||
"name": "glob-watcher",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/wearefractal/glob-watcher.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",
|
||||
"test": "mocha --reporter spec && jshint"
|
||||
},
|
||||
"version": "0.0.6"
|
||||
}
|
||||
1
build/node_modules/glob-watcher/test/fixtures/test.coffee
generated
vendored
Normal file
1
build/node_modules/glob-watcher/test/fixtures/test.coffee
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
test test
|
||||
87
build/node_modules/glob-watcher/test/main.js
generated
vendored
Normal file
87
build/node_modules/glob-watcher/test/main.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
var watch = require('../');
|
||||
var should = require('should');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var rimraf = require('rimraf');
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
require('mocha');
|
||||
|
||||
describe('glob-watcher', function() {
|
||||
it('should return a valid file struct via EE', function(done) {
|
||||
var expectedName = path.join(__dirname, "./fixtures/stuff/temp.coffee");
|
||||
var fname = path.join(__dirname, "./fixtures/**/temp.coffee");
|
||||
mkdirp.sync(path.dirname(expectedName));
|
||||
fs.writeFileSync(expectedName, "testing");
|
||||
|
||||
var watcher = watch(fname);
|
||||
watcher.on('change', function(evt) {
|
||||
should.exist(evt);
|
||||
should.exist(evt.path);
|
||||
should.exist(evt.type);
|
||||
evt.type.should.equal('changed');
|
||||
evt.path.should.equal(expectedName);
|
||||
watcher.end();
|
||||
});
|
||||
watcher.on('end', function(){
|
||||
rimraf.sync(expectedName);
|
||||
done();
|
||||
});
|
||||
setTimeout(function(){
|
||||
fs.writeFileSync(expectedName, "test test");
|
||||
}, 125);
|
||||
});
|
||||
|
||||
it('should emit nomatch via EE', function(done) {
|
||||
var fname = path.join(__dirname, "./doesnt_exist_lol/temp.coffee");
|
||||
|
||||
var watcher = watch(fname);
|
||||
watcher.on('nomatch', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return a valid file struct via callback', function(done) {
|
||||
var expectedName = path.join(__dirname, "./fixtures/stuff/test.coffee");
|
||||
var fname = path.join(__dirname, "./fixtures/**/test.coffee");
|
||||
mkdirp.sync(path.dirname(expectedName));
|
||||
fs.writeFileSync(expectedName, "testing");
|
||||
|
||||
var watcher = watch(fname, function(evt) {
|
||||
should.exist(evt);
|
||||
should.exist(evt.path);
|
||||
should.exist(evt.type);
|
||||
evt.type.should.equal('changed');
|
||||
evt.path.should.equal(expectedName);
|
||||
watcher.end();
|
||||
});
|
||||
|
||||
watcher.on('end', function(){
|
||||
rimraf.sync(expectedName);
|
||||
done();
|
||||
});
|
||||
setTimeout(function(){
|
||||
fs.writeFileSync(expectedName, "test test");
|
||||
}, 200);
|
||||
});
|
||||
|
||||
it('should not return a non-matching file struct via callback', function(done) {
|
||||
var expectedName = path.join(__dirname, "./fixtures/test123.coffee");
|
||||
var fname = path.join(__dirname, "./fixtures/**/test.coffee");
|
||||
mkdirp.sync(path.dirname(expectedName));
|
||||
fs.writeFileSync(expectedName, "testing");
|
||||
|
||||
var watcher = watch(fname, function(evt) {
|
||||
throw new Error("Should not have been called! "+evt.path);
|
||||
});
|
||||
|
||||
setTimeout(function(){
|
||||
fs.writeFileSync(expectedName, "test test");
|
||||
}, 200);
|
||||
|
||||
setTimeout(function(){
|
||||
rimraf.sync(expectedName);
|
||||
done();
|
||||
}, 1500);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user