gapic-generator-cloud 0.3.3 → 0.4.0

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: 10c441fdc1fa39c04dd899ecdf54220aee63f9c37e612f7967f29fec9760370c
4
- data.tar.gz: c7946bf5da749801f61af89282bb581958efe12c891fe6288c827f9496298712
3
+ metadata.gz: 67c698edddd3e5884a7ea49222c4bc4fcda045354d60380db267279d2524aa82
4
+ data.tar.gz: 7367fbc57dec1cf102cd69de072bf0f8a57d0a01fc895bcdf376c32163568b11
5
5
  SHA512:
6
- metadata.gz: 382a4df1000768f154070a62776dd9bf36d64326771addc29e5f7a904643657f6c0f68300e2e7d1f1b664afc7402dd0b68882f1023cb10eb9da534e544c21494
7
- data.tar.gz: c43058e550a06efffd832b7b7437d97da4f847824291bd738470850238a3bcbe9671ab1b15afe1f12280e19a3e4cfe0dc10cf3cd746aba70f5ea4c6e3fdec300
6
+ metadata.gz: 45d9725ff2c9b1b1db1fcd426edf33fdbfd3709274cbe9f172483ec86e315173fd342d520a2ffa05e55ac5df3a1bb633a06325120550bbdd78b271b7c2038f35
7
+ data.tar.gz: 69812b1f0fe041ed416b82a8fdc7af1408ae3e642f11917541a3277ba69e65ef2b52feb85fd5a9fec52da25bb3688dfd2e8bf0c4edc0b9bd6896efc0f2eccce9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History for gapic-generator-cloud
2
2
 
3
+ ### 0.4.0 / 2020-04-20
4
+
5
+ * Includes changes from gapic-generator 0.4.0
6
+ * Apply overrides to client namespaces but not proto namespaces.
7
+ * Remove common resources proto from generated files.
8
+ * Multiple overrides can be specified in the docker interface.
9
+ * Fixed: The pre-migration versions in wrapper readmes were malformed if the migration version was still 0.x.
10
+
3
11
  ### 0.3.3 / 2020-04-13
4
12
 
5
13
  * Includes changes from gapic-generator 0.3.3
@@ -18,10 +18,13 @@
18
18
  require "optparse"
19
19
  require "fileutils"
20
20
 
21
+ # Boolean options may have values "true" or "false" (as strings)
21
22
  bool_option_map = {
22
23
  ":gem.:free_tier" => "ruby-cloud-free-tier",
23
24
  ":gem.:yard_strict" => "ruby-cloud-yard-strict"
24
25
  }
26
+
27
+ # Value options always take string values.
25
28
  value_option_map = {
26
29
  "configuration" => "ruby-cloud-config",
27
30
  ":gem.:name" => "ruby-cloud-gem-name",
@@ -36,15 +39,28 @@ value_option_map = {
36
39
  ":gem.:api_id" => "ruby-cloud-api-id",
37
40
  ":gem.:factory_method_suffix" => "ruby-cloud-factory-method-suffix"
38
41
  }
42
+
43
+ # Path options take one or more file paths delimited by semicolons.
39
44
  path_option_map = {
40
45
  "samples" => ["ruby-cloud-samples", "samples"],
41
46
  "grpc_service_config" => "ruby-cloud-grpc-service-config"
42
47
  }
48
+
49
+ # Map options take one or more mappings delimited by semicolons. Each mapping
50
+ # must be of the form "key=value". Note that periods in keys are treated as
51
+ # literal periods, not subkey delimiters.
43
52
  map_option_map = {
53
+ ":common_services" => "ruby-cloud-common-services",
44
54
  ":overrides.:file_path" => "ruby-cloud-path-override",
45
55
  ":overrides.:namespace" => "ruby-cloud-namespace-override"
46
56
  }
47
57
 
58
+ # A set of files that, if generated, should be removed.
59
+ remove_paths = [
60
+ "lib/google/iam/v1/iam_policy_pb.rb",
61
+ "lib/google/cloud/common_resources_pb.rb"
62
+ ]
63
+
48
64
  parameters = {}
49
65
 
50
66
  OptionParser.new do |op|
@@ -72,8 +88,11 @@ OptionParser.new do |op|
72
88
  map_option_map.each do |key, flags|
73
89
  flags = Array(flags).map { |f| "--#{f} MAPPING" }
74
90
  op.on(*flags) do |mapping|
75
- mapping_key, mapping_val = mapping.split("=", 2)
76
- parameters["#{key}.#{mapping_key}"] = mapping_val if mapping_val
91
+ mapping.split(";").each do |mapping_kv|
92
+ mapping_key, mapping_val = mapping_kv.split("=", 2)
93
+ mapping_key.gsub!(".", "\\\\\\\\.")
94
+ parameters["#{key}.#{mapping_key}"] = mapping_val if mapping_val
95
+ end
77
96
  end
78
97
  end
79
98
  end.parse! ARGV
@@ -93,11 +112,18 @@ ruby_plugin_args =
93
112
 
94
113
  protoc_cmd = [
95
114
  "grpc_tools_ruby_protoc",
96
- "--proto_path=/protos/", "--proto_path=/in/"
115
+ # It is important for /in to come before /protos because all input files
116
+ # come from /in, and protoc will complain if any of those are also found
117
+ # earlier in the proto path.
118
+ "--proto_path=/in/", "--proto_path=/protos/"
97
119
  ] + ruby_plugin_args + [
98
120
  "--ruby_cloud_out=/out/",
99
121
  "--ruby_cloud_opt", parameter_strs.join(",")
100
122
  ] + ARGV + Dir.glob("/in/**/*.proto").sort
101
123
 
102
124
  FileUtils.mkdir_p "/out/lib"
103
- exec(*protoc_cmd)
125
+ system(*protoc_cmd)
126
+
127
+ remove_paths.each do |path|
128
+ FileUtils.rm_f Dir.glob "/out/#{path}"
129
+ end
@@ -14,10 +14,11 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
+
17
18
  module Gapic
18
19
  module Generator
19
20
  module Cloud
20
- VERSION = "0.3.3"
21
+ VERSION = "0.4.0"
21
22
  end
22
23
  end
23
24
  end
@@ -54,10 +54,16 @@ module Gapic
54
54
  gem_config :migration_version
55
55
  end
56
56
 
57
+ # A description of the versions prior to the migration version.
58
+ # Could be "a.x" if the migration version is 1.0 or later, otherwise
59
+ # falls back to "pre-a.b".
57
60
  def pre_migration_version
58
- m = /^(\d)+\./.match migration_version.to_s
59
- return nil unless m
60
- "#{m[1].to_i - 1}.x"
61
+ match = /^(\d)+\.0/.match migration_version.to_s
62
+ if match
63
+ major = match[1].to_i
64
+ return "#{major - 1}.x" if major.positive?
65
+ end
66
+ "pre-#{migration_version}"
61
67
  end
62
68
 
63
69
  def migration?
@@ -15,6 +15,7 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require "gapic/presenters"
18
+ require "gapic/ruby_info"
18
19
 
19
20
  module Gapic
20
21
  module Presenters
@@ -27,10 +28,13 @@ module Gapic
27
28
  end
28
29
 
29
30
  def factory_method_name
30
- method_name = ActiveSupport::Inflector.underscore name
31
- suffix = gem.factory_method_suffix
32
- method_name = "#{method_name}#{suffix}" unless method_name.end_with? suffix
33
- method_name
31
+ @factory_method_name ||= begin
32
+ method_name = ActiveSupport::Inflector.underscore name
33
+ suffix = gem.factory_method_suffix
34
+ method_name = "#{method_name}#{suffix}" unless method_name.end_with? suffix
35
+ method_name = "#{method_name}_client" if Gapic::RubyInfo.excluded_method_names.include? method_name
36
+ method_name
37
+ end
34
38
  end
35
39
 
36
40
  def create_client_call
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.3.3
4
+ version: 0.4.0
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-04-13 00:00:00.000000000 Z
13
+ date: 2020-04-20 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.3.3
35
+ version: 0.4.0
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.3.3
42
+ version: 0.4.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: google-style
45
45
  requirement: !ruby/object:Gem::Requirement