[Pkg-javascript-commits] [node-coveralls] 33/332: allow a null repo_token.
Bastien Roucariès
rouca at moszumanska.debian.org
Thu Nov 9 13:53:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-coveralls.
commit 3a04d6da55d49f62dc86b78f21f560274dbc3c7d
Author: cainus <gregg at caines.ca>
Date: Fri May 24 13:01:36 2013 -0700
allow a null repo_token.
---
bin/coveralls.js | 13 +++++++++----
lib/convertLcovToCoveralls.js | 6 +++---
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/bin/coveralls.js b/bin/coveralls.js
index 42503bb..38e8071 100755
--- a/bin/coveralls.js
+++ b/bin/coveralls.js
@@ -4,6 +4,7 @@ var path = require('path');
var YAML = require('libyaml');
var sendToCoveralls = require('../lib/sendToCoveralls');
var convertLcovToCoveralls = require('../lib/convertLcovToCoveralls');
+var repo_token;
process.stdin.resume();
process.stdin.setEncoding('utf8');
@@ -22,12 +23,16 @@ var inputToCoveralls = function(input){
console.log(input);
var libDir = process.argv[2] || '';
- if (process.env['COVERALLS_REPO_TOKEN'] != null) {
- repo_token = process.env['COVERALLS_REPO_TOKEN'];
+ if (process.env.COVERALLS_REPO_TOKEN) {
+ repo_token = process.env.COVERALLS_REPO_TOKEN;
} else {
var yml = path.join(process.cwd(), '.coveralls.yml');
- if (fs.statSync(yml).isFile()) {
- repo_token = YAML.readFileSync(yml)[0]['repo_token'];
+ try {
+ if (fs.statSync(yml).isFile()) {
+ repo_token = YAML.readFileSync(yml)[0].repo_token;
+ }
+ } catch(ex){
+ console.log("Repo token could not be determined. Continuing without it.");
}
}
diff --git a/lib/convertLcovToCoveralls.js b/lib/convertLcovToCoveralls.js
index 2b5e223..3f63f15 100644
--- a/lib/convertLcovToCoveralls.js
+++ b/lib/convertLcovToCoveralls.js
@@ -13,9 +13,9 @@ var detailsToCoverage = function(length, details){
var convertLcovFileObject = function(file, filepath){
if (file.file[0] !== '/'){
- filepath = path.join(filepath, file.file);
+ filepath = path.join(filepath, file.file);
} else {
- filepath = file.file;
+ filepath = file.file;
}
var source = fs.readFileSync(filepath, 'utf8');
var lines = source.split("\n");
@@ -35,7 +35,7 @@ var convertLcovToCoveralls = function(input, filepath, repo_token, cb){
var postJson = {
source_files : []
};
- if (typeof repo_token !== "undefined" && repo_token !== null) {
+ if (repo_token) {
postJson.repo_token = repo_token;
} else {
postJson.service_job_id = TRAVIS_JOB_ID;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-coveralls.git
More information about the Pkg-javascript-commits
mailing list