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

cmd/{rb,nod}env-sync: add new commands. #14972

Merged
merged 1 commit into from Mar 15, 2023

Conversation

MikeMcQuaid
Copy link
Member

Add these commands to ease use of Homebrew's bottles with rbenv and nodenv.

I've had a lot of people request this over the years and it's worked well for me for a long time.

I could see people extending these to support other languages or version managers so perhaps we want a more generic name.

Migrated from Homebrew/homebrew-core#125503

Marking as critical as already went through some rounds of review over there.

@MikeMcQuaid MikeMcQuaid added the critical Critical change which should be shipped as soon as possible. label Mar 14, 2023
@BrewTestBot
Copy link
Member

BrewTestBot commented Mar 14, 2023

Review period ended.

Copy link
Member

@Rylan12 Rylan12 left a comment

Choose a reason for hiding this comment

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

Makes sense to me. Can probably extract gem_like_version and gem_version_segments since they're reused between these two commands

Library/Homebrew/cmd/nodenv-sync.rb Outdated Show resolved Hide resolved
Library/Homebrew/cmd/rbenv-sync.rb Outdated Show resolved Hide resolved
Comment on lines 51 to 63
def gem_like_version(version_path)
Gem::Version.new(version_path.basename
.to_s
.tr("_", "."))
end

def gem_version_segments(version_path)
basename_without_revision = version_path.basename
.to_s
.gsub(/_\d+$/, "")
Gem::Version.new(basename_without_revision)
.canonical_segments
end
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason we're not using our Version?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Bo98 Just because it used to live in Not Homebrew. Ported to use Keg and Version from us now, bit nicer from that, thanks for suggestion!

Add these commands to ease use of Homebrew's bottles with `rbenv` and
`nodenv`.

I've had a lot of people request this over the years and it's worked
well for me for a long time.

I could see people extending these to support other languages or version
managers so perhaps we want a more generic name.

Co-authored-by: Rylan Polster <rslpolster@gmail.com>
@MikeMcQuaid
Copy link
Member Author

Can probably extract gem_like_version and gem_version_segments since they're reused between these two commands

Refactored them a bit instead so not longer needed!

@MikeMcQuaid MikeMcQuaid merged commit a2d3b3a into Homebrew:master Mar 15, 2023
22 of 23 checks passed
@MikeMcQuaid MikeMcQuaid deleted the rbenv-nodenv-sync branch March 15, 2023 17:29
@github-actions github-actions bot added the outdated PR was locked due to age label Apr 15, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
critical Critical change which should be shipped as soon as possible. outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants