-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Cask: require macOS #3325
Cask: require macOS #3325
Conversation
@sjackman, please review |
I'd be inclined to put this file under |
if OS.mac? | ||
require "extend/os/mac/cmd/cask" | ||
else | ||
odie "Homebrew Cask is supported on macOS only." |
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'd suggest…
The cask command requires macOS.
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.
maybe I'm not correct, but it seems weird for a command to require an operating system, no?
A command/program can require another program/command but it is either supported or not supported by the operating system.
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.
Library/Homebrew/requirements/macos_requirement.rb
says macOS is required.
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 think that requiring an operating system is fine. e.g. "iTunes requires either macOS or Windows."
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.
Library/Homebrew/requirements/macos_requirement.rb
saysmacOS is required
.
$ git blame Library/Homebrew/requirements/macos_requirement.rb
8f728d3a (Shaun Jackman 2017-02-25 10:17:25 -0800 1) class MacOSRequirement < Requirement
8f728d3a (Shaun Jackman 2017-02-25 10:17:25 -0800 2) fatal true
8f728d3a (Shaun Jackman 2017-02-25 10:17:25 -0800 3)
8f728d3a (Shaun Jackman 2017-02-25 10:17:25 -0800 4) satisfy(build_env: false) { OS.mac? }
8f728d3a (Shaun Jackman 2017-02-25 10:17:25 -0800 5)
8f728d3a (Shaun Jackman 2017-02-25 10:17:25 -0800 6) def message
8f728d3a (Shaun Jackman 2017-02-25 10:17:25 -0800 7) "macOS is required."
8f728d3a (Shaun Jackman 2017-02-25 10:17:25 -0800 8) end
8f728d3a (Shaun Jackman 2017-02-25 10:17:25 -0800 9) end
:)
There is no Library/Homebrew/requirements/macos_requirement.rb
in Homebrew
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.
Ah, hasn't been merged yet. See #3270
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 suggest moving this file to os/cmd/cask.rb
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.
On second thought, modifying the command search logic to search os/#{os}/cmd
seems like overkill. What you have is good. However, I'd suggest putting everything under os/cmd
rather than extend/os/cmd
. The directory extend
is intended for extending (monkey-patching) classes.
Library/Homebrew/cmd/cask.rb
Outdated
Hbc::CLI.run(*ARGV) | ||
end | ||
end | ||
require "extend/os/cmd/cask" |
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.
require "os/cmd/cask"
@@ -0,0 +1,5 @@ | |||
if OS.mac? | |||
require "extend/os/mac/cmd/cask" |
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.
require "os/mac/cmd/cask"
def cask | ||
Hbc::CLI.run(*ARGV) | ||
end | ||
end |
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 suggest moving this file to os/mac/cmd/cask.rb
if OS.mac? | ||
require "extend/os/mac/cmd/cask" | ||
else | ||
odie "Homebrew Cask is supported on macOS only." |
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 suggest moving this file to os/cmd/cask.rb
done! |
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.
Looks good to me. Thanks, Maxim.
What happens if you run |
Library/Homebrew/cmd/cask.rb
Outdated
module_function | ||
|
||
def cask | ||
Hbc::CLI.run(*ARGV) |
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 think odie "The cask command requires macOS." if OS.linux?
above this line could be sufficient for this whole PR.
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.
This is literally what Linuxbrew does right now: https://github.com/Linuxbrew/brew/blob/master/Library/Homebrew/cmd/cask.rb#L8
I will submit a PR that ports Linuxbrew's changes. Also, I believe it should be unless OS.mac?
because one can't expect cask to work anywhere else, right?
@reitermarkus I'd love your thoughts on this. |
I think this is a bit overkill, and I agree with #3325 (comment). |
|
11662dc
to
99bd6b6
Compare
What happens if you specify an actual cask, though. |
|
I think this is the command that could reasonably be interpreted to not work on Linux. I think it's a good thing that |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Closing per #3325 (comment) |
brew tests
with your changes locally?the hierarchy of
cask
commands requires macOS. Moving it underextend/os
makes Homebrew/brew compatible with other Operating Systems.