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
OS::Mac: Move version methods into ::Version #11581
Conversation
Review period will end on 2021-06-23 at 16:18:45 UTC. |
76ff839
to
e0869e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm new to this, might need some help with the technical side with fixing issues....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 from me. Moving hard-coded versions to os/mac/version
seems like a logical step to me because os/mac
behaves as an aggregator of macOS-specific behavior. I specifically like that this PR defines two new constants that we can quickly update or, if desired, read or obtain from somewhere later down the road.
Tested with: irb(main):013:0> v = OS::Mac::Version.new("10")
=> #<OS::Mac::Version:0x00007fa4bc070310 @version="10", @detected_from_url=false, @comparison_cache={}>
irb(main):014:0> v.prerelease?
=> false
irb(main):015:0> v.outdated_release?
=> true
irb(main):016:0> |
I modified the
For the same of completeness... Here's the output for a prerelease version: irb(main):001:0> v = OS::Mac::Version.new("12")
=> #<OS::Mac::Version:0x00007f86499ace60 @version="12", @detected_from_url=false, @comparison_cache={}>
irb(main):002:0> v.outdated_release?
=> false
irb(main):003:0> v.prerelease?
=> true Also, the existing behavior of irb(main):001:0> OS::Mac.version
=> #<OS::Mac::Version:0x00007f9c4aa31ec8 @version="11", @detected_from_url=false, @comparison_cache={}>
irb(main):002:0> OS::Mac.outdated_release?
=> false
irb(main):003:0> OS::Mac.prerelease?
=> false |
e0869e5
to
c589f66
Compare
There was a problem hiding this 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, nice API addition/cleanup. One optional thought but feel free to merge without if you'd rather.
I was pondering the This would allow us to fully remove the methods from |
c589f66
to
c387467
Compare
Makes sense to me 👍🏻 |
c387467
to
0752d25
Compare
In the latest changes, the new constants in Unless anyone sees anything else that needs to be addressed, I think that should take care of this. |
Review period ended. |
Thanks, everyone! |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?#11557 needs to know if a Sparkle feed item's
minimumSystemVersion
(a macOS version like12.0.0
) is a prerelease version.OS::Mac
has a#prerelease?
method but it can seemingly only be used to check the macOS version of the execution environment, likeOS::Mac.prerelease?
. We need to be able to doOS::Mac::Version.new("12.0.0").prerelease?
, which isn't currently supported.This PR moves the
#outdated_release?
and#prerelease?
methods toOS::Mac::Version
and simply calls the::Version
methods in the relatedOS::Mac
methods. This allows for bothOS::Mac.prerelease?
andOS::Mac::Version.new("12.0.0").prerelease?
.It would be nice to be able to remove these methods from
OS::Mac
while still being able to access them likeOS::Mac.prerelease?
. I couldn't get eitherdef_delegators
ordelegate
(fromActiveSupport
) to work whereOS::Mac.prerelease?
callsversion.prerelease?
). Any suggestions on how to approach this or is the present code what we would expect?