1、簡介
[1]是mac OS平臺下的軟件包管理工具開源MAC管理軟件,具有安裝、卸載、更新、查看、搜索等諸多實(shí)用功能。一個簡單的命令就可以實(shí)現(xiàn)包管理,不需要關(guān)心各種依賴和文件路徑,非常方便快捷??梢哉f,它已經(jīng)成為計(jì)算機(jī)程序員使用mac的標(biāo)準(zhǔn)。作為開源軟件的貢獻(xiàn)者,本文將向您介紹如何通過軟件包管理來管理您的開源項(xiàng)目。
brew install foo復(fù)制代碼
2、 對比。木桶
支持各種形式的軟件包管理,常見的兩種是Cask。一般用于編譯安裝開源命令行工具,Cask一般用于安裝支持UI的應(yīng)用。官方對應(yīng)的項(xiàng)目是-core[2],Cask對應(yīng)的項(xiàng)目是-cask[3]。建議在添加新工具之前將對應(yīng)的 Git 項(xiàng)目 fork 到自己的賬戶。由于篇幅有限圖標(biāo)圖片轉(zhuǎn)換工具,本文將只介紹 的創(chuàng)建和使用方法RePaper Studio(手繪板軟件),Cask的創(chuàng)建方法大同小異。
3、新步驟
1、本地 Git 存儲庫準(zhǔn)備就緒
cd `brew --repo`/Library/Taps/homebrew/homebrew-core
git remote add ${your_github_id} https://github.com/${your_github_id}/homebrew-core.git
git fetch ${your_github_id}
git checkout -b ${your_github_id} ${your_github_id}/master復(fù)制代碼
2、新建腳本文件
# 執(zhí)行該命令后將自動在 Formula 目錄下創(chuàng)建一個名為foo.rb的文件,文本編輯器也會自動打開該文件。
brew create foo復(fù)制代碼
3、編輯文件
4、測試安裝
# 安裝
brew install foo
# 下載源碼安裝而不是下載編譯好的 bottle 版本,下面鏈接是對 bottle 的介紹
# https://docs.brew.sh/Bottle
brew reinstall --build-from-source foo
# 檢查 Formula 腳本格式,超好用的 linter 工具
brew audit --strict foo復(fù)制代碼
5、提交 PR 合并代碼
社區(qū)相當(dāng)活躍開源MAC管理軟件Great Barcode Generator(條碼生成器),項(xiàng)目維護(hù)者通常會在提交 PR 后 24 小時(shí)內(nèi)回復(fù)。為了讓自己寫的工具能盡快被收錄,建議在提交PR前仔細(xì)閱讀Issue,根據(jù)建議修改。以下是官方的 PR 建議。
- [ ] Have you followed the [guidelines for contributing](https://github.com/Homebrew/homebrew-core/blob/master/CONTRIBUTING.md)?
- [ ] Have you checked that there aren't other open [pull requests](https://github.com/Homebrew/homebrew-core/pulls) for the same formula update/change?
- [ ] Have you built your formula locally with `brew install --build-from-source `, where `` is the name of the formula you' re submitting?
- [ ] Does your build pass `brew audit --strict ` (after doing `brew install `)?復(fù)制代碼
參考鏈接
[1]
[2]
[3]
[4] #-
[5]
[6]