Skip to content

Commit

Permalink
1.1.9
Browse files Browse the repository at this point in the history
- fixes environment overrides for CI
  • Loading branch information
gabrielcsapo committed Oct 28, 2017
1 parent a08fe83 commit 039f2fc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.1.9 (10/27/2017)

- fixes environment overrides for CI

# 1.1.8 (10/27/2017)

- fixes coverage api to sort before limit is run
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = function() {
options.service_pull_request = process.env.TRAVIS_PULL_REQUEST;
options.commit = 'HEAD';
options.message = process.env.TRAVIS_COMMIT_MESSAGE;
options.branch = process.env.TRAVIS_BRANCH || process.env.TRAVIS_PULL_REQUEST_BRANCH;
options.branch = process.env.TRAVIS_BRANCH || process.env.TRAVIS_PULL_REQUEST_BRANCH || process.env.TRAVIS_TAG;
}

if (process.env.DRONE){
Expand Down
36 changes: 19 additions & 17 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,55 @@ module.exports = function cli({ parser, input, url, basePath }) {
const parsedUrl = Url.parse(url);

return new Promise(async function(resolve, reject) {
const info = await git.parse();
const env = ci();
const output = {
service_job_id: env.service_job_id,
service_pull_request: env.service_pull_request,
service_name: env.service_name,
source_files: [],
git: {
commit: env.commit,
branch: env.branch,
message: env.message,
committer_name: env.committer_name,
committer_email: env.committer_email
author_date: info.author_date,
author_email: info.author_email,
author_name: info.author_name,
committer_date: info.committer_date,
commit: env.commit || info.commit,
branch: env.branch || info.branch,
message: env.message || info.message,
committer_name: env.committer_name || info.committer_name,
committer_email: env.committer_email || info.committer_email,
remotes: info.remotes
},
run_at: new Date()
};

let _lcov = {};
switch(parser) {
case 'cobertura':
_lcov = await cobertura.parse(input);
output['source_files'] = await cobertura.parse(input);
break;
case 'golang':
_lcov = await golang.parse(input);
output['source_files'] = await golang.parse(input);
break;
case 'jacoco':
_lcov = await jacoco.parse(input);
output['source_files'] = await jacoco.parse(input);
break;
default:
_lcov = await lcov.parse(input);
output['source_files'] = await lcov.parse(input);
break;
}

// Go through and set the file contents
for (let i = 0; i < _lcov.length; i++) {
let path = basePath ? Path.resolve(process.cwd(), basePath, _lcov[i].file) : _lcov[i].file;
for (let i = 0; i < output['source_files'].length; i++) {
let path = basePath ? Path.resolve(process.cwd(), basePath, output['source_files'][i].file) : output['source_files'][i].file;

if(fs.existsSync(path)) {
_lcov[i].source = fs.readFileSync(path).toString('utf8');
_lcov[i].title = _lcov[i].file.substring(_lcov[i].file.lastIndexOf('/') + 1, _lcov[i].file.length);
output['source_files'][i].source = fs.readFileSync(path).toString('utf8');
output['source_files'][i].title = output['source_files'][i].file.substring(output['source_files'][i].file.lastIndexOf('/') + 1, output['source_files'][i].file.length);
} else {
return reject(`can not find file at ${path}`);
}
}

output['source_files'] = _lcov;
output['git'] = Object.assign(output['git'], await git.parse());

const options = {
hostname: parsedUrl.hostname,
port: parsedUrl.port || 80,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lcov-server",
"version": "1.1.8",
"version": "1.1.9",
"description": "🎯 A simple lcov server & cli parser",
"main": "index.js",
"homepage": "https://github.com/gabrielcsapo/lcov-server#readme",
Expand Down

0 comments on commit 039f2fc

Please sign in to comment.