travis 1.5.9.travis.360.4 → 1.5.9.travis.361.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +92 -1
- data/assets/travis.sh +9 -3
- data/lib/travis/cli.rb +1 -0
- data/lib/travis/cli/cache.rb +76 -0
- data/lib/travis/cli/command.rb +4 -0
- data/lib/travis/cli/report.rb +101 -0
- data/lib/travis/client.rb +1 -0
- data/lib/travis/client/cache.rb +25 -0
- data/lib/travis/client/entity.rb +6 -1
- data/lib/travis/client/repository.rb +8 -0
- data/lib/travis/client/session.rb +11 -2
- data/lib/travis/client/weak_entity.rb +32 -0
- data/lib/travis/tools/formatter.rb +12 -0
- data/travis.gemspec +4 -0
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
YTM3ZGUxYTZiNWEzNTE3YWU1ODZkMGEyNTY1ZTUzOWY5NWI3ZjE4OA==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
MjgxNmY1ODE0N2Q3ZWEzMGNiNmZlNjliNzVjOWRlZjRiMmI0YjA0MA==
|
|
7
7
|
!binary "U0hBNTEy":
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
ZjVlNmY4NWFlNzc5YWE4NTVjYTZjYzQ0ZDQ1Y2Y2Yzc0NGNjY2U1MDgyYjUx
|
|
10
|
+
MTY2YTg5NWZjNzdhNWJhYzc0NDA5ZjdlN2I2ZTAzNTBlZmZiZDYwM2U4N2Yw
|
|
11
|
+
Zjc4Yjk2OTlhYTIyODU4ZTE3ZTQ0M2UwNzFiOTIyZDA0NTQ0ODU=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
NDk5YzYxZGZkYzM5Y2Y5ZGZhYTM4ZmQ2YjNhNmFhOGNiZWI2NjQxM2ZiYjZk
|
|
14
|
+
NThhOTBlMTc3YjAwYWM5MmQ1NTZhNzY0YTcwMjY0ODNiMGVkM2ZjYjU0Zjc0
|
|
15
|
+
MmQ2ZWI2ZGRiNzQ4MWQ5NTI2NDFmY2MyMDJlMGJlYzg2ZDBiYTk=
|
data/README.md
CHANGED
|
@@ -24,6 +24,7 @@ The [travis gem](https://rubygems.org/gems/travis) includes both a [command line
|
|
|
24
24
|
* [`whoami`](#whoami)
|
|
25
25
|
* [Repository Commands](#repository-commands)
|
|
26
26
|
* [`branches`](#branches)
|
|
27
|
+
* [`cache`](#cache)
|
|
27
28
|
* [`cancel`](#cancel)
|
|
28
29
|
* [`disable`](#disable)
|
|
29
30
|
* [`enable`](#enable)
|
|
@@ -389,12 +390,16 @@ Again, like most other commands, goes well with shell scripting:
|
|
|
389
390
|
-h, --help Display help
|
|
390
391
|
-i, --[no-]interactive be interactive and colorful
|
|
391
392
|
-E, --[no-]explode don't rescue exceptions
|
|
393
|
+
--skip-version-check don't check if travis client is up to date
|
|
394
|
+
--skip-completion-check don't check if auto-completion is set up
|
|
392
395
|
-e, --api-endpoint URL Travis API server to talk to
|
|
396
|
+
-I, --[no-]insecure do not verify SSL certificate of API endpoint
|
|
393
397
|
--pro short-cut for --api-endpoint 'https://api.travis-ci.com/'
|
|
394
398
|
--org short-cut for --api-endpoint 'https://api.travis-ci.org/'
|
|
395
399
|
-t, --token [ACCESS_TOKEN] access token to use
|
|
396
400
|
--debug show API requests
|
|
397
|
-
-
|
|
401
|
+
-X, --enterprise [NAME] use enterprise setup (optionally takes name for multiple setups)
|
|
402
|
+
-r, --repo SLUG repository to use (will try to detect from current git clone)
|
|
398
403
|
|
|
399
404
|
Repository commands have all the options [General API Commands](#general-api-commands) have.
|
|
400
405
|
|
|
@@ -419,6 +424,68 @@ Displays the most recent build for each branch:
|
|
|
419
424
|
|
|
420
425
|
For more fine grained control and older builds on a specific branch, see [`history`](#history).
|
|
421
426
|
|
|
427
|
+
#### `cache`
|
|
428
|
+
|
|
429
|
+
Lists or deletes repository caches.
|
|
430
|
+
Usage: travis cache [options]
|
|
431
|
+
-h, --help Display help
|
|
432
|
+
-i, --[no-]interactive be interactive and colorful
|
|
433
|
+
-E, --[no-]explode don't rescue exceptions
|
|
434
|
+
--skip-version-check don't check if travis client is up to date
|
|
435
|
+
--skip-completion-check don't check if auto-completion is set up
|
|
436
|
+
-e, --api-endpoint URL Travis API server to talk to
|
|
437
|
+
-I, --[no-]insecure do not verify SSL certificate of API endpoint
|
|
438
|
+
--pro short-cut for --api-endpoint 'https://api.travis-ci.com/'
|
|
439
|
+
--org short-cut for --api-endpoint 'https://api.travis-ci.org/'
|
|
440
|
+
-t, --token [ACCESS_TOKEN] access token to use
|
|
441
|
+
--debug show API requests
|
|
442
|
+
-X, --enterprise [NAME] use enterprise setup (optionally takes name for multiple setups)
|
|
443
|
+
-r, --repo SLUG repository to use (will try to detect from current git clone)
|
|
444
|
+
-d, --delete delete listed caches
|
|
445
|
+
-b, --branch BRANCH only list/delete caches on given branch
|
|
446
|
+
-m, --match STRING only list/delete caches where slug matches given string
|
|
447
|
+
-f, --force do not ask user to confirm deleting the caches
|
|
448
|
+
|
|
449
|
+
Lists or deletes [directory caches](http://about.travis-ci.org/docs/user/caching/) for a repository:
|
|
450
|
+
|
|
451
|
+
$ travis cache
|
|
452
|
+
On branch master:
|
|
453
|
+
cache--rvm-2.0.0--gemfile-Gemfile last modified: 2013-11-04 13:45:44 size: 62.21 MiB
|
|
454
|
+
cache--rvm-ruby-head--gemfile-Gemfile last modified: 2013-11-04 13:46:55 size: 62.65 MiB
|
|
455
|
+
|
|
456
|
+
On branch example:
|
|
457
|
+
cache--rvm-2.0.0--gemfile-Gemfile last modified: 2013-11-04 13:45:44 size: 62.21 MiB
|
|
458
|
+
|
|
459
|
+
Overall size of above caches: 187.07 MiB
|
|
460
|
+
|
|
461
|
+
You can filter by branch:
|
|
462
|
+
|
|
463
|
+
$ travis cache --branch master
|
|
464
|
+
On branch master:
|
|
465
|
+
cache--rvm-2.0.0--gemfile-Gemfile last modified: 2013-11-04 13:45:44 size: 62.21 MiB
|
|
466
|
+
cache--rvm-ruby-head--gemfile-Gemfile last modified: 2013-11-04 13:46:55 size: 62.65 MiB
|
|
467
|
+
|
|
468
|
+
Overall size of above caches: 124.86 MiB
|
|
469
|
+
|
|
470
|
+
And by matching against the slug:
|
|
471
|
+
|
|
472
|
+
$ travis cache --match 2.0.0
|
|
473
|
+
On branch master:
|
|
474
|
+
cache--rvm-2.0.0--gemfile-Gemfile last modified: 2013-11-04 13:45:44 size: 62.21 MiB
|
|
475
|
+
|
|
476
|
+
Overall size of above caches: 62.21 MiB
|
|
477
|
+
|
|
478
|
+
You can also use this command to delete caches:
|
|
479
|
+
|
|
480
|
+
$ travis cache -b example -m 2.0.0 --delete
|
|
481
|
+
DANGER ZONE: Do you really want to delete all caches on branch example that match 2.0.0? |no| yes
|
|
482
|
+
Deleted the following caches:
|
|
483
|
+
|
|
484
|
+
On branch example:
|
|
485
|
+
cache--rvm-2.0.0--gemfile-Gemfile last modified: 2013-11-04 13:45:44 size: 62.21 MiB
|
|
486
|
+
|
|
487
|
+
Overall size of above caches: 62.21 MiB
|
|
488
|
+
|
|
422
489
|
#### `cancel`
|
|
423
490
|
|
|
424
491
|
This command will cancel the latest build:
|
|
@@ -1169,6 +1236,28 @@ commit = repo.last_build.commit
|
|
|
1169
1236
|
puts "Last tested commit: #{commit.short_sha} on #{commit.branch} by #{commit.author_name} - #{commit.subject}"
|
|
1170
1237
|
```
|
|
1171
1238
|
|
|
1239
|
+
#### Caches
|
|
1240
|
+
|
|
1241
|
+
Caches can be fetched for a repository.
|
|
1242
|
+
|
|
1243
|
+
``` ruby
|
|
1244
|
+
require 'travis/pro'
|
|
1245
|
+
|
|
1246
|
+
Travis::Pro.access_token = "MY SECRET TOKEN"
|
|
1247
|
+
repo = Travis::Pro::Repository.find("my/rep")
|
|
1248
|
+
|
|
1249
|
+
repo.caches.each do |cache|
|
|
1250
|
+
puts "#{cache.branch}: #{cache.size}"
|
|
1251
|
+
cache.delete
|
|
1252
|
+
end
|
|
1253
|
+
```
|
|
1254
|
+
|
|
1255
|
+
It is also possible to delete multiple caches with a single API call:
|
|
1256
|
+
|
|
1257
|
+
``` ruby
|
|
1258
|
+
repo.delete_caches(branch: "master", match: "rbx")
|
|
1259
|
+
```
|
|
1260
|
+
|
|
1172
1261
|
#### Workers
|
|
1173
1262
|
|
|
1174
1263
|
If a worker is running something, it will reference a `job` and a `repository`. Otherwise the values will be `nil`.
|
|
@@ -1356,7 +1445,9 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
|
|
|
1356
1445
|
|
|
1357
1446
|
**1.5.9** (not yet released)
|
|
1358
1447
|
|
|
1448
|
+
* Add `travis cache` to list and delete directory caches.
|
|
1359
1449
|
* Add `travis report` to give a report of the system, endpoint, configuration and last exception.
|
|
1450
|
+
* Add `Cache` entity.
|
|
1360
1451
|
|
|
1361
1452
|
**1.5.8** (October 24, 2013)
|
|
1362
1453
|
|
data/assets/travis.sh
CHANGED
|
@@ -19,13 +19,14 @@ _travis_complete() {
|
|
|
19
19
|
if type compdef 1>/dev/null 2>/dev/null; then
|
|
20
20
|
compdef _travis travis
|
|
21
21
|
_travis() { _travis_complete $((${#words} - 1)) "${words[2]}"; }
|
|
22
|
-
_travis_commands() { list=(accounts:"displays accounts and their subscription status" branches:"displays the most recent build for each branch" cancel:"cancels a job or build" console:"interactive shell" disable:"disables a project" enable:"enables a project" encrypt:"encrypts values for the .travis.yml" endpoint:"displays or changes the API endpoint" help:"helps you out when in dire need of information" history:"displays a projects build history" init:"generates a .travis.yml and enables the project" 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" restart:"restarts a build or job" setup:"sets up an addon or deploy target" show:"displays a build or job" 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; }
|
|
22
|
+
_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" disable:"disables a project" enable:"enables a project" encrypt:"encrypts values for the .travis.yml" endpoint:"displays or changes the API endpoint" help:"helps you out when in dire need of information" history:"displays a projects build history" init:"generates a .travis.yml and enables the project" 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" restart:"restarts a build or job" setup:"sets up an addon or deploy target" show:"displays a build or job" 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
23
|
_travis_setup() { list=(appfog:"automatic deployment to Appfog" cloudcontrol:"automatic deployment to cloudControl" cloudfoundry:"automatic deployment to Cloud Foundry" engineyard:"automatic deployment to Engine Yard" heroku:"automatic deployment to Heroku" npm:"automatic release to NPM" nodejitsu:"automatic deployment to Nodejitsu" openshift:"automatic deployment to OpenShfit" pypi:"automatic deployment to PyPI" rubygems:"automatic release to RubyGems" s:"automatic pushing to S3" sauce_connect:"Sauce Connet addon for Sauce Labs integration") _describe -t common-commands 'common commands' list; }
|
|
24
24
|
_travis_init() { list=(c:'initialize c project' clojure:'initialize clojure project' cpp:'initialize cpp 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; }
|
|
25
25
|
_travis_option() {
|
|
26
26
|
case "${words[2]}" in
|
|
27
27
|
accounts) _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/']" "--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]" "-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]" '*:file:_files' && return 0;;
|
|
28
28
|
branches) _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/']" "--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]" "-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]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" '*:file:_files' && return 0;;
|
|
29
|
+
cache) _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/']" "--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]" "-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]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-d[delete listed caches]" "--delete[delete listed caches]" "-b[only list/delete caches on given branch]" "--branch[only list/delete caches on given branch]" "-m[only list/delete caches where slug matches given string]" "--match[only list/delete caches where slug matches given string]" "-f[do not ask user to confirm deleting the caches]" "--force[do not ask user to confirm deleting the caches]" '*:file:_files' && return 0;;
|
|
29
30
|
cancel) _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/']" "--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]" "-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]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" '*:file:_files' && return 0;;
|
|
30
31
|
console) _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/']" "--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]" "-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]" '*:file:_files' && return 0;;
|
|
31
32
|
disable) _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/']" "--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]" "-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]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" '*:file:_files' && return 0;;
|
|
@@ -42,6 +43,7 @@ if type compdef 1>/dev/null 2>/dev/null; then
|
|
|
42
43
|
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/']" "--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]" "-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]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-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;;
|
|
43
44
|
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/']" "--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]" "-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]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-p[encode in format used by pem]" "--pem[encode in format used by pem]" "--no-pem[encode in format used by pem]" '*:file:_files' && return 0;;
|
|
44
45
|
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/']" "--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]" "-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]" "--json[display as json]" "--no-json[display as json]" '*:file:_files' && return 0;;
|
|
46
|
+
report) _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/']" "--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]" "-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]" "-r[include repositories in report]" "--known-repos[include repositories in report]" '*:file:_files' && return 0;;
|
|
45
47
|
restart) _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/']" "--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]" "-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]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" '*:file:_files' && return 0;;
|
|
46
48
|
setup) _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/']" "--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]" "-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]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" "-f[override config section if it already exists]" "--force[override config section if it already exists]" '*:file:_files' && return 0;;
|
|
47
49
|
show) _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/']" "--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]" "-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]" "-r[repository to use (will try to detect from current git clone)]" "--repo[repository to use (will try to detect from current git clone)]" '*:file:_files' && return 0;;
|
|
@@ -56,13 +58,14 @@ if type compdef 1>/dev/null 2>/dev/null; then
|
|
|
56
58
|
elif type compctl 1>/dev/null 2>/dev/null; then
|
|
57
59
|
compctl -K _travis travis
|
|
58
60
|
_travis() { read -cA words && _travis_complete $((${#words} - 1)) "${words[2]}"; }
|
|
59
|
-
_travis_commands() { reply=("accounts" "branches" "cancel" "console" "disable" "enable" "encrypt" "endpoint" "help" "history" "init" "login" "logout" "logs" "monitor" "open" "pubkey" "raw" "restart" "setup" "show" "status" "sync" "token" "version" "whatsup" "whoami"); }
|
|
61
|
+
_travis_commands() { reply=("accounts" "branches" "cache" "cancel" "console" "disable" "enable" "encrypt" "endpoint" "help" "history" "init" "login" "logout" "logs" "monitor" "open" "pubkey" "raw" "report" "restart" "setup" "show" "status" "sync" "token" "version" "whatsup" "whoami"); }
|
|
60
62
|
_travis_setup() { reply=("appfog" "cloudcontrol" "cloudfoundry" "engineyard" "heroku" "npm" "nodejitsu" "openshift" "pypi" "rubygems" "s" "sauce_connect"); }
|
|
61
63
|
_travis_init() { reply=("c" "clojure" "cpp" "erlang" "go" "groovy" "haskell" "java" "node_js" "objective-c" "perl" "php" "python" "ruby" "scala"); }
|
|
62
64
|
_travis_option() {
|
|
63
65
|
case "${words[2]}" in
|
|
64
66
|
accounts) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter");;
|
|
65
67
|
branches) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r");;
|
|
68
|
+
cache) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--delete" "-d" "--branch" "-b" "--match" "-m" "--force" "-f");;
|
|
66
69
|
cancel) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r");;
|
|
67
70
|
console) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter");;
|
|
68
71
|
disable) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r");;
|
|
@@ -79,6 +82,7 @@ elif type compctl 1>/dev/null 2>/dev/null; then
|
|
|
79
82
|
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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--github" "-g" "--print" "-p");;
|
|
80
83
|
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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--pem" "--no-pem" "-p");;
|
|
81
84
|
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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--json" "--no-json");;
|
|
85
|
+
report) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--known-repos" "-r");;
|
|
82
86
|
restart) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r");;
|
|
83
87
|
setup) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r" "--force" "-f");;
|
|
84
88
|
show) 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" "--org" "--staging" "--token" "-t" "--debug" "--enterprise" "-X" "--adapter" "--repo" "-r");;
|
|
@@ -93,7 +97,7 @@ elif type compctl 1>/dev/null 2>/dev/null; then
|
|
|
93
97
|
elif type complete 1>/dev/null 2>/dev/null; then
|
|
94
98
|
complete -F _travis travis
|
|
95
99
|
_travis() { _travis_complete "$COMP_CWORD" "${COMP_WORDS[1]}"; }
|
|
96
|
-
_travis_commands() { COMPREPLY=( $(compgen -W "accounts branches cancel console disable enable encrypt endpoint help history init login logout logs monitor open pubkey raw restart setup show status sync token version whatsup whoami" -- "${COMP_WORDS[COMP_CWORD]}") ); }
|
|
100
|
+
_travis_commands() { COMPREPLY=( $(compgen -W "accounts branches cache cancel console disable enable encrypt endpoint help history init login logout logs monitor open pubkey raw report restart setup show status sync token version whatsup whoami" -- "${COMP_WORDS[COMP_CWORD]}") ); }
|
|
97
101
|
_travis_setup() { COMPREPLY=( $(compgen -W "appfog cloudcontrol cloudfoundry engineyard heroku npm nodejitsu openshift pypi rubygems s sauce_connect" -- "${COMP_WORDS[COMP_CWORD]}") ); }
|
|
98
102
|
_travis_init() { COMPREPLY=( $(compgen -W "c clojure cpp erlang go groovy haskell java node_js objective-c perl php python ruby scala" -- "${COMP_WORDS[COMP_CWORD]}") ); }
|
|
99
103
|
_travis_option() {
|
|
@@ -101,6 +105,7 @@ elif type complete 1>/dev/null 2>/dev/null; then
|
|
|
101
105
|
case "${COMP_WORDS[1]}" in
|
|
102
106
|
accounts) 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 --org --staging --token -t --debug --enterprise -X --adapter";;
|
|
103
107
|
branches) 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 --org --staging --token -t --debug --enterprise -X --adapter --repo -r";;
|
|
108
|
+
cache) 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 --org --staging --token -t --debug --enterprise -X --adapter --repo -r --delete -d --branch -b --match -m --force -f";;
|
|
104
109
|
cancel) 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 --org --staging --token -t --debug --enterprise -X --adapter --repo -r";;
|
|
105
110
|
console) 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 --org --staging --token -t --debug --enterprise -X --adapter";;
|
|
106
111
|
disable) 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 --org --staging --token -t --debug --enterprise -X --adapter --repo -r";;
|
|
@@ -117,6 +122,7 @@ elif type complete 1>/dev/null 2>/dev/null; then
|
|
|
117
122
|
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 --org --staging --token -t --debug --enterprise -X --adapter --repo -r --github -g --print -p";;
|
|
118
123
|
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 --org --staging --token -t --debug --enterprise -X --adapter --repo -r --pem --no-pem -p";;
|
|
119
124
|
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 --org --staging --token -t --debug --enterprise -X --adapter --json --no-json";;
|
|
125
|
+
report) 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 --org --staging --token -t --debug --enterprise -X --adapter --known-repos -r";;
|
|
120
126
|
restart) 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 --org --staging --token -t --debug --enterprise -X --adapter --repo -r";;
|
|
121
127
|
setup) 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 --org --staging --token -t --debug --enterprise -X --adapter --repo -r --force -f";;
|
|
122
128
|
show) 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 --org --staging --token -t --debug --enterprise -X --adapter --repo -r";;
|
data/lib/travis/cli.rb
CHANGED
|
@@ -17,6 +17,7 @@ module Travis
|
|
|
17
17
|
autoload :ApiCommand, 'travis/cli/api_command'
|
|
18
18
|
autoload :Accounts, 'travis/cli/accounts'
|
|
19
19
|
autoload :Branches, 'travis/cli/branches'
|
|
20
|
+
autoload :Cache, 'travis/cli/cache'
|
|
20
21
|
autoload :Cancel, 'travis/cli/cancel'
|
|
21
22
|
autoload :Command, 'travis/cli/command'
|
|
22
23
|
autoload :Console, 'travis/cli/console'
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require 'travis/cli'
|
|
2
|
+
|
|
3
|
+
module Travis
|
|
4
|
+
module CLI
|
|
5
|
+
class Cache < RepoCommand
|
|
6
|
+
description 'lists or deletes repository caches'
|
|
7
|
+
on '-d', '--delete', 'delete listed caches'
|
|
8
|
+
on '-b', '--branch BRANCH', 'only list/delete caches on given branch'
|
|
9
|
+
on '-m', '--match STRING', 'only list/delete caches where slug matches given string'
|
|
10
|
+
on '-f', '--force', 'do not ask user to confirm deleting the caches'
|
|
11
|
+
|
|
12
|
+
def run
|
|
13
|
+
error "not allowed to access caches for #{color(repository.slug, :bold)}" unless repository.member?
|
|
14
|
+
branches = caches.group_by(&:branch)
|
|
15
|
+
check_caches
|
|
16
|
+
|
|
17
|
+
warn "Deleted the following caches:\n" if delete?
|
|
18
|
+
branches.each { |name, list| display_branch(name, list) }
|
|
19
|
+
size = caches.inject(0) { |s,c| s + c.size }
|
|
20
|
+
say "Overall size of above caches: " << formatter.file_size(size)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def check_caches
|
|
26
|
+
return if caches.any?
|
|
27
|
+
say "no caches found"
|
|
28
|
+
exit
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def display_branch(name, list)
|
|
32
|
+
say color(name ? "On branch #{name}:" : "Global:", :important)
|
|
33
|
+
list.each { |c| display_cache(c) }
|
|
34
|
+
puts
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def display_cache(cache)
|
|
38
|
+
say [
|
|
39
|
+
color(cache.slug.ljust(space), :bold),
|
|
40
|
+
"last modified: " << formatter.time(cache.last_modified),
|
|
41
|
+
"size: " << formatter.file_size(cache.size)
|
|
42
|
+
].join(" ") << "\n"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def params
|
|
46
|
+
params = {}
|
|
47
|
+
params[:branch] = branch if branch?
|
|
48
|
+
params[:match] = match if match?
|
|
49
|
+
params
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def caches
|
|
53
|
+
@caches ||= drop? ? repository.delete_caches(params) : repository.caches(params)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def space
|
|
57
|
+
@space ||= caches.map(&:slug).map(&:size).max
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def drop?
|
|
61
|
+
return false unless delete?
|
|
62
|
+
return true if force?
|
|
63
|
+
error "not deleting caches without --force" unless interactive?
|
|
64
|
+
error "aborted" unless danger_zone? "Do you really want to delete #{description}?"
|
|
65
|
+
true
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def description
|
|
69
|
+
description = color("all caches", :important)
|
|
70
|
+
description << " on branch #{color(branch, :important)}" if branch?
|
|
71
|
+
description << " that match #{color(match, :important)}" if match?
|
|
72
|
+
description
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
data/lib/travis/cli/command.rb
CHANGED
|
@@ -318,6 +318,10 @@ module Travis
|
|
|
318
318
|
wrong_args("many") if args.any?
|
|
319
319
|
end
|
|
320
320
|
|
|
321
|
+
def danger_zone?(message)
|
|
322
|
+
agree(color("DANGER ZONE: ", [:red, :bold]) << message << " ") { |q| q.default = "no" }
|
|
323
|
+
end
|
|
324
|
+
|
|
321
325
|
def wrong_args(quantity)
|
|
322
326
|
error "too #{quantity} arguments" do
|
|
323
327
|
say help
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
require 'travis/cli'
|
|
2
|
+
require 'travis/tools/system'
|
|
3
|
+
|
|
4
|
+
module Travis
|
|
5
|
+
module CLI
|
|
6
|
+
class Report < ApiCommand
|
|
7
|
+
description "generates a report useful for filing issues"
|
|
8
|
+
on '-r', '--known-repos', 'include repositories in report'
|
|
9
|
+
skip :authenticate, :clear_error
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
display("System", :general)
|
|
13
|
+
display("CLI", :cli_info)
|
|
14
|
+
display("Session", :session_info)
|
|
15
|
+
display("Endpoints", :endpoints)
|
|
16
|
+
display("Known Repositories", :known_repos) if known_repos?
|
|
17
|
+
display_error
|
|
18
|
+
say "For issues with the command line tool, please visit #{color("https://github.com/travis-ci/travis/issues", :underline)}."
|
|
19
|
+
say "For Travis CI in general, go to #{color("https://github.com/travis-ci/travis-ci/issues", :underline)} or email #{color("support@travis-ci.com", :underline)}."
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def display_error
|
|
23
|
+
return unless error = load_file("error.log")
|
|
24
|
+
display("Last Exception", :say, color(error, :info))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def display(title, method, *args)
|
|
28
|
+
say color(title, [:bold, :underline])
|
|
29
|
+
send(method, *args) { |*a| list(*a) }
|
|
30
|
+
puts
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def list(key, value, additional = nil)
|
|
34
|
+
value = case value
|
|
35
|
+
when Array then value.empty? ? none : value.map(&:inspect).join(", ")
|
|
36
|
+
when true then "yes"
|
|
37
|
+
when false then "no"
|
|
38
|
+
when nil then "unknown"
|
|
39
|
+
else value.to_s
|
|
40
|
+
end
|
|
41
|
+
additional &&= " (#{additional})"
|
|
42
|
+
say "#{key}:".ljust(known_repos? ? 50 : 25) << " " << color(value.to_s, :bold) << additional.to_s
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def general
|
|
46
|
+
yield "Ruby", Tools::System.ruby
|
|
47
|
+
yield "Operating System", Tools::System.full_os
|
|
48
|
+
yield "RubyGems", Tools::System.rubygems
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def cli_info
|
|
52
|
+
yield "Version", Travis::VERSION
|
|
53
|
+
yield "Plugins", defined?(TRAVIS_PLUGINS) ? TRAVIS_PLUGINS : []
|
|
54
|
+
yield "Auto-Completion", Tools::Completion.completion_installed?
|
|
55
|
+
yield "Last Version Check", last_check['at'] ? Time.at(last_check['at']) : 'never'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def session_info
|
|
59
|
+
yield "API Endpoint", api_endpoint
|
|
60
|
+
yield "Logged In", user_info
|
|
61
|
+
yield "Verify SSL", !insecure
|
|
62
|
+
yield "Enterprise", enterprise?
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def endpoints
|
|
66
|
+
config['endpoints'].each do |endpoint, info|
|
|
67
|
+
info = [
|
|
68
|
+
info['access_token'] ? 'access token' : nil,
|
|
69
|
+
info['insecure'] ? 'insecure' : nil,
|
|
70
|
+
default_endpoint == endpoint ? 'default' : nil,
|
|
71
|
+
endpoint == api_endpoint ? 'current' : nil
|
|
72
|
+
].compact
|
|
73
|
+
yield endpoint_name(endpoint), endpoint, info.join(', ')
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def endpoint_name(url, prefix = "")
|
|
78
|
+
case url
|
|
79
|
+
when Travis::Client::ORG_URI then "#{prefix}org"
|
|
80
|
+
when Travis::Client::PRO_URI then "#{prefix}pro"
|
|
81
|
+
when /api-staging\.travis-ci/ then endpoint_name(url.sub("api-staging.", "api."), "staging-")
|
|
82
|
+
else
|
|
83
|
+
key, _ = config['enterprise'].detect { |k,v| v.start_with? url }
|
|
84
|
+
key ? "enterprise %p" % key : "???"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def known_repos
|
|
89
|
+
config["repos"].each do |key, info|
|
|
90
|
+
yield key, info['endpoint']
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def user_info
|
|
95
|
+
access_token ? "as %p" % user.login : "no"
|
|
96
|
+
rescue Travis::Client::Error => e
|
|
97
|
+
e.message
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
data/lib/travis/client.rb
CHANGED
|
@@ -9,6 +9,7 @@ require 'travis/client/user'
|
|
|
9
9
|
require 'travis/client/repository'
|
|
10
10
|
require 'travis/client/build'
|
|
11
11
|
require 'travis/client/artifact'
|
|
12
|
+
require 'travis/client/cache'
|
|
12
13
|
require 'travis/client/commit'
|
|
13
14
|
require 'travis/client/job'
|
|
14
15
|
require 'travis/client/worker'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'travis/client/weak_entity'
|
|
2
|
+
|
|
3
|
+
module Travis
|
|
4
|
+
module Client
|
|
5
|
+
class Cache < WeakEntity
|
|
6
|
+
# @!parse attr_reader :repository_id, :size, :slug, :branch, :last_modified
|
|
7
|
+
attributes :repository_id, :size, :slug, :branch, :last_modified
|
|
8
|
+
time :last_modified
|
|
9
|
+
|
|
10
|
+
# @!parse attr_reader :repository
|
|
11
|
+
has :repository
|
|
12
|
+
|
|
13
|
+
one :cache
|
|
14
|
+
many :caches
|
|
15
|
+
|
|
16
|
+
def delete
|
|
17
|
+
repository.delete_caches(:branch => branch, :match => slug)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def inspect_info
|
|
21
|
+
[repository.slug, branch, slug].compact.join(" ")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/travis/client/entity.rb
CHANGED
|
@@ -25,6 +25,10 @@ module Travis
|
|
|
25
25
|
names.each { |n| MAP[n.to_s] = self }
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
def self.weak?
|
|
29
|
+
false
|
|
30
|
+
end
|
|
31
|
+
|
|
28
32
|
def self.one(key = nil)
|
|
29
33
|
MAP[key.to_s] = self if key
|
|
30
34
|
@one ||= key.to_s
|
|
@@ -85,9 +89,10 @@ module Travis
|
|
|
85
89
|
id_field :id
|
|
86
90
|
|
|
87
91
|
def initialize(session, id)
|
|
92
|
+
raise Travis::Client::Error, '%p is not a valid id' % id unless self.class.id? id
|
|
88
93
|
@attributes = {}
|
|
89
94
|
@session = session
|
|
90
|
-
@id = self.class.cast_id(id)
|
|
95
|
+
@id = self.class.cast_id(id) if id
|
|
91
96
|
end
|
|
92
97
|
|
|
93
98
|
def update_attributes(data)
|
|
@@ -178,6 +178,14 @@ module Travis
|
|
|
178
178
|
session.account(owner_name)
|
|
179
179
|
end
|
|
180
180
|
|
|
181
|
+
def caches(params = {})
|
|
182
|
+
session.get("/repos/#{id}/caches", params)['caches']
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def delete_caches(params = {})
|
|
186
|
+
session.delete("/repos/#{id}/caches", params)['caches']
|
|
187
|
+
end
|
|
188
|
+
|
|
181
189
|
private
|
|
182
190
|
|
|
183
191
|
def state
|
|
@@ -150,6 +150,10 @@ module Travis
|
|
|
150
150
|
load get_raw(*args)
|
|
151
151
|
end
|
|
152
152
|
|
|
153
|
+
def delete(*args)
|
|
154
|
+
load delete_raw(*args)
|
|
155
|
+
end
|
|
156
|
+
|
|
153
157
|
def get_raw(*args)
|
|
154
158
|
raw(:get, *args)
|
|
155
159
|
end
|
|
@@ -162,6 +166,11 @@ module Travis
|
|
|
162
166
|
raw(:put, *args)
|
|
163
167
|
end
|
|
164
168
|
|
|
169
|
+
def delete_raw(*args)
|
|
170
|
+
raw(:delete, *args)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
|
|
165
174
|
def raw(verb, url, *args)
|
|
166
175
|
url = url.sub(/^\//, '')
|
|
167
176
|
result = instrumented(verb.to_s.upcase, url, *args) { connection.public_send(verb, url, *args) }
|
|
@@ -225,8 +234,8 @@ module Travis
|
|
|
225
234
|
|
|
226
235
|
def create_entity(type, data)
|
|
227
236
|
data = { type.id_field => data } if type.id? data
|
|
228
|
-
id = type.cast_id(data.fetch(type.id_field))
|
|
229
|
-
entity = cached(type, :id, id) { type.new(self, id) }
|
|
237
|
+
id = type.cast_id(data.fetch(type.id_field)) unless type.weak?
|
|
238
|
+
entity = id ? cached(type, :id, id) { type.new(self, id) } : type.new(self, nil)
|
|
230
239
|
entity.update_attributes(data)
|
|
231
240
|
entity
|
|
232
241
|
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'travis/client'
|
|
2
|
+
|
|
3
|
+
module Travis
|
|
4
|
+
module Client
|
|
5
|
+
class WeakEntity < Entity
|
|
6
|
+
def self.weak?
|
|
7
|
+
true
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.id_field
|
|
11
|
+
raise "weak entities do not have id fields"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.id?(object)
|
|
15
|
+
object.nil?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.cast_id(object)
|
|
19
|
+
return object if id? object
|
|
20
|
+
raise "weak entities do not have id fields"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def missing?(attribute)
|
|
24
|
+
false
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def complete?
|
|
28
|
+
true
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -20,6 +20,18 @@ module Travis
|
|
|
20
20
|
output.join(" ")
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def file_size(input, human = true)
|
|
24
|
+
return "#{input} B" unless human
|
|
25
|
+
format = "B"
|
|
26
|
+
iec = %w[KiB MiB GiB TiB PiB EiB ZiB YiB]
|
|
27
|
+
while human and input > 512 and iec.any?
|
|
28
|
+
input /= 1024.0
|
|
29
|
+
format = iec.shift
|
|
30
|
+
end
|
|
31
|
+
input = input.round(2) if input.is_a? Float
|
|
32
|
+
"#{input} #{format}"
|
|
33
|
+
end
|
|
34
|
+
|
|
23
35
|
def time(time)
|
|
24
36
|
return "not yet" if time.nil? # or time > Time.now
|
|
25
37
|
#return duration(time, "ago") if Time.now - time < DAY
|
data/travis.gemspec
CHANGED
|
@@ -98,6 +98,7 @@ Gem::Specification.new do |s|
|
|
|
98
98
|
"lib/travis/cli/accounts.rb",
|
|
99
99
|
"lib/travis/cli/api_command.rb",
|
|
100
100
|
"lib/travis/cli/branches.rb",
|
|
101
|
+
"lib/travis/cli/cache.rb",
|
|
101
102
|
"lib/travis/cli/cancel.rb",
|
|
102
103
|
"lib/travis/cli/command.rb",
|
|
103
104
|
"lib/travis/cli/console.rb",
|
|
@@ -117,6 +118,7 @@ Gem::Specification.new do |s|
|
|
|
117
118
|
"lib/travis/cli/pubkey.rb",
|
|
118
119
|
"lib/travis/cli/raw.rb",
|
|
119
120
|
"lib/travis/cli/repo_command.rb",
|
|
121
|
+
"lib/travis/cli/report.rb",
|
|
120
122
|
"lib/travis/cli/restart.rb",
|
|
121
123
|
"lib/travis/cli/setup.rb",
|
|
122
124
|
"lib/travis/cli/setup/appfog.rb",
|
|
@@ -144,6 +146,7 @@ Gem::Specification.new do |s|
|
|
|
144
146
|
"lib/travis/client/artifact.rb",
|
|
145
147
|
"lib/travis/client/broadcast.rb",
|
|
146
148
|
"lib/travis/client/build.rb",
|
|
149
|
+
"lib/travis/client/cache.rb",
|
|
147
150
|
"lib/travis/client/commit.rb",
|
|
148
151
|
"lib/travis/client/entity.rb",
|
|
149
152
|
"lib/travis/client/error.rb",
|
|
@@ -156,6 +159,7 @@ Gem::Specification.new do |s|
|
|
|
156
159
|
"lib/travis/client/session.rb",
|
|
157
160
|
"lib/travis/client/states.rb",
|
|
158
161
|
"lib/travis/client/user.rb",
|
|
162
|
+
"lib/travis/client/weak_entity.rb",
|
|
159
163
|
"lib/travis/client/worker.rb",
|
|
160
164
|
"lib/travis/pro.rb",
|
|
161
165
|
"lib/travis/tools/assets.rb",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: travis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.5.9.travis.
|
|
4
|
+
version: 1.5.9.travis.361.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Konstantin Haase
|
|
@@ -28,7 +28,7 @@ authors:
|
|
|
28
28
|
autorequire:
|
|
29
29
|
bindir: bin
|
|
30
30
|
cert_chain: []
|
|
31
|
-
date: 2013-11-
|
|
31
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
|
32
32
|
dependencies:
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: faraday
|
|
@@ -291,6 +291,7 @@ files:
|
|
|
291
291
|
- lib/travis/cli/accounts.rb
|
|
292
292
|
- lib/travis/cli/api_command.rb
|
|
293
293
|
- lib/travis/cli/branches.rb
|
|
294
|
+
- lib/travis/cli/cache.rb
|
|
294
295
|
- lib/travis/cli/cancel.rb
|
|
295
296
|
- lib/travis/cli/command.rb
|
|
296
297
|
- lib/travis/cli/console.rb
|
|
@@ -310,6 +311,7 @@ files:
|
|
|
310
311
|
- lib/travis/cli/pubkey.rb
|
|
311
312
|
- lib/travis/cli/raw.rb
|
|
312
313
|
- lib/travis/cli/repo_command.rb
|
|
314
|
+
- lib/travis/cli/report.rb
|
|
313
315
|
- lib/travis/cli/restart.rb
|
|
314
316
|
- lib/travis/cli/setup.rb
|
|
315
317
|
- lib/travis/cli/setup/appfog.rb
|
|
@@ -337,6 +339,7 @@ files:
|
|
|
337
339
|
- lib/travis/client/artifact.rb
|
|
338
340
|
- lib/travis/client/broadcast.rb
|
|
339
341
|
- lib/travis/client/build.rb
|
|
342
|
+
- lib/travis/client/cache.rb
|
|
340
343
|
- lib/travis/client/commit.rb
|
|
341
344
|
- lib/travis/client/entity.rb
|
|
342
345
|
- lib/travis/client/error.rb
|
|
@@ -349,6 +352,7 @@ files:
|
|
|
349
352
|
- lib/travis/client/session.rb
|
|
350
353
|
- lib/travis/client/states.rb
|
|
351
354
|
- lib/travis/client/user.rb
|
|
355
|
+
- lib/travis/client/weak_entity.rb
|
|
352
356
|
- lib/travis/client/worker.rb
|
|
353
357
|
- lib/travis/pro.rb
|
|
354
358
|
- lib/travis/tools/assets.rb
|