gapic-generator 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/gem_templates/dockerfile.text.erb +3 -3
- data/gem_templates/gitignore.text.erb +0 -1
- data/lib/gapic/generator/version.rb +1 -1
- data/lib/gapic/path_pattern/pattern.rb +16 -4
- data/lib/gapic/presenters/gem_presenter.rb +5 -1
- data/lib/gapic/presenters/sample_presenter.rb +1 -1
- data/lib/gapic/presenters/snippet/parameter_presenter.rb +1 -1
- data/templates/default/gem/gemfile.text.erb +1 -0
- data/templates/default/gem/gitignore.text.erb +0 -2
- data/templates/default/gem/test_helper.text.erb +9 -0
- data/templates/default/lib/_package.text.erb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2d7ec98be6131e97a365a5d526d0794c1009d93f27ab3fd4e0f92950fb731a88
|
|
4
|
+
data.tar.gz: 6fcf2cc7a6f3043eeb0a1e0b6d4b1433939aadef063e965a257ec1710edc433b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ac32f92bfff483181c5e81b6749be9ddc005852dc4a900003d6cdd386dc6cdee6a45020c18ce30c27c98478176bd997455b6e1a2f3137e46e50a097eeae2f2e
|
|
7
|
+
data.tar.gz: 4542f129c100cb51b0c63238571e6cad708d2fe83b2b97dad1df3c42b60879d7d6e272635523e39d42fe85d0c9a9864a390b438eee216a135475c5f64e4bc2dc
|
data/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# Creates /workspace/gapic-generator-<%= gem_name %>.gem
|
|
6
6
|
# to be copied into the final runtime image.
|
|
7
7
|
##
|
|
8
|
-
FROM ruby:2.6-stretch as builder
|
|
8
|
+
FROM ruby:2.6-stretch@sha256:53036d1d5886b2904a03e86400afb933ce713a03657718f1eb562c3ee93b863f as builder
|
|
9
9
|
WORKDIR /workspace
|
|
10
10
|
|
|
11
11
|
# Copy code from the local directory.
|
|
@@ -20,11 +20,11 @@ RUN gem build -o gapic-generator-<%= gem_name %>.gem \
|
|
|
20
20
|
# Runtime image.
|
|
21
21
|
# Installs the generator executables, common protos, and an entrypoint.
|
|
22
22
|
##
|
|
23
|
-
FROM ruby:2.6-stretch
|
|
23
|
+
FROM ruby:2.6-stretch@sha256:53036d1d5886b2904a03e86400afb933ce713a03657718f1eb562c3ee93b863f
|
|
24
24
|
WORKDIR /workspace
|
|
25
25
|
|
|
26
26
|
# Install common protos.
|
|
27
|
-
COPY --from=gcr.io/gapic-images/api-common-protos:beta /protos/ /workspace/common-protos/
|
|
27
|
+
COPY --from=gcr.io/gapic-images/api-common-protos:beta@sha256:d5725b72fc0ac14e7abf49731806c509a257e332e6a43bfa55f3674125fe120f /protos/ /workspace/common-protos/
|
|
28
28
|
|
|
29
29
|
# Copy gems from the builder.
|
|
30
30
|
COPY --from=builder /workspace/*.gem /workspace/
|
|
@@ -52,7 +52,8 @@ module Gapic
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
##
|
|
55
|
-
# Whether this is a basic double-star ("**") pattern
|
|
55
|
+
# Whether this is a basic double-star ("**") pattern (e.g. `{name=**}`).
|
|
56
|
+
# Basic double-star patterns match the entire parameter value.
|
|
56
57
|
# @return [Boolean]
|
|
57
58
|
def double_star_pattern?
|
|
58
59
|
@segments.length == 1 && @segments[0].pattern == "**"
|
|
@@ -66,12 +67,22 @@ module Gapic
|
|
|
66
67
|
end
|
|
67
68
|
|
|
68
69
|
##
|
|
69
|
-
# Converts the PathPattern into a regex string
|
|
70
|
+
# Converts the PathPattern into a regex string.
|
|
71
|
+
#
|
|
72
|
+
# Note: Double wildcard segments (`**`) are compiled with a named capture group
|
|
73
|
+
# `(?<__wildcard__>.*)`. This allows the runtime library (`gapic-common`) to extract
|
|
74
|
+
# the isolated substring matching the wildcard.
|
|
75
|
+
#
|
|
70
76
|
# @return [String]
|
|
71
77
|
def to_regex_str
|
|
78
|
+
if double_star_pattern?
|
|
79
|
+
# If the pattern is just a double wildcard (e.g. `{name=**}`), capture everything.
|
|
80
|
+
return "(?<__wildcard__>.*)"
|
|
81
|
+
end
|
|
82
|
+
|
|
72
83
|
regex_str = segments.first.to_regex_str
|
|
73
84
|
|
|
74
|
-
# for double wildcards the leading
|
|
85
|
+
# for double wildcards the leading `/` is optional
|
|
75
86
|
# e.g. `foo/**` should match `foo`
|
|
76
87
|
# this is why segments 'bring' the leading separator
|
|
77
88
|
# with them as they build the pattern
|
|
@@ -79,7 +90,8 @@ module Gapic
|
|
|
79
90
|
is_double_wildcard = segment.pattern == "**"
|
|
80
91
|
|
|
81
92
|
regex_str = if is_double_wildcard
|
|
82
|
-
|
|
93
|
+
# Capture the multi-segment suffix path specifically inside `__wildcard__`
|
|
94
|
+
"#{regex_str}(?:/(?<__wildcard__>.*))?"
|
|
83
95
|
else
|
|
84
96
|
"#{regex_str}/#{segment.to_regex_str}"
|
|
85
97
|
end
|
|
@@ -61,8 +61,12 @@ module Gapic
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
# Select the primary non-common service for documentation.
|
|
65
|
+
# Prioritize services with methods so that the README quickstart showcases a functional client.
|
|
66
|
+
# If all are empty (e.g., in unit tests), fall back to the first non-common service.
|
|
64
67
|
def first_non_common_service
|
|
65
|
-
services.
|
|
68
|
+
non_common = services.select { |service| service.common_service_delegate.nil? }
|
|
69
|
+
non_common.find { |service| service.methods.any? } || non_common.first
|
|
66
70
|
end
|
|
67
71
|
|
|
68
72
|
def proto_files
|
|
@@ -69,7 +69,7 @@ module Gapic
|
|
|
69
69
|
@value = convert field["value"]
|
|
70
70
|
@input_parameter = field["input_parameter"]
|
|
71
71
|
@comment = field["comment"]
|
|
72
|
-
@comment = nil if @comment
|
|
72
|
+
@comment = nil if @comment && @comment.empty?
|
|
73
73
|
@value_is_file = field["value_is_file"]
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -33,7 +33,7 @@ module Gapic
|
|
|
33
33
|
def initialize proto, json
|
|
34
34
|
@name = proto.name
|
|
35
35
|
@description = proto.description
|
|
36
|
-
@description = nil if @description
|
|
36
|
+
@description = nil if @description && @description.empty?
|
|
37
37
|
@type = TypePresenter.new proto&.type, json&.fetch("type", nil)
|
|
38
38
|
@example = ExpressionPresenter.new proto&.value, json&.fetch("value", nil)
|
|
39
39
|
end
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
<%- assert_locals gem -%>
|
|
2
2
|
<%= render partial: "shared/header" -%>
|
|
3
3
|
|
|
4
|
+
# Load JUnit XML formatter from googleapis/ruby-common-tools to write
|
|
5
|
+
# tmp/reports/sponge_log.xml for Kokoro/TestGrid build health tracking.
|
|
6
|
+
if ENV["CI"] || ENV["KOKORO_JOB_NAME"]
|
|
7
|
+
begin
|
|
8
|
+
require "gapic/minitest_junit_preloader"
|
|
9
|
+
rescue LoadError
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
4
13
|
require "minitest/autorun"
|
|
5
14
|
require "minitest/focus"
|
|
6
15
|
require "minitest/mock"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<%- assert_locals package -%>
|
|
2
2
|
<% @requires = capture do %>
|
|
3
|
-
<%- package.services.each do |service| -%>
|
|
3
|
+
<%- package.services.select { |s| s.methods.any? }.each do |service| -%>
|
|
4
4
|
require "<%= service.service_require %>"
|
|
5
5
|
<%- end -%>
|
|
6
6
|
require "<%= package.gem.version_require %>"
|
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.
|
|
4
|
+
version: 0.50.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ernest Landrito
|
|
@@ -73,14 +73,14 @@ dependencies:
|
|
|
73
73
|
requirements:
|
|
74
74
|
- - "~>"
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
|
-
version: '4.
|
|
76
|
+
version: '4.32'
|
|
77
77
|
type: :runtime
|
|
78
78
|
prerelease: false
|
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
|
81
81
|
- - "~>"
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version: '4.
|
|
83
|
+
version: '4.32'
|
|
84
84
|
- !ruby/object:Gem::Dependency
|
|
85
85
|
name: google-style
|
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|