Created
May 23, 2012 10:32
-
-
Save anonymous/2774491 to your computer and use it in GitHub Desktop.
Build Profile Summary
This file contains hidden or 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
| function(doc) { | |
| function toDateKey(timestamp) { | |
| var d = new Date(timestamp); | |
| var newdate = ""; | |
| var newdate2 = newdate.concat(d.getUTCDate(), "/", d.getUTCMonth() + 1, "/", d.getFullYear()," ",d.getUTCHours() + 1,":", d.getUTCMinutes() + 1,":", d.getUTCSeconds() + 1 ); | |
| return newdate2; | |
| } | |
| var event = null; | |
| doc.events.some(function(evt) { | |
| if (evt.eventType == "MavenExecutionRequest") { | |
| event = evt; | |
| return true; | |
| } | |
| return false; | |
| }); | |
| if (doc.type == 'maven-build-profile') | |
| { | |
| var hostname = doc.headers.systemProperties['env.HOSTNAME']; | |
| if (hostname == null) { | |
| hostname = doc.headers.systemProperties['env.COMPUTERNAME']; | |
| if (hostname == null) { | |
| hostname = doc.headers.systemProperties['env.NODE_NAME']; | |
| if (hostname == null) { | |
| hostname = "undefined"; | |
| } | |
| } | |
| } | |
| emit(doc._id, {'startdate': toDateKey(doc.headers.started), | |
| 'completeddate': toDateKey(doc.headers.completed), | |
| 'builduser': doc.headers.core.user, | |
| 'builduration': doc.headers.completed - doc.headers.started, | |
| 'baseDirectory': event.data.baseDirectory, | |
| 'pom': event.data.pom, | |
| 'workingDirectory': doc.headers.systemProperties['user.dir'], | |
| 'mavengoals': event.data.goals.join(', '), | |
| 'hostname': hostname, | |
| 'documentSize': JSON.stringify(doc).length | |
| }); }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment