56 lines
1.9 KiB
Ruby
56 lines
1.9 KiB
Ruby
require "language/node"
|
|
|
|
class Bit < Formula
|
|
desc "Distributed Code Component Manager"
|
|
homepage "https://bit.dev"
|
|
url "https://registry.npmjs.org/bit-bin/-/bit-bin-14.8.8.tgz"
|
|
sha256 "25d899bacd06d77fad41026a9b19cbe94c8fb986f5fe59ead7ccec9f60fd0ef9"
|
|
license "Apache-2.0"
|
|
revision 1
|
|
head "https://github.com/teambit/bit.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 monterey: "1b4cefb9480be0579cc849bed266ee8602d5d074f280c9e2c88c47ed28ac3404"
|
|
sha256 big_sur: "387868e05ed7c459fde2b0d7c6eb31f889002bfb2628fa54bcc8a33b91f3c6de"
|
|
sha256 catalina: "c8122cc1152f05f8daf5087cc02e864d68246412180c927bca1d2cd06123ac70"
|
|
end
|
|
|
|
depends_on arch: :x86_64 # installs an x86_64 `node.napi.node`
|
|
depends_on "node"
|
|
|
|
on_macos do
|
|
depends_on "terminal-notifier"
|
|
end
|
|
|
|
conflicts_with "bit-git", because: "both install `bit` binaries"
|
|
|
|
def install
|
|
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
|
|
bin.install_symlink libexec.glob("bin/*")
|
|
|
|
# Remove vendored pre-built binary `terminal-notifier`
|
|
node_notifier_vendor_dir = libexec/"lib/node_modules/bit-bin/node_modules/node-notifier/vendor"
|
|
node_notifier_vendor_dir.rmtree # remove vendored pre-built binaries
|
|
|
|
if OS.mac?
|
|
terminal_notifier_dir = node_notifier_vendor_dir/"mac.noindex"
|
|
terminal_notifier_dir.mkpath
|
|
|
|
# replace vendored `terminal-notifier` with our own
|
|
terminal_notifier_app = Formula["terminal-notifier"].opt_prefix/"terminal-notifier.app"
|
|
ln_sf terminal_notifier_app.relative_path_from(terminal_notifier_dir), terminal_notifier_dir
|
|
end
|
|
|
|
# Replace universal binaries with their native slices.
|
|
deuniversalize_machos
|
|
end
|
|
|
|
test do
|
|
(testpath/"Library/Caches/Bit/config/config.json").write <<~EOS
|
|
{ "analytics_reporting": false, "error_reporting": false }
|
|
EOS
|
|
output = shell_output("#{bin}/bit init --skip-update")
|
|
assert_match "successfully initialized", output
|
|
end
|
|
end
|