pax_global_header00006660000000000000000000000064132036321260014510gustar00rootroot0000000000000052 comment=bd4e2a1e4ff616764c4967e83f3e3b3c415ae476 ci-info-1.1.2/000077500000000000000000000000001320363212600130355ustar00rootroot00000000000000ci-info-1.1.2/.gitignore000066400000000000000000000000151320363212600150210ustar00rootroot00000000000000node_modules ci-info-1.1.2/.npmignore000066400000000000000000000000411320363212600150270ustar00rootroot00000000000000node_modules .travis.yml test.js ci-info-1.1.2/.travis.yml000066400000000000000000000001131320363212600151410ustar00rootroot00000000000000language: node_js node_js: - '8' - '7' - '6' - '5' - '4' - '0.12' - '0.10' ci-info-1.1.2/LICENSE000066400000000000000000000021031320363212600140360ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2016-2017 Thomas Watson Steen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ci-info-1.1.2/README.md000066400000000000000000000053211320363212600143150ustar00rootroot00000000000000# ci-info Get details about the current Continuous Integration environment. Please [open an issue](https://github.com/watson/ci-info/issues) if your CI server isn't properly detected :) [![Build status](https://travis-ci.org/watson/ci-info.svg?branch=master)](https://travis-ci.org/watson/ci-info) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) ## Installation ``` npm install ci-info --save ``` ## Usage ```js var ci = require('ci-info') if (ci.isCI) { console.log('The name of the CI server is:', ci.name) } else { console.log('This program is not running on a CI server') } ``` ## Supported CI tools Officially supported CI servers: - [AWS CodeBuild](https://aws.amazon.com/codebuild/) - [AppVeyor](http://www.appveyor.com) - [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian - [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) - [Buildkite](https://buildkite.com) - [CircleCI](http://circleci.com) - [Codeship](https://codeship.com) - [Drone](https://drone.io) - [GitLab CI](https://about.gitlab.com/gitlab-ci/) - [GoCD](https://www.go.cd/) - [Hudson](http://hudson-ci.org) - [Jenkins CI](https://jenkins-ci.org) - [Magnum CI](https://magnum-ci.com) - [Semaphore](https://semaphoreci.com) - [TaskCluster](http://docs.taskcluster.net) - [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx) by Microsoft - [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains - [Travis CI](http://travis-ci.org) ## API ### `ci.name` A string. Will contain the name of the CI server the code is running on. If not CI server is detected, it will be `null`. Don't depend on the value of this string not to change for a specific vendor. If you find your self writing `ci.name === 'Travis CI'`, you most likely want to use `ci.TRAVIS` instead. ### `ci.isCI` A boolean. Will be `true` if the code is running on a CI server. Otherwise `false`. Some CI servers not listed here might still trigger the `ci.isCI` boolean to be set to `true` if they use certain vendor neutral environment variables. In those cases `ci.name` will be `null` and no vendor specific boolean will be set to `true`. ### `ci.` The following vendor specific boolean constants are exposed. A constant will be `true` if the code is determined to run on the given CI server. Otherwise `false`. - `ci.APPVEYOR` - `ci.BAMBOO` - `ci.BITBUCKET` - `ci.BUILDKITE` - `ci.CIRCLE` - `ci.CODEBUILD` - `ci.CODESHIP` - `ci.DRONE` - `ci.GITLAB` - `ci.GOCD` - `ci.HUDSON` - `ci.JENKINS` - `ci.MAGNUM` - `ci.SEMAPHORE` - `ci.TASKCLUSTER` - `ci.TEAMCITY` - `ci.TFS` (Team Foundation Server) - `ci.TRAVIS` ## License MIT ci-info-1.1.2/index.js000066400000000000000000000027141320363212600145060ustar00rootroot00000000000000'use strict' var env = process.env var vendors = [ // Constant, Name, Envs ['TRAVIS', 'Travis CI', 'TRAVIS'], ['CIRCLE', 'CircleCI', 'CIRCLECI'], ['GITLAB', 'GitLab CI', 'GITLAB_CI'], ['APPVEYOR', 'AppVeyor', 'APPVEYOR'], ['CODESHIP', 'Codeship', {CI_NAME: 'codeship'}], ['DRONE', 'Drone', 'DRONE'], ['MAGNUM', 'Magnum CI', 'MAGNUM'], ['SEMAPHORE', 'Semaphore', 'SEMAPHORE'], ['JENKINS', 'Jenkins', 'JENKINS_URL', 'BUILD_ID'], ['BAMBOO', 'Bamboo', 'bamboo_planKey'], ['TFS', 'Team Foundation Server', 'TF_BUILD'], ['TEAMCITY', 'TeamCity', 'TEAMCITY_VERSION'], ['BUILDKITE', 'Buildkite', 'BUILDKITE'], ['HUDSON', 'Hudsun', 'HUDSON_URL'], ['TASKCLUSTER', 'TaskCluster', 'TASK_ID', 'RUN_ID'], ['GOCD', 'GoCD', 'GO_PIPELINE_LABEL'], ['BITBUCKET', 'Bitbucket Pipelines', 'BITBUCKET_COMMIT'], ['CODEBUILD', 'AWS CodeBuild', 'CODEBUILD_BUILD_ARN'] ] exports.name = null vendors.forEach(function (vendor) { var constant = vendor.shift() var name = vendor.shift() var isCI = vendor.every(function (obj) { if (typeof obj === 'string') return !!env[obj] return Object.keys(obj).every(function (k) { return env[k] === obj[k] }) }) exports[constant] = isCI if (isCI) exports.name = name }) exports.isCI = !!( env.CI || // Travis CI, CircleCI, Gitlab CI, Appveyor, CodeShip env.CONTINUOUS_INTEGRATION || // Travis CI env.BUILD_NUMBER || // Jenkins, TeamCity exports.name || false ) ci-info-1.1.2/package.json000066400000000000000000000014101320363212600153170ustar00rootroot00000000000000{ "name": "ci-info", "version": "1.1.2", "description": "Get details about the current Continuous Integration environment", "main": "index.js", "dependencies": {}, "devDependencies": { "clear-require": "^1.0.1", "standard": "^10.0.3" }, "scripts": { "test": "standard && node test.js" }, "repository": { "type": "git", "url": "https://github.com/watson/ci-info.git" }, "keywords": [ "ci", "continuous", "integration", "test", "detect" ], "author": "Thomas Watson Steen (https://twitter.com/wa7son)", "license": "MIT", "bugs": { "url": "https://github.com/watson/ci-info/issues" }, "homepage": "https://github.com/watson/ci-info", "coordinates": [ 55.777569, 12.589702 ] } ci-info-1.1.2/test.js000066400000000000000000000044151320363212600143560ustar00rootroot00000000000000'use strict' var assert = require('assert') var clearRequire = require('clear-require') // Known CI process.env.TRAVIS = 'true' var ci = require('./') assert.equal(ci.isCI, true) assert.equal(ci.name, 'Travis CI') assert.equal(ci.TRAVIS, true) assert.equal(ci.CIRCLE, false) assert.equal(ci.GITLAB, false) assert.equal(ci.APPVEYOR, false) assert.equal(ci.CODESHIP, false) assert.equal(ci.DRONE, false) assert.equal(ci.MAGNUM, false) assert.equal(ci.SEMAPHORE, false) assert.equal(ci.JENKINS, false) assert.equal(ci.BAMBOO, false) assert.equal(ci.TFS, false) assert.equal(ci.TEAMCITY, false) assert.equal(ci.BUILDKITE, false) assert.equal(ci.HUDSON, false) assert.equal(ci.TASKCLUSTER, false) assert.equal(ci.GOCD, false) assert.equal(ci.BITBUCKET, false) assert.equal(ci.CODEBUILD, false) // Not CI delete process.env.CI delete process.env.CONTINUOUS_INTEGRATION delete process.env.BUILD_NUMBER delete process.env.TRAVIS clearRequire('./') ci = require('./') assert.equal(ci.isCI, false) assert.equal(ci.name, undefined) assert.equal(ci.TRAVIS, false) assert.equal(ci.CIRCLE, false) assert.equal(ci.GITLAB, false) assert.equal(ci.APPVEYOR, false) assert.equal(ci.CODESHIP, false) assert.equal(ci.DRONE, false) assert.equal(ci.MAGNUM, false) assert.equal(ci.SEMAPHORE, false) assert.equal(ci.JENKINS, false) assert.equal(ci.BAMBOO, false) assert.equal(ci.TFS, false) assert.equal(ci.TEAMCITY, false) assert.equal(ci.BUILDKITE, false) assert.equal(ci.HUDSON, false) assert.equal(ci.TASKCLUSTER, false) assert.equal(ci.GOCD, false) assert.equal(ci.BITBUCKET, false) assert.equal(ci.CODEBUILD, false) // Unknown CI process.env.CI = 'true' clearRequire('./') ci = require('./') assert.equal(ci.isCI, true) assert.equal(ci.name, undefined) assert.equal(ci.TRAVIS, false) assert.equal(ci.CIRCLE, false) assert.equal(ci.GITLAB, false) assert.equal(ci.APPVEYOR, false) assert.equal(ci.CODESHIP, false) assert.equal(ci.DRONE, false) assert.equal(ci.MAGNUM, false) assert.equal(ci.SEMAPHORE, false) assert.equal(ci.JENKINS, false) assert.equal(ci.BAMBOO, false) assert.equal(ci.TFS, false) assert.equal(ci.TEAMCITY, false) assert.equal(ci.BUILDKITE, false) assert.equal(ci.HUDSON, false) assert.equal(ci.TASKCLUSTER, false) assert.equal(ci.GOCD, false) assert.equal(ci.BITBUCKET, false) assert.equal(ci.CODEBUILD, false)