@@ -16,53 +16,55 @@ module.exports = function cli({ parser, input, url, basePath }) {
16
16
const parsedUrl = Url . parse ( url ) ;
17
17
18
18
return new Promise ( async function ( resolve , reject ) {
19
+ const info = await git . parse ( ) ;
19
20
const env = ci ( ) ;
20
21
const output = {
21
22
service_job_id : env . service_job_id ,
22
23
service_pull_request : env . service_pull_request ,
23
24
service_name : env . service_name ,
24
25
source_files : [ ] ,
25
26
git : {
26
- commit : env . commit ,
27
- branch : env . branch ,
28
- message : env . message ,
29
- committer_name : env . committer_name ,
30
- committer_email : env . committer_email
27
+ author_date : info . author_date ,
28
+ author_email : info . author_email ,
29
+ author_name : info . author_name ,
30
+ committer_date : info . committer_date ,
31
+ commit : env . commit || info . commit ,
32
+ branch : env . branch || info . branch ,
33
+ message : env . message || info . message ,
34
+ committer_name : env . committer_name || info . committer_name ,
35
+ committer_email : env . committer_email || info . committer_email ,
36
+ remotes : info . remotes
31
37
} ,
32
38
run_at : new Date ( )
33
39
} ;
34
40
35
- let _lcov = { } ;
36
41
switch ( parser ) {
37
42
case 'cobertura' :
38
- _lcov = await cobertura . parse ( input ) ;
43
+ output [ 'source_files' ] = await cobertura . parse ( input ) ;
39
44
break ;
40
45
case 'golang' :
41
- _lcov = await golang . parse ( input ) ;
46
+ output [ 'source_files' ] = await golang . parse ( input ) ;
42
47
break ;
43
48
case 'jacoco' :
44
- _lcov = await jacoco . parse ( input ) ;
49
+ output [ 'source_files' ] = await jacoco . parse ( input ) ;
45
50
break ;
46
51
default :
47
- _lcov = await lcov . parse ( input ) ;
52
+ output [ 'source_files' ] = await lcov . parse ( input ) ;
48
53
break ;
49
54
}
50
55
51
56
// Go through and set the file contents
52
- for ( let i = 0 ; i < _lcov . length ; i ++ ) {
53
- let path = basePath ? Path . resolve ( process . cwd ( ) , basePath , _lcov [ i ] . file ) : _lcov [ i ] . file ;
57
+ for ( let i = 0 ; i < output [ 'source_files' ] . length ; i ++ ) {
58
+ let path = basePath ? Path . resolve ( process . cwd ( ) , basePath , output [ 'source_files' ] [ i ] . file ) : output [ 'source_files' ] [ i ] . file ;
54
59
55
60
if ( fs . existsSync ( path ) ) {
56
- _lcov [ i ] . source = fs . readFileSync ( path ) . toString ( 'utf8' ) ;
57
- _lcov [ i ] . title = _lcov [ i ] . file . substring ( _lcov [ i ] . file . lastIndexOf ( '/' ) + 1 , _lcov [ i ] . file . length ) ;
61
+ output [ 'source_files' ] [ i ] . source = fs . readFileSync ( path ) . toString ( 'utf8' ) ;
62
+ output [ 'source_files' ] [ i ] . title = output [ 'source_files' ] [ i ] . file . substring ( output [ 'source_files' ] [ i ] . file . lastIndexOf ( '/' ) + 1 , output [ 'source_files' ] [ i ] . file . length ) ;
58
63
} else {
59
64
return reject ( `can not find file at ${ path } ` ) ;
60
65
}
61
66
}
62
67
63
- output [ 'source_files' ] = _lcov ;
64
- output [ 'git' ] = Object . assign ( output [ 'git' ] , await git . parse ( ) ) ;
65
-
66
68
const options = {
67
69
hostname : parsedUrl . hostname ,
68
70
port : parsedUrl . port || 80 ,
0 commit comments