travis 1.12.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0b5c4a5f4cbdfb25775698bedbd1cd824829126ef517f1f5b46dfe87269eb55
4
- data.tar.gz: 49ef3fdf23e50443114305980b451502613322ae67b118cc21512a755b55aae3
3
+ metadata.gz: 998fcdcdfd03492820c29d028608bd6ad94a18017577afa5b7900ca43b8ec007
4
+ data.tar.gz: b189770e1539200697d0e57f8b100fffda04d11990e089bcd89a568e80b233bb
5
5
  SHA512:
6
- metadata.gz: c3d2c85a4a706274f514e593bb56adf3a25f95ba732030c9a47c49c2c0fdc1fbef46bbea4006d2efe555d48c70a80d057fe03d4536da5f713f443c9d5a770d3f
7
- data.tar.gz: 28f140f38fbfa6f479ff816c4174480d408c90ed4b4f79229c3a4449bdba3abd492acea894d951f679a91be1583b192650109fb36c6efd1f7978a4be1f551d75
6
+ metadata.gz: ad73d2de98f9998c273daff53ac40491db37044fff1ca395aac795a61cce1f3d6bf981936556483d3a933334f14d428e50a7504991516fe55ed5f0b06ef97593
7
+ data.tar.gz: fba8991abd529d94c1977232727b61015d10744a9c0b617508702a53ad7e30dd4e44b0c1607ccfeb779a0e20d7a41b89642d80398ddfd5463ff3447aa0af8681
data/README.md CHANGED
@@ -17,6 +17,8 @@ The [travis gem](https://rubygems.org/gems/travis) includes both a [command line
17
17
  * [`login`](#login) - authenticates against the API and stores the token
18
18
  * [`monitor`](#monitor) - live monitor for what's going on
19
19
  * [`raw`](#raw) - makes an (authenticated) API call and prints out the result
20
+ * [`regenerate-token`](#regenerate-token) - regenerates the stored API token
21
+ * [`remove-token`](#remove-token) - deletes the stored API token
20
22
  * [`report`](#report) - generates a report useful for filing issues
21
23
  * [`repos`](#repos) - lists repositories the user has certain permissions on
22
24
  * [`sync`](#sync) - triggers a new sync with GitHub
@@ -329,6 +331,24 @@ $ travis raw /repos/travis-ci/travis.rb
329
331
 
330
332
  Use `--json` if you'd rather prefer the output to be JSON.
331
333
 
334
+ #### `regenerate-token`
335
+
336
+ This command is used to regenerate the stored API token. New token will be stored in the config.
337
+
338
+ ``` console
339
+ $ travis regenerate-token
340
+ Successfully regenerated the token!
341
+ ```
342
+
343
+ #### `remove-token`
344
+
345
+ This command is used to remove the access token from the config, log out the user and disable the token.
346
+
347
+ ``` console
348
+ $ travis remove-token
349
+ Successfully removed the access token!
350
+ ```
351
+
332
352
  #### `report`
333
353
 
334
354
  When inspecting a bug or reporting an issue, it can be handy to include a report about the system and configuration used for running a command.
@@ -2066,6 +2086,11 @@ See https://github.com/travis-ci/travis.rb/issues/768#issuecomment-700220351 for
2066
2086
 
2067
2087
  ## Version History
2068
2088
 
2089
+ ### 1.13.0
2090
+
2091
+ * Default API endpoint switched https://github.com/travis-ci/travis.rb/pull/840
2092
+ * Api key regenerate https://github.com/travis-ci/travis.rb/pull/842
2093
+
2069
2094
  ### 1.12.0
2070
2095
 
2071
2096
  * Upgraded ruby version to 3.2 https://github.com/travis-ci/travis.rb/pull/848
@@ -21,7 +21,7 @@ module Travis
21
21
  [other_cmds, api_cmds, repo_cmds].each do |cmd_grp|
22
22
  say " #{cmd_grp.header}"
23
23
  cmd_grp.cmds.each do |cmd|
24
- say " #{color(cmd.command_name, :command).ljust(22)} #{color(cmd.description, :info)}"
24
+ say " #{color(cmd.command_name, :command).ljust(25)} #{color(cmd.description, :info)}"
25
25
  end
26
26
  end
27
27
  say "\nrun `#{$PROGRAM_NAME} help COMMAND` for more info"
@@ -0,0 +1,15 @@
1
+ require 'travis/cli'
2
+
3
+ module Travis
4
+ module CLI
5
+ class RegenerateToken < ApiCommand
6
+ description "regenerates the stored API token"
7
+
8
+ def run
9
+ token = session.regenerate_token['token']
10
+ endpoint_config['access_token'] = token
11
+ success("Successfully regenerated the token!")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'travis/cli'
2
+
3
+ module Travis
4
+ module CLI
5
+ class RemoveToken < ApiCommand
6
+ description "deletes the stored API token"
7
+
8
+ def run
9
+ session.remove_token
10
+ endpoint_config['access_token'] = nil
11
+ success("Successfully removed the access token!")
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/travis/cli.rb CHANGED
@@ -13,46 +13,48 @@ require 'stringio'
13
13
 
14
14
  module Travis
15
15
  module CLI
16
- autoload :Token, 'travis/cli/token'
17
- autoload :ApiCommand, 'travis/cli/api_command'
18
- autoload :Accounts, 'travis/cli/accounts'
19
- autoload :Branches, 'travis/cli/branches'
20
- autoload :Cache, 'travis/cli/cache'
21
- autoload :Cancel, 'travis/cli/cancel'
22
- autoload :Command, 'travis/cli/command'
23
- autoload :Console, 'travis/cli/console'
24
- autoload :Disable, 'travis/cli/disable'
25
- autoload :Enable, 'travis/cli/enable'
26
- autoload :Encrypt, 'travis/cli/encrypt'
27
- autoload :EncryptFile, 'travis/cli/encrypt_file'
28
- autoload :Endpoint, 'travis/cli/endpoint'
29
- autoload :Env, 'travis/cli/env'
30
- autoload :Help, 'travis/cli/help'
31
- autoload :History, 'travis/cli/history'
32
- autoload :Init, 'travis/cli/init'
33
- autoload :Lint, 'travis/cli/lint'
34
- autoload :Login, 'travis/cli/login'
35
- autoload :Logout, 'travis/cli/logout'
36
- autoload :Logs, 'travis/cli/logs'
37
- autoload :Monitor, 'travis/cli/monitor'
38
- autoload :Open, 'travis/cli/open'
39
- autoload :Parser, 'travis/cli/parser'
40
- autoload :Pubkey, 'travis/cli/pubkey'
41
- autoload :Raw, 'travis/cli/raw'
42
- autoload :RepoCommand, 'travis/cli/repo_command'
43
- autoload :Report, 'travis/cli/report'
44
- autoload :Repos, 'travis/cli/repos'
45
- autoload :Restart, 'travis/cli/restart'
46
- autoload :Requests, 'travis/cli/requests'
47
- autoload :Settings, 'travis/cli/settings'
48
- autoload :Setup, 'travis/cli/setup'
49
- autoload :Show, 'travis/cli/show'
50
- autoload :Sshkey, 'travis/cli/sshkey'
51
- autoload :Status, 'travis/cli/status'
52
- autoload :Sync, 'travis/cli/sync'
53
- autoload :Version, 'travis/cli/version'
54
- autoload :Whatsup, 'travis/cli/whatsup'
55
- autoload :Whoami, 'travis/cli/whoami'
16
+ autoload :Token, 'travis/cli/token'
17
+ autoload :ApiCommand, 'travis/cli/api_command'
18
+ autoload :Accounts, 'travis/cli/accounts'
19
+ autoload :Branches, 'travis/cli/branches'
20
+ autoload :Cache, 'travis/cli/cache'
21
+ autoload :Cancel, 'travis/cli/cancel'
22
+ autoload :Command, 'travis/cli/command'
23
+ autoload :Console, 'travis/cli/console'
24
+ autoload :Disable, 'travis/cli/disable'
25
+ autoload :Enable, 'travis/cli/enable'
26
+ autoload :Encrypt, 'travis/cli/encrypt'
27
+ autoload :EncryptFile, 'travis/cli/encrypt_file'
28
+ autoload :Endpoint, 'travis/cli/endpoint'
29
+ autoload :Env, 'travis/cli/env'
30
+ autoload :Help, 'travis/cli/help'
31
+ autoload :History, 'travis/cli/history'
32
+ autoload :Init, 'travis/cli/init'
33
+ autoload :Lint, 'travis/cli/lint'
34
+ autoload :Login, 'travis/cli/login'
35
+ autoload :Logout, 'travis/cli/logout'
36
+ autoload :Logs, 'travis/cli/logs'
37
+ autoload :Monitor, 'travis/cli/monitor'
38
+ autoload :Open, 'travis/cli/open'
39
+ autoload :Parser, 'travis/cli/parser'
40
+ autoload :Pubkey, 'travis/cli/pubkey'
41
+ autoload :Raw, 'travis/cli/raw'
42
+ autoload :RegenerateToken, 'travis/cli/regenerate_token'
43
+ autoload :RemoveToken, 'travis/cli/remove_token'
44
+ autoload :RepoCommand, 'travis/cli/repo_command'
45
+ autoload :Report, 'travis/cli/report'
46
+ autoload :Repos, 'travis/cli/repos'
47
+ autoload :Restart, 'travis/cli/restart'
48
+ autoload :Requests, 'travis/cli/requests'
49
+ autoload :Settings, 'travis/cli/settings'
50
+ autoload :Setup, 'travis/cli/setup'
51
+ autoload :Show, 'travis/cli/show'
52
+ autoload :Sshkey, 'travis/cli/sshkey'
53
+ autoload :Status, 'travis/cli/status'
54
+ autoload :Sync, 'travis/cli/sync'
55
+ autoload :Version, 'travis/cli/version'
56
+ autoload :Whatsup, 'travis/cli/whatsup'
57
+ autoload :Whoami, 'travis/cli/whoami'
56
58
 
57
59
  extend self
58
60
 
@@ -97,6 +97,22 @@ module Travis
97
97
  session.get_raw('/logout')
98
98
  end
99
99
 
100
+ def regenerate_token
101
+ session.headers['Travis-Api-Version'] = '3'
102
+ token = session.patch_raw('/access_token')
103
+ session.headers.delete('Travis-Api-Version')
104
+
105
+ token
106
+ end
107
+
108
+ def remove_token
109
+ session.headers['Travis-Api-Version'] = '3'
110
+ resp = session.delete_raw('/access_token')
111
+ session.headers.delete('Travis-Api-Version')
112
+
113
+ resp
114
+ end
115
+
100
116
  def listen(*entities, &block)
101
117
  listener = Listener.new(session)
102
118
  listener.subscribe(*entities, &block)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Travis
4
- VERSION = '1.12.0'
4
+ VERSION = '1.13.0'
5
5
  end
data/travis.gemspec CHANGED
@@ -4,7 +4,7 @@
4
4
  Gem::Specification.new do |s|
5
5
  # general info
6
6
  s.name = 'travis'
7
- s.version = '1.12.0'
7
+ s.version = '1.13.0'
8
8
  s.required_ruby_version = '>= 3.2.0'
9
9
  s.description = 'CLI and Ruby client library for Travis CI'
10
10
  s.homepage = 'https://github.com/travis-ci/travis.rb'
@@ -288,6 +288,8 @@ Gem::Specification.new do |s|
288
288
  'lib/travis/cli/parser.rb',
289
289
  'lib/travis/cli/pubkey.rb',
290
290
  'lib/travis/cli/raw.rb',
291
+ 'lib/travis/cli/regenerate_token.rb',
292
+ 'lib/travis/cli/remove_token.rb',
291
293
  'lib/travis/cli/repo_command.rb',
292
294
  'lib/travis/cli/report.rb',
293
295
  'lib/travis/cli/repos.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.12.0
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
@@ -107,7 +107,7 @@ authors:
107
107
  autorequire:
108
108
  bindir: bin
109
109
  cert_chain: []
110
- date: 2024-02-27 00:00:00.000000000 Z
110
+ date: 2024-03-19 00:00:00.000000000 Z
111
111
  dependencies:
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: faraday
@@ -422,6 +422,8 @@ files:
422
422
  - lib/travis/cli/parser.rb
423
423
  - lib/travis/cli/pubkey.rb
424
424
  - lib/travis/cli/raw.rb
425
+ - lib/travis/cli/regenerate_token.rb
426
+ - lib/travis/cli/remove_token.rb
425
427
  - lib/travis/cli/repo_command.rb
426
428
  - lib/travis/cli/report.rb
427
429
  - lib/travis/cli/repos.rb
@@ -562,7 +564,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
562
564
  - !ruby/object:Gem::Version
563
565
  version: '0'
564
566
  requirements: []
565
- rubygems_version: 3.4.1
567
+ rubygems_version: 3.2.15
566
568
  signing_key:
567
569
  specification_version: 4
568
570
  summary: Travis CI client