@drifted/raven 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/index.js +15 -8
- package/package.json +1 -1
- package/test/raven.test.js +23 -5
- package/test/workspace/example.json.encrypted +1 -0
package/index.js
CHANGED
|
@@ -51,22 +51,29 @@ class JSONDataFile {
|
|
|
51
51
|
var times = 0;
|
|
52
52
|
|
|
53
53
|
await file.read();
|
|
54
|
-
|
|
55
|
-
while(times <
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
|
|
55
|
+
while(times < iterations) {
|
|
56
|
+
try {
|
|
57
|
+
file.data = file.decrypt(file.data)
|
|
58
|
+
} catch(error) {
|
|
59
|
+
//console.log(error);
|
|
60
|
+
}
|
|
61
|
+
times = times + 1;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
try {
|
|
65
|
+
file.data = JSON.parse(file.data.trim());
|
|
66
|
+
} catch(error) {
|
|
67
|
+
console.log(error);
|
|
68
|
+
}
|
|
63
69
|
|
|
64
|
-
resolve(
|
|
70
|
+
resolve(file.data)
|
|
65
71
|
})
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
static toEnv(options={}) {
|
|
69
75
|
var self = this;
|
|
76
|
+
|
|
70
77
|
return new Promise((resolve) => {
|
|
71
78
|
self.eval(options).then((json) => {
|
|
72
79
|
Object.assign(process.env, json);
|
package/package.json
CHANGED
package/test/raven.test.js
CHANGED
|
@@ -8,18 +8,36 @@ var defaults = {
|
|
|
8
8
|
secret: 'ffdnZY17Fw+sup2+lhOOt6PW++/RkLTXRaLL3RJsjzE='
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const {
|
|
12
|
+
doneMessage
|
|
13
|
+
} = require('@drifted/qa');
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
run, ensure, remove
|
|
17
|
+
} = require(path.join(__dirname, 'helpers'));
|
|
18
|
+
|
|
13
19
|
|
|
14
20
|
|
|
15
21
|
process.chdir(path.join(__dirname, 'workspace'));
|
|
16
22
|
|
|
23
|
+
console.log(__dirname);
|
|
24
|
+
|
|
25
|
+
//console.log(process.env)
|
|
26
|
+
|
|
17
27
|
describe('raven', function() {
|
|
18
28
|
|
|
19
29
|
|
|
20
|
-
it('
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
it('eval', function(done) {
|
|
31
|
+
|
|
32
|
+
// this seems to work. i should write a test to make sure that it works
|
|
33
|
+
JSONDataFile.eval({
|
|
34
|
+
secret: defaults.secret,
|
|
35
|
+
iterations: 2,
|
|
36
|
+
file: path.join(__dirname, 'workspace', 'example.json.encrypted')
|
|
37
|
+
}).then((json) => {
|
|
38
|
+
done()
|
|
39
|
+
}).catch(doneMessage(done))
|
|
40
|
+
|
|
23
41
|
})
|
|
24
42
|
|
|
25
43
|
it('write', function(done) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
100ac0d8b2d2519e65222eac9b08bbef:b5ce9cdbbb5c54453e2dfddf2d64e16a:a9d72d894df8323e9de43ba14c42603c26432452330fc235d340008ee7967f87614893d689aaeea81635be5c544a8661c9eb3c1f9d2978f2c6f1310aeab3801ad15121ba77c9c88ec93193f4127b5ced7a17e480f984b4cc717289671dbf24f7
|