Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A gem executable should not use require_relative #227

Merged
merged 1 commit into from
Oct 18, 2024
Merged

A gem executable should not use require_relative #227

merged 1 commit into from
Oct 18, 2024

Conversation

eregon
Copy link
Member

@eregon eregon commented Oct 17, 2024

Otherwise it makes incorrect assumption about RubyGems layout.
RubyGems always guarantees the gem's lib is in $LOAD_PATH.

Follow up of #226

Otherwise it makes incorrect assumption about RubyGems layout.
@eregon eregon marked this pull request as ready for review October 17, 2024 19:54
@eregon eregon requested a review from hsbt October 17, 2024 19:54
@schneems
Copy link
Collaborator

I like relative requires because they help make sure i'm not accidentally running the system installed gems when I'm trying to debug things locally if I am invoking things in a slightly off way. Is this a perf optimization or you're getting warnings or you just happened to spot this?

@eregon
Copy link
Member Author

eregon commented Oct 17, 2024

Would a bin/syntax_suggest which unshifts ../lib to $LOAD_PATH address that concern?

My main motivation here is to have the gem executable to be clean and follow recommendations, and to avoid the extra LoadError (which is rescue-d but is still shown with -d, causes some extra work, etc).

Copy link
Collaborator

@schneems schneems left a comment

Choose a reason for hiding this comment

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

This is fine to merge as is. You’ve got appproval. Thanks for the extra explanation.

Im neutral on adding a bin/syntax_suggest. I am okay to wait and add it later only if I feel a stronger need.

@hsbt
Copy link
Member

hsbt commented Oct 18, 2024

I don't have any opinion about this. I followed @schneems's decision.

@hsbt hsbt merged commit a8ee251 into main Oct 18, 2024
21 of 24 checks passed
@hsbt hsbt deleted the just-require branch October 18, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants