Created
August 6, 2015 16:38
-
-
Save dhoss/b5c14840923e0b863cec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def crawlProjectRepos(project: String) = { | |
Logger.info("crawling " + project + " by API") | |
// a list of Futures containing a Tuple2 of a repository name and a Future[WSResponse] | |
val repoList = reposFor(project).map { repo => | |
(repo, callApi(buildCommitUrl(project, repo))) | |
} | |
Logger.debug("REPOS FOR" + reposFor(project)) | |
Future.traverse(repoList) ( | |
repoCommits => | |
repoCommits._2.filter(_.status==200).map { res => | |
(res.json \ "values").as[List[JsValue]].map { c => | |
Commit(0, | |
(c \ "id").as[String], | |
(c \ "message").as[String], | |
(c \ "author" \ "name").as[String], | |
(c \ "author" \ "emailAddress").as[String], | |
(c \ "authorTimestamp").as[Option[DateTime]](Reads.optionWithNull(jodaDateReads("yyyy-MM-dd'T'HH:mm:ss'Z"))), | |
repoCommits._1, | |
Option(new DateTime), | |
Option(new DateTime) | |
)} | |
}).map(_.flatten) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment