1 Star 0 Fork 0

Kinkley / homebrew-cask

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
hacking.md 4.44 KB
一键复制 编辑 原始数据 按行查看 历史
Miccal Matthews 提交于 2020-12-03 12:04 . Update hacking.md (#94165)

Hacking on Homebrew Cask

If you’d like to hack on the Ruby code that drives this project, please join us, we’d love to have you!

Goals, Design, and Philosophy

Homebrew Cask is an attempt to make a Linux-style package manager for precompiled macOS software. Homebrew Cask is not yet as featureful as apt or yum, but we are trying to be as close as we can get to those tools from the user’s point of view.

Homebrew Cask is designed to work like a traditional Unix tool:

  • All functionality should be accessible from the CLI. The user should be freed (freed!) from interacting with a GUI.
  • Homebrew Cask should itself be scriptable.

Project Status

We have good support for a variety of artifacts such as apps, pkgs, binaries, plugins, and fonts.

Casks and Formulae

Homebrew Formulae deal with many different build processes, and often include arbitrary Ruby code.

Casks, by contrast, only need to support the few installation methods used by apps, pkg installers, and so on, making them suitable for a declarative DSL.

We encourage Cask authors to use the DSL as much as possible, since that makes things easier for everyone: from maintainers who review pull requests, to first-time contributors, to people who are unfamiliar with Ruby but would like to help.

For software with unusual needs that are not covered by the DSL, we generally accept Casks containing small hacks or arbitrary code (for example, though the use of shims scripts). If the hack becomes common enough, we extend the DSL with a simple shorthand that offers the same (or better) functionality.

Contributing

Setup

The Homebrew Cask core code is included in Homebrew. Consult Homebrew’s documentation for contributors for more information.

Forcing a Specific Homebrew Cask Subcommand

If you are developing a subcommand, you can force brew to dispatch a specific file by giving a fully-qualified path to the file containing the subcommand, like this:

$ brew /usr/local/Homebrew/Library/Homebrew/cask/cmd/info.rb google-chrome

Forcing a Specific macOS Release

The environment variable $MACOS_VERSION can be overridden at the command line for test purposes:

$ MACOS_VERSION=10.9 brew info <cask>

Submitting Your Changes

See the relevant section in adding_a_cask.md.

Commit Messages

The first line of a commit message (the summary line) is like the subject line of an email. (See adding_a_cask.md). A short but complete summary line helps the maintainers respond to your pull request more quickly.

External Commands

Advanced users may create their own external commands for Homebrew Cask by following conventions similar to external commands for git or Homebrew. An external command may be any executable on your $PATH which follows the form brewcask-<command>. (So long as <command> does not conflict with an existing command.) The command will be invoked by exec and passed any unprocessed arguments from the original command-line. An external command may also be implemented as an executable Ruby file, on your $PATH, which follows the form brewcask-<command>.rb. The Ruby file will be required and will have full access to the Ruby environments of both Homebrew Cask and Homebrew.

Instead of in the $PATH, an external command can also be located in the cmd subdirectory of a Tap.

The Internal Command _stanza

_stanza is a useful command to contributors who want to build a tool that leans on the information from Homebrew Cask. It extracts and renders a specific stanza for either a given Cask or every Cask.

The syntax is

brew cask _stanza <stanza_name> [ --table | --yaml | --inspect | --quiet ] [ <cask_token> ... ]

If no <cask_token>’s are given, then data for all Casks is returned. On failure, a blank line is returned to the standard output.

For example, brew cask _stanza appcast atom outputs the appcast for the Cask atom.rb, namely https://github.com/atom/atom/releases.atom.

1
https://gitee.com/jinxin.70/homebrew-cask.git
git@gitee.com:jinxin.70/homebrew-cask.git
jinxin.70
homebrew-cask
homebrew-cask
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891