googleauth 0.8.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.kokoro/build.bat +9 -1
- data/.kokoro/continuous/linux.cfg +12 -2
- data/.kokoro/continuous/osx.cfg +5 -0
- data/.kokoro/continuous/post.cfg +30 -0
- data/.kokoro/continuous/windows.cfg +27 -1
- data/.kokoro/presubmit/linux.cfg +11 -1
- data/.kokoro/presubmit/osx.cfg +5 -0
- data/.kokoro/presubmit/windows.cfg +27 -1
- data/.kokoro/release.cfg +42 -1
- data/.kokoro/trampoline.bat +10 -0
- data/.repo-metadata.json +5 -0
- data/.rubocop.yml +10 -2
- data/CHANGELOG.md +34 -0
- data/Gemfile +8 -3
- data/README.md +7 -12
- data/Rakefile +48 -5
- data/googleauth.gemspec +6 -3
- data/integration/helper.rb +31 -0
- data/integration/id_tokens/key_source_test.rb +74 -0
- data/lib/googleauth.rb +1 -0
- data/lib/googleauth/application_default.rb +1 -1
- data/lib/googleauth/compute_engine.rb +19 -17
- data/lib/googleauth/credentials.rb +318 -63
- data/lib/googleauth/credentials_loader.rb +10 -8
- data/lib/googleauth/id_tokens.rb +233 -0
- data/lib/googleauth/id_tokens/errors.rb +71 -0
- data/lib/googleauth/id_tokens/key_sources.rb +394 -0
- data/lib/googleauth/id_tokens/verifier.rb +144 -0
- data/lib/googleauth/json_key_reader.rb +6 -2
- data/lib/googleauth/service_account.rb +16 -7
- data/lib/googleauth/signet.rb +8 -5
- data/lib/googleauth/user_authorizer.rb +6 -1
- data/lib/googleauth/user_refresh.rb +2 -2
- data/lib/googleauth/version.rb +1 -1
- data/lib/googleauth/web_user_authorizer.rb +13 -8
- data/rakelib/devsite_builder.rb +45 -0
- data/rakelib/link_checker.rb +64 -0
- data/rakelib/repo_metadata.rb +59 -0
- data/spec/googleauth/apply_auth_examples.rb +28 -5
- data/spec/googleauth/compute_engine_spec.rb +25 -13
- data/spec/googleauth/credentials_spec.rb +366 -161
- data/spec/googleauth/service_account_spec.rb +23 -16
- data/spec/googleauth/signet_spec.rb +46 -7
- data/spec/googleauth/user_authorizer_spec.rb +21 -1
- data/spec/googleauth/user_refresh_spec.rb +1 -1
- data/spec/googleauth/web_user_authorizer_spec.rb +6 -0
- data/test/helper.rb +33 -0
- data/test/id_tokens/key_sources_test.rb +240 -0
- data/test/id_tokens/verifier_test.rb +269 -0
- metadata +46 -12
- data/.kokoro/windows.sh +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76c72d4ffdf847178b1dbd45ff3563f30efd9b2e0a251ff70a3cd0a4eaecf842
|
4
|
+
data.tar.gz: 3ae45e385f73dfd312263e2e51ea7d977b9f2a310765626f5e3f38bd03523ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 503a6163b90755a3b07d1dccd6724fa8424501afcfab35582183e871ced300c8d460f6c2068948fdb618ad06b8f074019ed1f0ee4f34546b37bc49dd4a42301c
|
7
|
+
data.tar.gz: 0a6d1a9c75abff1c03e6114b3154351eb6f7041de65d4621e20c86a28725ecfb9bd4b6705081d87df860e9e0f80c0d21f1539aee77a002770254e08ee5cd0615
|
data/.kokoro/build.bat
CHANGED
@@ -5,4 +5,12 @@ REM * Merges run all non-acceptance tests for every library, and acceptance tes
|
|
5
5
|
REM * Nightlies run all acceptance tests for every library.
|
6
6
|
REM Currently only runs tests on 2.5.1
|
7
7
|
|
8
|
-
"
|
8
|
+
SET url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/build.bat"
|
9
|
+
|
10
|
+
SET "download=powershell -C Invoke-WebRequest -Uri %url% -OutFile master-build.bat"
|
11
|
+
|
12
|
+
SET EXIT_STATUS=1
|
13
|
+
|
14
|
+
%download% && master-build.bat && SET EXIT_STATUS=0
|
15
|
+
|
16
|
+
EXIT %EXIT_STATUS%
|
@@ -3,13 +3,23 @@
|
|
3
3
|
build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
|
4
4
|
|
5
5
|
# Configure the docker image for kokoro-trampoline.
|
6
|
-
# Dockerfile is maintained at https://github.com/googleapis/google-cloud-ruby/tree/master/.kokoro/docker/
|
6
|
+
# Dockerfile is maintained at https://github.com/googleapis/google-cloud-ruby/tree/master/.kokoro/docker/multi
|
7
7
|
env_vars: {
|
8
8
|
key: "TRAMPOLINE_IMAGE"
|
9
|
-
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/
|
9
|
+
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/multi"
|
10
10
|
}
|
11
11
|
|
12
12
|
env_vars: {
|
13
13
|
key: "TRAMPOLINE_BUILD_FILE"
|
14
14
|
value: "github/google-auth-library-ruby/.kokoro/build.sh"
|
15
15
|
}
|
16
|
+
|
17
|
+
env_vars: {
|
18
|
+
key: "TRAMPOLINE_SCRIPT"
|
19
|
+
value: "trampoline_v1.py"
|
20
|
+
}
|
21
|
+
|
22
|
+
env_vars: {
|
23
|
+
key: "OS"
|
24
|
+
value: "linux"
|
25
|
+
}
|
data/.kokoro/continuous/osx.cfg
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Format: //devtools/kokoro/config/proto/build.proto
|
2
|
+
|
3
|
+
build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
|
4
|
+
|
5
|
+
# Configure the docker image for kokoro-trampoline.
|
6
|
+
# Dockerfile is maintained at https://github.com/googleapis/google-cloud-ruby/tree/master/.kokoro/docker/multi-node
|
7
|
+
env_vars: {
|
8
|
+
key: "TRAMPOLINE_IMAGE"
|
9
|
+
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/multi-node"
|
10
|
+
}
|
11
|
+
|
12
|
+
env_vars: {
|
13
|
+
key: "TRAMPOLINE_BUILD_FILE"
|
14
|
+
value: "github/google-auth-library-ruby/.kokoro/build.sh"
|
15
|
+
}
|
16
|
+
|
17
|
+
env_vars: {
|
18
|
+
key: "TRAMPOLINE_SCRIPT"
|
19
|
+
value: "trampoline_v1.py"
|
20
|
+
}
|
21
|
+
|
22
|
+
env_vars: {
|
23
|
+
key: "OS"
|
24
|
+
value: "linux"
|
25
|
+
}
|
26
|
+
|
27
|
+
env_vars: {
|
28
|
+
key: "JOB_TYPE"
|
29
|
+
value: "post"
|
30
|
+
}
|
@@ -1,3 +1,29 @@
|
|
1
1
|
# Format: //devtools/kokoro/config/proto/build.proto
|
2
2
|
|
3
|
-
build_file: "google-auth-library-ruby/.kokoro/
|
3
|
+
build_file: "google-auth-library-ruby/.kokoro/trampoline.bat"
|
4
|
+
|
5
|
+
# Configure the docker image for kokoro-trampoline.
|
6
|
+
env_vars: {
|
7
|
+
key: "TRAMPOLINE_IMAGE"
|
8
|
+
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/windows"
|
9
|
+
}
|
10
|
+
|
11
|
+
env_vars: {
|
12
|
+
key: "TRAMPOLINE_BUILD_FILE"
|
13
|
+
value: "github/google-auth-library-ruby/.kokoro/build.bat"
|
14
|
+
}
|
15
|
+
|
16
|
+
env_vars: {
|
17
|
+
key: "TRAMPOLINE_SCRIPT"
|
18
|
+
value: "trampoline_windows.py"
|
19
|
+
}
|
20
|
+
|
21
|
+
env_vars: {
|
22
|
+
key: "REPO_DIR"
|
23
|
+
value: "google-auth-library-ruby"
|
24
|
+
}
|
25
|
+
|
26
|
+
env_vars: {
|
27
|
+
key: "OS"
|
28
|
+
value: "windows"
|
29
|
+
}
|
data/.kokoro/presubmit/linux.cfg
CHANGED
@@ -5,10 +5,20 @@ build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
|
|
5
5
|
# Configure the docker image for kokoro-trampoline.
|
6
6
|
env_vars: {
|
7
7
|
key: "TRAMPOLINE_IMAGE"
|
8
|
-
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/
|
8
|
+
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/multi"
|
9
9
|
}
|
10
10
|
|
11
11
|
env_vars: {
|
12
12
|
key: "TRAMPOLINE_BUILD_FILE"
|
13
13
|
value: "github/google-auth-library-ruby/.kokoro/build.sh"
|
14
14
|
}
|
15
|
+
|
16
|
+
env_vars: {
|
17
|
+
key: "TRAMPOLINE_SCRIPT"
|
18
|
+
value: "trampoline_v1.py"
|
19
|
+
}
|
20
|
+
|
21
|
+
env_vars: {
|
22
|
+
key: "OS"
|
23
|
+
value: "linux"
|
24
|
+
}
|
data/.kokoro/presubmit/osx.cfg
CHANGED
@@ -1,3 +1,29 @@
|
|
1
1
|
# Format: //devtools/kokoro/config/proto/build.proto
|
2
2
|
|
3
|
-
build_file: "google-auth-library-ruby/.kokoro/
|
3
|
+
build_file: "google-auth-library-ruby/.kokoro/trampoline.bat"
|
4
|
+
|
5
|
+
# Configure the docker image for kokoro-trampoline.
|
6
|
+
env_vars: {
|
7
|
+
key: "TRAMPOLINE_IMAGE"
|
8
|
+
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/windows"
|
9
|
+
}
|
10
|
+
|
11
|
+
env_vars: {
|
12
|
+
key: "TRAMPOLINE_BUILD_FILE"
|
13
|
+
value: "github/google-auth-library-ruby/.kokoro/build.bat"
|
14
|
+
}
|
15
|
+
|
16
|
+
env_vars: {
|
17
|
+
key: "TRAMPOLINE_SCRIPT"
|
18
|
+
value: "trampoline_windows.py"
|
19
|
+
}
|
20
|
+
|
21
|
+
env_vars: {
|
22
|
+
key: "REPO_DIR"
|
23
|
+
value: "google-auth-library-ruby"
|
24
|
+
}
|
25
|
+
|
26
|
+
env_vars: {
|
27
|
+
key: "OS"
|
28
|
+
value: "windows"
|
29
|
+
}
|
data/.kokoro/release.cfg
CHANGED
@@ -17,6 +17,37 @@ before_action {
|
|
17
17
|
}
|
18
18
|
}
|
19
19
|
|
20
|
+
# Fetch magictoken to use with Magic Github Proxy
|
21
|
+
before_action {
|
22
|
+
fetch_keystore {
|
23
|
+
keystore_resource {
|
24
|
+
keystore_config_id: 73713
|
25
|
+
keyname: "releasetool-magictoken"
|
26
|
+
backend_type: FASTCONFIGPUSH
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
# Fetch api key to use with Magic Github Proxy
|
32
|
+
before_action {
|
33
|
+
fetch_keystore {
|
34
|
+
keystore_resource {
|
35
|
+
keystore_config_id: 73713
|
36
|
+
keyname: "magic-github-proxy-api-key"
|
37
|
+
backend_type: FASTCONFIGPUSH
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
before_action {
|
43
|
+
fetch_keystore {
|
44
|
+
keystore_resource {
|
45
|
+
keystore_config_id: 73713
|
46
|
+
keyname: "docuploader_service_account"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
20
51
|
# Download resources for system tests (service account key, etc.)
|
21
52
|
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-ruby"
|
22
53
|
|
@@ -29,7 +60,7 @@ build_file: "google-auth-library-ruby/.kokoro/trampoline.sh"
|
|
29
60
|
# Configure the docker image for kokoro-trampoline.
|
30
61
|
env_vars: {
|
31
62
|
key: "TRAMPOLINE_IMAGE"
|
32
|
-
value: "gcr.io/cloud-devrel-kokoro-resources/
|
63
|
+
value: "gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/release"
|
33
64
|
}
|
34
65
|
|
35
66
|
env_vars: {
|
@@ -37,6 +68,11 @@ env_vars: {
|
|
37
68
|
value: "github/google-auth-library-ruby/.kokoro/build.sh"
|
38
69
|
}
|
39
70
|
|
71
|
+
env_vars: {
|
72
|
+
key: "TRAMPOLINE_SCRIPT"
|
73
|
+
value: "trampoline_v1.py"
|
74
|
+
}
|
75
|
+
|
40
76
|
env_vars: {
|
41
77
|
key: "JOB_TYPE"
|
42
78
|
value: "release"
|
@@ -51,3 +87,8 @@ env_vars: {
|
|
51
87
|
key: "REPO_DIR"
|
52
88
|
value: "github/google-auth-library-ruby"
|
53
89
|
}
|
90
|
+
|
91
|
+
env_vars: {
|
92
|
+
key: "PACKAGE"
|
93
|
+
value: "googleauth"
|
94
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
SET url="https://raw.githubusercontent.com/googleapis/google-cloud-ruby/master/.kokoro/trampoline.bat"
|
3
|
+
|
4
|
+
SET "download=powershell -C Invoke-WebRequest -Uri %url% -OutFile master-trampoline.bat"
|
5
|
+
|
6
|
+
SET EXIT_STATUS=1
|
7
|
+
|
8
|
+
%download% && master-trampoline.bat && SET EXIT_STATUS=0
|
9
|
+
|
10
|
+
EXIT %EXIT_STATUS%
|
data/.repo-metadata.json
ADDED
data/.rubocop.yml
CHANGED
@@ -3,9 +3,17 @@ inherit_gem:
|
|
3
3
|
|
4
4
|
AllCops:
|
5
5
|
Exclude:
|
6
|
-
- "spec/**/*"
|
7
6
|
- "Rakefile"
|
7
|
+
- "integration/**/*"
|
8
|
+
- "rakelib/**/*"
|
9
|
+
- "spec/**/*"
|
10
|
+
- "test/**/*"
|
8
11
|
Metrics/ClassLength:
|
9
|
-
Max:
|
12
|
+
Max: 200
|
10
13
|
Metrics/ModuleLength:
|
11
14
|
Max: 110
|
15
|
+
Metrics/BlockLength:
|
16
|
+
Exclude:
|
17
|
+
- "googleauth.gemspec"
|
18
|
+
Style/SafeNavigation:
|
19
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
### 0.13.0 / 2020-06-17
|
2
|
+
|
3
|
+
* Support for validating ID tokens.
|
4
|
+
* Fixed header application of ID tokens from service accounts.
|
5
|
+
|
6
|
+
### 0.12.0 / 2020-04-08
|
7
|
+
|
8
|
+
* Support for ID token credentials.
|
9
|
+
* Support reading quota_id_project from service account credentials.
|
10
|
+
|
11
|
+
### 0.11.0 / 2020-02-24
|
12
|
+
|
13
|
+
* Support Faraday 1.x.
|
14
|
+
* Allow special "postmessage" value for redirect_uri.
|
15
|
+
|
16
|
+
### 0.10.0 / 2019-10-09
|
17
|
+
|
18
|
+
Note: This release now requires Ruby 2.4 or later
|
19
|
+
|
20
|
+
* Increase metadata timeout to improve reliability in some hosting environments
|
21
|
+
* Support an environment variable to suppress Cloud SDK credentials warnings
|
22
|
+
* Make the header check case insensitive
|
23
|
+
* Set instance variables at initialization to avoid spamming warnings
|
24
|
+
* Pass "Metadata-Flavor" header to metadata server when checking for GCE
|
25
|
+
|
26
|
+
### 0.9.0 / 2019-08-05
|
27
|
+
|
28
|
+
* Restore compatibility with Ruby 2.0. This is the last release that will work on end-of-lifed versions of Ruby. The 0.10 release will require Ruby 2.4 or later.
|
29
|
+
* Update Credentials to use methods for values that are intended to be changed by users, replacing constants.
|
30
|
+
* Add retry on error for fetch_access_token
|
31
|
+
* Allow specifying custom state key-values
|
32
|
+
* Add verbosity none to gcloud command
|
33
|
+
* Make arity of WebUserAuthorizer#get_credentials compatible with the base class
|
34
|
+
|
1
35
|
### 0.8.1 / 2019-03-27
|
2
36
|
|
3
37
|
* Silence unnecessary gcloud warning
|
data/Gemfile
CHANGED
@@ -8,18 +8,23 @@ group :development do
|
|
8
8
|
gem "coveralls", "~> 0.7"
|
9
9
|
gem "fakefs", "~> 0.6"
|
10
10
|
gem "fakeredis", "~> 0.5"
|
11
|
-
gem "google-style", "~> 0
|
11
|
+
gem "google-style", "~> 1.24.0"
|
12
12
|
gem "logging", "~> 2.0"
|
13
|
+
gem "minitest", "~> 5.14"
|
14
|
+
gem "minitest-focus", "~> 1.1"
|
13
15
|
gem "rack-test", "~> 0.6"
|
14
|
-
gem "rake", "~>
|
16
|
+
gem "rake", "~> 13.0"
|
15
17
|
gem "redis", "~> 3.2"
|
16
18
|
gem "rspec", "~> 3.0"
|
17
19
|
gem "simplecov", "~> 0.9"
|
18
20
|
gem "sinatra"
|
19
|
-
gem "webmock", "~>
|
21
|
+
gem "webmock", "~> 3.8"
|
20
22
|
end
|
21
23
|
|
22
24
|
platforms :jruby do
|
23
25
|
group :development do
|
24
26
|
end
|
25
27
|
end
|
28
|
+
|
29
|
+
gem "faraday", "~> 0.17"
|
30
|
+
gem "gems", "~> 1.2"
|
data/README.md
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# Google Auth Library for Ruby
|
2
2
|
|
3
3
|
<dl>
|
4
|
-
<dt>Homepage</dt><dd><a href="http://www.github.com/
|
4
|
+
<dt>Homepage</dt><dd><a href="http://www.github.com/googleapis/google-auth-library-ruby">http://www.github.com/googleapis/google-auth-library-ruby</a></dd>
|
5
5
|
<dt>Authors</dt><dd><a href="mailto:temiola@google.com">Tim Emiola</a></dd>
|
6
6
|
<dt>Copyright</dt><dd>Copyright © 2015 Google, Inc.</dd>
|
7
7
|
<dt>License</dt><dd>Apache 2.0</dd>
|
8
8
|
</dl>
|
9
9
|
|
10
10
|
[![Gem Version](https://badge.fury.io/rb/googleauth.svg)](http://badge.fury.io/rb/googleauth)
|
11
|
-
[![Build Status](https://secure.travis-ci.org/google/google-auth-library-ruby.svg)](http://travis-ci.org/google/google-auth-library-ruby)
|
12
|
-
[![Coverage Status](https://coveralls.io/repos/google/google-auth-library-ruby/badge.svg)](https://coveralls.io/r/google/google-auth-library-ruby)
|
13
11
|
|
14
12
|
## Description
|
15
13
|
|
@@ -180,15 +178,13 @@ access and refresh tokens. Two storage implementations are included:
|
|
180
178
|
* Google::Auth::Stores::RedisTokenStore
|
181
179
|
|
182
180
|
Custom storage implementations can also be used. See
|
183
|
-
[token_store.rb](
|
181
|
+
[token_store.rb](https://googleapis.dev/ruby/googleauth/latest/Google/Auth/TokenStore.html) for additional details.
|
184
182
|
|
185
183
|
## Supported Ruby Versions
|
186
184
|
|
187
|
-
This library
|
185
|
+
This library requires Ruby 2.4 or later.
|
188
186
|
|
189
|
-
|
190
|
-
reached or are nearing end-of-life. After March 31, 2019, Google will provide
|
191
|
-
official support only for Ruby versions that are considered current and
|
187
|
+
In general, this library supports Ruby versions that are considered current and
|
192
188
|
supported by Ruby Core (that is, Ruby versions that are either in normal
|
193
189
|
maintenance or in security maintenance).
|
194
190
|
See https://www.ruby-lang.org/en/downloads/branches/ for further details.
|
@@ -210,7 +206,6 @@ hesitate to
|
|
210
206
|
[ask questions](http://stackoverflow.com/questions/tagged/google-auth-library-ruby)
|
211
207
|
about the client or APIs on [StackOverflow](http://stackoverflow.com).
|
212
208
|
|
213
|
-
[
|
214
|
-
[
|
215
|
-
[
|
216
|
-
[copying]: https://github.com/google/google-auth-library-ruby/tree/master/COPYING
|
209
|
+
[application default credentials]: https://developers.google.com/accounts/docs/application-default-credentials
|
210
|
+
[contributing]: https://github.com/googleapis/google-auth-library-ruby/tree/master/.github/CONTRIBUTING.md
|
211
|
+
[copying]: https://github.com/googleapis/google-auth-library-ruby/tree/master/COPYING
|
data/Rakefile
CHANGED
@@ -1,18 +1,40 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
+
require "json"
|
2
3
|
require "bundler/gem_tasks"
|
3
4
|
|
5
|
+
require "rubocop/rake_task"
|
6
|
+
RuboCop::RakeTask.new
|
7
|
+
|
8
|
+
require "rake/testtask"
|
9
|
+
|
10
|
+
desc "Run tests."
|
11
|
+
Rake::TestTask.new do |t|
|
12
|
+
t.libs << "test"
|
13
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
14
|
+
t.warning = false
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run integration tests."
|
18
|
+
Rake::TestTask.new("integration") do |t|
|
19
|
+
t.libs << "integration"
|
20
|
+
t.test_files = FileList["integration/**/*_test.rb"]
|
21
|
+
t.warning = false
|
22
|
+
end
|
23
|
+
|
4
24
|
task :ci do
|
5
25
|
header "Using Ruby - #{RUBY_VERSION}"
|
6
26
|
sh "bundle exec rubocop"
|
27
|
+
Rake::Task["test"].invoke
|
28
|
+
Rake::Task["integration"].invoke
|
7
29
|
sh "bundle exec rspec"
|
8
30
|
end
|
9
31
|
|
10
|
-
task :
|
32
|
+
task :release_gem, :tag do |_t, args|
|
11
33
|
tag = args[:tag]
|
12
34
|
raise "You must provide a tag to release." if tag.nil?
|
13
35
|
|
14
36
|
# Verify the tag format "vVERSION"
|
15
|
-
m = tag.match
|
37
|
+
m = tag.match /v(?<version>\S*)/
|
16
38
|
raise "Tag #{tag} does not match the expected format." if m.nil?
|
17
39
|
|
18
40
|
version = m[:version]
|
@@ -33,17 +55,24 @@ task :release, :tag do |_t, args|
|
|
33
55
|
sh "bundle exec rake build"
|
34
56
|
end
|
35
57
|
|
36
|
-
path_to_be_pushed = "pkg
|
58
|
+
path_to_be_pushed = "pkg/googleauth-#{version}.gem"
|
59
|
+
gem_was_published = nil
|
37
60
|
if File.file? path_to_be_pushed
|
38
61
|
begin
|
39
|
-
::Gems.push File.new(path_to_be_pushed)
|
62
|
+
response = ::Gems.push File.new(path_to_be_pushed)
|
63
|
+
puts response
|
64
|
+
raise unless response.include? "Successfully registered gem:"
|
65
|
+
gem_was_published = true
|
40
66
|
puts "Successfully built and pushed googleauth for version #{version}"
|
41
67
|
rescue StandardError => e
|
68
|
+
gem_was_published = false
|
42
69
|
puts "Error while releasing googleauth version #{version}: #{e.message}"
|
43
70
|
end
|
44
71
|
else
|
45
72
|
raise "Cannot build googleauth for version #{version}"
|
46
73
|
end
|
74
|
+
|
75
|
+
Rake::Task["kokoro:publish_docs"].invoke if gem_was_published
|
47
76
|
end
|
48
77
|
|
49
78
|
namespace :kokoro do
|
@@ -63,6 +92,14 @@ namespace :kokoro do
|
|
63
92
|
Rake::Task["ci"].invoke
|
64
93
|
end
|
65
94
|
|
95
|
+
task :post do
|
96
|
+
require_relative "rakelib/link_checker.rb"
|
97
|
+
|
98
|
+
link_checker = LinkChecker.new
|
99
|
+
link_checker.run
|
100
|
+
exit link_checker.exit_status
|
101
|
+
end
|
102
|
+
|
66
103
|
task :nightly do
|
67
104
|
Rake::Task["ci"].invoke
|
68
105
|
end
|
@@ -75,7 +112,13 @@ namespace :kokoro do
|
|
75
112
|
.first.split("(").last.split(")").first || "0.1.0"
|
76
113
|
end
|
77
114
|
Rake::Task["kokoro:load_env_vars"].invoke
|
78
|
-
Rake::Task["
|
115
|
+
Rake::Task["release_gem"].invoke "v#{version}"
|
116
|
+
end
|
117
|
+
|
118
|
+
task :publish_docs do
|
119
|
+
require_relative "rakelib/devsite_builder.rb"
|
120
|
+
|
121
|
+
DevsiteBuilder.new(__dir__).publish
|
79
122
|
end
|
80
123
|
end
|
81
124
|
|