gapic-generator-cloud 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +24 -0
- data/CONTRIBUTING.md +28 -0
- data/LICENSE +202 -0
- data/README.md +84 -0
- data/bin/protoc-gen-ruby_cloud +33 -0
- data/bin/ruby-cloud-docker-entrypoint +63 -0
- data/cloud-rubocop.yml +14 -0
- data/lib/gapic/generator/cloud/version.rb +23 -0
- data/lib/gapic/generators/cloud_generator.rb +76 -0
- data/templates/cloud/gem/authentication.erb +169 -0
- data/templates/cloud/gem/dashed.erb +2 -0
- data/templates/cloud/gem/gemspec.erb +38 -0
- data/templates/cloud/gem/gitignore.erb +21 -0
- data/templates/cloud/gem/license.erb +202 -0
- data/templates/cloud/gem/rakefile.erb +82 -0
- data/templates/cloud/gem/repo-metadata.erb +6 -0
- data/templates/cloud/gem/rubocop.erb +64 -0
- data/templates/cloud/gem/yardopts.erb +13 -0
- data/templates/cloud/service/client/_credentials.erb +30 -0
- data/templates/cloud/service/client/_requires.erb +2 -0
- data/templates/cloud/service/client/_self_configure.erb +13 -0
- data/templates/cloud/service/client/method/def/_rescue.erb +3 -0
- data/templates/cloud/service/client/method/docs/_error.erb +2 -0
- data/templates/cloud/shared/_license.erb +13 -0
- metadata +213 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
<%- assert_locals gem -%>
|
2
|
+
<%= render partial: "shared/header" -%>
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "bundler/gem_tasks"
|
6
|
+
|
7
|
+
require "rubocop/rake_task"
|
8
|
+
RuboCop::RakeTask.new
|
9
|
+
|
10
|
+
require "rake/testtask"
|
11
|
+
desc "Run tests."
|
12
|
+
Rake::TestTask.new do |t|
|
13
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
14
|
+
t.warning = false
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :test do
|
18
|
+
desc "Runs tests with coverage."
|
19
|
+
task :coverage do
|
20
|
+
require "simplecov"
|
21
|
+
SimpleCov.start do
|
22
|
+
command_name "<%= gem.name %>"
|
23
|
+
track_files "lib/**/*.rb"
|
24
|
+
add_filter "test/"
|
25
|
+
end
|
26
|
+
|
27
|
+
Rake::Task[:test].invoke
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Acceptance tests
|
32
|
+
desc "Run the <%= gem.name %> acceptance tests."
|
33
|
+
task :acceptance do
|
34
|
+
puts "The <%= gem.name %> gem does not have acceptance tests."
|
35
|
+
end
|
36
|
+
|
37
|
+
namespace :acceptance do
|
38
|
+
task :coverage do
|
39
|
+
end
|
40
|
+
task :cleanup do
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
require "yard"
|
45
|
+
require "yard/rake/yardoc_task"
|
46
|
+
YARD::Rake::YardocTask.new do |y|
|
47
|
+
y.options << "--fail-on-warning"
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Run yard-doctest example tests."
|
51
|
+
task :doctest do
|
52
|
+
puts "The <%= gem.name %> gem does not have doctest tests."
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Run the CI build"
|
56
|
+
task :ci do
|
57
|
+
header "BUILDING <%= gem.name %>"
|
58
|
+
header "<%= gem.name %> rubocop", "*"
|
59
|
+
Rake::Task[:rubocop].invoke
|
60
|
+
header "<%= gem.name %> yard", "*"
|
61
|
+
Rake::Task[:yard].invoke
|
62
|
+
header "<%= gem.name %> test", "*"
|
63
|
+
Rake::Task[:test].invoke
|
64
|
+
end
|
65
|
+
|
66
|
+
namespace :ci do
|
67
|
+
task :acceptance do
|
68
|
+
end
|
69
|
+
task :a do
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
task default: :test
|
74
|
+
|
75
|
+
def header str, token = "#"
|
76
|
+
line_length = str.length + 8
|
77
|
+
puts ""
|
78
|
+
puts token * line_length
|
79
|
+
puts "#{token * 3} #{str} #{token * 3}"
|
80
|
+
puts token * line_length
|
81
|
+
puts ""
|
82
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<%- assert_locals gem -%>
|
2
|
+
inherit_gem:
|
3
|
+
google-style: google-style.yml
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
Exclude:
|
7
|
+
- "lib/**/*_pb.rb"
|
8
|
+
- "proto_docs/**/*"
|
9
|
+
- "test/**/*"
|
10
|
+
|
11
|
+
Metrics/AbcSize:
|
12
|
+
Exclude:
|
13
|
+
<%- gem.packages.each do |package| -%>
|
14
|
+
<%- package.services.each do |service| -%>
|
15
|
+
- "lib/<%= service.client_file_path.sub "client.rb", "*.rb" %>"
|
16
|
+
<%- end -%>
|
17
|
+
<%- end -%>
|
18
|
+
Metrics/ClassLength:
|
19
|
+
Exclude:
|
20
|
+
<%- gem.packages.each do |package| -%>
|
21
|
+
<%- package.services.each do |service| -%>
|
22
|
+
- "lib/<%= service.client_file_path.sub "client.rb", "*.rb" %>"
|
23
|
+
<%- end -%>
|
24
|
+
<%- end -%>
|
25
|
+
Metrics/CyclomaticComplexity:
|
26
|
+
Exclude:
|
27
|
+
<%- gem.packages.each do |package| -%>
|
28
|
+
<%- package.services.each do |service| -%>
|
29
|
+
- "lib/<%= service.client_file_path.sub "client.rb", "*.rb" %>"
|
30
|
+
<%- end -%>
|
31
|
+
<%- end -%>
|
32
|
+
Metrics/LineLength:
|
33
|
+
Exclude:
|
34
|
+
<%- gem.packages.each do |package| -%>
|
35
|
+
<%- package.services.each do |service| -%>
|
36
|
+
- "lib/<%= service.client_file_path.sub "client.rb", "*.rb" %>"
|
37
|
+
<%- end -%>
|
38
|
+
<%- end -%>
|
39
|
+
- "<%= gem.name %>.gemspec"
|
40
|
+
Metrics/MethodLength:
|
41
|
+
Exclude:
|
42
|
+
<%- gem.packages.each do |package| -%>
|
43
|
+
<%- package.services.each do |service| -%>
|
44
|
+
- "lib/<%= service.client_file_path.sub "client.rb", "*.rb" %>"
|
45
|
+
<%- end -%>
|
46
|
+
<%- end -%>
|
47
|
+
Metrics/PerceivedComplexity:
|
48
|
+
Exclude:
|
49
|
+
<%- gem.packages.each do |package| -%>
|
50
|
+
<%- package.services.each do |service| -%>
|
51
|
+
- "lib/<%= service.client_file_path.sub "client.rb", "*.rb" %>"
|
52
|
+
<%- end -%>
|
53
|
+
<%- end -%>
|
54
|
+
Naming/FileName:
|
55
|
+
Exclude:
|
56
|
+
- "lib/<%= gem.name %>.rb"
|
57
|
+
Style/CaseEquality:
|
58
|
+
Exclude:
|
59
|
+
<%- gem.packages.each do |package| -%>
|
60
|
+
<%- package.services.each do |service| -%>
|
61
|
+
- "lib/<%= service.client_file_path.sub "client.rb", "*.rb" %>"
|
62
|
+
<%- end -%>
|
63
|
+
<%- end -%>
|
64
|
+
- "lib/<%= gem.name.tr "-", "/" %>.rb"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<%- assert_locals service -%>
|
2
|
+
<% @requires = capture do %>
|
3
|
+
require "googleauth"
|
4
|
+
<% end %>
|
5
|
+
# Credentials for the <%= service.name %> API.
|
6
|
+
class <%= service.credentials_name %> < Google::Auth::Credentials
|
7
|
+
<%- if service.client_scopes.any? -%>
|
8
|
+
self.scope = [
|
9
|
+
<%- service.client_scopes.each_with_index do |client_scope, index| -%>
|
10
|
+
<%- comma = index == service.client_scopes.count - 1 ? "" : "," -%>
|
11
|
+
<%= client_scope.inspect %><%= comma %>
|
12
|
+
<%- end -%>
|
13
|
+
]
|
14
|
+
<%- end -%>
|
15
|
+
self.env_vars = [
|
16
|
+
"<%= service.gem.env_prefix %>_CREDENTIALS",
|
17
|
+
"<%= service.gem.env_prefix %>_KEYFILE",
|
18
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
19
|
+
"GOOGLE_CLOUD_KEYFILE",
|
20
|
+
"GCLOUD_KEYFILE",
|
21
|
+
"<%= service.gem.env_prefix %>_CREDENTIALS_JSON",
|
22
|
+
"<%= service.gem.env_prefix %>_KEYFILE_JSON",
|
23
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
24
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
25
|
+
"GCLOUD_KEYFILE_JSON"
|
26
|
+
]
|
27
|
+
self.paths = [
|
28
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
29
|
+
]
|
30
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%- assert_locals service -%>
|
2
|
+
@configure ||= begin
|
3
|
+
namespace = <%= service.namespace.split("::").inspect %>
|
4
|
+
parent_config = while namespace.any?
|
5
|
+
parent_name = namespace.join "::"
|
6
|
+
parent_const = const_get parent_name
|
7
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
8
|
+
namespace.pop
|
9
|
+
end
|
10
|
+
<%= service.client_name %>::Configuration.new parent_config
|
11
|
+
end
|
12
|
+
yield @configure if block_given?
|
13
|
+
@configure
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Copyright <%= Time.now.year %> Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
metadata
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gapic-generator-cloud
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ernest Landrito
|
8
|
+
- Chris Smith
|
9
|
+
- Mike Moore
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2020-03-08 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: actionpack
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '5.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '5.2'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: gapic-generator
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.1.0
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.1.0
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: google-style
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.24.0
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.24.0
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: protobuf
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '3.8'
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '3.8'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: bundler
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.1'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '2.1'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: grpc-tools
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '1.19'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '1.19'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: minitest
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '5.0'
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '5.0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: minitest-autotest
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '1.0'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - "~>"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '1.0'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: minitest-focus
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - "~>"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '1.0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - "~>"
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '1.0'
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: rake
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - "~>"
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '12.0'
|
148
|
+
type: :development
|
149
|
+
prerelease: false
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - "~>"
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '12.0'
|
155
|
+
description:
|
156
|
+
email:
|
157
|
+
- landrito@google.com
|
158
|
+
- quartzmo@gmail.com
|
159
|
+
- mike@blowmage.com
|
160
|
+
executables:
|
161
|
+
- protoc-gen-ruby_cloud
|
162
|
+
- ruby-cloud-docker-entrypoint
|
163
|
+
extensions: []
|
164
|
+
extra_rdoc_files: []
|
165
|
+
files:
|
166
|
+
- CHANGELOG.md
|
167
|
+
- CONTRIBUTING.md
|
168
|
+
- LICENSE
|
169
|
+
- README.md
|
170
|
+
- bin/protoc-gen-ruby_cloud
|
171
|
+
- bin/ruby-cloud-docker-entrypoint
|
172
|
+
- cloud-rubocop.yml
|
173
|
+
- lib/gapic/generator/cloud/version.rb
|
174
|
+
- lib/gapic/generators/cloud_generator.rb
|
175
|
+
- templates/cloud/gem/authentication.erb
|
176
|
+
- templates/cloud/gem/dashed.erb
|
177
|
+
- templates/cloud/gem/gemspec.erb
|
178
|
+
- templates/cloud/gem/gitignore.erb
|
179
|
+
- templates/cloud/gem/license.erb
|
180
|
+
- templates/cloud/gem/rakefile.erb
|
181
|
+
- templates/cloud/gem/repo-metadata.erb
|
182
|
+
- templates/cloud/gem/rubocop.erb
|
183
|
+
- templates/cloud/gem/yardopts.erb
|
184
|
+
- templates/cloud/service/client/_credentials.erb
|
185
|
+
- templates/cloud/service/client/_requires.erb
|
186
|
+
- templates/cloud/service/client/_self_configure.erb
|
187
|
+
- templates/cloud/service/client/method/def/_rescue.erb
|
188
|
+
- templates/cloud/service/client/method/docs/_error.erb
|
189
|
+
- templates/cloud/shared/_license.erb
|
190
|
+
homepage: https://github.com/googleapis/gapic-generator-ruby
|
191
|
+
licenses:
|
192
|
+
- Apache-2.0
|
193
|
+
metadata: {}
|
194
|
+
post_install_message:
|
195
|
+
rdoc_options: []
|
196
|
+
require_paths:
|
197
|
+
- lib
|
198
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: '0'
|
203
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
requirements: []
|
209
|
+
rubygems_version: 3.1.2
|
210
|
+
signing_key:
|
211
|
+
specification_version: 4
|
212
|
+
summary: An API Client Generator for Ruby in Ruby!
|
213
|
+
test_files: []
|