Skip to content

feat(cloud): add ruby-cloud-renamed-from for renamed wrapper gems - #1342

Merged
suztomo merged 2 commits into
googleapis:mainfrom
suztomo:feat/ruby-cloud-renamed-from
Sep 4, 2026
Merged

feat(cloud): add ruby-cloud-renamed-from for renamed wrapper gems#1342
suztomo merged 2 commits into
googleapis:mainfrom
suztomo:feat/ruby-cloud-renamed-from

Conversation

@suztomo

@suztomo suztomo commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

Adds support for the ruby-cloud-renamed-from generator parameter (aliased to :gem.:renamed_from).

Background & Motivation

In most Google Cloud Ruby client libraries, a wrapper gem shares its exact package name with the service (e.g. google-cloud-storage wraps google-cloud-storage-v1).

However, in certain cases a wrapper gem cannot be published under its canonical name due to naming conflicts on RubyGems.org:

  1. google-cloud-run: RubyGems already had a pre-existing gem named google_cloud_run. Because RubyGems treats underscores and hyphens as equivalent for gem registration collisions, google-cloud-run could not be registered. The wrapper gem was therefore renamed to google-cloud-run-client.
  2. google-iam: RubyGems already had an unrelated gem named google-iam registered in 2011. The wrapper gem was therefore renamed to google-iam-client.

In both cases:

  • The wrapper gem name is <canonical-name>-client (e.g. google-cloud-run-client, google-iam-client).
  • The wrapped versioned gem(s) use the canonical name (e.g. google-cloud-run-v2, google-iam-v2).
  • The Ruby namespaces are canonical (e.g. Google::Cloud::Run, Google::Iam).
  • The version constant uses the gem namespace (e.g. Google::Cloud::Run::Client::VERSION, Google::Iam::Client::VERSION in lib/.../client/version.rb).

Previously, this required an .owlbot.rb post-processor script in each gem to rewrite gemspecs, entrypoints, READMEs, and version requires. By adding ruby-cloud-renamed-from, the generator handles this natively for Librarian onboarding.

Generator Behavior with ruby-cloud-renamed-from

When ruby-cloud-renamed-from is specified:

  1. gem.namespace: uses Google::Cloud::Run (or Google::Iam) rather than deriving from -client.
  2. gem.gem_namespace: uses Google::Cloud::Run::Client (or Google::Iam::Client) for version constants.
  3. gem.version_name_full: Google::Cloud::Run::Client::VERSION.
  4. gem.versioned_gems: derives dependencies matching <renamed_from>-v* (e.g., google-cloud-run-v2) instead of <name>-v*.
  5. gem.google_cloud_short_name: strips google-cloud- from renamed_from (yields "run").
  6. Entrypoint template: uses gem.version_name_full in require guards.
  7. README template: references versioned gems pattern <renamed_from>-v*.

Resolves googleapis/librarian#7447.

Preview PR in google-cloud-ruby: googleapis/google-cloud-ruby#36528

@suztomo
suztomo marked this pull request as ready for review September 3, 2026 23:03
@suztomo
suztomo requested a review from a team as a code owner September 3, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ruby: handle Gem renaming in .owlbot.rb files in Librarian generation

2 participants