Skip to content

Raise error when gem contains capital letters#5432

Merged
hsbt merged 2 commits intoruby:masterfrom
okuramasafumi:bundle-gem-capital-warning
Feb 13, 2026
Merged

Raise error when gem contains capital letters#5432
hsbt merged 2 commits intoruby:masterfrom
okuramasafumi:bundle-gem-capital-warning

Conversation

@okuramasafumi
Copy link
Copy Markdown
Contributor

The problem is described in #5431
The guide ( https://guides.rubygems.org/name-your-gem/ ) says

DON’T USE UPPERCASE LETTERS
so bundle gem command should respect it.

What was the end-user or developer problem that led to this PR?

Issue #5431

What is your fix for the problem, implemented in this PR?

It now raises error when gem name includes capital letters.
@simi said warning might be enough, but I thought we don't want to proceed with uppercase letters anyway, so raising error should be fine.

Make sure the following tasks are checked

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

@simi Are you ok with an error or you prefer a warning? Honestly I would be fine with both.

Comment thread bundler/lib/bundler/cli/gem.rb Outdated
if name =~ /^\d/
Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
if name =~ /(^\d)|[A-Z]/
Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers nor include capital letters."
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only capital letters?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simi This regex matches when there's only one capital letter.

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

I guess a warning for now is probably best.

@simi
Copy link
Copy Markdown

simi commented Jul 28, 2022

Other level of this would be to make this warning in specification_policy as well. Anyway this seems like good start.

@hsbt hsbt force-pushed the bundle-gem-capital-warning branch from 60b5ae4 to 1ff89c8 Compare February 13, 2026 05:03
@hsbt hsbt enabled auto-merge February 13, 2026 05:04
okuramasafumi and others added 2 commits February 13, 2026 14:04
The problem is described in ruby#5431
The guide ( https://guides.rubygems.org/name-your-gem/ ) says
> DON’T USE UPPERCASE LETTERS
so `bundle gem` command should respect it.
@hsbt hsbt force-pushed the bundle-gem-capital-warning branch from 1ff89c8 to 26dab84 Compare February 13, 2026 05:04
@hsbt
Copy link
Copy Markdown
Member

hsbt commented Feb 13, 2026

@okuramasafumi I will merge this for warning at first.

@hsbt hsbt merged commit b7177fa into ruby:master Feb 13, 2026
92 checks passed
hsbt added a commit that referenced this pull request Feb 24, 2026
Raise error when gem contains capital letters

(cherry picked from commit b7177fa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants