gapic-generator-cloud 0.6.6 → 0.6.11

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: 2e359e61601902da9832af1c7ad6189098a9758d2030cbc000fedd1314022167
4
- data.tar.gz: 2af72feba6c809ebf3ac4d6603a5e2443ab304747596373a2680b63d99718da4
3
+ metadata.gz: 2957bcfef6da89ca64200f8299f0f84767da2fa04830230dd9d2a27d43ecf2a5
4
+ data.tar.gz: 2d591da86b144ce9817d3a75d90084ea1b8d6b33e79e61ee3c90bffa3c3b412b
5
5
  SHA512:
6
- metadata.gz: 7a3550151980f55d5a31e17e67226e8e0767af2ae0c993f8225056bfb96b94979966c207be0977b9e97e1289bdfb5db8ed9c525e214d762a96bc17fec19f1ea9
7
- data.tar.gz: f3914d12bf66c93bfdec7ebccb13fd55f1d366b76c7053bc3cb87bbb347964d60b9b1142c53dffd80706cc6664eb9859913a5daafbf0aca491d136e9c4f94301
6
+ metadata.gz: 991ec0c1d722ff6a851ad908a2f003dddaeb1abfa0e035b939e293fa0914fcf1fd73444b8f86e1afa3cc74672f4780da91383e110a4787dbbecca94474b2bb9c
7
+ data.tar.gz: 22d52a0982fd15315f009fe2fac863c00985669cad9b5426e70a3a9e25e86927bc76f3f3ffe9da970eebcc42e1c22baf4028cb69e9a296f473aadaf422a4fb49
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Release History for gapic-generator-cloud
2
2
 
3
+ ### 0.6.11 / 2021-02-01
4
+
5
+ * Includes changes from gapic-generator 0.6.11.
6
+ * Updated generated readmes to cover main vs versioned clients.
7
+
8
+ ### 0.6.10 / 2021-01-13
9
+
10
+ * Includes changes from gapic-generator 0.6.10.
11
+ * A set of human-readable cloud-specific command-line parameters can now be specified for the gapic-generator-cloud, e.g. `ruby-cloud-gem-name`. These parameters strictly duplicate the existing behaviour of old command-line parameters, e.g. `:gem.:name`.
12
+
13
+ ### 0.6.9 / 2020-12-07
14
+
15
+ * Includes changes from gapic-generator 0.6.9.
16
+
17
+ ### 0.6.8 / 2020-09-16
18
+
19
+ * Includes changes from gapic-generator 0.6.8.
20
+
21
+ ### 0.6.7 / 2020-08-07
22
+
23
+ * Includes changes from gapic-generator 0.6.7.
24
+
3
25
  ### 0.6.6 / 2020-08-05
4
26
 
5
27
  * Includes changes from gapic-generator 0.6.6.
@@ -18,7 +18,7 @@
18
18
  module Gapic
19
19
  module Generator
20
20
  module Cloud
21
- VERSION = "0.6.6"
21
+ VERSION = "0.6.11"
22
22
  end
23
23
  end
24
24
  end
@@ -15,6 +15,7 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require "gapic/generators/default_generator"
18
+ require "gapic/generators/cloud_generator_parameters"
18
19
  require "gapic/presenters"
19
20
  require "gapic/presenters/cloud_gem_presenter"
20
21
  require "gapic/presenters/wrapper_gem_presenter"
@@ -101,6 +102,13 @@ module Gapic
101
102
 
102
103
  # rubocop:enable all
103
104
 
105
+ # Schema of the parameters that the generator accepts
106
+ # @return [Gapic::Schema::ParameterSchema]
107
+ def self.parameter_schema
108
+ CloudGeneratorParameters.default_schema
109
+ end
110
+
111
+
104
112
  private
105
113
 
106
114
  ##
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require "gapic/generators/default_generator_parameters"
18
+
19
+ module Gapic
20
+ module Generators
21
+ # Contains the cloud generator's parameters
22
+ module CloudGeneratorParameters
23
+ BOOL_PARAMETERS_ALIASES = {
24
+ "ruby-cloud-free-tier" => ":gem.:free_tier",
25
+ "ruby-cloud-yard-strict" => ":gem.:yard_strict",
26
+ "ruby-cloud-generic-endpoint" => ":gem.:generic_endpoint"
27
+ }.freeze
28
+
29
+ STRING_PARAMETERS_ALIASES = {
30
+ "ruby-cloud-gem-name" => ":gem.:name",
31
+ "ruby-cloud-gem-namespace" => ":gem.:namespace",
32
+ "ruby-cloud-title" => ":gem.:title",
33
+ "ruby-cloud-description" => ":gem.:description",
34
+ "ruby-cloud-summary" => ":gem.:summary",
35
+ "ruby-cloud-homepage" => ":gem.:homepage",
36
+ "ruby-cloud-env-prefix" => ":gem.:env_prefix",
37
+ "ruby-cloud-wrapper-of" => ":gem.:version_dependencies",
38
+ "ruby-cloud-migration-version" => ":gem.:migration_version",
39
+ "ruby-cloud-product-url" => ":gem.:product_documentation_url",
40
+ "ruby-cloud-issues-url" => ":gem.:issue_tracker_url",
41
+ "ruby-cloud-api-id" => ":gem.:api_id",
42
+ "ruby-cloud-api-shortname" => ":gem.:api_shortname",
43
+ "ruby-cloud-factory-method-suffix" => ":gem.:factory_method_suffix",
44
+ "ruby-cloud-default-service-host" => ":defaults.:service.:default_host",
45
+ "ruby-cloud-grpc-service-config" => "grpc_service_config"
46
+ }.freeze
47
+
48
+ ARRAY_PARAMETERS_ALIASES = {
49
+ "ruby-cloud-default-oauth-scopes" => ":defaults.:service.:oauth_scopes"
50
+ }.freeze
51
+
52
+ MAP_PARAMETERS_ALIASES = {
53
+ "ruby-cloud-common-services" => ":common_services",
54
+ "ruby-cloud-path-override" => ":overrides.:file_path",
55
+ "ruby-cloud-namespace-override" => ":overrides.:namespace",
56
+ "ruby-cloud-service-override" => ":overrides.:service",
57
+ "ruby-cloud-extra-dependencies" => ":gem.:extra_dependencies"
58
+ }.freeze
59
+
60
+ def self.default_schema
61
+ Gapic::Generators::DefaultGeneratorParameters.default_schema.extend_with_aliases(
62
+ bool_aliases: BOOL_PARAMETERS_ALIASES,
63
+ string_aliases: STRING_PARAMETERS_ALIASES,
64
+ array_aliases: ARRAY_PARAMETERS_ALIASES,
65
+ map_aliases: MAP_PARAMETERS_ALIASES
66
+ )
67
+ end
68
+ end
69
+ end
70
+ end
@@ -37,6 +37,36 @@ module Gapic
37
37
  deps["google-cloud-errors"] = "~> 1.0"
38
38
  deps
39
39
  end
40
+
41
+ ##
42
+ # The name of the wrapper gem corresponding to this versioned gem
43
+ # @return [String]
44
+ #
45
+ def wrapper_name
46
+ minfo = /^(.+)-v\w+$/.match name
47
+ minfo ? minfo[1] : nil
48
+ end
49
+
50
+ alias_method :readme_description, :description # rubocop:disable Style/Alias
51
+
52
+ ##
53
+ # Overrides the gemspec description including a note that users should
54
+ # consider installing the wrapper instead of this versioned gem.
55
+ #
56
+ # Note: The method `readme_description` was aliased to the superclass
57
+ # method because the description without this note is used in the readme.
58
+ #
59
+ # @return [String]
60
+ #
61
+ def description
62
+ desc = readme_description
63
+ if wrapper_name
64
+ desc += " Note that #{name} is a version-specific client library." \
65
+ " For most uses, we recommend installing the main client library" \
66
+ " #{wrapper_name} instead. See the readme for more details."
67
+ end
68
+ desc
69
+ end
40
70
  end
41
71
 
42
72
  def self.cloud_gem_presenter api
@@ -101,6 +101,10 @@ module Gapic
101
101
  version_dependencies.first&.first
102
102
  end
103
103
 
104
+ def default_versioned_gem
105
+ versioned_gems.first
106
+ end
107
+
104
108
  def dependencies
105
109
  deps = { "google-cloud-core" => "~> 1.5" }
106
110
  version_dependencies.each do |version, requirement|
@@ -102,6 +102,40 @@ namespace :acceptance do
102
102
  end
103
103
  end
104
104
 
105
+ task :samples do
106
+ Rake::Task["samples:latest"].invoke
107
+ end
108
+
109
+ namespace :samples do
110
+ task :latest do
111
+ if File.directory? "samples"
112
+ Dir.chdir "samples" do
113
+ Bundler.with_clean_env do
114
+ ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "not_master"
115
+ sh "bundle update"
116
+ sh "bundle exec rake test"
117
+ end
118
+ end
119
+ else
120
+ puts "The <%= gem.name %> gem has no samples to test."
121
+ end
122
+ end
123
+
124
+ task :master do
125
+ if File.directory? "samples"
126
+ Dir.chdir "samples" do
127
+ Bundler.with_clean_env do
128
+ ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "master"
129
+ sh "bundle update"
130
+ sh "bundle exec rake test"
131
+ end
132
+ end
133
+ else
134
+ puts "The <%= gem.name %> gem has no samples to test."
135
+ end
136
+ end
137
+ end
138
+
105
139
  require "yard"
106
140
  require "yard/rake/yardoc_task"
107
141
  YARD::Rake::YardocTask.new do |y|
@@ -2,10 +2,18 @@
2
2
 
3
3
  <%= gem.summary %>
4
4
 
5
- <%= gem.description %>
5
+ <%= gem.readme_description %>
6
6
 
7
7
  <%= gem.homepage %>
8
8
 
9
+ <%- if gem.wrapper_name -%>
10
+ This gem is a _versioned_ client. It provides basic client classes for a
11
+ specific version of the <%= gem.title %> API. Most users should consider using
12
+ the main client gem,
13
+ [<%= gem.wrapper_name %>](https://rubygems.org/gems/<%= gem.wrapper_name %>).
14
+ See the section below titled *Which client should I use?* for more information.
15
+
16
+ <%- end -%>
9
17
  ## Installation
10
18
 
11
19
  ```
@@ -93,3 +101,63 @@ in security maintenance, and not end of life. Currently, this means Ruby 2.4
93
101
  and later. Older versions of Ruby _may_ still work, but are unsupported and not
94
102
  recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
95
103
  about the Ruby support schedule.
104
+ <%- if gem.wrapper_name -%>
105
+
106
+ ## Which client should I use?
107
+
108
+ Most modern Ruby client libraries for Google APIs come in two flavors: the main
109
+ client library with a name such as `<%= gem.wrapper_name %>`,
110
+ and lower-level _versioned_ client libraries with names such as
111
+ `<%= gem.name %>`.
112
+ _In most cases, you should install the main client._
113
+
114
+ ### What's the difference between the main client and a versioned client?
115
+
116
+ A _versioned client_ provides a basic set of data types and client classes for
117
+ a _single version_ of a specific service. (That is, for a service with multiple
118
+ versions, there might be a separate versioned client for each service version.)
119
+ Most versioned clients are written and maintained by a code generator.
120
+
121
+ The _main client_ is designed to provide you with the _recommended_ client
122
+ interfaces for the service. There will be only one main client for any given
123
+ service, even a service with multiple versions. The main client includes
124
+ factory methods for constructing the client objects we recommend for most
125
+ users. In some cases, those will be classes provided by an underlying versioned
126
+ client; in other cases, they will be handwritten higher-level client objects
127
+ with additional capabilities, convenience methods, or best practices built in.
128
+ Generally, the main client will default to a recommended service version,
129
+ although in some cases you can override this if you need to talk to a specific
130
+ service version.
131
+
132
+ ### Why would I want to use the main client?
133
+
134
+ We recommend that most users install the main client gem for a service. You can
135
+ identify this gem as the one _without_ a version in its name, e.g.
136
+ `<%= gem.wrapper_name %>`.
137
+ The main client is recommended because it will embody the best practices for
138
+ accessing the service, and may also provide more convenient interfaces or
139
+ tighter integration into frameworks and third-party libraries. In addition, the
140
+ documentation and samples published by Google will generally demonstrate use of
141
+ the main client.
142
+
143
+ ### Why would I want to use a versioned client?
144
+
145
+ You can use a versioned client if you are content with a possibly lower-level
146
+ class interface, you explicitly want to avoid features provided by the main
147
+ client, or you want to access a specific service version not be covered by the
148
+ main client. You can identify versioned client gems because the service version
149
+ is part of the name, e.g. `<%= gem.name %>`.
150
+
151
+ ### What about the google-apis-<name> clients?
152
+
153
+ Client library gems with names that begin with `google-apis-` are based on an
154
+ older code generation technology. They talk to a REST/JSON backend (whereas
155
+ most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
156
+ not offer the same performance, features, and ease of use provided by more
157
+ modern clients.
158
+
159
+ The `google-apis-` clients have wide coverage across Google services, so you
160
+ might need to use one if there is no modern client available for the service.
161
+ However, if a modern client is available, we generally recommend it over the
162
+ older `google-apis-` clients.
163
+ <%- end -%>
@@ -28,6 +28,10 @@ Metrics/PerceivedComplexity:
28
28
  Naming/FileName:
29
29
  Exclude:
30
30
  - "lib/<%= gem.name %>.rb"
31
+ Naming/PredicateName:
32
+ Enabled: false
33
+ Style/AsciiComments:
34
+ Enabled: false
31
35
  Style/CaseEquality:
32
36
  Enabled: false
33
37
  Style/IfUnlessModifier:
@@ -76,8 +76,8 @@ end
76
76
  # The library version as recorded in instrumentation and logging.
77
77
  # * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
78
78
  # An array of interceptors that are run before calls are executed.
79
- # * `timeout` (*type:* `Integer`) -
80
- # Default timeout in milliseconds.
79
+ # * `timeout` (*type:* `Numeric`) -
80
+ # Default timeout in seconds.
81
81
  # * `metadata` (*type:* `Hash{Symbol=>String}`) -
82
82
  # Additional gRPC headers to be sent with the call.
83
83
  # * `retry_policy` (*type:* `Hash`) -
@@ -6,9 +6,10 @@
6
6
 
7
7
  Actual client classes for the various versions of this API are defined in
8
8
  _versioned_ client gems, with names of the form `<%= gem.name %>-v*`.
9
- The gem `<%= gem.name %>` is a convenience wrapper library that brings the
9
+ The gem `<%= gem.name %>` is the main client library that brings the
10
10
  verisoned gems in as dependencies, and provides high-level methods for
11
- constructing clients.
11
+ constructing clients. More information on versioned clients can be found below
12
+ in the section titled *Which client should I use?*.
12
13
 
13
14
  View the [Client Library Documentation](<%= gem.library_documentation_url %>)
14
15
  for this library, <%= gem.name %>, to see the convenience methods for
@@ -95,3 +96,61 @@ in security maintenance, and not end of life. Currently, this means Ruby 2.4
95
96
  and later. Older versions of Ruby _may_ still work, but are unsupported and not
96
97
  recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
97
98
  about the Ruby support schedule.
99
+
100
+ ## Which client should I use?
101
+
102
+ Most modern Ruby client libraries for Google APIs come in two flavors: the main
103
+ client library with a name such as `<%= gem.name %>`,
104
+ and lower-level _versioned_ client libraries with names such as
105
+ `<%= gem.default_versioned_gem %>`.
106
+ _In most cases, you should install the main client._
107
+
108
+ ### What's the difference between the main client and a versioned client?
109
+
110
+ A _versioned client_ provides a basic set of data types and client classes for
111
+ a _single version_ of a specific service. (That is, for a service with multiple
112
+ versions, there might be a separate versioned client for each service version.)
113
+ Most versioned clients are written and maintained by a code generator.
114
+
115
+ The _main client_ is designed to provide you with the _recommended_ client
116
+ interfaces for the service. There will be only one main client for any given
117
+ service, even a service with multiple versions. The main client includes
118
+ factory methods for constructing the client objects we recommend for most
119
+ users. In some cases, those will be classes provided by an underlying versioned
120
+ client; in other cases, they will be handwritten higher-level client objects
121
+ with additional capabilities, convenience methods, or best practices built in.
122
+ Generally, the main client will default to a recommended service version,
123
+ although in some cases you can override this if you need to talk to a specific
124
+ service version.
125
+
126
+ ### Why would I want to use the main client?
127
+
128
+ We recommend that most users install the main client gem for a service. You can
129
+ identify this gem as the one _without_ a version in its name, e.g.
130
+ `<%= gem.name %>`.
131
+ The main client is recommended because it will embody the best practices for
132
+ accessing the service, and may also provide more convenient interfaces or
133
+ tighter integration into frameworks and third-party libraries. In addition, the
134
+ documentation and samples published by Google will generally demonstrate use of
135
+ the main client.
136
+
137
+ ### Why would I want to use a versioned client?
138
+
139
+ You can use a versioned client if you are content with a possibly lower-level
140
+ class interface, you explicitly want to avoid features provided by the main
141
+ client, or you want to access a specific service version not be covered by the
142
+ main client. You can identify versioned client gems because the service version
143
+ is part of the name, e.g. `<%= gem.default_versioned_gem %>`.
144
+
145
+ ### What about the google-apis-<name> clients?
146
+
147
+ Client library gems with names that begin with `google-apis-` are based on an
148
+ older code generation technology. They talk to a REST/JSON backend (whereas
149
+ most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
150
+ not offer the same performance, features, and ease of use provided by more
151
+ modern clients.
152
+
153
+ The `google-apis-` clients have wide coverage across Google services, so you
154
+ might need to use one if there is no modern client available for the service.
155
+ However, if a modern client is available, we generally recommend it over the
156
+ older `google-apis-` clients.
@@ -21,3 +21,6 @@ Metrics/BlockLength:
21
21
  Naming/FileName:
22
22
  Exclude:
23
23
  - "lib/<%= gem.name %>.rb"
24
+
25
+ Style/AsciiComments:
26
+ Enabled: false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gapic-generator-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernest Landrito
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-08-05 00:00:00.000000000 Z
13
+ date: 2021-02-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionpack
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.6.6
35
+ version: 0.6.11
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.6.6
42
+ version: 0.6.11
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: google-style
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -159,6 +159,7 @@ files:
159
159
  - cloud-rubocop.yml
160
160
  - lib/gapic/generator/cloud/version.rb
161
161
  - lib/gapic/generators/cloud_generator.rb
162
+ - lib/gapic/generators/cloud_generator_parameters.rb
162
163
  - lib/gapic/presenters/cloud_gem_presenter.rb
163
164
  - lib/gapic/presenters/wrapper_gem_presenter.rb
164
165
  - lib/gapic/presenters/wrapper_service_presenter.rb
@@ -206,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
207
  - !ruby/object:Gem::Version
207
208
  version: '0'
208
209
  requirements: []
209
- rubygems_version: 3.0.3
210
+ rubygems_version: 3.1.4
210
211
  signing_key:
211
212
  specification_version: 4
212
213
  summary: An API Client Generator for Ruby in Ruby!