diff --git a/src/bin/watch.js b/src/bin/watch.js index ce99602..5b5de6e 100644 --- a/src/bin/watch.js +++ b/src/bin/watch.js @@ -13,4 +13,6 @@ const pathETCD = resolve('/', argz._[0]); const client = makeEtcdClient(argz); const watcher = client.watcher(pathETCD, null, {recursive: true}); -createWatcher$(watcher).do(action => process.stdout.write(`${stringify(action)}\n`)).toPromise(); +createWatcher$(watcher) + .do(action => process.stdout.write(`${stringify(action)}\n`)) + .toPromise(); diff --git a/src/fetch.js b/src/fetch.js index d800d13..b6243e6 100644 --- a/src/fetch.js +++ b/src/fetch.js @@ -10,7 +10,11 @@ const createFetch$ = (client, cwd) => { client.get(cwd, {recursive: true}, (err, data) => cb(err, data)) ); - return Observable.of(list).map(f => f()).mergeAll().retry(Infinity).map(parseAction); + return Observable.of(list) + .map(f => f()) + .mergeAll() + .retry(Infinity) + .map(parseAction); }; export default createFetch$; diff --git a/src/patch.js b/src/patch.js index f3c056a..4d2c93e 100644 --- a/src/patch.js +++ b/src/patch.js @@ -20,7 +20,13 @@ const set = (store, {action, node, prevNode}) => { return node; } - const storeKey = path.join(store.key, path.relative(store.key, node.key).split('/').shift()); + const storeKey = path.join( + store.key, + path + .relative(store.key, node.key) + .split('/') + .shift() + ); return set_( 'nodes', diff --git a/src/store.js b/src/store.js index ee4f02e..f0b474e 100644 --- a/src/store.js +++ b/src/store.js @@ -6,7 +6,11 @@ const createStore = (node$, indexer) => { const replayed$ = store$.publishReplay(1); - const ready = key => replayed$.first().pluck(key).toPromise(); + const ready = key => + replayed$ + .first() + .pluck(key) + .toPromise(); return { store: ready, diff --git a/src/test/etcd.js b/src/test/etcd.js index 0297315..f605dc3 100644 --- a/src/test/etcd.js +++ b/src/test/etcd.js @@ -67,7 +67,10 @@ test('should composite events observable', async t => { setEvent ]; - const eventsP = events$.take(6).toArray().toPromise(); + const eventsP = events$ + .take(6) + .toArray() + .toPromise(); [setEvent, deleteEvent, resyncEvent, deleteEvent, setEvent].forEach(event => watcher.emit(event.action, event) diff --git a/src/test/fallback.js b/src/test/fallback.js index 7dddd88..8533238 100644 --- a/src/test/fallback.js +++ b/src/test/fallback.js @@ -17,6 +17,8 @@ test('should load fallback', async t => { }); test("shouldn't throw error if file doesn't exist", async t => { - const events = await createFallback$(join(__dirname, 'fixtures/nope.json')).toArray().toPromise(); + const events = await createFallback$(join(__dirname, 'fixtures/nope.json')) + .toArray() + .toPromise(); t.deepEqual(events, []); }); diff --git a/src/test/resync.js b/src/test/resync.js index 6a96284..e40e545 100644 --- a/src/test/resync.js +++ b/src/test/resync.js @@ -38,7 +38,10 @@ test('should transform resync event', async t => { } ]; - const events = await watcher$.take(1).toArray().toPromise(); + const events = await watcher$ + .take(1) + .toArray() + .toPromise(); t.deepEqual(events, expected); }); @@ -77,6 +80,9 @@ test('should keep order', async t => { setEvent ]; - const events = await watcher$.take(3).toArray().toPromise(); + const events = await watcher$ + .take(3) + .toArray() + .toPromise(); t.deepEqual(events, expected); }); diff --git a/src/test/save.js b/src/test/save.js index 6604828..d1904af 100644 --- a/src/test/save.js +++ b/src/test/save.js @@ -22,6 +22,8 @@ test('should create file', async t => { test('should do nothing if file is not defined', async t => { const save = createSave(); - const events = await save(Observable.of(fallback)).toArray().toPromise(); + const events = await save(Observable.of(fallback)) + .toArray() + .toPromise(); t.deepEqual(events, [fallback]); }); diff --git a/src/util/fs.js b/src/util/fs.js index 68aecad..765b668 100644 --- a/src/util/fs.js +++ b/src/util/fs.js @@ -7,7 +7,9 @@ export const stat$ = Observable.bindNodeCallback(stat); const _readdir$ = Observable.bindNodeCallback(readdir); export const readdir$ = pathFS => - _readdir$(pathFS).flatMap(Observable.from).map(entry => join(pathFS, entry)); + _readdir$(pathFS) + .flatMap(Observable.from) + .map(entry => join(pathFS, entry)); export const readFile$ = Observable.bindNodeCallback(readFile); export const readFileUTF8$ = file => readFile$(file, {encoding: 'UTF8'}); @@ -17,5 +19,7 @@ export const isFile$ = pathFS => stat$(pathFS).map(_stat => _stat.isFile()); export const isDirectory$ = pathFS => stat$(pathFS).map(_stat => _stat.isDirectory()); export const filter$ = curry((predicate, value) => - predicate(value).filter(Boolean).map(() => value) + predicate(value) + .filter(Boolean) + .map(() => value) ); diff --git a/src/util/test/cli.js b/src/util/test/cli.js index 3e17252..7d8dbe7 100644 --- a/src/util/test/cli.js +++ b/src/util/test/cli.js @@ -62,7 +62,9 @@ test('should throw error on directory sync if etcd throws unknown error', t => { }); return t.throws( - syncDirectory$(client, join(__dirname, 'fixtures/fs'), '/test').toArray().toPromise(), + syncDirectory$(client, join(__dirname, 'fixtures/fs'), '/test') + .toArray() + .toPromise(), 'UnknownError' ); }); @@ -160,7 +162,9 @@ test('should throw error on file sync if etcd throws unknown error', t => { }); return t.throws( - syncFile$(client, join(__dirname, 'fixtures/fs/foo'), '/test/foo').toArray().toPromise(), + syncFile$(client, join(__dirname, 'fixtures/fs/foo'), '/test/foo') + .toArray() + .toPromise(), 'UnknownError' ); }); diff --git a/src/util/test/fs.js b/src/util/test/fs.js index 705692f..9d9bff6 100644 --- a/src/util/test/fs.js +++ b/src/util/test/fs.js @@ -7,17 +7,29 @@ const joinTestFolder = (...argz) => join(__dirname, 'fixtures/fs', ...argz); const mapJoinTestFolder = map(joinTestFolder); test('should return true if entry is a file', t => - isFile$(joinTestFolder('foo')).toPromise().then(isFile => t.deepEqual(isFile, true))); + isFile$(joinTestFolder('foo')) + .toPromise() + .then(isFile => t.deepEqual(isFile, true))); test('should return false if entry is a directory', t => - isFile$(joinTestFolder('bar')).toPromise().then(isFile => t.deepEqual(isFile, false))); + isFile$(joinTestFolder('bar')) + .toPromise() + .then(isFile => t.deepEqual(isFile, false))); test('should return error if entry is neither a file nor a directory', t => { return Promise.all([ - isFile$(joinTestFolder('qux')).toPromise().then(() => t.fail(), () => t.pass()), - isFile$(joinTestFolder('qux/quux')).toPromise().then(() => t.fail(), () => t.pass()), - isDirectory$(joinTestFolder('qux')).toPromise().then(() => t.fail(), () => t.pass()), - isDirectory$(joinTestFolder('qux/quux')).toPromise().then(() => t.fail(), () => t.pass()) + isFile$(joinTestFolder('qux')) + .toPromise() + .then(() => t.fail(), () => t.pass()), + isFile$(joinTestFolder('qux/quux')) + .toPromise() + .then(() => t.fail(), () => t.pass()), + isDirectory$(joinTestFolder('qux')) + .toPromise() + .then(() => t.fail(), () => t.pass()), + isDirectory$(joinTestFolder('qux/quux')) + .toPromise() + .then(() => t.fail(), () => t.pass()) ]); }); @@ -39,8 +51,12 @@ test('should read directory content', t => test('should return error if entry is not a directory', t => Promise.all([ - readdir$(joinTestFolder('foo')).toPromise().then(() => t.fail(), () => t.pass()), - readdir$(joinTestFolder('quz')).toPromise().then(() => t.fail(), () => t.pass()) + readdir$(joinTestFolder('foo')) + .toPromise() + .then(() => t.fail(), () => t.pass()), + readdir$(joinTestFolder('quz')) + .toPromise() + .then(() => t.fail(), () => t.pass()) ])); test('should filterFile directory content', t =>