[Pkg-javascript-commits] [node-coveralls] 30/332: Supporting the COVERALLS_REPO_TOKEN environment-variable

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 ebca6c04edd9952c1c3fb99aea019e385a4c53b8
Author: elliottcable <me at ell.io>
Date:   Fri May 24 02:54:37 2013 -0400

    Supporting the COVERALLS_REPO_TOKEN environment-variable
---
 README.md        |  2 +-
 bin/coveralls.js | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 4f41665..e484a36 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ In mocha, if you've got your code instrumented for coverage, the command for a t
 YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js
 ```
 
-If you're running locally, you must have a `.coveralls.yml` file, as documented in their documentation, with your `repo_token` in it.
+If you're running locally, you must have a `.coveralls.yml` file, as documented in their documentation, with your `repo_token` in it; or, you must provide a `COVERALLS_REPO_TOKEN` environment-variable on the command-line.
 
 Check out an example [Makefile](https://github.com/cainus/urlgrey/blob/master/Makefile) from one of my projects for an example, especially the test-coveralls build target.  Note: Travis runs `npm test`, so whatever target you create in your Makefile must be the target that `npm test` runs (This is set in package.json's 'scripts' property).
 
diff --git a/bin/coveralls.js b/bin/coveralls.js
index d3d18e1..42503bb 100755
--- a/bin/coveralls.js
+++ b/bin/coveralls.js
@@ -22,9 +22,13 @@ var inputToCoveralls = function(input){
     console.log(input);
     var libDir = process.argv[2] || '';
     
-    var yml = path.join(process.cwd(), '.coveralls.yml');
-    if (fs.statSync(yml).isFile()) {
-      repo_token = YAML.readFileSync(yml)[0]['repo_token'];
+    if (process.env['COVERALLS_REPO_TOKEN'] != null) {
+      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'];
+      }
     }
     
     convertLcovToCoveralls(input, libDir, repo_token, function(err, postData){

-- 
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