gapic-generator 0.6.4 → 0.6.5

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: 0dc10e022bdc300aff2d3f5cb95686c3deae5cd4ab3068dc621771ab716137d2
4
- data.tar.gz: '048e93d769f582f002d59be693b3f49818cefb205db30bc70969994edb0880bf'
3
+ metadata.gz: 27e2894595efed8561aa48e9059465257267e7f29310a806251bcc6d4d85c63f
4
+ data.tar.gz: af47f16264074317a8d02e73539208a4b43f565ae346aef480619bc73a6b1203
5
5
  SHA512:
6
- metadata.gz: '0496b671939b2290d878ce0ba38e3d6cc2499e483c018d7a1b62ad99f629c506c261b6108d4d5a5cd82f82dd40050b374a7a059a03b3fad1b5951256dd940b1c'
7
- data.tar.gz: b521992f0db776914b9a4f035bcc3fb76ecb57f0bd005f2ff0fc6c744410d48f787fd648bfb218a88d93ecc12cfa86bdccd63557ddbe63aa962f3d4994e8a3ca
6
+ metadata.gz: eacd1840fadb1236cb5ed7efe7ba254a977529435ee7ddff1fcee7bb900fa847ccc0a3b861098f1292a63f72e82f6065146f1f0a0260b0624dc9a184de3d3389
7
+ data.tar.gz: 8a93aaef7317b85fc048604b626af4cef13cf90ea2dd785a12180d94d71dbf0bc4ea24a34c828a04825adcfd4ae2b88e4cc3934d41de7de01b3be27f6302aaba
@@ -1,5 +1,10 @@
1
1
  # Release History for gapic-generator
2
2
 
3
+ ### 0.6.5 / 2020-07-16
4
+
5
+ * Examples in auth, rakefile, and readme should pick a non-common service.
6
+ * Emit a warning if common_services config references a nonexistent service.
7
+
3
8
  ### 0.6.4 / 2020-07-13
4
9
 
5
10
  * Fix rubocop warning on a generated multi-path helper if it could take no arguments.
@@ -30,7 +30,7 @@ COPY --from=gcr.io/gapic-images/api-common-protos:beta /protos/ /workspace/commo
30
30
  COPY --from=builder /workspace/*.gem /workspace/
31
31
 
32
32
  # Install the subgenerator and other needed tools.
33
- RUN gem install --pre grpc-tools gapic-generator-<%= gem_name %>.gem \
33
+ RUN gem install grpc-tools gapic-generator-<%= gem_name %>.gem \
34
34
  && rm gapic-generator-<%= gem_name %>.gem \
35
35
  && mkdir -p --mode=777 /.cache
36
36
 
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Gapic
18
18
  module Generator
19
- VERSION = "0.6.4"
19
+ VERSION = "0.6.5"
20
20
  end
21
21
  end
@@ -48,6 +48,10 @@ module Gapic
48
48
  end
49
49
  end
50
50
 
51
+ def first_non_common_service
52
+ services.find { |service| service.common_service_delegate.nil? }
53
+ end
54
+
51
55
  def proto_files
52
56
  @proto_files ||= begin
53
57
  files = @api.files
@@ -44,14 +44,18 @@ module Gapic
44
44
  #
45
45
  # @param request [Google::Protobuf::Compiler::CodeGeneratorRequest]
46
46
  # The request object.
47
- def initialize request
47
+ # @param error_output [IO] An IO to write any errors/warnings to.
48
+ # @param configuration [Hash] Optional override of configuration.
49
+ def initialize request, error_output: STDERR, configuration: nil
48
50
  @request = request
49
51
  loader = Loader.new
50
52
  @files = request.proto_file.map do |fd|
51
53
  loader.load_file fd, request.file_to_generate.include?(fd.name)
52
54
  end
53
55
  @files.each { |f| f.parent = self }
56
+ @configuration = configuration
54
57
  @resource_types = analyze_resources
58
+ sanity_checks error_output
55
59
  end
56
60
 
57
61
  def containing_api
@@ -295,6 +299,18 @@ module Gapic
295
299
 
296
300
  private
297
301
 
302
+ # Perform a variety of sanity checks on the data, and prints errors to
303
+ # the given output as appropriate.
304
+ #
305
+ # @param output [IO] Stream to write outputs to.
306
+ def sanity_checks output
307
+ addrs = services.map { |service| service.address.join "." }
308
+ configuration[:common_services]&.each do |k, v|
309
+ output.puts "WARNING: configured common service #{k} is not present" unless addrs.include? k
310
+ output.puts "WARNING: configured common service delegate #{v} is not present" unless addrs.include? v
311
+ end
312
+ end
313
+
298
314
  # Does a pre-analysis of all resources defined in the job. This has
299
315
  # two effects:
300
316
  # * Side effect: each resource has its parent_resources field set.
@@ -16,7 +16,7 @@ $ gem install <%= gem.name %>
16
16
 
17
17
  ```ruby
18
18
  require "<%= gem.entrypoint_require %>"
19
- <%- service = gem.packages.first&.services.first -%>
19
+ <%- service = gem.first_non_common_service -%>
20
20
  <%- method = service&.methods.first -%>
21
21
  <%- if service && method -%>
22
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gapic-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
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-07-13 00:00:00.000000000 Z
13
+ date: 2020-07-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionpack