-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathapp.js
More file actions
41 lines (36 loc) · 1.44 KB
/
app.js
File metadata and controls
41 lines (36 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var MongoClient = require('mongodb').MongoClient;
var parseService = require("./services/parsing/readFilesForParsing.js");
var downloadService = require('./services/downloading/gitHubRepoGrabber.js');
var scrapeService = require('./services/scraping.js');
var queryService = require('./services/query.js');
var fileSystemUtilities = require('./services/fileSystem/utilities');
var initialize = function() {
console.log('Initializing GitSecure and cleaning from last cycle');
var pathToData = __dirname + '/services/parsing/git_data';
fileSystemUtilities.removeDirectorySync(pathToData);
getNextGitHubRepo();
};
var getNextGitHubRepo = function() {
MongoClient.connect('mongodb://TweetTrackerDB.cloudapp.net:27017/gitSecure', function(err, db) {
GLOBAL.db = db;
scrapeService.scrapeUrls(function(){
queryService.query(function(urlList){
downloadService.readListOfFiles(urlList, function(parseList){
console.log('Initiating parsing of repos');
parseService.parseFile(parseList, function(){
console.log('Completed execution of service cycle');
getNextGitHubRepo();
});
});
});
});
});
};
MongoClient.connect('mongodb://TweetTrackerDB.cloudapp.net:27017/gitSecure', function(err, db) {
db.collectionNames("count", function(err, names) {
if (names.length === 0) {
db.collection('count').insert({count: 0}, function(){});
}
});
});
initialize();