Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(606)

Unified Diff: utils/apidoc/mdn/postProcess.dart

Issue 10889017: Repair bitrot in the utils/apidoc/mdn/ code. It now runs all the way through, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: utils/apidoc/mdn/postProcess.dart
===================================================================
--- utils/apidoc/mdn/postProcess.dart (revision 11346)
+++ utils/apidoc/mdn/postProcess.dart (working copy)
@@ -1,16 +1,27 @@
+/**
+ * Read database.json,
+ * write database.filtered.json (with "best" entries)
+ * and obsolete.json (with entries marked obsolete).
+ */
+
#library("postProcess");
+#import("dart:io");
#import("dart:json");
#import("util.dart");
void main() {
// Database of code documentation.
Map<String, List> database = JSON.parse(
- fs.readFileSync('output/database.json', 'utf8'));
+ new File('output/database.json').readAsTextSync());
final filteredDb = {};
final obsolete = [];
for (String type in database.getKeys()) {
final entry = pickBestEntry(database[type], type);
+ if (entry == null) {
+ print("Can't find ${type} in database. Skipping.");
+ continue;
+ }
filteredDb[type] = entry;
if (entry.containsKey("members")) {
Map members = getMembersMap(entry);
@@ -22,7 +33,6 @@
}
}
}
- fs.writeFileSync("output/database.filtered.json",
- JSON.stringify(filteredDb));
- fs.writeFileSync("output/obsolete.json", JSON.stringify(obsolete));
+ writeFileSync("output/database.filtered.json", JSON.stringify(filteredDb));
+ writeFileSync("output/obsolete.json", JSON.stringify(obsolete));
}

Powered by Google App Engine
This is Rietveld 408576698