Share
Embed
Transcript
25 slides
-
話すひと 2 インフォコム株式会社 品質マネジメント推進室 ソフトウェアエンジニア JS (ES6) / Node.js /
GCP / IoT / iOS (Swift) 猫,#JPOP図解 Satoshi SAKAO @ottijp -
Homebrew ってなんぞ • macOS用のパッケージマネージャ • macOSで開発をしている人の999割が使っている • Homebrew: 自家醸造 •
Windowsの人ごめんなさい 3 https://brew.sh -
Homebrewの各用語 「自家醸造」をモチーフにした用語を使っている • formula: 調理法,調合方法 • keg: 小樽 • cellar:
貯蔵室 • bottle: ボトル • tap: 蛇口 • cask: 大樽 5 -
formula: 調理法,調合方法 • 複数形はformulae(フォーミュリ) • パッケージ定義(実体はrubyファイル) • ソースのURL • bottle(ビルド済みバイナリ)
• 依存パッケージ • インストールスクリプト • テストスクリプト • etc 6 -
formula 7 class PdfR2l < Formula desc "Change PDF reading
direction to Right-to-Left (R2L)" homepage "https://github.com/ottijp/pdf-r2l" url "https://github.com/ottijp/pdf-r2l/archive/v1.0.2.tar.gz" sha256 "421c44dae937bb010e5268ffc061fee3841ec1c668a208c06dd73dcfa9b62ab7" bottle do root_url "https://github.com/ottijp/pdf-r2l/releases/download/v1.0.2" cellar :any_skip_relocation sha256 "2218917185397ab470ee42c39cabed405de639500bb5d5c42fd0e238f950b83e" => :catalina end depends_on "gradle" => :build def install system "gradle", "-q", "installDist" bin.install "build/install/pdf-r2l/bin/pdf-r2l" libexec.install Dir["build/install/pdf-r2l/lib/*"] system "sed", "-i", "", "s/\\$APP_HOME\\/lib\\//\\$APP_HOME\\/libexec\\//g", "#{bin}/pdf-r2l" end test do system "false" end end -
keg: 小樽 • インストールされたformula もしくは bottle • ここに,/usr/local/{bin,lib} などから シンボリックリングが貼られる
9 install build&install -
cask: 大樽 • バイナリのみ提供されるパッケージ • macOSアプリケーション • フォント • プラグイン
• その他のOSSではないソフトウェア • HomeBrew(自家醸造)できないもので, 推奨されておらず拡張扱い 12 -
全体図 13 install build&install store tap keg cellar cask formula
bottle CaskRoom store extension -
tapの作成 15 ottijp/tap $ brew tap-new ottijp/tap ==> Created ottijp/tap
/usr/local/Homebrew/Library/Taps/ottijp/homebrew-tap -
formulaの作成 16 ottijp/tap/pdf-r2l $ brew create --tap ottijp/tap --set-name pdf-r2l
https:// github.com/ottijp/pdf-r2l/archive/v1.0.0.tar.gz (中略) Editing /usr/local/Homebrew/Library/Taps/ottijp/homebrew- tap/Formula/pdf-r2l.rb ソースコードURL 作成したtap -
formulaの作成 17 class PdfR2l < Formula desc "Change PDF reading
direction to Right-to-Left (R2L)" homepage "https://github.com/ottijp/pdf-r2l" url "https://github.com/ottijp/pdf-r2l/archive/v1.0.2.tar.gz" sha256 "421c44dae937bb010e5268ffc061fee3841ec1c668a208c06dd73dcfa9b62ab7" depends_on "gradle" => :build def install system "gradle", "-q", "installDist" bin.install "build/install/pdf-r2l/bin/pdf-r2l" libexec.install Dir["build/install/pdf-r2l/lib/*"] system "sed", "-i", "", "s/\\$APP_HOME\\/lib\\//\\$APP_HOME\\/libexec\\//g", "#{bin}/pdf-r2l" end test do system "false" end end -
bottleの作成 18 $ brew install --build-bottle ottijp/tap/pdf-r2l (中略) /usr/local/Cellar/pdf-r2l/1.0.1: 22
files, 12.3MB, built in 14 seconds $ brew bottle --root-url https://github.com/ottijp/pdf-r2l/releases/download/v1.0.1 ottijp/tap/pdf-r2l (中略) ./pdf-r2l--1.0.1.catalina.bottle.tar.gz bottle do root_url "https://github.com/ottijp/pdf-r2l/releases/download/v1.0.1" cellar :any_skip_relocation sha256 "763118b39d3822b3ee3df8e9709332849d29499a120b9be1ad81f8594e6d08d7" => :catalina end pdf-r2l--1.0.1.catalina.bottle.tar.gz bottle用にビルド bottleの作成 -
Homebrew の基本コマンド 24 # Homebrewのインストール /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/
master/install.sh)" # パッケージ情報の更新 $ brew update # パッケージのインストール $ brew install <formula> # パッケージのアンインストール $ brew uninstall <formula>