commit aaa7ee9ea9b948ee0e0e5f87c2383f681c37034c Author: PhilKunz Date: Thu Sep 22 16:33:44 2016 +0200 initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2095b4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +pages/ +public/ +coverage/ diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..09c6dcc --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,36 @@ +/// +/// +import * as plugins from './smartchok.plugins'; +import { Stringmap } from 'lik'; +export declare type TSmartchokStatus = 'idle' | 'starting' | 'watching'; +export declare type TFsEvent = 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlinkDir' | 'ready' | 'raw'; +export declare class Smartchok { + watchStringmap: Stringmap; + chokidarOptions: plugins.chokidar.WatchOptions; + status: TSmartchokStatus; + private watcher; + private watchingDeferred; + private eventObservablemap; + constructor(watchArrayArg: string[], optionsArg?: plugins.chokidar.WatchOptions); + /** + * adds files to the list of watched files + */ + add(pathArrayArg: string[]): void; + /** + * removes files from the list of watched files + */ + remove(pathArg: string): void; + /** + * gets an observable for a certain event + */ + getObservableFor(fsEvent: TFsEvent): plugins.q.Promise>; + /** + * starts the watcher + * @returns Promise + */ + start(): plugins.q.Promise; + /** + * stop the watcher process if watching + */ + stop(): void; +} diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..034b34b --- /dev/null +++ b/dist/index.js @@ -0,0 +1,81 @@ +"use strict"; +const plugins = require("./smartchok.plugins"); +const lik_1 = require("lik"); +class Smartchok { + constructor(watchArrayArg, optionsArg = {}) { + this.watchStringmap = new lik_1.Stringmap(); + this.watchingDeferred = plugins.q.defer(); // used to run things when watcher is initialized + this.eventObservablemap = new plugins.lik.Observablemap(); // register one observable per event + this.watchStringmap.addStringArray(watchArrayArg); + this.chokidarOptions = optionsArg; + } + /** + * adds files to the list of watched files + */ + add(pathArrayArg) { + this.watchStringmap.addStringArray(pathArrayArg); + this.watchingDeferred.promise.then(() => { + this.watcher.add(pathArrayArg); + }); + } + /** + * removes files from the list of watched files + */ + remove(pathArg) { + this.watchStringmap.removeString(''); // TODO + this.watchingDeferred.promise.then(() => { + this.watcher.unwatch(pathArg); + }); + } + /** + * gets an observable for a certain event + */ + getObservableFor(fsEvent) { + let done = plugins.q.defer(); + this.watchingDeferred.promise.then(() => { + let eventObservable = this.eventObservablemap.getObservableForEmitterEvent(this.watcher, fsEvent); + done.resolve(eventObservable); + }); + return done.promise; + } + /** + * starts the watcher + * @returns Promise + */ + start() { + let done = plugins.q.defer(); + this.status = 'starting'; + this.watcher = plugins.chokidar.watch(this.watchStringmap.getStringArray(), this.chokidarOptions); + this.watcher.on('ready', () => { + this.status = 'watching'; + this.watchingDeferred.resolve(); + done.resolve(); + }); + return done.promise; + } + /** + * stop the watcher process if watching + */ + stop() { + let closeWatcher = () => { + let watchedFiles = this.watcher.getWatched(); + for (let key in watchedFiles) { + let files = watchedFiles[key]; + for (let file in files) { + let filePath = plugins.path.join(key, file); + this.watcher.unwatch(filePath); + } + } + this.watcher.close(); + }; + if (this.status === 'watching') { + console.log('closing while watching'); + closeWatcher(); + } + else if (this.status === 'starting') { + this.watchingDeferred.promise.then(() => { closeWatcher(); }); + } + } +} +exports.Smartchok = Smartchok; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0NBQThDO0FBQzlDLDZCQUErQjtBQUsvQjtJQVFJLFlBQVksYUFBdUIsRUFBRSxVQUFVLEdBQWtDLEVBQUU7UUFQbkYsbUJBQWMsR0FBRyxJQUFJLGVBQVMsRUFBRSxDQUFBO1FBSXhCLHFCQUFnQixHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFRLENBQUEsQ0FBQyxpREFBaU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EdBQUcsQ0FBQyxDQUFBO2dCQUM3QixHQUFHLENBQUMsQ0FBQyxJQUFJLElBQUksSUFBSSxLQUFLLENBQUMsQ0FBQyxDQUFDO29CQUNyQixJQUFJLFFBQVEsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUMsSUFBSSxDQUFDLENBQUE7b0JBQzFDLElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFBO2dCQUNsQyxDQUFDO1lBQ0wsQ0FBQztZQUNELElBQUksQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLENBQUE7UUFDeEIsQ0FBQyxDQUFBO1FBQ0QsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFDO1lBQzdCLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQTtZQUNyQyxZQUFZLEVBQUUsQ0FBQTtRQUNsQixDQUFDO1FBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDLElBQUksQ0FBQyxNQUFNLEtBQUssVUFBVSxDQUFDLENBQUMsQ0FBQztZQUNwQyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxRQUFRLFlBQVksRUFBRSxDQUFBLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFDaEUsQ0FBQztJQUNMLENBQUM7Q0FDSjtBQW5GRCw4QkFtRkMifQ== \ No newline at end of file diff --git a/dist/smartchok.plugins.d.ts b/dist/smartchok.plugins.d.ts new file mode 100644 index 0000000..b42bf1a --- /dev/null +++ b/dist/smartchok.plugins.d.ts @@ -0,0 +1,6 @@ +import 'typings-global'; +export import chokidar = require('chokidar'); +export import lik = require('lik'); +export import path = require('path'); +export import q = require('q'); +export import rx = require('rxjs/Rx'); diff --git a/dist/smartchok.plugins.js b/dist/smartchok.plugins.js new file mode 100644 index 0000000..c5f267a --- /dev/null +++ b/dist/smartchok.plugins.js @@ -0,0 +1,8 @@ +"use strict"; +require("typings-global"); +exports.chokidar = require("chokidar"); +exports.lik = require("lik"); +exports.path = require("path"); +exports.q = require("q"); +exports.rx = require("rxjs/Rx"); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjaG9rLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGNob2sucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLHVDQUE0QztBQUM1Qyw2QkFBa0M7QUFDbEMsK0JBQW9DO0FBQ3BDLHlCQUE4QjtBQUM5QixnQ0FBcUMifQ== \ No newline at end of file diff --git a/npmextra.json b/npmextra.json new file mode 100644 index 0000000..c14d69e --- /dev/null +++ b/npmextra.json @@ -0,0 +1,5 @@ +{ + "npmts": { + "mode": "default" + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..0df77f7 --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "smartchok", + "version": "1.0.0", + "description": "smart wrapper for chokidar", + "main": "dist/index.js", + "typings": "dist/index.d.ts", + "scripts": { + "test": "(npm run prepareTest && npmts)", + "prepareTest":"(rm -f ./test/assets/hi.txt)" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@gitlab.com/pushrocks/smartchok.git" + }, + "author": "Lossless GmbH", + "license": "MIT", + "bugs": { + "url": "https://gitlab.com/pushrocks/smartchok/issues" + }, + "homepage": "https://gitlab.com/pushrocks/smartchok#README", + "dependencies": { + "@types/chokidar": "^1.4.29", + "@types/q": "0.0.31", + "chokidar": "^1.6.0", + "lik": "^1.0.20", + "q": "^1.4.1", + "rxjs": "^5.0.0-beta.12", + "typings-global": "^1.0.14" + }, + "devDependencies": { + "@types/should": "^8.1.30", + "should": "^11.1.0", + "smartfile": "^4.0.20", + "typings-test": "^1.0.3" + } +} diff --git a/test/assets/hi.txt b/test/assets/hi.txt new file mode 100644 index 0000000..56f44d3 --- /dev/null +++ b/test/assets/hi.txt @@ -0,0 +1 @@ +HI \ No newline at end of file diff --git a/test/assets/test1.txt b/test/assets/test1.txt new file mode 100644 index 0000000..c530d55 --- /dev/null +++ b/test/assets/test1.txt @@ -0,0 +1 @@ +# This is a textfile that will be cloned \ No newline at end of file diff --git a/test/test.d.ts b/test/test.d.ts new file mode 100644 index 0000000..2fd432a --- /dev/null +++ b/test/test.d.ts @@ -0,0 +1 @@ +import 'typings-test'; diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..e91ab3f --- /dev/null +++ b/test/test.js @@ -0,0 +1,35 @@ +"use strict"; +require("typings-test"); +const should = require("should"); +const smartfile = require("smartfile"); +const smartchok = require("../dist/index"); +describe('smartchok', function () { + let testSmartchok; + let testAddObservable; + let testSubscription; + it('should create a new instance', function () { + testSmartchok = new smartchok.Smartchok([]); + should(testSmartchok).be.instanceof(smartchok.Smartchok); + }); + it('should add some files to watch and start', function (done) { + testSmartchok.add(['./test/assets/**/*.txt']); + testSmartchok.start().then(() => { done(); }).catch(err => { console.log(err); }); + }); + it('should get an observable for a certain event', function (done) { + testSmartchok.getObservableFor('add').then((observableArg) => { + testAddObservable = observableArg; + done(); + }).catch(err => { console.log(err); }); + }); + it('should register an add operation', function (done) { + this.timeout(5000); + testSubscription = testAddObservable.subscribe(x => { + done(); + }); + smartfile.memory.toFs('HI', './test/assets/hi.txt'); + }); + it('should stop the watch process', function () { + testSmartchok.stop(); + }); +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFDaEMsdUNBQ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DLENBQUEsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUN6QyxDQUFDLENBQUMsQ0FBQTtJQUNGLEVBQUUsQ0FBQyxrQ0FBa0MsRUFBQyxVQUFTLElBQUk7UUFDL0MsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUNsQixnQkFBZ0IsR0FBRyxpQkFBaUIsQ0FBQyxTQUFTLENBQUMsQ0FBQztZQUM1QyxJQUFJLEVBQUUsQ0FBQTtRQUNWLENBQUMsQ0FBQyxDQUFBO1FBQ0YsU0FBUyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFDLHNCQUFzQixDQUFDLENBQUE7SUFDdEQsQ0FBQyxDQUFDLENBQUE7SUFDRixFQUFFLENBQUMsK0JBQStCLEVBQUM7UUFDL0IsYUFBYSxDQUFDLElBQUksRUFBRSxDQUFBO0lBQ3hCLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ== \ No newline at end of file diff --git a/test/test.ts b/test/test.ts new file mode 100644 index 0000000..3b86459 --- /dev/null +++ b/test/test.ts @@ -0,0 +1,35 @@ +import 'typings-test' +import * as should from 'should' +import * as smartfile from 'smartfile' +import * as rx from 'rxjs/Rx' +import * as smartchok from '../dist/index' + +describe('smartchok',function(){ + let testSmartchok: smartchok.Smartchok + let testAddObservable: rx.Observable + let testSubscription: rx.Subscription + it('should create a new instance',function(){ + testSmartchok = new smartchok.Smartchok([]) + should(testSmartchok).be.instanceof(smartchok.Smartchok) + }) + it('should add some files to watch and start',function(done){ + testSmartchok.add(['./test/assets/**/*.txt']) + testSmartchok.start().then(() => { done() }).catch(err => { console.log(err) }) + }) + it('should get an observable for a certain event',function(done){ + testSmartchok.getObservableFor('add').then((observableArg) => { + testAddObservable = observableArg + done() + }).catch(err => { console.log(err) }) + }) + it('should register an add operation',function(done){ + this.timeout(5000) + testSubscription = testAddObservable.subscribe(x => { + done() + }) + smartfile.memory.toFs('HI','./test/assets/hi.txt') + }) + it('should stop the watch process',function() { + testSmartchok.stop() + }) +}) diff --git a/ts/index.ts b/ts/index.ts new file mode 100644 index 0000000..d38cc35 --- /dev/null +++ b/ts/index.ts @@ -0,0 +1,82 @@ +import * as plugins from './smartchok.plugins' +import { Stringmap } from 'lik' + +export type TSmartchokStatus = 'idle' | 'starting' | 'watching' +export type TFsEvent = 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlinkDir' | 'ready' | 'raw' + +export class Smartchok { + watchStringmap = new Stringmap() + chokidarOptions: plugins.chokidar.WatchOptions + status: TSmartchokStatus + private watcher + private watchingDeferred = plugins.q.defer() // used to run things when watcher is initialized + private eventObservablemap = new plugins.lik.Observablemap() // register one observable per event + + constructor(watchArrayArg: string[], optionsArg: plugins.chokidar.WatchOptions = {}) { + this.watchStringmap.addStringArray(watchArrayArg) + this.chokidarOptions = optionsArg + } + + /** + * adds files to the list of watched files + */ + add(pathArrayArg: string[]) { + this.watchStringmap.addStringArray(pathArrayArg) + this.watchingDeferred.promise.then(() => { + this.watcher.add(pathArrayArg) + }) + } + + /** + * removes files from the list of watched files + */ + remove(pathArg: string) { + this.watchStringmap.removeString('') // TODO + this.watchingDeferred.promise.then(() => { + this.watcher.unwatch(pathArg) + }) + } + + /** + * gets an observable for a certain event + */ + getObservableFor(fsEvent: TFsEvent): plugins.q.Promise> { + let done = plugins.q.defer>() + this.watchingDeferred.promise.then(() => { + let eventObservable = this.eventObservablemap.getObservableForEmitterEvent(this.watcher, fsEvent) + done.resolve(eventObservable) + }) + return done.promise + } + + /** + * starts the watcher + * @returns Promise + */ + start(): plugins.q.Promise { + let done = plugins.q.defer() + this.status = 'starting' + this.watcher = plugins.chokidar.watch(this.watchStringmap.getStringArray(), this.chokidarOptions) + this.watcher.on('ready', () => { + this.status = 'watching' + this.watchingDeferred.resolve() + done.resolve() + }) + return done.promise + } + + /** + * stop the watcher process if watching + */ + stop() { + let closeWatcher = () => { + this.watcher.close() + } + if (this.status === 'watching') { + console.log('closing while watching') + closeWatcher() + } else if (this.status === 'starting') { + this.watchingDeferred.promise.then(() => { closeWatcher() }) + } + } +} diff --git a/ts/smartchok.plugins.ts b/ts/smartchok.plugins.ts new file mode 100644 index 0000000..0f8b82f --- /dev/null +++ b/ts/smartchok.plugins.ts @@ -0,0 +1,6 @@ +import 'typings-global' +export import chokidar = require('chokidar') +export import lik = require('lik') +export import path = require('path') +export import q = require('q') +export import rx = require('rxjs/Rx') diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..45052ad --- /dev/null +++ b/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "tslint-config-standard" +}