travis 1.5.1 → 1.5.2
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 +4 -4
- data/README.md +64 -5
- data/completion/travis.sh +56 -2
- data/lib/travis/cli.rb +1 -0
- data/lib/travis/cli/api_command.rb +7 -2
- data/lib/travis/cli/cancel.rb +15 -0
- data/lib/travis/cli/command.rb +6 -0
- data/lib/travis/cli/endpoint.rb +9 -1
- data/lib/travis/cli/repo_command.rb +2 -0
- data/lib/travis/cli/setup.rb +19 -7
- data/lib/travis/client.rb +1 -0
- data/lib/travis/client/build.rb +1 -5
- data/lib/travis/client/entity.rb +8 -0
- data/lib/travis/client/job.rb +1 -5
- data/lib/travis/client/methods.rb +7 -0
- data/lib/travis/client/restartable.rb +23 -0
- data/lib/travis/client/session.rb +6 -2
- data/lib/travis/version.rb +1 -1
- data/spec/cli/cancel_spec.rb +15 -0
- data/spec/cli/encrypt_spec.rb +1 -1
- data/spec/cli/endpoint_spec.rb +6 -0
- data/spec/cli/restart_spec.rb +1 -1
- data/spec/cli/setup_spec.rb +1 -21
- data/spec/cli/whoami_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/fake_api.rb +5 -0
- data/spec/travis_spec.rb +1 -0
- data/travis.gemspec +13 -8
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e921c3e50d219945b7a6dd95288a2bd941c8ed
|
4
|
+
data.tar.gz: 6f053ea71b23f940a0c6d25de1e3541deb59145a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3888323efad2668054faa063208894261bfe7f906ef43c53373549de22252d48f875ffef7f67f96dc884f32ebc6346f94b5bdc99029e732d1b522832e2aaa57
|
7
|
+
data.tar.gz: e109cb1086c344be1a16090d3676adb1224eaab912682efa89b6d01bf09f23faaf761aea388a173ef965d1d1dbc5ad0fd3b125f960f8c44000e77648a0698aca
|
data/README.md
CHANGED
@@ -23,6 +23,7 @@ The [travis gem](https://rubygems.org/gems/travis) includes both a [command line
|
|
23
23
|
* [`whoami`](#whoami)
|
24
24
|
* [Repository Commands](#repository-commands)
|
25
25
|
* [`branches`](#branches)
|
26
|
+
* [`cancel`](#cancel)
|
26
27
|
* [`disable`](#disable)
|
27
28
|
* [`enable`](#enable)
|
28
29
|
* [`encrypt`](#encrypt)
|
@@ -35,6 +36,7 @@ The [travis gem](https://rubygems.org/gems/travis) includes both a [command line
|
|
35
36
|
* [`setup`](#setup)
|
36
37
|
* [`show`](#show)
|
37
38
|
* [`status`](#status)
|
39
|
+
* [Environment Variables](#environment-variables)
|
38
40
|
* [Ruby Library](#ruby-library)
|
39
41
|
* [Authentication](#authentication)
|
40
42
|
* [Using Pro](#using-pro)
|
@@ -150,7 +152,7 @@ But why use this over just `irb -r travis`? For one, it will take care of authen
|
|
150
152
|
|
151
153
|
#### `endpoint`
|
152
154
|
|
153
|
-
|
155
|
+
Prints out the API endpoint you're talking to.
|
154
156
|
|
155
157
|
$ travis endpoint
|
156
158
|
API endpoint: https://api.travis-ci.org/
|
@@ -159,6 +161,16 @@ Handy for using it when working with shell scripts:
|
|
159
161
|
|
160
162
|
$ curl "$(travis endpoint)/docs" > docs.html
|
161
163
|
|
164
|
+
It can also be used to set the default API endpoint used for [General API Commands](#general-api-commands):
|
165
|
+
|
166
|
+
$ travis endpoint --pro --set-default
|
167
|
+
API endpoint: https://api.travis-ci.com/ (stored as default)
|
168
|
+
|
169
|
+
You can use `--drop-default` to remove the setting again:
|
170
|
+
|
171
|
+
$ travis endpoint --drop-default
|
172
|
+
default API endpoint dropped (was https://api.travis-ci.com/)
|
173
|
+
|
162
174
|
#### `login`
|
163
175
|
|
164
176
|
The `login` command will, well, log you in. That way, all subsequent commands that run against the same endpoint will be authenticated.
|
@@ -340,6 +352,23 @@ Displays the most recent build for each branch:
|
|
340
352
|
|
341
353
|
For more fine grained control and older builds on a specific branch, see [`history`](#history).
|
342
354
|
|
355
|
+
#### `cancel`
|
356
|
+
|
357
|
+
This command will cancel the latest build:
|
358
|
+
|
359
|
+
$ travis cancel
|
360
|
+
build #85 has been canceled
|
361
|
+
|
362
|
+
You can also cancel any build by giving a build number:
|
363
|
+
|
364
|
+
$ travis cancel 57
|
365
|
+
build #57 has been canceled
|
366
|
+
|
367
|
+
Or a single job:
|
368
|
+
|
369
|
+
$ travis cancel 57.1
|
370
|
+
job #57.1 has been canceled
|
371
|
+
|
343
372
|
#### `disable`
|
344
373
|
|
345
374
|
If you want to turn of a repository temporarily or indefinitely, you can do so with the `disable` command:
|
@@ -609,7 +638,7 @@ Helps you configure Travis addons.
|
|
609
638
|
-r, --repo SLUG repository to use (will try to detect from current git clone)
|
610
639
|
-f, --force override config section if it already exists
|
611
640
|
|
612
|
-
Available services: `cloudcontrol`, `engineyard`, `heroku`, `nodejitsu`, `openshift`, `rubygems` and `sauce_connect`.
|
641
|
+
Available services: `cloudcontrol`, `cloudfoundry`, `engineyard`, `heroku`, `nodejitsu`, `openshift`, `rubygems` and `sauce_connect`.
|
613
642
|
|
614
643
|
Example:
|
615
644
|
|
@@ -707,6 +736,14 @@ Outputs a one line status message about the project's last build. With `-q` that
|
|
707
736
|
|
708
737
|
$ travis status -qpx && cap deploy
|
709
738
|
|
739
|
+
### Environment Variables
|
740
|
+
|
741
|
+
You can set the following environment variables to influence the travis behavior:
|
742
|
+
|
743
|
+
* `$TRAVIS_TOKEN` - access token to use when the `--token` flag is not user
|
744
|
+
* `$TRAVIS_ENDPOINT` - API endpoint to use when the `--api-endpoint`, `--org` or `--pro` flag is not used
|
745
|
+
* `$TRAVIS_CONFIG_PATH` - directory to store configuration in (defaults to ~/.travis)
|
746
|
+
|
710
747
|
## Ruby Library
|
711
748
|
|
712
749
|
There are two approaches of using the Ruby library, one straight forward with one global session:
|
@@ -914,6 +951,12 @@ You can restart a build, if the current user has sufficient permissions on the r
|
|
914
951
|
rails.last_build.restart
|
915
952
|
```
|
916
953
|
|
954
|
+
Same goes for canceling it:
|
955
|
+
|
956
|
+
``` ruby
|
957
|
+
rails.last_build.cancel
|
958
|
+
```
|
959
|
+
|
917
960
|
You can also retrieve a Hash mapping branch names to the latest build on that given branch via `branches` or use the `branch` method to get the last build for a specific branch:
|
918
961
|
|
919
962
|
``` ruby
|
@@ -947,6 +990,12 @@ Like builds, you can also restart singe jobs:
|
|
947
990
|
rails.job('5000.1').restart
|
948
991
|
```
|
949
992
|
|
993
|
+
Same goes for canceling it:
|
994
|
+
|
995
|
+
``` ruby
|
996
|
+
rails.job('5000.1').cancel
|
997
|
+
```
|
998
|
+
|
950
999
|
#### Artifacts
|
951
1000
|
|
952
1001
|
The artifacts you usually care for are probably logs. You can reach them directly from a build:
|
@@ -1038,6 +1087,7 @@ session.artifact(42) # artifact with id 42
|
|
1038
1087
|
session.log(42) # same as above
|
1039
1088
|
session.user # the current user, if logged in
|
1040
1089
|
session.restart(session.build(4266036)) # restart some build
|
1090
|
+
session.cancel(session.build(4266036)) # cancel some build
|
1041
1091
|
```
|
1042
1092
|
|
1043
1093
|
You can add these methods to any object responding to `session` via said mixin.
|
@@ -1127,12 +1177,12 @@ You can check your Ruby version by running `ruby -v`:
|
|
1127
1177
|
|
1128
1178
|
Then run:
|
1129
1179
|
|
1130
|
-
$ gem install travis -v 1.5.
|
1180
|
+
$ gem install travis -v 1.5.2 --no-rdoc --no-ri
|
1131
1181
|
|
1132
1182
|
Now make sure everything is working:
|
1133
1183
|
|
1134
1184
|
$ travis version
|
1135
|
-
1.5.
|
1185
|
+
1.5.2
|
1136
1186
|
|
1137
1187
|
### Updating your Ruby
|
1138
1188
|
|
@@ -1179,11 +1229,20 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
|
|
1179
1229
|
|
1180
1230
|
## Version History
|
1181
1231
|
|
1232
|
+
**1.5.2** (August 18, 2013)
|
1233
|
+
|
1234
|
+
* Add `travis cancel`.
|
1235
|
+
* Add `Build#cancel` and `Job#cancel` to Ruby API.
|
1236
|
+
* Add `travis setup cloudfoundry`.
|
1237
|
+
* Add `--set-default` and `--drop-default` to `travis endpoint`.
|
1238
|
+
* Make it possible to configure cli via env variables (`$TRAVIS_TOKEN`, `$TRAVIS_ENDPOINT` and `$TRAVIS_CONFIG_PATH`).
|
1239
|
+
* Improve `travis setup cloudcontrol`.
|
1240
|
+
|
1182
1241
|
**1.5.1** (August 15, 2013)
|
1183
1242
|
|
1184
1243
|
* Add `travis setup engineyard`.
|
1244
|
+
* Add `travis setup cloudcontrol`.
|
1185
1245
|
* Silence warnings when running `travis help` or `travis console`.
|
1186
|
-
* Add `travis setup cloudcontrol`
|
1187
1246
|
|
1188
1247
|
**1.5.0** (August 7, 2013)
|
1189
1248
|
|
data/completion/travis.sh
CHANGED
@@ -6,6 +6,7 @@ local completions
|
|
6
6
|
if [ "$COMP_CWORD" -eq 1 ]; then
|
7
7
|
completions="accounts
|
8
8
|
branches
|
9
|
+
cancel
|
9
10
|
console
|
10
11
|
disable
|
11
12
|
enable
|
@@ -73,6 +74,28 @@ completions="--help
|
|
73
74
|
--repo
|
74
75
|
-r"
|
75
76
|
;;
|
77
|
+
cancel)
|
78
|
+
completions="--help
|
79
|
+
-h
|
80
|
+
--interactive
|
81
|
+
--no-interactive
|
82
|
+
-i
|
83
|
+
--explode
|
84
|
+
--no-explode
|
85
|
+
-E
|
86
|
+
--skip-version-check
|
87
|
+
--api-endpoint
|
88
|
+
-e
|
89
|
+
--pro
|
90
|
+
--org
|
91
|
+
--staging
|
92
|
+
--token
|
93
|
+
-t
|
94
|
+
--debug
|
95
|
+
--adapter
|
96
|
+
--repo
|
97
|
+
-r"
|
98
|
+
;;
|
76
99
|
console)
|
77
100
|
completions="--help
|
78
101
|
-h
|
@@ -188,11 +211,14 @@ completions="--help
|
|
188
211
|
--token
|
189
212
|
-t
|
190
213
|
--debug
|
191
|
-
--adapter
|
214
|
+
--adapter
|
215
|
+
--drop-default
|
216
|
+
--set-default"
|
192
217
|
;;
|
193
218
|
help)
|
194
219
|
completions="accounts
|
195
220
|
branches
|
221
|
+
cancel
|
196
222
|
console
|
197
223
|
disable
|
198
224
|
enable
|
@@ -479,6 +505,7 @@ sauce_connect
|
|
479
505
|
sauce_labs
|
480
506
|
sauce
|
481
507
|
cloudcontrol
|
508
|
+
cloudfoundry
|
482
509
|
--help
|
483
510
|
-h
|
484
511
|
--interactive
|
@@ -667,6 +694,7 @@ read -cA words
|
|
667
694
|
if [ "${#words}" -eq 2 ]; then
|
668
695
|
completions="accounts
|
669
696
|
branches
|
697
|
+
cancel
|
670
698
|
console
|
671
699
|
disable
|
672
700
|
enable
|
@@ -734,6 +762,28 @@ completions="--help
|
|
734
762
|
--repo
|
735
763
|
-r"
|
736
764
|
;;
|
765
|
+
cancel)
|
766
|
+
completions="--help
|
767
|
+
-h
|
768
|
+
--interactive
|
769
|
+
--no-interactive
|
770
|
+
-i
|
771
|
+
--explode
|
772
|
+
--no-explode
|
773
|
+
-E
|
774
|
+
--skip-version-check
|
775
|
+
--api-endpoint
|
776
|
+
-e
|
777
|
+
--pro
|
778
|
+
--org
|
779
|
+
--staging
|
780
|
+
--token
|
781
|
+
-t
|
782
|
+
--debug
|
783
|
+
--adapter
|
784
|
+
--repo
|
785
|
+
-r"
|
786
|
+
;;
|
737
787
|
console)
|
738
788
|
completions="--help
|
739
789
|
-h
|
@@ -849,11 +899,14 @@ completions="--help
|
|
849
899
|
--token
|
850
900
|
-t
|
851
901
|
--debug
|
852
|
-
--adapter
|
902
|
+
--adapter
|
903
|
+
--drop-default
|
904
|
+
--set-default"
|
853
905
|
;;
|
854
906
|
help)
|
855
907
|
completions="accounts
|
856
908
|
branches
|
909
|
+
cancel
|
857
910
|
console
|
858
911
|
disable
|
859
912
|
enable
|
@@ -1140,6 +1193,7 @@ sauce_connect
|
|
1140
1193
|
sauce_labs
|
1141
1194
|
sauce
|
1142
1195
|
cloudcontrol
|
1196
|
+
cloudfoundry
|
1143
1197
|
--help
|
1144
1198
|
-h
|
1145
1199
|
--interactive
|
data/lib/travis/cli.rb
CHANGED
@@ -20,6 +20,7 @@ module Travis
|
|
20
20
|
autoload :ApiCommand, 'travis/cli/api_command'
|
21
21
|
autoload :Accounts, 'travis/cli/accounts'
|
22
22
|
autoload :Branches, 'travis/cli/branches'
|
23
|
+
autoload :Cancel, 'travis/cli/cancel'
|
23
24
|
autoload :Command, 'travis/cli/command'
|
24
25
|
autoload :Console, 'travis/cli/console'
|
25
26
|
autoload :Disable, 'travis/cli/disable'
|
@@ -41,6 +41,7 @@ module Travis
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def setup
|
44
|
+
self.api_endpoint = default_endpoint if default_endpoint and not explicit_api_endpoint?
|
44
45
|
self.access_token ||= fetch_token
|
45
46
|
endpoint_config['access_token'] ||= access_token
|
46
47
|
authenticate if pro?
|
@@ -86,8 +87,12 @@ module Travis
|
|
86
87
|
end
|
87
88
|
end
|
88
89
|
|
90
|
+
def default_endpoint
|
91
|
+
ENV['TRAVIS_ENDPOINT'] || config['default_endpoint']
|
92
|
+
end
|
93
|
+
|
89
94
|
def detected_endpoint
|
90
|
-
Travis::Client::ORG_URI
|
95
|
+
default_endpoint || Travis::Client::ORG_URI
|
91
96
|
end
|
92
97
|
|
93
98
|
def endpoint_option
|
@@ -98,7 +103,7 @@ module Travis
|
|
98
103
|
end
|
99
104
|
|
100
105
|
def fetch_token
|
101
|
-
|
106
|
+
ENV['TRAVIS_TOKEN'] || endpoint_config['access_token']
|
102
107
|
end
|
103
108
|
end
|
104
109
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'travis/cli'
|
2
|
+
|
3
|
+
module Travis
|
4
|
+
module CLI
|
5
|
+
class Cancel < RepoCommand
|
6
|
+
def run(number = last_build.number)
|
7
|
+
authenticate
|
8
|
+
entity = job(number) || build(number)
|
9
|
+
entity.cancel
|
10
|
+
|
11
|
+
say "canceled", "#{entity.class.one} ##{entity.number} has been %s"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/travis/cli/command.rb
CHANGED
data/lib/travis/cli/endpoint.rb
CHANGED
@@ -4,9 +4,17 @@ module Travis
|
|
4
4
|
module CLI
|
5
5
|
class Endpoint < ApiCommand
|
6
6
|
skip :authenticate
|
7
|
+
on '--drop-default', 'delete stored default endpoint'
|
8
|
+
on '--set-default', 'store endpoint as global default'
|
7
9
|
|
8
10
|
def run
|
9
|
-
|
11
|
+
if drop_default? and was = config['default_endpoint']
|
12
|
+
config.delete('default_endpoint')
|
13
|
+
say was, "default API endpoint dropped (was %s)"
|
14
|
+
else
|
15
|
+
config['default_endpoint'] = api_endpoint if set_default?
|
16
|
+
say api_endpoint, "API endpoint: %s#{" (stored as default)" if set_default?}"
|
17
|
+
end
|
10
18
|
end
|
11
19
|
end
|
12
20
|
end
|
data/lib/travis/cli/setup.rb
CHANGED
@@ -92,16 +92,28 @@ module Travis
|
|
92
92
|
|
93
93
|
def setup_cloudcontrol
|
94
94
|
configure 'deploy', 'provider' => 'cloudcontrol' do |config|
|
95
|
-
config['email']
|
96
|
-
config['password']
|
97
|
-
app
|
98
|
-
dep
|
95
|
+
config['email'] = ask("cloudControl email: ").to_s
|
96
|
+
config['password'] = ask("cloudControl password: ") { |q| q.echo = "*" }.to_s
|
97
|
+
app = ask("cloudControl application: ") { |q| q.default = repository.name }.to_s
|
98
|
+
dep = ask("cloudControl deployment: ") { |q| q.default = "default" }.to_s
|
99
99
|
config['deployment'] = "#{app}/#{dep}"
|
100
|
-
config['on']
|
101
|
-
encrypt(config, 'password') if agree("Encrypt password
|
100
|
+
config['on'] = { 'repo' => repository.slug } if agree("Deploy only from #{repository.slug}? ") { |q| q.default = 'yes' }
|
101
|
+
encrypt(config, 'password') if agree("Encrypt password? ") { |q| q.default = 'yes' }
|
102
102
|
end
|
103
103
|
end
|
104
|
-
|
104
|
+
|
105
|
+
def setup_cloudfoundry
|
106
|
+
configure 'deploy', 'provider' => 'cloudfoundry' do |config|
|
107
|
+
config['target'] = ask("Cloud Foundry target: ").to_s
|
108
|
+
config['username'] = ask("Cloud Foundry user name: ").to_s
|
109
|
+
config['password'] = ask("Cloud Foundry password: ") { |q| q.echo = "*" }.to_s
|
110
|
+
config['organization'] = ask("Cloud Foundry organization: ").to_s
|
111
|
+
config['space'] = ask("Cloud Foundry space: ").to_s
|
112
|
+
config['on'] = { 'repo' => repository.slug } if agree("Deploy only from #{repository.slug}? ") { |q| q.default = 'yes' }
|
113
|
+
encrypt(config, 'password') if agree("Encrypt password? ") { |q| q.default = 'yes' }
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
105
117
|
private
|
106
118
|
|
107
119
|
def encrypt(config, key)
|
data/lib/travis/client.rb
CHANGED
data/lib/travis/client/build.rb
CHANGED
@@ -3,7 +3,7 @@ require 'travis/client'
|
|
3
3
|
module Travis
|
4
4
|
module Client
|
5
5
|
class Build < Entity
|
6
|
-
include States
|
6
|
+
include States, Restartable
|
7
7
|
|
8
8
|
# @!parse attr_reader :repository_id, :commit_id, :number, :pull_request, :config, :state, :started_at, :finished_at, :duration, :job_ids
|
9
9
|
attributes :repository_id, :commit_id, :number, :pull_request, :config, :state, :started_at, :finished_at, :duration, :job_ids
|
@@ -18,10 +18,6 @@ module Travis
|
|
18
18
|
many :builds
|
19
19
|
aka :branches
|
20
20
|
|
21
|
-
def restart
|
22
|
-
session.restart(self)
|
23
|
-
end
|
24
|
-
|
25
21
|
def push?
|
26
22
|
not pull_request?
|
27
23
|
end
|
data/lib/travis/client/entity.rb
CHANGED
data/lib/travis/client/job.rb
CHANGED
@@ -3,7 +3,7 @@ require 'travis/client'
|
|
3
3
|
module Travis
|
4
4
|
module Client
|
5
5
|
class Job < Entity
|
6
|
-
include States
|
6
|
+
include States, Restartable
|
7
7
|
|
8
8
|
# @!parse attr_reader :repository_id, :build_id, :commit_id, :log_id, :number, :config, :state, :started_at, :finished_at, :queue, :allow_failure, :tags
|
9
9
|
attributes :repository_id, :build_id, :commit_id, :log_id, :number, :config, :state, :started_at, :finished_at, :queue, :allow_failure, :tags
|
@@ -17,10 +17,6 @@ module Travis
|
|
17
17
|
one :job
|
18
18
|
many :jobs
|
19
19
|
|
20
|
-
def restart
|
21
|
-
session.restart(self)
|
22
|
-
end
|
23
|
-
|
24
20
|
def pull_request?
|
25
21
|
build.pull_request?
|
26
22
|
end
|
@@ -74,10 +74,17 @@ module Travis
|
|
74
74
|
def restart(entity)
|
75
75
|
# btw, internally we call this reset, not restart, as it resets the state machine
|
76
76
|
# but we thought that would be too confusing
|
77
|
+
raise Error, "cannot restart a #{entity.class.one}" unless entity.restartable?
|
77
78
|
session.post_raw('/requests', "#{entity.class.one}_id" => entity.id)
|
78
79
|
entity.reload
|
79
80
|
end
|
80
81
|
|
82
|
+
def cancel(entity)
|
83
|
+
raise Error, "cannot cancel a #{entity.class.one}" unless entity.cancelable?
|
84
|
+
session.post_raw("/#{entity.class.many}/#{entity.id}/cancel")
|
85
|
+
entity.reload
|
86
|
+
end
|
87
|
+
|
81
88
|
def listen(*entities, &block)
|
82
89
|
listener = Listener.new(session)
|
83
90
|
listener.subscribe(*entities, &block)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'travis/client'
|
2
|
+
|
3
|
+
module Travis
|
4
|
+
module Client
|
5
|
+
module Restartable
|
6
|
+
def restartable?
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
10
|
+
def restart
|
11
|
+
session.restart(self)
|
12
|
+
end
|
13
|
+
|
14
|
+
def cancelable?
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
18
|
+
def cancel
|
19
|
+
session.cancel(self)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -194,10 +194,14 @@ module Travis
|
|
194
194
|
end
|
195
195
|
|
196
196
|
def handle_error(e)
|
197
|
-
message = e.response[:body].to_str rescue e.message
|
198
197
|
klass = Travis::Client::NotFound if e.is_a? Faraday::Error::ResourceNotFound
|
199
198
|
klass ||= Travis::Client::Error
|
200
|
-
raise klass,
|
199
|
+
raise klass, error_message(e), e.backtrace
|
200
|
+
end
|
201
|
+
|
202
|
+
def error_message(e)
|
203
|
+
message = e.response[:body].to_str rescue e.message
|
204
|
+
JSON.parse(message).fetch('error').fetch('message') rescue message
|
201
205
|
end
|
202
206
|
|
203
207
|
def reset_entities
|
data/lib/travis/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Travis::CLI::Cancel do
|
4
|
+
example 'travis cancel' do
|
5
|
+
run_cli('cancel', '-t', 'token').should be_success
|
6
|
+
$params['id'].should be == "4125095"
|
7
|
+
$params['entity'].should be == "builds"
|
8
|
+
end
|
9
|
+
|
10
|
+
example 'travis cancel 6180.1' do
|
11
|
+
run_cli('cancel', '6180.1', '-t', 'token').should be_success
|
12
|
+
$params['id'].should be == "4125096"
|
13
|
+
$params['entity'].should be == "jobs"
|
14
|
+
end
|
15
|
+
end
|
data/spec/cli/encrypt_spec.rb
CHANGED
data/spec/cli/endpoint_spec.rb
CHANGED
@@ -16,6 +16,12 @@ describe Travis::CLI::Endpoint do
|
|
16
16
|
stdout.should be == "http://localhost:3000/\n"
|
17
17
|
end
|
18
18
|
|
19
|
+
example "TRAVIS_ENDPOINT=http://localhost:3000/ travis endpoint" do
|
20
|
+
ENV['TRAVIS_ENDPOINT'] = "http://localhost:3000/"
|
21
|
+
run_cli('endpoint').should be_success
|
22
|
+
stdout.should be == "http://localhost:3000/\n"
|
23
|
+
end
|
24
|
+
|
19
25
|
example "travis endpoint -i" do
|
20
26
|
run_cli('endpoint', '-i').should be_success
|
21
27
|
stdout.should be == "API endpoint: https://api.travis-ci.org/\n"
|
data/spec/cli/restart_spec.rb
CHANGED
data/spec/cli/setup_spec.rb
CHANGED
@@ -1,25 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Travis::CLI::Setup do
|
4
|
-
|
5
|
-
run_cli('setup', 'cloudcontrol') { |i|
|
6
|
-
i.puts('email')
|
7
|
-
i.puts('password')
|
8
|
-
i.puts('application')
|
9
|
-
i.puts('deployment')
|
10
|
-
i.puts('yes')
|
11
|
-
i.puts('yes')}.should be_success
|
12
|
-
stdout.should be == "cloudControl email: cloudControl password: ********\ncloudControl application: cloudControl deployment: Deploy only from rails/rails? |yes| Encrypt password key? |yes| "
|
13
|
-
file = File.expand_path('.travis.yml', Dir.pwd.gsub!(/\/spec/, ''))
|
14
|
-
config = YAML.load_file(file)
|
15
|
-
|
16
|
-
config['deploy']['provider'].should eql('cloudcontrol')
|
17
|
-
config['deploy']['email'].should eql('email')
|
18
|
-
config['deploy']['deployment'].should eql('application/deployment')
|
19
|
-
|
20
|
-
config.delete('deploy')
|
21
|
-
yaml = config.to_yaml
|
22
|
-
yaml.gsub! /\A---\s*\n/, ''
|
23
|
-
File.write(file, yaml)
|
24
|
-
end
|
4
|
+
# TODO
|
25
5
|
end
|
data/spec/cli/whoami_spec.rb
CHANGED
@@ -19,6 +19,13 @@ describe Travis::CLI::Whoami do
|
|
19
19
|
stderr.should be_empty
|
20
20
|
end
|
21
21
|
|
22
|
+
example "TRAVIS_TOKEN=token travis whoami" do
|
23
|
+
ENV['TRAVIS_TOKEN'] = 'token'
|
24
|
+
run_cli('whoami').should be_success
|
25
|
+
stdout.should be == "rkh\n"
|
26
|
+
stderr.should be_empty
|
27
|
+
end
|
28
|
+
|
22
29
|
example "travis whoami -t token -i" do
|
23
30
|
run_cli('whoami', '-t', 'token', '-i').should be_success
|
24
31
|
stdout.should be == "You are rkh (Konstantin Haase)\n"
|
data/spec/spec_helper.rb
CHANGED
@@ -20,10 +20,12 @@ RSpec.configure do |c|
|
|
20
20
|
temp_dir = File.expand_path('travis-spec', Dir.tmpdir)
|
21
21
|
FileUtils.rm_rf(temp_dir)
|
22
22
|
FileUtils.mkdir_p(temp_dir)
|
23
|
+
ENV.delete_if { |k,v| k.start_with? "TRAVIS_" }
|
23
24
|
ENV['TRAVIS_CONFIG_PATH'] = File.expand_path('travis', temp_dir)
|
24
25
|
end
|
25
26
|
|
26
27
|
c.after do
|
28
|
+
ENV.delete_if { |k,v| k.start_with? "TRAVIS_" }
|
27
29
|
FileUtils.rm_rf(temp_dir)
|
28
30
|
end
|
29
31
|
end
|
data/spec/support/fake_api.rb
CHANGED
data/spec/travis_spec.rb
CHANGED
@@ -4,6 +4,7 @@ describe Travis do
|
|
4
4
|
its(:api_endpoint) { should be == 'https://api.travis-ci.org/' }
|
5
5
|
|
6
6
|
it 'has a nice inspect on entities' do
|
7
|
+
pending "does not work on JRuby" if defined? RUBY_ENGINE and RUBY_ENGINE == 'jruby'
|
7
8
|
Travis::Repository.find('rails/rails').inspect.should be == "#<Travis::Repository: rails/rails>"
|
8
9
|
end
|
9
10
|
end
|
data/travis.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
# general infos
|
4
4
|
s.name = "travis"
|
5
|
-
s.version = "1.5.
|
5
|
+
s.version = "1.5.2"
|
6
6
|
s.description = "CLI and Ruby client library for Travis CI"
|
7
7
|
s.homepage = "https://github.com/travis-ci/travis"
|
8
8
|
s.summary = "Travis CI client"
|
@@ -17,16 +17,17 @@ Gem::Specification.new do |s|
|
|
17
17
|
"Peter Souter",
|
18
18
|
"Max Barnash",
|
19
19
|
"Aaron Hill",
|
20
|
-
"
|
20
|
+
"Mathias Meyer",
|
21
|
+
"Josh Kalderimis",
|
21
22
|
"Justin Lambert",
|
22
|
-
"
|
23
|
+
"Adrien Brault",
|
23
24
|
"Laurent Petit",
|
24
|
-
"
|
25
|
-
"Mathias Meyer",
|
26
|
-
"Benjamin Manns",
|
25
|
+
"Daniel Chatfield",
|
27
26
|
"Piotr Sarnacki",
|
28
27
|
"Rapha\xC3\xABl Pinson",
|
29
28
|
"Tobias Wilken",
|
29
|
+
"Mario Visic",
|
30
|
+
"Benjamin Manns",
|
30
31
|
"Jacob Burkhart"
|
31
32
|
]
|
32
33
|
|
@@ -37,17 +38,18 @@ Gem::Specification.new do |s|
|
|
37
38
|
"p.morsou@gmail.com",
|
38
39
|
"i.am@anhero.ru",
|
39
40
|
"aa1ronham@gmail.com",
|
41
|
+
"meyer@paperplanes.de",
|
40
42
|
"jlambert@eml.cc",
|
41
43
|
"benmanns@gmail.com",
|
42
44
|
"adrien.brault@gmail.com",
|
43
45
|
"laurent.petit@gmail.com",
|
44
46
|
"chatfielddaniel@gmail.com",
|
45
|
-
"meyer@paperplanes.de",
|
46
47
|
"drogus@gmail.com",
|
47
48
|
"raphael.pinson@camptocamp.com",
|
48
49
|
"tw@cloudcontrol.de",
|
49
50
|
"mario@mariovisic.com",
|
50
|
-
"jburkhart@engineyard.com"
|
51
|
+
"jburkhart@engineyard.com",
|
52
|
+
"josh.kalderimis@gmail.com"
|
51
53
|
]
|
52
54
|
|
53
55
|
# generated from git ls-files
|
@@ -65,6 +67,7 @@ Gem::Specification.new do |s|
|
|
65
67
|
"lib/travis/cli/accounts.rb",
|
66
68
|
"lib/travis/cli/api_command.rb",
|
67
69
|
"lib/travis/cli/branches.rb",
|
70
|
+
"lib/travis/cli/cancel.rb",
|
68
71
|
"lib/travis/cli/command.rb",
|
69
72
|
"lib/travis/cli/console.rb",
|
70
73
|
"lib/travis/cli/disable.rb",
|
@@ -119,6 +122,7 @@ Gem::Specification.new do |s|
|
|
119
122
|
"lib/travis/client/methods.rb",
|
120
123
|
"lib/travis/client/namespace.rb",
|
121
124
|
"lib/travis/client/repository.rb",
|
125
|
+
"lib/travis/client/restartable.rb",
|
122
126
|
"lib/travis/client/session.rb",
|
123
127
|
"lib/travis/client/states.rb",
|
124
128
|
"lib/travis/client/user.rb",
|
@@ -128,6 +132,7 @@ Gem::Specification.new do |s|
|
|
128
132
|
"lib/travis/tools/safe_string.rb",
|
129
133
|
"lib/travis/tools/token_finder.rb",
|
130
134
|
"lib/travis/version.rb",
|
135
|
+
"spec/cli/cancel_spec.rb",
|
131
136
|
"spec/cli/encrypt_spec.rb",
|
132
137
|
"spec/cli/endpoint_spec.rb",
|
133
138
|
"spec/cli/help_spec.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.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
@@ -9,21 +9,22 @@ authors:
|
|
9
9
|
- Peter Souter
|
10
10
|
- Max Barnash
|
11
11
|
- Aaron Hill
|
12
|
-
-
|
12
|
+
- Mathias Meyer
|
13
|
+
- Josh Kalderimis
|
13
14
|
- Justin Lambert
|
14
|
-
-
|
15
|
+
- Adrien Brault
|
15
16
|
- Laurent Petit
|
16
|
-
-
|
17
|
-
- Mathias Meyer
|
18
|
-
- Benjamin Manns
|
17
|
+
- Daniel Chatfield
|
19
18
|
- Piotr Sarnacki
|
20
19
|
- Raphaël Pinson
|
21
20
|
- Tobias Wilken
|
21
|
+
- Mario Visic
|
22
|
+
- Benjamin Manns
|
22
23
|
- Jacob Burkhart
|
23
24
|
autorequire:
|
24
25
|
bindir: bin
|
25
26
|
cert_chain: []
|
26
|
-
date: 2013-08-
|
27
|
+
date: 2013-08-18 00:00:00.000000000 Z
|
27
28
|
dependencies:
|
28
29
|
- !ruby/object:Gem::Dependency
|
29
30
|
name: faraday
|
@@ -234,17 +235,18 @@ email:
|
|
234
235
|
- p.morsou@gmail.com
|
235
236
|
- i.am@anhero.ru
|
236
237
|
- aa1ronham@gmail.com
|
238
|
+
- meyer@paperplanes.de
|
237
239
|
- jlambert@eml.cc
|
238
240
|
- benmanns@gmail.com
|
239
241
|
- adrien.brault@gmail.com
|
240
242
|
- laurent.petit@gmail.com
|
241
243
|
- chatfielddaniel@gmail.com
|
242
|
-
- meyer@paperplanes.de
|
243
244
|
- drogus@gmail.com
|
244
245
|
- raphael.pinson@camptocamp.com
|
245
246
|
- tw@cloudcontrol.de
|
246
247
|
- mario@mariovisic.com
|
247
248
|
- jburkhart@engineyard.com
|
249
|
+
- josh.kalderimis@gmail.com
|
248
250
|
executables:
|
249
251
|
- travis
|
250
252
|
extensions:
|
@@ -264,6 +266,7 @@ files:
|
|
264
266
|
- lib/travis/cli/accounts.rb
|
265
267
|
- lib/travis/cli/api_command.rb
|
266
268
|
- lib/travis/cli/branches.rb
|
269
|
+
- lib/travis/cli/cancel.rb
|
267
270
|
- lib/travis/cli/command.rb
|
268
271
|
- lib/travis/cli/console.rb
|
269
272
|
- lib/travis/cli/disable.rb
|
@@ -318,6 +321,7 @@ files:
|
|
318
321
|
- lib/travis/client/methods.rb
|
319
322
|
- lib/travis/client/namespace.rb
|
320
323
|
- lib/travis/client/repository.rb
|
324
|
+
- lib/travis/client/restartable.rb
|
321
325
|
- lib/travis/client/session.rb
|
322
326
|
- lib/travis/client/states.rb
|
323
327
|
- lib/travis/client/user.rb
|
@@ -327,6 +331,7 @@ files:
|
|
327
331
|
- lib/travis/tools/safe_string.rb
|
328
332
|
- lib/travis/tools/token_finder.rb
|
329
333
|
- lib/travis/version.rb
|
334
|
+
- spec/cli/cancel_spec.rb
|
330
335
|
- spec/cli/encrypt_spec.rb
|
331
336
|
- spec/cli/endpoint_spec.rb
|
332
337
|
- spec/cli/help_spec.rb
|
@@ -381,8 +386,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
381
386
|
version: '0'
|
382
387
|
requirements: []
|
383
388
|
rubyforge_project:
|
384
|
-
rubygems_version: 2.0.
|
389
|
+
rubygems_version: 2.0.5
|
385
390
|
signing_key:
|
386
391
|
specification_version: 4
|
387
392
|
summary: Travis CI client
|
388
393
|
test_files: []
|
394
|
+
has_rdoc:
|