From d9856462a6c0b303ab68c615fd4f033ea4931440 Mon Sep 17 00:00:00 2001 From: Nikita Tokarchuk Date: Tue, 22 Mar 2022 11:57:35 +0100 Subject: [PATCH] Add formula for chromium depot tools --- Formula/depot-tools.rb | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Formula/depot-tools.rb diff --git a/Formula/depot-tools.rb b/Formula/depot-tools.rb new file mode 100644 index 0000000..b1ce162 --- /dev/null +++ b/Formula/depot-tools.rb @@ -0,0 +1,36 @@ +class DepotTools < Formula + desc "Tools for working with Chromium development" + homepage "http://dev.chromium.org/developers/how-tos/install-depot-tools" + url "https://chromium.googlesource.com/chromium/tools/depot_tools.git", using: :git, revision: "a657331e90e23e289e85a92af49b64829151f403" + version "20220120.a657331e9" + license "BSD-3-Clause" + +# +# Credit to https://github.com/Homebrew/homebrew/pull/17675/files +# + + depends_on "python@3.9" + depends_on "repo" + + def install + dst = prefix/'tools' + dst.mkpath unless dst.directory? + mv Dir.glob('*'), dst + %w[gclient gn gcl git-cl hammer drover cpplint.py presubmit_support.py + trychange.py git-try wtf weekly git-gs zsh-goodies].each do |tool| + (bin/tool).write <<~EOS + #!/bin/bash + TOOL=#{prefix}/tools/#{tool} + export DEPOT_TOOLS_UPDATE=0 + export PATH="$PATH:#{prefix}/tools" + exec "$TOOL" "$@" + EOS + end + end + + test do + %w[gclient presubmit_support.py trychange.py].each do |tool| + system "#{bin}/#{tool} --version" + end + end +end