Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPII-3138: Update snapsets in data base #626

Merged
merged 51 commits into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
74dde50
GPII-3138: Added CouchDB views for retrieving snapset data.
cindyli Jun 27, 2018
ee30bb2
GPII-3138: Update snapsets in the data base
klown Jul 6, 2018
1c0f38a
GPII-3138: Update snapsets in the data base
klown Jul 6, 2018
b5dd8c0
GPII-3138: Update snapsets in the data base
klown Jul 6, 2018
f7068c0
GPII-3138: Update snapsets in the data base
klown Jul 9, 2018
e2f4e63
GPII-3138: Update snapsets in the data base
klown Jul 9, 2018
554ae82
GPII-3138: Update snapsets in the data base
klown Jul 9, 2018
f145f66
GPII-3138: Delete and reload snapsets in the data base
klown Jul 10, 2018
8f54a33
GPII-3138: Merged upstream master GPII branch into GPII-3138
klown Jul 16, 2018
67f7bd6
GPII-3138: Add a couchDB view to return all GPII keys.
cindyli Jul 18, 2018
c48d7ae
Merge pull request #1 from cindyli/GPII-3138
klown Jul 18, 2018
f029df2
GPII-3138: Merged Cindy's pull request with new database view
klown Jul 18, 2018
5f2f1b5
GPII-3138: Delete and (re)load snapsets into the database
klown Jul 20, 2018
750cdf3
GPII-3138: Delete and reload snapsets into the database
klown Jul 23, 2018
0e41600
GPII-3138: Delete and reload snapsets into the database
klown Jul 24, 2018
22d6605
GPII-3138: Delete and load snapsets Prefs Safes.
klown Jul 25, 2018
574236f
GPII-3138: Delete and load snapsets Prefs Safes into the database.
klown Jul 25, 2018
d6547d3
GPII-3138: Delete and load snapsets Prefs Safes into the database.
klown Jul 25, 2018
8520379
GPII-3138: Delete and load snapsets into the database
klown Jul 25, 2018
ef1e721
GPII-3138: Merged upstream GPII master branch.
klown Jul 26, 2018
0181c42
GPII-3138: Delete and load snapsets into the database
klown Jul 27, 2018
9bb64af
GPII-3138: Update snapsets into the database
klown Jul 30, 2018
a4541ba
GPII-3138: Update snapsets into the database
klown Jul 30, 2018
e026465
GPII-3138: Merged changes from upstreasm master GPII branch.
klown Jul 31, 2018
f4c41a6
GPII-3138: Update snapsets into the database
klown Jul 31, 2018
6723b6e
GPII-3138: Update snapsets into the database
klown Jul 31, 2018
2e0bb55
GPII-3138: Update snapsets into the database
klown Jul 31, 2018
fae02da
GPII-3138: Use UUIDs for demo user keys as well as creating 20 empty …
cindyli Aug 1, 2018
831a762
Merge pull request #2 from cindyli/GPII-3138
klown Aug 1, 2018
582b3d7
GPII-3138: Update snapsets in the database
klown Aug 5, 2018
c401c97
GPII-3138: Update snapsets in the database
klown Aug 7, 2018
54defe7
GPII-3138: Update snapsets in the database
klown Aug 7, 2018
58fdde7
GPII-3138: Update snapsets in the database
klown Aug 9, 2018
0862af6
GPII-3138: Merged changes from upstream master GPII branch.
klown Aug 10, 2018
79abd7d
GPII-3138: Merged changes from upstream master GPII branch
klown Aug 27, 2018
2b8cbeb
GPII-3138: Update snapsets in the database
klown Aug 28, 2018
59f03a8
GPII-3138: Update snapsets in the database
klown Aug 30, 2018
6ee716e
GPII-3138: Update snapsets in the database
klown Sep 10, 2018
9a090a1
GPII-3138: Update snapsets in the database
klown Sep 11, 2018
a9eec11
GPII-3138: Update snapsets in the database
klown Sep 11, 2018
a4cf452
GPII-3138: Update snapsets in the database
klown Sep 12, 2018
63c1a11
GPII-3138: Update snapsets in the database
klown Sep 13, 2018
7ce1b84
GPII-3138: Update snapsets in the database
klown Sep 18, 2018
afc6888
GPII-3138: Update snapsets in the database
klown Sep 19, 2018
75456ba
GPII-3138: Update snapsets in the database
klown Sep 19, 2018
230c8f0
GPII-3138: Update snapsets in the database
klown Sep 19, 2018
23b27e4
GPII-3138 Merged upstream master GPII branch
klown Oct 9, 2018
33f1741
GPII-3138: Update snapsets in the database.
klown Oct 9, 2018
2c48ca5
GPII-3138: Update snapsets in the database
klown Oct 11, 2018
d9ac25e
GPII-3138: Update snapsets in the database
klown Oct 15, 2018
ebde69d
GPII-3138: Update snapsets in the database
klown Oct 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gpii/node_modules/testing/src/PouchTestCaseHolder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@
"test:vagrantProduction": "vagrant ssh -c 'cd /home/vagrant/sync/universal; DISPLAY=:0; ./scripts/vagrantCloudBasedContainers.sh'",
"posttest": "node node_modules/nyc/bin/nyc.js report -r text-summary -r html --report-dir reports --temp-directory coverage",
"start": "node gpii.js",
"postinstall": "node scripts/browserifyTestDependency.js && node scripts/convertPrefs.js testData/preferences/ build/dbData/ && node scripts/convertPrefs.js tests/data/preferences/ build/tests/dbData/"
"postinstall": "node scripts/browserifyTestDependency.js && node scripts/convertPrefs.js testData/preferences/ build/dbData/snapset/ snapset && node scripts/convertPrefs.js testData/preferences/ build/dbData/user/ user && node scripts/convertPrefs.js tests/data/preferences/ build/tests/dbData/ user && node scripts/convertPrefs.js testData/preferences/demoUserPrefs/ build/dbData/demouser/ user"
}
}
8 changes: 4 additions & 4 deletions scripts/convertPrefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ https://github.com/GPII/universal/blob/master/LICENSE.txt
*/

// This script reads files from an input directory that contains preferences JSON5 files and convert them to JSON files of GPII keys and
// preferences safes suitable for direct loading into CouchDB or PouchDB, which comply with the new GPII data model:
// preferences safes suitable for direct loading into CouchDB or PouchDB, which comply with the new GPII data model:
// https://wiki.gpii.net/w/Keys,_KeyTokens,_and_Preferences in the target directory
// Usage: node scripts/convertPrefs.js {input_path} {target_path}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the usage too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

//
Expand All @@ -25,14 +25,14 @@ var fs = require("fs"),

var inputDir = process.argv[2];
var targetDir = process.argv[3];
var prefsSafeType = process.argv[4];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either check prefsSafeType must be provided or change this line to

var prefsSafeType = process.argv[4] || "user";

to set "user" as the default if this argument is optional.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've modified the code to use the "or" form. Still ... shouldn't we check that it's either "snapset" or "user" and quit if it's neither -- what if someone entered "group" for the type, for example? Or, will there be other types of prefsSafes in the future?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harmless to check. I cannot tell at the moment if there will be other types of prefsSafes in the future.


var prefsSafes = [];
var gpiiKeys = [];
var count = 0;

var filenames = fs.readdirSync(inputDir);

console.log("Converting preferences data in the source directory " + inputDir + " to the target directory " + targetDir + " ...");
console.log("Converting preferences data in the source directory " + inputDir + " to the target directory " + targetDir + " as " + prefsSafeType + " Prefs Safes ...");

// Read and loop thru json5 files in the input directory
rimraf(targetDir, function () {
Expand Down Expand Up @@ -61,7 +61,7 @@ rimraf(targetDir, function () {
"_id": prefsSafeId,
"type": "prefsSafe",
"schemaVersion": "0.1",
"prefsSafeType": "user",
"prefsSafeType": prefsSafeType,
"name": gpiiKey,
"password": null,
"email": null,
Expand Down
Loading