I mentioned in https://github.com/Homebrew/homebrew-portable-ruby/issues/203#issuecomment-2135154188 that I was checking the Ruby Releases page (instead of the main Downloads page) because we needed all of the versions for a given major/minor to be able to identify the latest non-X.Y.0 version. However, thinking about this some more, we will want the latest version from the previous major/minor when there's a new X.Y.0 version and the download page provides that information. With that in mind, we can use formula "ruby" with a regex override for the version restriction.
[For what it's worth, I generally try to avoid regex lookarounds for the sake of performance but I've handled the portable-ruby version restriction using a regex as it's technically faster than a strategy block approach. The tradeoff is that it's harder to read the regex compared to strategy block code but it's not too bad.]
As requested in https://github.com/Homebrew/homebrew-portable-ruby/issues/203#issuecomment-2135115748, this integrates changes from @Bo98's
livecheck
blocks. This also updates theportable-ruby
livecheck
block to avoid X.Y.0 versions.I mentioned in https://github.com/Homebrew/homebrew-portable-ruby/issues/203#issuecomment-2135154188 that I was checking the Ruby Releases page (instead of the main Downloads page) because we needed all of the versions for a given major/minor to be able to identify the latest non-X.Y.0 version. However, thinking about this some more, we will want the latest version from the previous major/minor when there's a new X.Y.0 version and the download page provides that information. With that in mind, we can use
formula "ruby"
with a regex override for the version restriction.[For what it's worth, I generally try to avoid regex lookarounds for the sake of performance but I've handled the
portable-ruby
version restriction using a regex as it's technically faster than astrategy
block approach. The tradeoff is that it's harder to read the regex compared tostrategy
block code but it's not too bad.]