From 513bb686ef6affa6d1e93bc7f1809f4c8574b16d Mon Sep 17 00:00:00 2001 From: PhilKunz Date: Sat, 24 Sep 2016 21:49:53 +0200 Subject: [PATCH] update --- dist/npmextra.classes.keyValueStore.d.ts | 18 -------- dist/npmextra.classes.keyValueStore.js | 22 ---------- ts/npmextra.classes.keyvaluestore.ts | 55 +++++++++++++++++++----- ts/npmextra.paths.ts | 6 +++ 4 files changed, 51 insertions(+), 50 deletions(-) delete mode 100644 dist/npmextra.classes.keyValueStore.d.ts delete mode 100644 dist/npmextra.classes.keyValueStore.js diff --git a/dist/npmextra.classes.keyValueStore.d.ts b/dist/npmextra.classes.keyValueStore.d.ts deleted file mode 100644 index 48442af..0000000 --- a/dist/npmextra.classes.keyValueStore.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export declare type keyValueStoreTypes = 'path' | 'gitProject'; -export declare class KeyValueStore { - constructor(optionsArg: { - type: keyValueStoreTypes; - }); - /** - * reads a keyValueFile from disk - */ - kvRead(): void; - /** - * writes a key value file to disk - */ - kvWrite(): void; - /** - * wipes a key value store from disk - */ - kevWipe(): void; -} diff --git a/dist/npmextra.classes.keyValueStore.js b/dist/npmextra.classes.keyValueStore.js deleted file mode 100644 index 1974216..0000000 --- a/dist/npmextra.classes.keyValueStore.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -class KeyValueStore { - constructor(optionsArg) { - } - /** - * reads a keyValueFile from disk - */ - kvRead() { - } - /** - * writes a key value file to disk - */ - kvWrite() { - } - /** - * wipes a key value store from disk - */ - kevWipe() { - } -} -exports.KeyValueStore = KeyValueStore; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZXh0cmEuY2xhc3Nlcy5rZXl2YWx1ZXN0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFLQTtJQUNJLFlBQVksVUFFWDtJQUVELENBQUM7SUFDRDs7R0FFRDtJQUNDLE1BQU07SUFFTixDQUFDO0lBRUQ7O09BRUc7SUFDSCxPQUFPO0lBRVAsQ0FBQztJQUVEOztPQUVHO0lBQ0gsT0FBTztJQUVQLENBQUM7Q0FDSjtBQTFCRCxzQ0EwQkMifQ== \ No newline at end of file diff --git a/ts/npmextra.classes.keyvaluestore.ts b/ts/npmextra.classes.keyvaluestore.ts index 7eb35d1..b9ef9e9 100644 --- a/ts/npmextra.classes.keyvaluestore.ts +++ b/ts/npmextra.classes.keyvaluestore.ts @@ -1,32 +1,67 @@ import * as plugins from './npmextra.plugins' +import * as paths from './npmextra.paths' -export type keyValueStoreTypes = 'path' | 'gitProject' +export type keyValueStoreTypes = 'path' | 'gitProject' | 'customString' export class KeyValueStore { - constructor(optionsArg: { - type: keyValueStoreTypes - }) { - + type: string // the type of the kvStore + identity: string // the identity of the kvStore + filePath: string // the filePath of the kvStore + constructor(typeArg: keyValueStoreTypes, identityStringArg?: string) { + // set kvStoreType + this.type = typeArg + this.initIdentity(identityStringArg) + this.initFilePath() } + /** - * reads a keyValueFile from disk - */ - kvRead() { + * reads a keyValueFile from disk + */ + read() { } /** * writes a key value file to disk */ - kvWrite() { + write() { } /** * wipes a key value store from disk */ - kevWipe() { + wipe() { } + + /** + * updates a value + */ + update() { + + } + + /** + * computes the identity + */ + private initIdentity(identityStringArg: string){ + + } + + /** + * computes the filePath + */ + private initFilePath() { + let baseDir: string + if (this.type === 'customString') { + baseDir = paths.kvCusomDir + } else if (this.type === 'gitProject') { + baseDir = paths.kvGitDir + } else if (this.type === 'path') { + baseDir = paths.kvPathDir + } + this.filePath = plugins.path.join(baseDir, this.identity + '.json') + } } diff --git a/ts/npmextra.paths.ts b/ts/npmextra.paths.ts index 860ab1f..2ed6a0e 100644 --- a/ts/npmextra.paths.ts +++ b/ts/npmextra.paths.ts @@ -4,5 +4,11 @@ import * as plugins from './npmextra.plugins' export let cwd = process.cwd() export let packageDir = plugins.path.join(__dirname,'../') +// keyValueStore specific +export let kvBase = '~/.npmextra/kv' +export let kvCusomDir = plugins.path.join(kvBase, 'custom') +export let kvGitDir = plugins.path.join(kvBase, 'git') +export let kvPathDir = plugins.path.join(kvBase, 'path') + // files export let configFile = plugins.path.join(cwd,'npmextra.json')