travis 1.6.3.travis.390.4 → 1.6.3.travis.392.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODI0NjU0ZDQxOTQyNmE2ODhkOTM2NGQ1OGZiNzJiNzA0OTVkNDBlOQ==
4
+ NzQwMTMyZTUyMjkyOTY5ODE5MDg4YmM5ZmQ4ZWY5NTY4NTVmMWZkZA==
5
5
  data.tar.gz: !binary |-
6
- ZDIxOWMyYzM1MmQ3NmFkYjJjODc3MmE4YjEzZDdiYmQ0OTk3MGM3MQ==
6
+ N2IxNmM0ODUwZGZiZjllOTZkNTMxMzhiMzc5NGU0MzU4NTdmYWQ0NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjMyNjVlMDRhMjFkMjRhNDU1MjFmYTgzMDcxZjBjZTE5ZGM4ZmQwYjYyMzgx
10
- MjFhNDIwNGQ1MjcxMThiYmU0Y2NkZDgxMzMxOGM0NGEyMDYwZjk2MjFkMzkz
11
- OGMzODg0YWRlMzk2NTBhYjUyZjMyYmE4YTUzNWM0ZjJkMGJkMjY=
9
+ Zjk3NGQxMzBmOGFmOTM5MGNmZGY4MGMxYzRjZjgzM2YyZjg3OThiNTIxY2Yx
10
+ YmJkZDAzMDkyNmI1NWQ1MzQ3ZTgwNzNhNTg2NTIzYjYyNjMwODA5MWFjOTkx
11
+ N2IzOWRhN2EzOTk3N2IwYzM2NzBlZjgzOTBjNDZkMWFiOGY5NGM=
12
12
  data.tar.gz: !binary |-
13
- MGFjOTM0MWIzZjRhODgyM2UyNGJiMWUxOTQzMTQxMTJkMTVmN2Y3NDFhOGJm
14
- NmNjMzI5MTQxZGNlNjhlZDI3NDUwZmNjMmUxODA2NGQyMDI1YWVkNWQ3ODE4
15
- YjBmYzk2ZTMxNWNhMDM5ZTUwMWUwYWE4NTUwNjY2OGUwNWRlNzI=
13
+ MjVlOThiMTExYjYxZWI0NmJjYmFiNDdiOTdlZDE2YjA4ZDdjNTQ1Yjg4MTIz
14
+ ZTUwNTk3OGZkNjRjOWZhZjQ3MGFkODhiODU4ZjI0NGZkYzgzNTlhODJkMDhl
15
+ ODNiYmE1MjU0NjNhOTE5ZTAyM2M3NWRiMmJiYTczZWI2N2E0Y2Y=
data/README.md CHANGED
@@ -18,6 +18,7 @@ The [travis gem](https://rubygems.org/gems/travis) includes both a [command line
18
18
  * [`monitor`](#monitor)
19
19
  * [`raw`](#raw)
20
20
  * [`report`](#report)
21
+ * [`repos`](#repos)
21
22
  * [`sync`](#sync)
22
23
  * [`token`](#token)
23
24
  * [`whatsup`](#whatsup)
@@ -307,6 +308,46 @@ When inspecting a bug or reporting an issue, it can be handy to include a report
307
308
 
308
309
  This command can also list all known repos and the endpoint to use for them via the `--known-repos` option.
309
310
 
311
+ #### `repos`
312
+
313
+ Lists repositories the user has certain permissions on.
314
+ Usage: travis repos [options]
315
+ -h, --help Display help
316
+ -i, --[no-]interactive be interactive and colorful
317
+ -E, --[no-]explode don't rescue exceptions
318
+ --skip-version-check don't check if travis client is up to date
319
+ --skip-completion-check don't check if auto-completion is set up
320
+ -e, --api-endpoint URL Travis API server to talk to
321
+ -I, --[no-]insecure do not verify SSL certificate of API endpoint
322
+ --pro short-cut for --api-endpoint 'https://api.travis-ci.com/'
323
+ --org short-cut for --api-endpoint 'https://api.travis-ci.org/'
324
+ -t, --token [ACCESS_TOKEN] access token to use
325
+ --debug show API requests
326
+ -X, --enterprise [NAME] use enterprise setup (optionally takes name for multiple setups)
327
+ --adapter ADAPTER Faraday adapter to use for HTTP requests
328
+ -m, --match PATTERN only list repositories matching the given pattern (shell style)
329
+ -o, --owner LOGIN only list repos for a certain owner
330
+ -n, --name NAME only list repos with a given name
331
+ -a, --active only list active repositories
332
+ -A, --inactive only list inactive repositories
333
+ -d, --admin only list repos with (or without) admin access
334
+ -D, --no-admin only list repos without admin access
335
+
336
+ Lists repositories and displays whether these are active or not. Has a variety of options to filter repositories.
337
+
338
+ $ travis repos -m 'rkh/travis-*'
339
+ rkh/travis-chat (active: yes, admin: yes, push: yes, pull: yes)
340
+ Description: example app demoing travis-sso usage
341
+
342
+ rkh/travis-encrypt (active: yes, admin: yes, push: yes, pull: yes)
343
+ Description: proof of concept in browser encryption of travis settings
344
+
345
+ rkh/travis-lite (active: no, admin: yes, push: yes, pull: yes)
346
+ Description: Travis CI without the JavaScript
347
+
348
+ rkh/travis-surveillance (active: no, admin: yes, push: yes, pull: yes)
349
+ Description: Veille sur un projet.
350
+
310
351
  #### `sync`
311
352
 
312
353
  Usage: travis sync [options]
@@ -1447,6 +1488,7 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
1447
1488
  **1.6.3** (not yet released)
1448
1489
 
1449
1490
  * Fix OS detection on Windows.
1491
+ * Add `travis repos` command.
1450
1492
  * Add `travis setup cloudfiles`.
1451
1493
  * Add `travis setup divshot`.
1452
1494
  * Add `--date` flag to `travis history`.
data/lib/travis/cli.rb CHANGED
@@ -38,6 +38,7 @@ module Travis
38
38
  autoload :Raw, 'travis/cli/raw'
39
39
  autoload :RepoCommand, 'travis/cli/repo_command'
40
40
  autoload :Report, 'travis/cli/report'
41
+ autoload :Repos, 'travis/cli/repos'
41
42
  autoload :Restart, 'travis/cli/restart'
42
43
  autoload :Setup, 'travis/cli/setup'
43
44
  autoload :Show, 'travis/cli/show'
@@ -4,6 +4,7 @@ module Travis
4
4
  module Client
5
5
  class Build < Entity
6
6
  include States, Restartable
7
+ preloadable
7
8
 
8
9
  # @!parse attr_reader :repository_id, :commit_id, :number, :pull_request, :pull_request_number, :pull_request_title, :config, :state, :started_at, :finished_at, :duration, :job_ids
9
10
  attributes :repository_id, :commit_id, :number, :pull_request, :pull_request_number, :pull_request_title, :config, :state, :started_at, :finished_at, :duration, :job_ids
@@ -86,6 +86,16 @@ module Travis
86
86
  @id_field || superclass.id_field
87
87
  end
88
88
 
89
+ def self.preloadable
90
+ def self.preloadable?
91
+ true
92
+ end
93
+ end
94
+
95
+ def self.preloadable?
96
+ false
97
+ end
98
+
89
99
  id_field :id
90
100
 
91
101
  def initialize(session, id)
@@ -4,6 +4,7 @@ module Travis
4
4
  module Client
5
5
  class Job < Entity
6
6
  include States, Restartable
7
+ preloadable
7
8
 
8
9
  # @!parse attr_reader :repository_id, :build_id, :commit_id, :log_id, :number, :config, :state, :started_at, :finished_at, :queue, :allow_failure, :tags
9
10
  attributes :repository_id, :build_id, :commit_id, :log_id, :number, :config, :state, :started_at, :finished_at, :queue, :allow_failure, :tags
@@ -88,6 +88,10 @@ module Travis
88
88
  listener.subscribe(*entities, &block)
89
89
  listener.listen
90
90
  end
91
+
92
+ def hooks
93
+ session.get('hooks')['hooks']
94
+ end
91
95
  end
92
96
  end
93
97
  end
@@ -46,16 +46,22 @@ module Travis
46
46
  end
47
47
 
48
48
  include States
49
+ preloadable
49
50
 
50
51
  # @!parse attr_reader :slug, :description
51
- attributes :slug, :description, :last_build_id, :last_build_number, :last_build_state, :last_build_duration, :last_build_started_at, :last_build_finished_at, :github_language
52
+ attributes :slug, :active, :private, :admin, :description, :last_build_id, :last_build_number, :last_build_state, :last_build_duration, :last_build_started_at, :last_build_finished_at, :github_language
52
53
  inspect_info :slug
53
54
 
54
55
  time :last_build_finished_at, :last_build_started_at
55
56
 
56
57
  one :repo
57
58
  many :repos
58
- aka :repository, :permissions, :admin, :pull, :push
59
+ aka :repository, :permissions, :admin, :pull, :push, :hooks
60
+
61
+ def initialize(*)
62
+ super
63
+ attributes['active'] = attributes['private'] = attributes['admin'] = nil
64
+ end
59
65
 
60
66
  def public_key
61
67
  attributes["public_key"] ||= begin
@@ -186,6 +192,24 @@ module Travis
186
192
  session.delete("/repos/#{id}/caches", params)['caches']
187
193
  end
188
194
 
195
+ def active?
196
+ # TODO remove once active is properly synced and exposed by api
197
+ return active unless active.nil?
198
+ last_build_id?
199
+ end
200
+
201
+ def admin?(user = session.user)
202
+ user.admin_access? self
203
+ end
204
+
205
+ def push?(user = session.user)
206
+ user.push_access? self
207
+ end
208
+
209
+ def pull?(user = session.user)
210
+ user.pull_access? self
211
+ end
212
+
189
213
  private
190
214
 
191
215
  def state
@@ -143,6 +143,15 @@ module Travis
143
143
  result
144
144
  end
145
145
 
146
+ def preload(list)
147
+ list.group_by(&:class).each do |type, instances|
148
+ next unless type.preloadable?
149
+ ids = instances.map { |e| e.id unless e.complete? }.compact
150
+ find_many(type, :ids => ids) if ids.any?
151
+ end
152
+ list
153
+ end
154
+
146
155
  def get(*args)
147
156
  load get_raw(*args)
148
157
  end
@@ -24,8 +24,36 @@ module Travis
24
24
  attributes['channels'] ||= ['common']
25
25
  end
26
26
 
27
+ def permissions
28
+ attributes['permissions'] ||= session.get('/users/permissions')
29
+ end
30
+
27
31
  def repositories
28
- attributes['repositories'] ||= session.get('/users/permissions')['permissions']
32
+ permissions['permissions']
33
+ end
34
+
35
+ def push_access
36
+ permissions['push']
37
+ end
38
+
39
+ def pull_access
40
+ permissions['pull']
41
+ end
42
+
43
+ def admin_access
44
+ permissions['admin']
45
+ end
46
+
47
+ def push_access?(repo)
48
+ push_access.include? repo
49
+ end
50
+
51
+ def pull_access?(repo)
52
+ pull_access.include? repo
53
+ end
54
+
55
+ def admin_access?(repo)
56
+ admin_access.include? repo
29
57
  end
30
58
 
31
59
  alias syncing? is_syncing
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.6.3.travis.390.4
4
+ version: 1.6.3.travis.392.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase