Sha256: b922cc88adba3260d9c26c8b50e814c0a5e8ef5d7f9df72645284002b76e82fd

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require "optparse"
require "fileutils"

parameters = {}

OptionParser.new do |op|
  op.on "--ruby-cloud-config FILE" do |val|
    parameters["configuration"] = val
  end
  op.on "--ruby-cloud-samples FILE", "--samples FILE" do |val|
    parameters["samples"] = val
  end
  op.on "--ruby-cloud-gem-name NAME" do |val|
    parameters[":gem.:name"] = val
  end
  op.on "--ruby-cloud-title NAME" do |val|
    parameters[":gem.:title"] = val
  end
  op.on "--ruby-cloud-summary VAL" do |val|
    parameters[":gem.:summary"] = val
  end
  op.on "--ruby-cloud-homepage VAL" do |val|
    parameters[":gem.:homepage"] = val
  end
  op.on "--ruby-cloud-env-prefix VAL" do |val|
    parameters[":gem.:env_prefix"] = val
  end
end.parse! ARGV

parameter_strs =
  parameters.map do |k, v|
    v = v.gsub("\\", "\\\\\\\\").gsub(",", "\\\\,").gsub("=", "\\\\=")
    "#{k}=#{v}"
  end

protoc_cmd = [
  "grpc_tools_ruby_protoc",
  "--proto_path=/protos/", "--proto_path=/in/",
  "--ruby_out=/out/lib",
  "--grpc_out=/out/lib",
  "--ruby_cloud_out=/out/",
  "--ruby_cloud_opt", parameter_strs.join(",")
] + ARGV + Dir.glob("/in/**/*.proto").sort

FileUtils.mkdir_p "/out/lib"
exec(*protoc_cmd)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gapic-generator-cloud-0.1.0 bin/ruby-cloud-docker-entrypoint