Upgrade to Pro — share decks privately, control downloads, hide ads and more …

非公開な社内限のCLIツールを Homebrewで配布したい

非公開な社内限のCLIツールを Homebrewで配布したい

Masayuki Morita

May 25, 2017
Tweet

More Decks by Masayuki Morita

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ • ৿ా ਅ೭ (Masayuki Morita) • Twitter/GitHub: @minamijoyo •

    CrowdWorks Inc. • Πϯϑϥ୲౰ • ͍͍ͩͨAWS/Terraform/Dockerͱ͔͍ͬͯ͡Δ
  2. $ curl -sLJO -H 'Accept: application/octet-stream' \ "https://[email protected]/repos/ yourcompany/hoge/releases/assets/$( \

    curl -sL https://[email protected]/ repos/yourcompany/hoge/releases/tags/v0.1.0 \ | jq '.assets[] | select(.name | contains("darwin")) | .id')" GitHub APIΛ࢖ͬͯ curl+jqͰ͕Μ͹Δ
  3. require "formula" class Myaws < Formula homepage "https://github.com/minamijoyo/myaws" url "https://github.com/minamijoyo/myaws/releases/download/

    v0.3.0/myaws_v0.3.0_darwin_amd64.tar.gz" sha256 "a2d9bccb4d95556b81d50bb7338dc12815acb0b4e19e28adff1a235b0a44fca4" head "https://github.com/minamijoyo/myaws.git" version "0.3.0" def install bin.install "myaws" end end brew tap༻ͷFormulaΛ࡞੒
  4. $ brew install minamijoyo/myaws/myaws $ brew tap minamijoyo/myaws $ brew

    install myaws ΋͘͠͸ߦͰ·ͱΊͯ CSFXUBQͯ͠JOTUBMM
  5. require "formula" class Hoge < Formula homepage "https://github.com/yourcompany/hoge" url "https://github.com/yourcompany/hoge/releases/

    download/v0.1.0/hoge_v0.1.0_darwin_amd64.tar.gz", :using => GitHubPrivateRepositoryReleaseDownloadStrategy sha256 "6de411ff3e4b1658a413dd6181fcXXXXXXXXXXXXXXXXXXXX" head "https://github.com/yourcompany/hoge.git" version "0.1.0" def install bin.install "hoge" end end FormulaͷurlઃఆͰ GitHubPrivateRepositoryReleaseDownloadStrategyΛࢦఆ
  6. $ brew tap yourcompany/tap [email protected]:yourcompany/homebrew-tap.git CSFXUBQͷϦϙδτϦ΋ඇެ։ͳͷͰ ύεΛHJUϓϩτίϧࢦఆͯ͠44)ೝূ͢Δ $ brew tap

    yourcompany/tap https://[email protected]/yourcompany/ homebrew-tap.git ˞CSFXUBQͷϦϙδτϦΛIUUQTͰ (JU)VCτʔΫϯͰೝূ͍ͨ͠৔߹͸ҎԼͰ΋Մ