googleauth 0.13.1 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +7 -0
- data/.github/workflows/ci.yml +55 -0
- data/.github/workflows/release-please.yml +39 -0
- data/.gitignore +3 -0
- data/.kokoro/populate-secrets.sh +76 -0
- data/.kokoro/release.cfg +7 -49
- data/.kokoro/release.sh +18 -0
- data/.kokoro/trampoline_v2.sh +489 -0
- data/.rubocop.yml +0 -2
- data/.toys/.toys.rb +45 -0
- data/.toys/ci.rb +43 -0
- data/.toys/kokoro/.toys.rb +66 -0
- data/.toys/kokoro/publish-docs.rb +67 -0
- data/.toys/kokoro/publish-gem.rb +53 -0
- data/.toys/linkinator.rb +43 -0
- data/.trampolinerc +48 -0
- data/CHANGELOG.md +66 -26
- data/Gemfile +2 -7
- data/{COPYING → LICENSE} +0 -0
- data/README.md +9 -7
- data/googleauth.gemspec +2 -1
- data/lib/googleauth/compute_engine.rb +30 -8
- data/lib/googleauth/credentials.rb +167 -48
- data/lib/googleauth/credentials_loader.rb +1 -1
- data/lib/googleauth/iam.rb +1 -1
- data/lib/googleauth/id_tokens/key_sources.rb +7 -5
- data/lib/googleauth/id_tokens/verifier.rb +7 -9
- data/lib/googleauth/scope_util.rb +1 -1
- data/lib/googleauth/service_account.rb +31 -21
- data/lib/googleauth/signet.rb +1 -1
- data/lib/googleauth/stores/file_token_store.rb +1 -0
- data/lib/googleauth/stores/redis_token_store.rb +1 -0
- data/lib/googleauth/version.rb +1 -1
- data/lib/googleauth/web_user_authorizer.rb +4 -7
- data/spec/googleauth/compute_engine_spec.rb +36 -4
- data/spec/googleauth/credentials_spec.rb +228 -106
- data/spec/googleauth/service_account_spec.rb +8 -0
- metadata +18 -23
- data/.kokoro/build.bat +0 -16
- data/.kokoro/build.sh +0 -4
- data/.kokoro/continuous/common.cfg +0 -24
- data/.kokoro/continuous/linux.cfg +0 -25
- data/.kokoro/continuous/osx.cfg +0 -8
- data/.kokoro/continuous/post.cfg +0 -30
- data/.kokoro/continuous/windows.cfg +0 -29
- data/.kokoro/osx.sh +0 -4
- data/.kokoro/presubmit/common.cfg +0 -24
- data/.kokoro/presubmit/linux.cfg +0 -24
- data/.kokoro/presubmit/osx.cfg +0 -8
- data/.kokoro/presubmit/windows.cfg +0 -29
- data/.kokoro/trampoline.bat +0 -10
- data/.kokoro/trampoline.sh +0 -4
- data/Rakefile +0 -132
- data/rakelib/devsite_builder.rb +0 -45
- data/rakelib/link_checker.rb +0 -64
- data/rakelib/repo_metadata.rb +0 -59
data/rakelib/devsite_builder.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require "pathname"
|
2
|
-
|
3
|
-
require_relative "repo_metadata.rb"
|
4
|
-
|
5
|
-
class DevsiteBuilder
|
6
|
-
def initialize master_dir = "."
|
7
|
-
@master_dir = Pathname.new master_dir
|
8
|
-
@output_dir = "doc"
|
9
|
-
@metadata = RepoMetadata.from_source "#{master_dir}/.repo-metadata.json"
|
10
|
-
end
|
11
|
-
|
12
|
-
def build
|
13
|
-
FileUtils.remove_dir @output_dir if Dir.exist? @output_dir
|
14
|
-
markup = "--markup markdown"
|
15
|
-
|
16
|
-
Dir.chdir @master_dir do
|
17
|
-
cmds = ["-o #{@output_dir}", markup]
|
18
|
-
cmd "yard --verbose #{cmds.join ' '}"
|
19
|
-
end
|
20
|
-
@metadata.build @master_dir + @output_dir
|
21
|
-
end
|
22
|
-
|
23
|
-
def upload
|
24
|
-
Dir.chdir @output_dir do
|
25
|
-
opts = [
|
26
|
-
"--credentials=#{ENV['KOKORO_KEYSTORE_DIR']}/73713_docuploader_service_account",
|
27
|
-
"--staging-bucket=#{ENV.fetch 'STAGING_BUCKET', 'docs-staging'}",
|
28
|
-
"--metadata-file=./docs.metadata"
|
29
|
-
]
|
30
|
-
cmd "python3 -m docuploader upload . #{opts.join ' '}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def publish
|
35
|
-
build
|
36
|
-
upload
|
37
|
-
end
|
38
|
-
|
39
|
-
def cmd line
|
40
|
-
puts line
|
41
|
-
output = `#{line}`
|
42
|
-
puts output
|
43
|
-
output
|
44
|
-
end
|
45
|
-
end
|
data/rakelib/link_checker.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require "open3"
|
2
|
-
|
3
|
-
class LinkChecker
|
4
|
-
def initialize
|
5
|
-
@failed = false
|
6
|
-
end
|
7
|
-
|
8
|
-
def run
|
9
|
-
job_info
|
10
|
-
git_commit = ENV.fetch "KOKORO_GITHUB_COMMIT", "master"
|
11
|
-
|
12
|
-
markdown_files = Dir.glob "**/*.md"
|
13
|
-
broken_markdown_links = check_links markdown_files,
|
14
|
-
"https://github.com/googleapis/google-auth-library-ruby/tree/#{git_commit}",
|
15
|
-
" --skip '^(?!(\\Wruby.*google|.*google.*\\Wruby|.*cloud\\.google\\.com))'"
|
16
|
-
|
17
|
-
broken_devsite_links = check_links ["googleauth"],
|
18
|
-
"https://googleapis.dev/ruby",
|
19
|
-
"/latest/ --recurse --skip https:.*github.*"
|
20
|
-
|
21
|
-
puts_broken_links broken_markdown_links
|
22
|
-
puts_broken_links broken_devsite_links
|
23
|
-
end
|
24
|
-
|
25
|
-
def check_links location_list, base, tail
|
26
|
-
broken_links = Hash.new { |h, k| h[k] = [] }
|
27
|
-
location_list.each do |location|
|
28
|
-
out, err, st = Open3.capture3 "npx linkinator #{base}/#{location}#{tail}"
|
29
|
-
puts out
|
30
|
-
unless st.to_i.zero?
|
31
|
-
@failed = true
|
32
|
-
puts err
|
33
|
-
end
|
34
|
-
checked_links = out.split "\n"
|
35
|
-
checked_links.select! { |link| link =~ /\[\d+\]/ && !link.include?("[200]") }
|
36
|
-
unless checked_links.empty?
|
37
|
-
@failed = true
|
38
|
-
broken_links[location] += checked_links
|
39
|
-
end
|
40
|
-
end
|
41
|
-
broken_links
|
42
|
-
end
|
43
|
-
|
44
|
-
def puts_broken_links link_hash
|
45
|
-
link_hash.each do |location, links|
|
46
|
-
puts "#{location} contains the following broken links:"
|
47
|
-
links.each { |link| puts " #{link}" }
|
48
|
-
puts ""
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def job_info
|
53
|
-
line_length = "Using Ruby - #{RUBY_VERSION}".length + 8
|
54
|
-
puts ""
|
55
|
-
puts "#" * line_length
|
56
|
-
puts "### Using Ruby - #{RUBY_VERSION} ###"
|
57
|
-
puts "#" * line_length
|
58
|
-
puts ""
|
59
|
-
end
|
60
|
-
|
61
|
-
def exit_status
|
62
|
-
@failed ? 1 : 0
|
63
|
-
end
|
64
|
-
end
|
data/rakelib/repo_metadata.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require "json"
|
2
|
-
|
3
|
-
class RepoMetadata
|
4
|
-
attr_reader :data
|
5
|
-
|
6
|
-
def initialize data
|
7
|
-
@data = data
|
8
|
-
normalize_data!
|
9
|
-
end
|
10
|
-
|
11
|
-
def allowed_fields
|
12
|
-
[
|
13
|
-
"name", "version", "language", "distribution-name",
|
14
|
-
"product-page", "github-repository", "issue-tracker"
|
15
|
-
]
|
16
|
-
end
|
17
|
-
|
18
|
-
def build output_directory
|
19
|
-
fields = @data.to_a.map { |kv| "--#{kv[0]} #{kv[1]}" }
|
20
|
-
Dir.chdir output_directory do
|
21
|
-
cmd "python3 -m docuploader create-metadata #{fields.join ' '}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def normalize_data!
|
26
|
-
require_relative "../lib/googleauth/version.rb"
|
27
|
-
|
28
|
-
@data.delete_if { |k, _| !allowed_fields.include?(k) }
|
29
|
-
@data["version"] = "v#{Google::Auth::VERSION}"
|
30
|
-
end
|
31
|
-
|
32
|
-
def [] key
|
33
|
-
data[key]
|
34
|
-
end
|
35
|
-
|
36
|
-
def []= key, value
|
37
|
-
@data[key] = value
|
38
|
-
end
|
39
|
-
|
40
|
-
def cmd line
|
41
|
-
puts line
|
42
|
-
output = `#{line}`
|
43
|
-
puts output
|
44
|
-
output
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.from_source source
|
48
|
-
if source.is_a? RepoMetadata
|
49
|
-
data = source.data
|
50
|
-
elsif source.is_a? Hash
|
51
|
-
data = source
|
52
|
-
elsif File.file? source
|
53
|
-
data = JSON.parse File.read(source)
|
54
|
-
else
|
55
|
-
raise "Source must be a path, hash, or RepoMetadata instance"
|
56
|
-
end
|
57
|
-
RepoMetadata.new data
|
58
|
-
end
|
59
|
-
end
|