travis 1.10.1.travis.1341.9 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ba5629e8ff02579e5c633e0b116d46819b1aea46823e5185d2ad49e46b0ae4f
4
- data.tar.gz: 0c193edc796481141bef3babefeed00c0d2523f6f4951d110f2333a6040c5634
3
+ metadata.gz: bd56aab41cadf71c5d3e17baa3e32ef92c12b47df8433885cd93bfcdeba0a3ac
4
+ data.tar.gz: 31dfb62475ae626176823ce90347915da42e601c44f570cac6ee338bb4a923c1
5
5
  SHA512:
6
- metadata.gz: 804dc8309253b61dbcf37e83197869a8f3ee0d361a3f8978ff4c2cb354cb9dd975f96038eaaa558347598ee5554f17f71edffdbbbfc75ab9c2ebea1075dd1274
7
- data.tar.gz: 41d1dba9f1c19ed6521d7c224510e08f3fb756b3d4dfcd0ebbbed968cec8fee3c28bc6c57f6d5adffc8703b36a661ce6e09ec3888028f545cd8f1851f82e9a3e
6
+ metadata.gz: 1f3035ba8ccbf3031a84796f3d16ca3f88d93512a7250b71a3d6f773e19b95b4662ccf96ee350331b89403c437ce98f1ae3f921cb4ec2249f6529a13c51eb258
7
+ data.tar.gz: c8277df2456d7e9386a6241804e91078a378014804073efaed2c5f6c91d75db8fe51ab4dd180f74cfe3242b4c4f3d55ccd0f04b6a2dbd89e2544b595e7fbfcc6
data/README.md CHANGED
@@ -233,22 +233,11 @@ default API endpoint dropped (was https://api.travis-ci.com/)
233
233
  The `login` command will, well, log you in. That way, all subsequent commands that run against the same endpoint will be authenticated.
234
234
 
235
235
  ``` console
236
- $ travis login
237
- We need your GitHub login to identify you.
238
- This information will not be sent to Travis CI, only to GitHub.
239
- The password will not be displayed.
240
-
241
- Try running with --github-token or --auto if you don't want to enter your password anyway.
242
-
243
- Username: rkh
244
- Password: *******************
245
-
246
- Successfully logged in!
236
+ $ travis login --pro --github-token ghp_********
237
+ Successfully logged in as rkh!
247
238
  ```
248
239
 
249
- As you can see above, it will ask you for your GitHub user name and password, but not send these to Travis CI. Instead, it will use them to create a GitHub API token, show the token to Travis, which then on its own checks if you really are who you say you are, and gives you an access token for the Travis API in return. The client will then delete the GitHub token again, just to be sure. But don't worry, all that happens under the hood and fully automatic.
250
-
251
- If you don't want it to send your credentials to GitHub, you can create a GitHub token on your own and supply it via `--github-token`. In that case, the client will not delete the GitHub token (as it can't, it needs your password to do this). Travis CI will not store the token, though - after all, it already should have a valid token for you in the database.
240
+ You need to use a GitHub token and supply it via `--github-token`. Travis CI will not store the token, though - after all, it already should have a valid token for you in the database.
252
241
  *NOTE*: When creating a GitHub token, see [GitHub Permissions used by travis-ci.com](https://docs.travis-ci.com/user/github-oauth-scopes/#travis-ci-for-private-projects) or [GitHub Permissions used by travis-ci.org](https://docs.travis-ci.com/user/github-oauth-scopes/#travis-ci-for-open-source-projects). The token permissions are dependent on use of travis-ci.com or travis-ci.org and not if they are public or private repositories.
253
242
 
254
243
  A third option is for the really lazy: `--auto`. In this mode the client will try to find a GitHub token for you and just use that. This will only work if you have a [global GitHub token](https://help.github.com/articles/git-over-https-using-oauth-token) stored in your [.netrc](http://blogdown.io/c4d42f87-80dd-45d5-8927-4299cbdf261c/posts/574baa68-f663-4dcf-88b9-9d41310baf2f). If you haven't heard of this, it's worth looking into in general. Again: Travis CI will not store that token.
@@ -1560,26 +1549,6 @@ puts "Hello #{Travis::User.current.name}!"
1560
1549
 
1561
1550
  Travis CI will not store that token.
1562
1551
 
1563
- It also ships with a tool for generating a GitHub token from a user name and password via the GitHub API:
1564
-
1565
- ``` ruby
1566
- require 'travis'
1567
- require 'travis/tools/github'
1568
-
1569
- # drop_token will make the token a temporary one
1570
- github = Travis::Tools::Github.new(drop_token: true) do |g|
1571
- g.ask_login = -> { print("GitHub login: "); gets }
1572
- g.ask_password = -> { print("Password: "); gets }
1573
- g.ask_otp = -> { print("Two-factor token: "); gets }
1574
- end
1575
-
1576
- github.with_token do |token|
1577
- Travis.github_auth(token)
1578
- end
1579
-
1580
- puts "Hello #{Travis::User.current.name}!"
1581
- ```
1582
-
1583
1552
  There is also `travis/auto_login`, which will try to read the CLI configuration or .netrc for a Travis CI or GitHub token to authenticate with automatically:
1584
1553
 
1585
1554
  ``` ruby
@@ -2027,7 +1996,7 @@ See also [Note on Ubuntu](#ubuntu) below.
2027
1996
  For Ruby 2.3.x, be sure to have a compatible version of `faraday` installed; e.g.,
2028
1997
 
2029
1998
  $ gem install faraday -v 1.0.1
2030
-
1999
+
2031
2000
  ### Development Version
2032
2001
 
2033
2002
  You can also install the development version via RubyGems:
data/assets/travis.sh CHANGED
@@ -20,7 +20,7 @@ _travis_complete() {
20
20
  if type compdef 1>/dev/null 2>/dev/null; then
21
21
  compdef _travis travis
22
22
  _travis() { _travis_complete $((${#words} - 1)) "${words[2]}"; }
23
- _travis_commands() { list=(accounts:"displays accounts and their subscription status" branches:"displays the most recent build for each branch" cache:"lists or deletes repository caches" cancel:"cancels a job or build" console:"interactive shell; requires `pry`" disable:"disables a project" enable:"enables a project" encrypt:"encrypts values for the .travis.yml" encrypt-file:"encrypts a file and adds decryption steps to .travis.yml" endpoint:"displays or changes the API endpoint" env:"show or modify build environment variables" help:"helps you out when in dire need of information" history:"displays a project's build history" init:"generates a .travis.yml and enables the project" lint:"display warnings for a .travis.yml" login:"authenticates against the API and stores the token" logout:"deletes the stored API token" logs:"streams test logs" monitor:"live monitor for what's going on" open:"opens a build or job in the browser" pubkey:"prints out a repository's public key" raw:"makes an (authenticated) API call and prints out the result" report:"generates a report useful for filing issues" repos:"lists repositories the user has certain permissions on" requests:"lists recent requests" restart:"restarts a build or job" settings:"access repository settings" setup:"sets up an addon or deploy target" show:"displays a build or job" sshkey:"checks, updates or deletes an SSH key" status:"checks status of the latest build" sync:"triggers a new sync with GitHub" token:"outputs the secret API token" version:"outputs the client version" whatsup:"lists most recent builds" whoami:"outputs the current user") _describe -t common-commands 'common commands' list; }
23
+ _travis_commands() { list=(accounts:"displays accounts and their subscription status" branches:"displays the most recent build for each branch" cache:"lists or deletes repository caches" cancel:"cancels a job or build" console:"interactive shell; requires `pry`" disable:"disables a project" enable:"enables a project" encrypt:"encrypts values for the .travis.yml" encrypt-file:"encrypts a file and adds decryption steps to .travis.yml" endpoint:"displays or changes the API endpoint" env:"show or modify build environment variables" help:"helps you out when in dire need of information" history:"displays a project's build history" init:"generates a .travis.yml and enables the project" lint:"display warnings for a .travis.yml" login:"authenticates against the API and stores the token" logout:"deletes the stored API token" logs:"streams test logs" open:"opens a build or job in the browser" pubkey:"prints out a repository's public key" raw:"makes an (authenticated) API call and prints out the result" report:"generates a report useful for filing issues" repos:"lists repositories the user has certain permissions on" requests:"lists recent requests" restart:"restarts a build or job" settings:"access repository settings" setup:"sets up an addon or deploy target" show:"displays a build or job" sshkey:"checks, updates or deletes an SSH key" status:"checks status of the latest build" sync:"triggers a new sync with GitHub" token:"outputs the secret API token" version:"outputs the client version" whatsup:"lists most recent builds" whoami:"outputs the current user") _describe -t common-commands 'common commands' list; }
24
24
  _travis_setup() { list=(anynines:"automatic deployment to anynines" appfog:"automatic deployment to Appfog" artifacts:"automatic artifact shipping to S3" biicode:"automatic publish to biicode" cloudcontrol:"automatic deployment to cloudControl" cloudfiles:"automatic pushing to Rackspace Cloud Files" cloudfoundry:"automatic deployment to Cloud Foundry" cloud66:"Automatic deployment to Cloud 66" codedeploy:"triggering a new deployment on Amazon CodeDeploy" deis:"automatic deployment to a deis app" divshot:"deployment to Divshot.io" elasticbeanstalk:"deployment to AWS Elastic Beanstalk" engineyard:"automatic deployment to Engine Yard" gcs:"automatic pushing to Google Cloud Storage" hackage:"automatic deployment of hackage packages" heroku:"automatic deployment to Heroku" modulus:"deployment to Modulus" npm:"automatic release to npm" ninefold:"Automatic deployment to Ninefold" nodejitsu:"automatic deployment to Nodejitsu" openshift:"automatic deployment to OpenShfit" opsworks:"deployment to OpsWorks" pypi:"automatic deployment to PyPI" releases:"Upload Assets to GitHub Releases" rubygems:"automatic release to RubyGems" s3:"automatic pushing to S3" sauce_connect:"Sauce Connet addon for Sauce Labs integration") _describe -t common-commands 'common commands' list; }
25
25
  _travis_settings() { list=(builds_only_with_travis_yml:"Only run builds with a .travis.yml" build_pushes:"Build pushes" build_pull_requests:"Build pull requests" maximum_number_of_builds:"Maximum number of concurrent builds" auto_cancel_pushes:"Cancel older push builds that are not yet running" auto_cancel_pull_requests:"Cancel older pull request builds that are not yet running") _describe -t common-commands 'common commands' list; }
26
26
  _travis_init() { list=(bash:'initialize bash project' c:'initialize c project' clojure:'initialize clojure project' cpp:'initialize cpp project' elixir:'initialize elixir project' erlang:'initialize erlang project' go:'initialize go project' groovy:'initialize groovy project' haskell:'initialize haskell project' java:'initialize java project' node_js:'initialize node_js project' objective-c:'initialize objective-c project' perl:'initialize perl project' php:'initialize php project' python:'initialize python project' ruby:'initialize ruby project' scala:'initialize scala project') _describe -t common-commands 'common commands' list; }
@@ -44,7 +44,6 @@ if type compdef 1>/dev/null 2>/dev/null; then
44
44
  login) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--com[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "--debug-http[show HTTP(S) exchange]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests. If omitted, use Typhoeus if it is installed, and Net::HTTP otherwise. See https://lostisland.github.io/faraday/adapters/ for more info]" "-g[identify by GitHub token]" "--github-token[identify by GitHub token]" "-T[try to figure out who you are automatically (might send another apps token to Travis, token will not be stored)]" "--auto-token[try to figure out who you are automatically (might send another apps token to Travis, token will not be stored)]" "-p[try to load password from OSX keychain (will not be stored)]" "--auto-password[try to load password from OSX keychain (will not be stored)]" "-a[shorthand for --auto-token --auto-password]" "--auto[shorthand for --auto-token --auto-password]" "-u[user to log in as]" "--user[user to log in as]" "-M[do not use interactive login]" "--no-manual[do not use interactive login]" "--list-github-token[instead of actually logging in, list found GitHub tokens]" "--skip-token-check[don't verify the token with github]" '*:file:_files' && return 0;;
45
45
  logout) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--com[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "--debug-http[show HTTP(S) exchange]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests. If omitted, use Typhoeus if it is installed, and Net::HTTP otherwise. See https://lostisland.github.io/faraday/adapters/ for more info]" '*:file:_files' && return 0;;
46
46
  logs) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--com[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "--debug-http[show HTTP(S) exchange]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests. If omitted, use Typhoeus if it is installed, and Net::HTTP otherwise. See https://lostisland.github.io/faraday/adapters/ for more info]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-R[like --repo, but remembers value for current directory]" "--store-repo[like --repo, but remembers value for current directory]" "-d[remove logs]" "--delete[remove logs]" "-f[do not ask user to confirm deleting the logs]" "--force[do not ask user to confirm deleting the logs]" "--stream[only print current logs, do not stream]" "--no-stream[only print current logs, do not stream]" '*:file:_files' && return 0;;
47
- monitor) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--com[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "--debug-http[show HTTP(S) exchange]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests. If omitted, use Typhoeus if it is installed, and Net::HTTP otherwise. See https://lostisland.github.io/faraday/adapters/ for more info]" "-m[Only monitor my own repositories]" "--my-repos[Only monitor my own repositories]" "-r[monitor given repository (can be used more than once)]" "--repo[monitor given repository (can be used more than once)]" "-n[send out desktop notifications (optional type: osx, growl, libnotify)]" "--notify[send out desktop notifications (optional type: osx, growl, libnotify)]" "--no-notify[send out desktop notifications (optional type: osx, growl, libnotify)]" "-b[only monitor builds, not jobs]" "--builds[only monitor builds, not jobs]" "-p[monitor push events]" "--push[monitor push events]" "-P[monitor pull request events]" "--pull[monitor pull request events]" '*:file:_files' && return 0;;
48
47
  open) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--com[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "--debug-http[show HTTP(S) exchange]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests. If omitted, use Typhoeus if it is installed, and Net::HTTP otherwise. See https://lostisland.github.io/faraday/adapters/ for more info]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-R[like --repo, but remembers value for current directory]" "--store-repo[like --repo, but remembers value for current directory]" "-g[Open the corresponding project, compare view or pull request on GitHub]" "--github[Open the corresponding project, compare view or pull request on GitHub]" "-p[Print out the URL instead of opening it in a browser]" "--print[Print out the URL instead of opening it in a browser]" '*:file:_files' && return 0;;
49
48
  pubkey) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--com[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "--debug-http[show HTTP(S) exchange]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests. If omitted, use Typhoeus if it is installed, and Net::HTTP otherwise. See https://lostisland.github.io/faraday/adapters/ for more info]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-R[like --repo, but remembers value for current directory]" "--store-repo[like --repo, but remembers value for current directory]" "-p[encode in format used by pem]" "--pem[encode in format used by pem]" "-f[display fingerprint]" "--fingerprint[display fingerprint]" '*:file:_files' && return 0;;
50
49
  raw) _arguments -s -S "-h[Display help]" "--help[Display help]" "-i[be interactive and colorful]" "--interactive[be interactive and colorful]" "--no-interactive[be interactive and colorful]" "-E[don't rescue exceptions]" "--explode[don't rescue exceptions]" "--no-explode[don't rescue exceptions]" "--skip-version-check[don't check if travis client is up to date]" "--skip-completion-check[don't check if auto-completion is set up]" "-e[Travis API server to talk to]" "--api-endpoint[Travis API server to talk to]" "-I[do not verify SSL certificate of API endpoint]" "--insecure[do not verify SSL certificate of API endpoint]" "--no-insecure[do not verify SSL certificate of API endpoint]" "--pro[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--com[short-cut for --api-endpoint 'https://api.travis-ci.com/']" "--org[short-cut for --api-endpoint 'https://api.travis-ci.org/']" "--staging[talks to staging system]" "-t[access token to use]" "--token[access token to use]" "--debug[show API requests]" "--debug-http[show HTTP(S) exchange]" "-X[use enterprise setup (optionally takes name for multiple setups)]" "--enterprise[use enterprise setup (optionally takes name for multiple setups)]" "--adapter[Faraday adapter to use for HTTP requests. If omitted, use Typhoeus if it is installed, and Net::HTTP otherwise. See https://lostisland.github.io/faraday/adapters/ for more info]" "--json[display as json]" "--no-json[display as json]" '*:file:_files' && return 0;;
@@ -67,7 +66,7 @@ if type compdef 1>/dev/null 2>/dev/null; then
67
66
  elif type compctl 1>/dev/null 2>/dev/null; then
68
67
  compctl -K _travis travis
69
68
  _travis() { read -cA words && _travis_complete $((${#words} - 1)) "${words[2]}"; }
70
- _travis_commands() { reply=("accounts" "branches" "cache" "cancel" "console" "disable" "enable" "encrypt" "encrypt-file" "endpoint" "env" "help" "history" "init" "lint" "login" "logout" "logs" "monitor" "open" "pubkey" "raw" "report" "repos" "requests" "restart" "settings" "setup" "show" "sshkey" "status" "sync" "token" "version" "whatsup" "whoami"); }
69
+ _travis_commands() { reply=("accounts" "branches" "cache" "cancel" "console" "disable" "enable" "encrypt" "encrypt-file" "endpoint" "env" "help" "history" "init" "lint" "login" "logout" "logs" "open" "pubkey" "raw" "report" "repos" "requests" "restart" "settings" "setup" "show" "sshkey" "status" "sync" "token" "version" "whatsup" "whoami"); }
71
70
  _travis_setup() { reply=("anynines" "appfog" "artifacts" "biicode" "cloudcontrol" "cloudfiles" "cloudfoundry" "cloud66" "codedeploy" "deis" "divshot" "elasticbeanstalk" "engineyard" "gcs" "hackage" "heroku" "modulus" "npm" "ninefold" "nodejitsu" "openshift" "opsworks" "pypi" "releases" "rubygems" "s3" "sauce_connect"); }
72
71
  _travis_settings() { reply=(builds_only_with_travis_yml build_pushes build_pull_requests maximum_number_of_builds auto_cancel_pushes auto_cancel_pull_requests); }
73
72
  _travis_init() { reply=("bash" "c" "clojure" "cpp" "elixir" "erlang" "go" "groovy" "haskell" "java" "node_js" "objective-c" "perl" "php" "python" "ruby" "scala"); }
@@ -91,7 +90,6 @@ elif type compctl 1>/dev/null 2>/dev/null; then
91
90
  login) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--com" "--org" "--staging" "--token" "-t" "--debug" "--debug-http" "--enterprise" "-X" "--adapter" "--github-token" "-g" "--auto-token" "-T" "--auto-password" "-p" "--auto" "-a" "--user" "-u" "--no-manual" "-M" "--list-github-token" "--skip-token-check");;
92
91
  logout) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--com" "--org" "--staging" "--token" "-t" "--debug" "--debug-http" "--enterprise" "-X" "--adapter");;
93
92
  logs) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--com" "--org" "--staging" "--token" "-t" "--debug" "--debug-http" "--enterprise" "-X" "--adapter" "--repo" "-r" "--store-repo" "-R" "--delete" "-d" "--force" "-f" "--stream" "--no-stream");;
94
- monitor) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--com" "--org" "--staging" "--token" "-t" "--debug" "--debug-http" "--enterprise" "-X" "--adapter" "--my-repos" "-m" "--repo" "-r" "--notify" "--no-notify" "-n" "--builds" "-b" "--push" "-p" "--pull" "-P");;
95
93
  open) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--com" "--org" "--staging" "--token" "-t" "--debug" "--debug-http" "--enterprise" "-X" "--adapter" "--repo" "-r" "--store-repo" "-R" "--github" "-g" "--print" "-p");;
96
94
  pubkey) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--com" "--org" "--staging" "--token" "-t" "--debug" "--debug-http" "--enterprise" "-X" "--adapter" "--repo" "-r" "--store-repo" "-R" "--pem" "-p" "--fingerprint" "-f");;
97
95
  raw) reply=("--help" "-h" "--interactive" "--no-interactive" "-i" "--explode" "--no-explode" "-E" "--skip-version-check" "--skip-completion-check" "--api-endpoint" "-e" "--insecure" "--no-insecure" "-I" "--pro" "--com" "--org" "--staging" "--token" "-t" "--debug" "--debug-http" "--enterprise" "-X" "--adapter" "--json" "--no-json");;
@@ -114,7 +112,7 @@ elif type compctl 1>/dev/null 2>/dev/null; then
114
112
  elif type complete 1>/dev/null 2>/dev/null; then
115
113
  complete -F _travis travis
116
114
  _travis() { _travis_complete "$COMP_CWORD" "${COMP_WORDS[1]}"; }
117
- _travis_commands() { COMPREPLY=( $(compgen -W "accounts branches cache cancel console disable enable encrypt encrypt-file endpoint env help history init lint login logout logs monitor open pubkey raw report repos requests restart settings setup show sshkey status sync token version whatsup whoami" -- "${COMP_WORDS[COMP_CWORD]}") ); }
115
+ _travis_commands() { COMPREPLY=( $(compgen -W "accounts branches cache cancel console disable enable encrypt encrypt-file endpoint env help history init lint login logout logs open pubkey raw report repos requests restart settings setup show sshkey status sync token version whatsup whoami" -- "${COMP_WORDS[COMP_CWORD]}") ); }
118
116
  _travis_setup() { COMPREPLY=( $(compgen -W "anynines appfog artifacts biicode cloudcontrol cloudfiles cloudfoundry cloud66 codedeploy deis divshot elasticbeanstalk engineyard gcs hackage heroku modulus npm ninefold nodejitsu openshift opsworks pypi releases rubygems s3 sauce_connect" -- "${COMP_WORDS[COMP_CWORD]}") ); }
119
117
  _travis_settings() { COMPREPLY=( $(compgen -W "builds_only_with_travis_yml build_pushes build_pull_requests maximum_number_of_builds auto_cancel_pushes auto_cancel_pull_requests" -- "${COMP_WORDS[COMP_CWORD]}") ); }
120
118
  _travis_init() { COMPREPLY=( $(compgen -W ""bash" "c" "clojure" "cpp" "elixir" "erlang" "go" "groovy" "haskell" "java" "node_js" "objective-c" "perl" "php" "python" "ruby" "scala"" -- "${COMP_WORDS[COMP_CWORD]}") ); }
@@ -139,7 +137,6 @@ elif type complete 1>/dev/null 2>/dev/null; then
139
137
  login) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --com --org --staging --token -t --debug --debug-http --enterprise -X --adapter --github-token -g --auto-token -T --auto-password -p --auto -a --user -u --no-manual -M --list-github-token --skip-token-check";;
140
138
  logout) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --com --org --staging --token -t --debug --debug-http --enterprise -X --adapter";;
141
139
  logs) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --com --org --staging --token -t --debug --debug-http --enterprise -X --adapter --repo -r --store-repo -R --delete -d --force -f --stream --no-stream";;
142
- monitor) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --com --org --staging --token -t --debug --debug-http --enterprise -X --adapter --my-repos -m --repo -r --notify --no-notify -n --builds -b --push -p --pull -P";;
143
140
  open) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --com --org --staging --token -t --debug --debug-http --enterprise -X --adapter --repo -r --store-repo -R --github -g --print -p";;
144
141
  pubkey) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --com --org --staging --token -t --debug --debug-http --enterprise -X --adapter --repo -r --store-repo -R --pem -p --fingerprint -f";;
145
142
  raw) options="--help -h --interactive --no-interactive -i --explode --no-explode -E --skip-version-check --skip-completion-check --api-endpoint -e --insecure --no-insecure -I --pro --com --org --staging --token -t --debug --debug-http --enterprise -X --adapter --json --no-json";;
data/examples/pro_auth.rb CHANGED
@@ -2,11 +2,11 @@ require 'travis/pro'
2
2
  require 'travis/tools/github'
3
3
  require 'highline/import' # so we can hide the password
4
4
 
5
+ github_token = ask("GitHub token: ")
6
+
5
7
  # Set up GitHub tool for doing the login handshake.
6
8
  github = Travis::Tools::Github.new(drop_token: true) do |g|
7
- g.ask_login = -> { ask("GitHub login: ") }
8
- g.ask_password = -> { ask("Password: ") { |q| q.echo = "*" } }
9
- g.ask_otp = -> { ask("Two-factor token: ") }
9
+ g.github_token = github_token
10
10
  end
11
11
 
12
12
  # Create temporary GitHub token and use it to authenticate against Travis CI.
@@ -16,7 +16,7 @@ end
16
16
 
17
17
  # Look up the current user.
18
18
  user = Travis::Pro::User.current
19
- puts "Hello #{user.name}!"
19
+ puts "Hello #{user.login}!"
20
20
 
21
21
  # Display repositories the user is a member of.
22
22
  repos = Travis::Pro::Repository.find_all(member: user.login)
@@ -10,10 +10,6 @@ module Travis
10
10
  description "authenticates against the API and stores the token"
11
11
  on('-g', '--github-token TOKEN', 'identify by GitHub token')
12
12
  on('-T', '--auto-token', 'try to figure out who you are automatically (might send another apps token to Travis, token will not be stored)')
13
- on('-p', '--auto-password', 'try to load password from OSX keychain (will not be stored)')
14
- on('-a', '--auto', 'shorthand for --auto-token --auto-password') { |c| c.auto_token = c.auto_password = true }
15
- on('-u', '--user LOGIN', 'user to log in as') { |c,n| c.user_login = n }
16
- on('-M', '--no-manual', 'do not use interactive login')
17
13
  on('--list-github-token', 'instead of actually logging in, list found GitHub tokens')
18
14
  on('--skip-token-check', 'don\'t verify the token with github')
19
15
 
@@ -55,17 +51,11 @@ module Travis
55
51
  load_gh
56
52
  Tools::Github.new(session.config['github']) do |g|
57
53
  g.note = "temporary token to identify with the travis command line client against #{api_endpoint}"
58
- g.manual_login = no_manual.nil?
59
54
  g.explode = explode?
60
55
  g.github_token = github_token
61
56
  g.auto_token = auto_token
62
- g.auto_password = auto_password
63
- g.github_login = user_login
64
57
  g.check_token = !skip_token_check?
65
58
  g.drop_token = !list_github_token
66
- g.ask_login = proc { ask("Username: ") }
67
- g.ask_password = proc { |user| ask("Password for #{user}: ") { |q| q.echo = "*" } }
68
- g.ask_otp = proc { |user| ask("Two-factor authentication code for #{user}: ") }
69
59
  g.login_header = proc { login_header }
70
60
  g.debug = proc { |log| debug(log) }
71
61
  g.after_tokens = proc { g.explode = true and error("no suitable github token found") }
@@ -74,12 +64,9 @@ module Travis
74
64
  end
75
65
 
76
66
  def login_header
77
- say "We need your #{color("GitHub login", :important)} to identify you."
78
- say "This information will #{color("not be sent to Travis CI", :important)}, only to #{color(github_endpoint.host, :info)}."
79
- say "The password will not be displayed."
80
- empty_line
81
- say "Try running with #{color("--github-token", :info)} or #{color("--auto", :info)} if you don't want to enter your password anyway."
82
- empty_line
67
+ say "GitHub deprecated its Authorizations API exchanging a password for a token."
68
+ say "Please visit https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations for more information."
69
+ say "Try running with #{color("--github-token", :info)} or #{color("--auto-token", :info)} ."
83
70
  end
84
71
  end
85
72
  end
@@ -6,6 +6,7 @@ module Travis
6
6
  class RepoCommand < ApiCommand
7
7
  GIT_REGEX = %r{/?(.*/.+?)(\.git)?$}
8
8
  TRAVIS = %r{^https://(staging-)?api\.travis-ci\.(org|com)}
9
+ on('-g', '--github-token TOKEN', 'identify by GitHub token')
9
10
  on('-r', '--repo SLUG', 'repository to use (will try to detect from current git clone)') do |c, slug|
10
11
  c.slug = slug
11
12
  c.error "SLUG should be of the form OWNER/REPO" unless slug.split('/').compact.size == 2
@@ -10,6 +10,10 @@ module Travis
10
10
  def run
11
11
  deploy 'releases' do |config|
12
12
  github.with_token { |t| config['api_key'] = t }
13
+ if config['api_key'].nil?
14
+ raise Travis::Client::GitHubLoginFailed, 'all GitHub tokens given were invalid'
15
+ end
16
+
13
17
  config['file'] = ask("File to Upload: ").to_s
14
18
  end
15
19
  end
@@ -19,9 +23,7 @@ module Travis
19
23
  load_gh
20
24
  Tools::Github.new(session.config['github']) do |g|
21
25
  g.drop_token = false
22
- g.ask_login = proc { ask("Username: ") }
23
- g.ask_password = proc { |user| ask("Password for #{user}: ") { |q| q.echo = "*" } }
24
- g.ask_otp = proc { |user| ask("Two-factor authentication code for #{user}: ") }
26
+ g.github_token = github_token
25
27
  g.debug = proc { |log| debug(log) }
26
28
  g.after_tokens = proc { g.explode = true and error("no suitable github token found") }
27
29
  g.scopes = org? ? ['public_repo'] : ['repo']
@@ -32,4 +34,4 @@ module Travis
32
34
  end
33
35
  end
34
36
  end
35
- end
37
+ end
@@ -13,6 +13,7 @@ module Travis
13
13
  on '-c', '--check', 'set exit code depending on key existing'
14
14
  on '-g', '--generate', 'generate SSH key and set up for given GitHub user'
15
15
  on '-p', '--passphrase PASSPHRASE', 'pass phrase to decrypt with when using --upload'
16
+ on '-g', '--github-token TOKEN', 'identify by GitHub token'
16
17
 
17
18
  def_delegators :repository, :ssh_key
18
19
 
@@ -51,27 +52,34 @@ module Travis
51
52
  end
52
53
 
53
54
  def generate_key
54
- github.with_basic_auth do |gh|
55
- login = gh['user']['login']
56
- check_access(gh)
57
- empty_line
55
+ access_token = nil
56
+ github.with_token do |token|
57
+ access_token = github_auth(token)
58
+ end
59
+ session.access_token = nil
60
+ unless access_token
61
+ raise Travis::Client::GitHubLoginFailed, "all GitHub tokens given were invalid"
62
+ end
63
+ gh = GH.with(token: github_token)
64
+ login = gh['user']['login']
65
+ check_access(gh)
66
+ empty_line
58
67
 
59
- say "Generating RSA key."
60
- private_key = Tools::SSLKey.generate_rsa
61
- self.description ||= "key for fetching dependencies for #{slug} via #{login}"
68
+ say "Generating RSA key."
69
+ private_key = Tools::SSLKey.generate_rsa
70
+ self.description ||= "key for fetching dependencies for #{slug} via #{login}"
62
71
 
63
- say "Uploading public key to GitHub."
64
- gh.post("/user/keys", :title => "#{description} (Travis CI)", :key => Tools::SSLKey.rsa_ssh(private_key.public_key))
72
+ say "Uploading public key to GitHub."
73
+ gh.post("/user/keys", :title => "#{description} (Travis CI)", :key => Tools::SSLKey.rsa_ssh(private_key.public_key))
65
74
 
66
- say "Uploading private key to Travis CI."
67
- ssh_key.update(:value => private_key.to_s, :description => description)
75
+ say "Uploading private key to Travis CI."
76
+ ssh_key.update(:value => private_key.to_s, :description => description)
68
77
 
69
- empty_line
70
- say "You can store the private key to reuse it for other repositories (travis sshkey --upload FILE)."
71
- if agree("Store private key? ") { |q| q.default = "no" }
72
- path = ask("Path: ") { |q| q.default = "id_travis_rsa" }
73
- File.write(path, private_key.to_s)
74
- end
78
+ empty_line
79
+ say "You can store the private key to reuse it for other repositories (travis sshkey --upload FILE)."
80
+ if agree("Store private key? ") { |q| q.default = "no" }
81
+ path = ask("Path: ") { |q| q.default = "id_travis_rsa" }
82
+ File.write(path, private_key.to_s)
75
83
  end
76
84
  end
77
85
 
@@ -97,9 +105,7 @@ module Travis
97
105
  Tools::Github.new(session.config['github']) do |g|
98
106
  g.note = "token for fetching dependencies for #{slug} (Travis CI)"
99
107
  g.explode = explode?
100
- g.ask_login = proc { ask("Username: ") }
101
- g.ask_password = proc { |user| ask("Password for #{user}: ") { |q| q.echo = "*" } }
102
- g.ask_otp = proc { |user| ask("Two-factor authentication code for #{user}: ") }
108
+ g.github_token = github_token
103
109
  g.login_header = proc { login_header }
104
110
  g.debug = proc { |log| debug(log) }
105
111
  g.after_tokens = proc { g.explode = true and error("no suitable github token found") }
@@ -108,10 +114,9 @@ module Travis
108
114
  end
109
115
 
110
116
  def login_header
111
- say "We need the #{color("GitHub login", :important)} for the account you want to add the key to."
112
- say "This information will #{color("not be sent to Travis CI", :important)}, only to #{color(github_endpoint.host, :info)}."
113
- say "The password will not be displayed."
114
- empty_line
117
+ say "GitHub deprecated its Authorizations API exchanging a password for a token."
118
+ say "Please visit https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations for more information."
119
+ say "Try running with #{color("--github-token", :info)} or #{color("--auto-token", :info)} ."
115
120
  end
116
121
  end
117
122
  end
@@ -24,7 +24,6 @@ module Travis
24
24
  def github
25
25
  @github ||= Tools::Github.new(session.config['github']) do |g|
26
26
  g.explode = true
27
- g.manual_login = false
28
27
  g.auto_token = @auto_token
29
28
  g.after_tokens = proc { raise NoTokenError, "no suitable github token found" } if @raise
30
29
  end
@@ -10,19 +10,15 @@ module Travis
10
10
  GITHUB_API = 'api.github.com'
11
11
  GITHUB_HOST = 'github.com'
12
12
 
13
- attr_accessor :api_url, :scopes, :github_token, :github_login, :drop_token, :callback, :explode, :after_tokens,
14
- :ask_login, :ask_password, :ask_otp, :login_header, :auto_token, :auto_password, :manual_login, :note,
15
- :netrc_path, :hub_path, :oauth_paths, :composer_path, :git_config_keys, :debug, :no_token, :check_token
13
+ attr_accessor :api_url, :scopes, :github_token, :drop_token, :callback, :explode, :after_tokens,
14
+ :login_header, :auto_token, :note,
15
+ :hub_path, :oauth_paths, :composer_path, :git_config_keys, :debug, :no_token, :check_token
16
16
 
17
17
  def initialize(options = nil)
18
18
  @check_token = true
19
- @manual_login = true
20
19
  @ask_login = proc { raise "ask_login callback not set" }
21
20
  @after_tokens = proc { }
22
- @ask_password = proc { |_| raise "ask_password callback not set" }
23
- @ask_otp = proc { |_| raise "ask_otp callback not set" }
24
21
  @debug = proc { |_| }
25
- @netrc_path = '~/.netrc'
26
22
  @hub_path = ENV['HUB_CONFIG'] || '~/.config/hub'
27
23
  @oauth_paths = ['~/.github-oauth-token']
28
24
  @composer_path = "~/.composer/config.json"
@@ -37,14 +33,6 @@ module Travis
37
33
  each_token { |t| break yield(t) }
38
34
  end
39
35
 
40
- def with_basic_auth(&block)
41
- user, password = ask_credentials
42
- basic_auth(user, password, true) do |gh, _|
43
- gh['user'] # so otp kicks in
44
- yield gh
45
- end
46
- end
47
-
48
36
  def each_token
49
37
  require 'gh' unless defined? GH
50
38
  possible_tokens { |t| yield(t) if acceptable?(t) }
@@ -61,7 +49,6 @@ module Travis
61
49
  return block[github_token] if github_token
62
50
 
63
51
  if auto_token
64
- netrc_tokens(&block)
65
52
  git_tokens(&block)
66
53
  hub_tokens(&block)
67
54
  oauth_file_tokens(&block)
@@ -70,41 +57,10 @@ module Travis
70
57
  composer_token(&block)
71
58
  end
72
59
 
73
- if auto_password
74
- possible_logins do |user, password|
75
- yield login(user, password, false)
76
- end
77
- end
78
-
79
- if manual_login
80
- user, password = ask_credentials
81
- yield login(user, password, true)
82
- end
83
-
84
- after_tokens.call
85
- end
86
-
87
- def ask_credentials
88
- login_header.call if login_header
89
- user = github_login || ask_login.call
90
- password = ask_password.arity == 0 ? ask_password.call : ask_password.call(user)
91
- [user, password]
92
- end
93
-
94
- def possible_logins(&block)
95
- netrc_logins(&block)
96
- hub_logins(&block)
97
- keychain_login(&block)
98
- end
99
-
100
- def netrc_tokens
101
- netrc.each do |entry|
102
- next unless entry["machine"] == api_host or entry["machine"] == host
103
- entry.values_at("token", "login", "password").each do |entry|
104
- next if entry.to_s.size != TOKEN_SIZE
105
- debug "found oauth token in netrc"
106
- yield entry
107
- end
60
+ if github_token || auto_token
61
+ after_tokens.call
62
+ elsif login_header
63
+ login_header.call
108
64
  end
109
65
  end
110
66
 
@@ -127,7 +83,6 @@ module Travis
127
83
 
128
84
  def hub_tokens
129
85
  hub.fetch(host, []).each do |entry|
130
- next if github_login and github_login != entry["user"]
131
86
  yield entry["oauth_token"] if entry["oauth_token"]
132
87
  end
133
88
  end
@@ -141,45 +96,6 @@ module Travis
141
96
  end
142
97
  end
143
98
 
144
- def netrc_logins
145
- netrc.each do |entry|
146
- next unless entry["machine"] == api_host or entry["machine"] == host
147
- next if github_login and github_login != entry["login"]
148
- yield entry["login"], entry["password"] if entry["login"] and entry["password"]
149
- end
150
- end
151
-
152
- def hub_logins
153
- hub.fetch(host, []).each do |entry|
154
- next if github_login and github_login != entry["user"]
155
- yield entry["user"], entry["password"] if entry["user"] and entry["password"]
156
- end
157
- end
158
-
159
- def keychain_login
160
- if github_login
161
- security(:internet, :w, "-s #{host} -a #{github_login}", "#{host} password for #{github_login}") do |password|
162
- yield github_login, password if password and not password.empty?
163
- end
164
- else
165
- security(:internet, :g, "-s #{host}", "#{host} login and password") do |data|
166
- username = data[/^\s+"acct"<blob>="(.*)"$/, 1].to_s
167
- password = data[/^password: "(.*)"$/, 1].to_s
168
- yield username, password unless username.empty? or password.empty?
169
- end
170
- end
171
- end
172
-
173
- def netrc
174
- file(netrc_path, []) do |contents|
175
- contents.scan(/^\s*(\S+)\s+(\S+)\s*$/).inject([]) do |mapping, (key, value)|
176
- mapping << {} if key == "machine"
177
- mapping.last[key] = value if mapping.last
178
- mapping
179
- end
180
- end
181
- end
182
-
183
99
  def hub
184
100
  file(hub_path, {}) do |contents|
185
101
  YAML.load(contents)
@@ -192,7 +108,6 @@ module Travis
192
108
 
193
109
  def github_for_mac_token(&block)
194
110
  command = '-s "github.com/mac"'
195
- command << " -a #{github_login}" if github_login
196
111
  security(:internet, :w, command, "GitHub for Mac token", &block) if host == 'github.com'
197
112
  end
198
113
 
@@ -205,52 +120,12 @@ module Travis
205
120
  api_url[%r{^(?:https?://)?([^/]+)}, 1]
206
121
  end
207
122
 
208
- def basic_auth(user, password, die = true, otp = nil, &block)
209
- gh = GH.with(:username => user, :password => password)
210
- with_otp(gh, user, otp, &block)
211
- rescue GH::Error => error
212
- raise gh_error(error) if die
213
- end
214
-
215
- def login(user, password, die = true, otp = nil)
216
- basic_auth(user, password, die, otp) do |gh, new_otp|
217
- reply = create_token(gh)
218
- auth_href = reply['_links']['self']['href']
219
- self.callback = proc { with_otp(gh, user, new_otp) { |g| g.delete(auth_href) } } if drop_token
220
- reply['token']
221
- end
222
- end
223
-
224
- def create_token(gh)
225
- gh.post('/authorizations', :scopes => scopes, :note => note)
226
- rescue GH::Error => error
227
- # token might already exist due to bug in earlier CLI version, we'll have to delete it first
228
- raise error unless error.info[:response_status] == 422 and error.info[:response_body].to_s =~ /already_exists/
229
- raise error unless reply = gh['/authorizations'].detect { |a| a['note'] == note }
230
- gh.delete(reply['_links']['self']['href'])
231
- retry
232
- end
233
-
234
- def with_otp(gh, user, otp, &block)
235
- gh = GH.with(gh.options.merge(:headers => { "X-GitHub-OTP" => otp })) if otp
236
- block.call(gh, otp)
237
- rescue GH::Error => error
238
- raise error unless error.info[:response_status] == 401 and error.info[:response_headers]['x-github-otp'].to_s =~ /required/
239
- otp = ask_otp.arity == 0 ? ask_otp.call : ask_otp.call(user)
240
- retry
241
- end
242
-
243
123
  def acceptable?(token)
244
124
  return true unless check_token
245
125
  gh = GH.with(:token => token)
246
126
  user = gh['user']
247
127
 
248
- if github_login and github_login != user['login']
249
- debug "token is not acceptable: identifies %p instead of %p" % [user['login'], github_login]
250
- false
251
- else
252
- true
253
- end
128
+ true
254
129
  rescue GH::Error => error
255
130
  debug "token is not acceptable: #{gh_error(error)}"
256
131
  false
@@ -1,3 +1,3 @@
1
1
  module Travis
2
- VERSION = '1.10.0'
2
+ VERSION = '1.11.0'
3
3
  end
data/travis.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  # general info
4
4
  s.name = "travis"
5
- s.version = "1.10.0"
5
+ s.version = "1.11.0"
6
6
  s.required_ruby_version = ">= 2.3.0"
7
7
  s.description = "CLI and Ruby client library for Travis CI"
8
8
  s.homepage = "https://github.com/travis-ci/travis.rb"
@@ -12,24 +12,34 @@ Gem::Specification.new do |s|
12
12
 
13
13
  # generated from git shortlog -sn
14
14
  s.authors = [
15
- "Hiro Asari",
16
15
  "Konstantin Haase",
16
+ "Hiro Asari",
17
+ "Henrik Hodne",
18
+ "joshua-anderson",
19
+ "Aaron Hill",
17
20
  "Piotr Milcarz",
18
21
  "Buck Doyle",
22
+ "Peter Souter",
19
23
  "Christopher Grim",
20
24
  "Joe Corcoran",
25
+ "Peter van Dijk",
21
26
  "Sven Fuchs",
22
27
  "Aakriti Gupta",
23
28
  "Josh Kalderimis",
24
- "Ke Zhu",
25
29
  "Piotr Sarnacki",
30
+ "Ke Zhu",
31
+ "Max Barnash",
26
32
  "Ren\xC3\xA9e Hendricksen",
27
33
  "carlad",
34
+ "Carlos Palhares",
35
+ "Dan Buch",
28
36
  "Mar\xC3\xADa de Ant\xC3\xB3n",
37
+ "Mathias Meyer",
29
38
  "Matt Toothman",
30
39
  "mariadeanton",
31
40
  "techgaun",
32
41
  "Alpha",
42
+ "Andreas Tiefenthaler",
33
43
  "Beau Bouchard",
34
44
  "Corinna Wiesner",
35
45
  "David Rodr\xC3\xADguez",
@@ -39,39 +49,54 @@ Gem::Specification.new do |s|
39
49
  "Ivan Pozdeev",
40
50
  "Joep van Delft",
41
51
  "Stefan Nordhausen",
52
+ "Thais Camilo and Konstantin Haase",
42
53
  "Tobias Bieniek",
43
- "xflotus",
44
54
  "Adam Baxter",
55
+ "Adam Lavin",
56
+ "Adrien Brault",
45
57
  "Alfie John",
46
58
  "Alo\xC3\xAFs Th\xC3\xA9venot",
47
- "Andreas Tiefenthaler",
48
59
  "Basarat Ali Syed",
60
+ "Benjamin Manns",
49
61
  "Christian H\xC3\xB6ltje",
50
62
  "Dani Hodovic",
63
+ "Daniel Chatfield",
51
64
  "Dominic Jodoin",
52
65
  "Eli Schwartz",
66
+ "Eric Herot",
53
67
  "Eugene K",
54
- "Greg Jones",
68
+ "George Millo",
55
69
  "Gunter Grodotzki",
56
70
  "Harald Nordgren",
57
71
  "HaraldNordgren",
58
72
  "Igor",
59
73
  "Iulian Onofrei",
60
74
  "Jacob Atzen",
75
+ "Jacob Burkhart",
61
76
  "James Nylen",
62
77
  "Joe Rafaniello",
63
78
  "Jon-Erik Schneiderhan",
64
79
  "Jonas Chromik",
80
+ "Jonne Ha\xC3\x9F",
81
+ "Julia S.Simon",
82
+ "Justin Lambert",
83
+ "Laurent Petit",
84
+ "Maarten van Vliet",
65
85
  "Marco Craveiro",
66
- "Marek Marczykowski-G\xC3\xB3recki",
86
+ "Mario Visic",
67
87
  "Matt",
68
88
  "Matteo Sumberaz",
69
89
  "Matthias Bussonnier",
90
+ "Michael Mior",
70
91
  "Michael S. Fischer",
92
+ "Miro Hron\xC4\x8Dok",
93
+ "Neamar",
71
94
  "Nero Leung",
95
+ "Nicolas Bessi (nbessi)",
72
96
  "Nikhil Owalekar",
73
97
  "Peter Bengtsson",
74
98
  "Peter Drake",
99
+ "Rapha\xC3\xABl Pinson",
75
100
  "Rob Hoelz",
76
101
  "Robert Grider",
77
102
  "Robert Van Voorhees",
@@ -79,31 +104,47 @@ Gem::Specification.new do |s|
79
104
  "Tahsin Hasan",
80
105
  "Titus",
81
106
  "Titus Wormer",
107
+ "Tobias Wilken",
108
+ "Zachary Gershman",
109
+ "Zachary Scott",
82
110
  "designerror",
83
111
  "ia",
112
+ "jeffdh",
113
+ "john muhl",
84
114
  "slewt"
85
115
  ]
86
116
 
87
117
  # generated from git shortlog -sne
88
118
  s.email = [
89
- "asari.ruby@gmail.com",
90
119
  "konstantin.mailinglists@googlemail.com",
120
+ "asari.ruby@gmail.com",
121
+ "j@zatigo.com",
122
+ "aa1ronham@gmail.com",
91
123
  "piotrm@travis-ci.org",
124
+ "me@henrikhodne.com",
92
125
  "b@chromatin.ca",
126
+ "henrik@hodne.io",
127
+ "p.morsou@gmail.com",
93
128
  "chrisg@luminal.io",
94
129
  "joe@corcoran.io",
130
+ "peter.van.dijk@netherlabs.nl",
95
131
  "me@svenfuchs.com",
96
132
  "josh.kalderimis@gmail.com",
97
- "kzhu@us.ibm.com",
98
133
  "drogus@gmail.com",
134
+ "kzhu@us.ibm.com",
135
+ "i.am@anhero.ru",
99
136
  "renee@travis-ci.org",
100
137
  "aakritigupta@users.noreply.github.com",
138
+ "me@xjunior.me",
139
+ "dan@meatballhat.com",
101
140
  "mariadeanton@gmail.com",
141
+ "meyer@paperplanes.de",
102
142
  "matt.toothman@aver.io",
103
143
  "carlad@users.noreply.github.com",
104
144
  "coolsamar207@gmail.com",
105
145
  "aakriti@travis-ci.org",
106
146
  "AlphaWong@users.noreply.github.com",
147
+ "at@an-ti.eu",
107
148
  "127320+BeauBouchard@users.noreply.github.com",
108
149
  "wiesner@avarteq.de",
109
150
  "deivid.rodriguez@gmail.com",
@@ -112,49 +153,69 @@ Gem::Specification.new do |s|
112
153
  "igor@travis-ci.org",
113
154
  "vano@mail.mipt.ru",
114
155
  "stefan.nordhausen@immobilienscout24.de",
156
+ "dev+narwen+rkh@rkh.im",
115
157
  "tobias.bieniek@gmail.com",
116
- "0xflotus@gmail.com",
117
158
  "github@voltagex.org",
159
+ "adam@lavoaster.co.uk",
160
+ "adrien.brault@gmail.com",
118
161
  "33c6c91f3bb4a391082e8a29642cafaf@alfie.wtf",
119
162
  "aloisthevenot@srxp.com",
120
- "at@an-ti.eu",
121
163
  "basaratali@gmail.com",
164
+ "benmanns@gmail.com",
122
165
  "docwhat@gerf.org",
123
166
  "danihodovic@users.noreply.github.com",
167
+ "chatfielddaniel@gmail.com",
124
168
  "dominic@travis-ci.com",
125
169
  "eschwartz@archlinux.org",
170
+ "eric.github@herot.com",
126
171
  "34233075+eugene-kulak@users.noreply.github.com",
127
- "greg.jones@gmail.com",
172
+ "georgejulianmillo@gmail.com",
128
173
  "gunter@grodotzki.co.za",
129
174
  "haraldnordgren@gmail.com",
130
175
  "igorwwwwwwwwwwwwwwwwwwww@users.noreply.github.com",
131
176
  "6d0847b9@opayq.com",
132
177
  "jatzen@gmail.com",
178
+ "jburkhart@engineyard.com",
133
179
  "jnylen@gmail.com",
134
180
  "jrafanie@users.noreply.github.com",
135
181
  "joep@travis-ci.org",
136
182
  "joepvd@users.noreply.github.com",
137
183
  "jon-erik.schneiderhan@meyouhealth.com",
138
184
  "Jonas.Chromik@student.hpi.uni-potsdam.de",
185
+ "me@jhass.eu",
186
+ "julia.simon@biicode.com",
187
+ "jlambert@eml.cc",
188
+ "laurent.petit@gmail.com",
189
+ "maartenvanvliet@gmail.com",
139
190
  "marco.craveiro@gmail.com",
140
- "marmarek@invisiblethingslab.com",
191
+ "mario@mariovisic.com",
141
192
  "mtoothman@users.noreply.github.com",
142
193
  "gnappoms@gmail.com",
143
194
  "bussonniermatthias@gmail.com",
195
+ "mmior@uwaterloo.ca",
144
196
  "mfischer@zendesk.com",
197
+ "miro@hroncok.cz",
198
+ "neamar@neamar.fr",
145
199
  "neroleung@gmail.com",
200
+ "nbessi@users.noreply.github.com",
146
201
  "nowalekar@tigetext.com",
147
202
  "peterbe@mozilla.com",
148
203
  "peter.drake@acquia.com",
204
+ "raphael.pinson@camptocamp.com",
149
205
  "rob@hoelz.ro",
150
206
  "robert.grider@northwestern.edu",
151
207
  "rcvanvo@gmail.com",
152
208
  "simon.cropp@gmail.com",
153
209
  "51903216+Tahsin-travis-ci@users.noreply.github.com",
154
210
  "tituswormer@gmail.com",
211
+ "tw@cloudcontrol.de",
212
+ "pair+zg@pivotallabs.com",
213
+ "e@zzak.io",
155
214
  "carla@travis-ci.org",
156
215
  "designerror@yandex.ru",
157
216
  "isaac.ardis@gmail.com",
217
+ "jeffdh@gmail.com",
218
+ "git@johnmuhl.com",
158
219
  "leland@lcweathers.net"
159
220
  ]
160
221
 
@@ -315,7 +376,6 @@ Gem::Specification.new do |s|
315
376
  "spec/cli/help_spec.rb",
316
377
  "spec/cli/history_spec.rb",
317
378
  "spec/cli/init_spec.rb",
318
- "spec/cli/login_spec.rb",
319
379
  "spec/cli/logs_spec.rb",
320
380
  "spec/cli/open_spec.rb",
321
381
  "spec/cli/repo_command_spec.rb",
metadata CHANGED
@@ -1,27 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1.travis.1341.9
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
- - Hiro Asari
8
7
  - Konstantin Haase
8
+ - Hiro Asari
9
+ - Henrik Hodne
10
+ - joshua-anderson
11
+ - Aaron Hill
9
12
  - Piotr Milcarz
10
13
  - Buck Doyle
14
+ - Peter Souter
11
15
  - Christopher Grim
12
16
  - Joe Corcoran
17
+ - Peter van Dijk
13
18
  - Sven Fuchs
14
19
  - Aakriti Gupta
15
20
  - Josh Kalderimis
16
- - Ke Zhu
17
21
  - Piotr Sarnacki
22
+ - Ke Zhu
23
+ - Max Barnash
18
24
  - Renée Hendricksen
19
25
  - carlad
26
+ - Carlos Palhares
27
+ - Dan Buch
20
28
  - María de Antón
29
+ - Mathias Meyer
21
30
  - Matt Toothman
22
31
  - mariadeanton
23
32
  - techgaun
24
33
  - Alpha
34
+ - Andreas Tiefenthaler
25
35
  - Beau Bouchard
26
36
  - Corinna Wiesner
27
37
  - David Rodríguez
@@ -31,39 +41,54 @@ authors:
31
41
  - Ivan Pozdeev
32
42
  - Joep van Delft
33
43
  - Stefan Nordhausen
44
+ - Thais Camilo and Konstantin Haase
34
45
  - Tobias Bieniek
35
- - xflotus
36
46
  - Adam Baxter
47
+ - Adam Lavin
48
+ - Adrien Brault
37
49
  - Alfie John
38
50
  - Aloïs Thévenot
39
- - Andreas Tiefenthaler
40
51
  - Basarat Ali Syed
52
+ - Benjamin Manns
41
53
  - Christian Höltje
42
54
  - Dani Hodovic
55
+ - Daniel Chatfield
43
56
  - Dominic Jodoin
44
57
  - Eli Schwartz
58
+ - Eric Herot
45
59
  - Eugene K
46
- - Greg Jones
60
+ - George Millo
47
61
  - Gunter Grodotzki
48
62
  - Harald Nordgren
49
63
  - HaraldNordgren
50
64
  - Igor
51
65
  - Iulian Onofrei
52
66
  - Jacob Atzen
67
+ - Jacob Burkhart
53
68
  - James Nylen
54
69
  - Joe Rafaniello
55
70
  - Jon-Erik Schneiderhan
56
71
  - Jonas Chromik
72
+ - Jonne Haß
73
+ - Julia S.Simon
74
+ - Justin Lambert
75
+ - Laurent Petit
76
+ - Maarten van Vliet
57
77
  - Marco Craveiro
58
- - Marek Marczykowski-Górecki
78
+ - Mario Visic
59
79
  - Matt
60
80
  - Matteo Sumberaz
61
81
  - Matthias Bussonnier
82
+ - Michael Mior
62
83
  - Michael S. Fischer
84
+ - Miro Hrončok
85
+ - Neamar
63
86
  - Nero Leung
87
+ - Nicolas Bessi (nbessi)
64
88
  - Nikhil Owalekar
65
89
  - Peter Bengtsson
66
90
  - Peter Drake
91
+ - Raphaël Pinson
67
92
  - Rob Hoelz
68
93
  - Robert Grider
69
94
  - Robert Van Voorhees
@@ -71,13 +96,18 @@ authors:
71
96
  - Tahsin Hasan
72
97
  - Titus
73
98
  - Titus Wormer
99
+ - Tobias Wilken
100
+ - Zachary Gershman
101
+ - Zachary Scott
74
102
  - designerror
75
103
  - ia
104
+ - jeffdh
105
+ - john muhl
76
106
  - slewt
77
- autorequire:
107
+ autorequire:
78
108
  bindir: bin
79
109
  cert_chain: []
80
- date: 2021-01-04 00:00:00.000000000 Z
110
+ date: 2022-01-03 00:00:00.000000000 Z
81
111
  dependencies:
82
112
  - !ruby/object:Gem::Dependency
83
113
  name: faraday
@@ -241,24 +271,35 @@ dependencies:
241
271
  version: '0.6'
242
272
  description: CLI and Ruby client library for Travis CI
243
273
  email:
244
- - asari.ruby@gmail.com
245
274
  - konstantin.mailinglists@googlemail.com
275
+ - asari.ruby@gmail.com
276
+ - j@zatigo.com
277
+ - aa1ronham@gmail.com
246
278
  - piotrm@travis-ci.org
279
+ - me@henrikhodne.com
247
280
  - b@chromatin.ca
281
+ - henrik@hodne.io
282
+ - p.morsou@gmail.com
248
283
  - chrisg@luminal.io
249
284
  - joe@corcoran.io
285
+ - peter.van.dijk@netherlabs.nl
250
286
  - me@svenfuchs.com
251
287
  - josh.kalderimis@gmail.com
252
- - kzhu@us.ibm.com
253
288
  - drogus@gmail.com
289
+ - kzhu@us.ibm.com
290
+ - i.am@anhero.ru
254
291
  - renee@travis-ci.org
255
292
  - aakritigupta@users.noreply.github.com
293
+ - me@xjunior.me
294
+ - dan@meatballhat.com
256
295
  - mariadeanton@gmail.com
296
+ - meyer@paperplanes.de
257
297
  - matt.toothman@aver.io
258
298
  - carlad@users.noreply.github.com
259
299
  - coolsamar207@gmail.com
260
300
  - aakriti@travis-ci.org
261
301
  - AlphaWong@users.noreply.github.com
302
+ - at@an-ti.eu
262
303
  - 127320+BeauBouchard@users.noreply.github.com
263
304
  - wiesner@avarteq.de
264
305
  - deivid.rodriguez@gmail.com
@@ -267,49 +308,69 @@ email:
267
308
  - igor@travis-ci.org
268
309
  - vano@mail.mipt.ru
269
310
  - stefan.nordhausen@immobilienscout24.de
311
+ - dev+narwen+rkh@rkh.im
270
312
  - tobias.bieniek@gmail.com
271
- - 0xflotus@gmail.com
272
313
  - github@voltagex.org
314
+ - adam@lavoaster.co.uk
315
+ - adrien.brault@gmail.com
273
316
  - 33c6c91f3bb4a391082e8a29642cafaf@alfie.wtf
274
317
  - aloisthevenot@srxp.com
275
- - at@an-ti.eu
276
318
  - basaratali@gmail.com
319
+ - benmanns@gmail.com
277
320
  - docwhat@gerf.org
278
321
  - danihodovic@users.noreply.github.com
322
+ - chatfielddaniel@gmail.com
279
323
  - dominic@travis-ci.com
280
324
  - eschwartz@archlinux.org
325
+ - eric.github@herot.com
281
326
  - 34233075+eugene-kulak@users.noreply.github.com
282
- - greg.jones@gmail.com
327
+ - georgejulianmillo@gmail.com
283
328
  - gunter@grodotzki.co.za
284
329
  - haraldnordgren@gmail.com
285
330
  - igorwwwwwwwwwwwwwwwwwwww@users.noreply.github.com
286
331
  - 6d0847b9@opayq.com
287
332
  - jatzen@gmail.com
333
+ - jburkhart@engineyard.com
288
334
  - jnylen@gmail.com
289
335
  - jrafanie@users.noreply.github.com
290
336
  - joep@travis-ci.org
291
337
  - joepvd@users.noreply.github.com
292
338
  - jon-erik.schneiderhan@meyouhealth.com
293
339
  - Jonas.Chromik@student.hpi.uni-potsdam.de
340
+ - me@jhass.eu
341
+ - julia.simon@biicode.com
342
+ - jlambert@eml.cc
343
+ - laurent.petit@gmail.com
344
+ - maartenvanvliet@gmail.com
294
345
  - marco.craveiro@gmail.com
295
- - marmarek@invisiblethingslab.com
346
+ - mario@mariovisic.com
296
347
  - mtoothman@users.noreply.github.com
297
348
  - gnappoms@gmail.com
298
349
  - bussonniermatthias@gmail.com
350
+ - mmior@uwaterloo.ca
299
351
  - mfischer@zendesk.com
352
+ - miro@hroncok.cz
353
+ - neamar@neamar.fr
300
354
  - neroleung@gmail.com
355
+ - nbessi@users.noreply.github.com
301
356
  - nowalekar@tigetext.com
302
357
  - peterbe@mozilla.com
303
358
  - peter.drake@acquia.com
359
+ - raphael.pinson@camptocamp.com
304
360
  - rob@hoelz.ro
305
361
  - robert.grider@northwestern.edu
306
362
  - rcvanvo@gmail.com
307
363
  - simon.cropp@gmail.com
308
364
  - 51903216+Tahsin-travis-ci@users.noreply.github.com
309
365
  - tituswormer@gmail.com
366
+ - tw@cloudcontrol.de
367
+ - pair+zg@pivotallabs.com
368
+ - e@zzak.io
310
369
  - carla@travis-ci.org
311
370
  - designerror@yandex.ru
312
371
  - isaac.ardis@gmail.com
372
+ - jeffdh@gmail.com
373
+ - git@johnmuhl.com
313
374
  - leland@lcweathers.net
314
375
  executables:
315
376
  - travis
@@ -471,7 +532,6 @@ files:
471
532
  - spec/cli/help_spec.rb
472
533
  - spec/cli/history_spec.rb
473
534
  - spec/cli/init_spec.rb
474
- - spec/cli/login_spec.rb
475
535
  - spec/cli/logs_spec.rb
476
536
  - spec/cli/open_spec.rb
477
537
  - spec/cli/repo_command_spec.rb
@@ -507,7 +567,7 @@ homepage: https://github.com/travis-ci/travis.rb
507
567
  licenses:
508
568
  - MIT
509
569
  metadata: {}
510
- post_install_message:
570
+ post_install_message:
511
571
  rdoc_options: []
512
572
  require_paths:
513
573
  - lib
@@ -518,12 +578,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
518
578
  version: 2.3.0
519
579
  required_rubygems_version: !ruby/object:Gem::Requirement
520
580
  requirements:
521
- - - ">"
581
+ - - ">="
522
582
  - !ruby/object:Gem::Version
523
- version: 1.3.1
583
+ version: '0'
524
584
  requirements: []
525
- rubygems_version: 3.0.8
526
- signing_key:
585
+ rubygems_version: 3.2.15
586
+ signing_key:
527
587
  specification_version: 4
528
588
  summary: Travis CI client
529
589
  test_files: []
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Travis::CLI::Login do
4
- example "travis login", :unless => Travis::Tools::System.windows? do
5
- run_cli('login', '-E', '--skip-token-check') { |i| i.puts('rkh', 'password') }.should be_success
6
- run_cli('whoami').out.should be == "rkh\n"
7
- end
8
-
9
- example "travis login (with bad credentials)", :unless => Travis::Tools::System.windows? do
10
- run_cli('login') { |i| i.puts('rkh', 'wrong password') }.should_not be_success
11
- run_cli('whoami').should_not be_success
12
- end
13
- end