<commit_before>require "language/node"

class HasuraCli < Formula
  desc "Command-Line Interface for Hasura GraphQL Engine"
  homepage "https://hasura.io"
  url "https://github.com/hasura/graphql-engine/archive/v2.13.1.tar.gz"
  sha256 "62622b59af755de35a5c500b3dd50f326b274c216464e526377688af2aa7b14f"
  license "Apache-2.0"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_ventura:  "e95677f396a58ab0756f3f8ea41492e0508dcfbdb0f3d4cf4e2a1cb07e605ee6"
    sha256 cellar: :any_skip_relocation, arm64_monterey: "bce7edbf383f7122edafc92b0772bd962f6aab947080b135483cd7304f3af053"
    sha256 cellar: :any_skip_relocation, arm64_big_sur:  "c25d09dac82ca31194c095505491a4c7de3fbeef18a8540bfef149f30076b664"
    sha256 cellar: :any_skip_relocation, monterey:       "35f0605fa48ecca70b8f7c2a421f6f7f6a0f77c1c7f545e1b7eb84a3df4b42e4"
    sha256 cellar: :any_skip_relocation, big_sur:        "39c6be10797721de942088ea18dd958d71d6169a79d07bd6ca3c5eb2c94d8d45"
    sha256 cellar: :any_skip_relocation, catalina:       "83a7a8db845d9180938c5de47904ccb347a9088a561c2af755c77452ae4cfff8"
    sha256 cellar: :any_skip_relocation, x86_64_linux:   "aaf251f8bbb4ec593d945a5faada89e4f989fba8a8e75ffa7dca9be43954ef95"
  end

  depends_on "go" => :build
  depends_on "node@16" => :build # Switch back to node with https://github.com/vercel/pkg/issues/1364

  def install
    Language::Node.setup_npm_environment

    ldflags = %W[
      -s -w
      -X github.com/hasura/graphql-engine/cli/v2/version.BuildVersion=#{version}
      -X github.com/hasura/graphql-engine/cli/v2/plugins.IndexBranchRef=master
    ]

    # Based on `make build-cli-ext`, but only build a single host-specific binary
    cd "cli-ext" do
      system "npm", "install", *Language::Node.local_npm_install_args
      system "npm", "run", "prebuild"
      system "./node_modules/.bin/pkg", "./build/command.js", "--output", "./bin/cli-ext-hasura", "-t", "host"
    end

    cd "cli" do
      arch = Hardware::CPU.intel? ? "amd64" : Hardware::CPU.arch.to_s
      os = OS.kernel_name.downcase

      cp "../cli-ext/bin/cli-ext-hasura", "./internal/cliext/static-bin/#{os}/#{arch}/cli-ext"
      system "go", "build", *std_go_args(output: bin/"hasura", ldflags: ldflags), "./cmd/hasura/"

      generate_completions_from_executable(bin/"hasura", "completion", base_name: "hasura", shells: [:bash, :zsh])
    end<commit_msg>hasura-cli: update 2.13.1 bottle.<commit_after>require "language/node"

class HasuraCli < Formula
  desc "Command-Line Interface for Hasura GraphQL Engine"
  homepage "https://hasura.io"
  url "https://github.com/hasura/graphql-engine/archive/v2.13.1.tar.gz"
  sha256 "62622b59af755de35a5c500b3dd50f326b274c216464e526377688af2aa7b14f"
  license "Apache-2.0"

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_monterey: "bf3d70bd3155b9bb1f05de8d8813e0fcf2c7d0ab94816b518d89aeda6efd100f"
    sha256 cellar: :any_skip_relocation, arm64_big_sur:  "6386fe25fee7c249a7bcbb465ec5e137152389771131b93a9d3f8bf9ff86418f"
    sha256 cellar: :any_skip_relocation, monterey:       "3b46547ff49207a70224c3397cf8612982a59808d93d198b0f4203b64e886b32"
    sha256 cellar: :any_skip_relocation, big_sur:        "f4faca27c91ceb7bf1c64d2299eacd4a00d8676bc3b705601961641845920420"
    sha256 cellar: :any_skip_relocation, catalina:       "99e44dc55bd70f59b24d8fb2d63c9c173be4f860dda3e835a83b6a8abb27bb4a"
    sha256 cellar: :any_skip_relocation, x86_64_linux:   "1b01d01df71ac117d9103538d4a426a9684a381372ebe2b4d61279010d91d31e"
  end

  depends_on "go" => :build
  depends_on "node@16" => :build # Switch back to node with https://github.com/vercel/pkg/issues/1364

  def install
    Language::Node.setup_npm_environment

    ldflags = %W[
      -s -w
      -X github.com/hasura/graphql-engine/cli/v2/version.BuildVersion=#{version}
      -X github.com/hasura/graphql-engine/cli/v2/plugins.IndexBranchRef=master
    ]

    # Based on `make build-cli-ext`, but only build a single host-specific binary
    cd "cli-ext" do
      system "npm", "install", *Language::Node.local_npm_install_args
      system "npm", "run", "prebuild"
      system "./node_modules/.bin/pkg", "./build/command.js", "--output", "./bin/cli-ext-hasura", "-t", "host"
    end

    cd "cli" do
      arch = Hardware::CPU.intel? ? "amd64" : Hardware::CPU.arch.to_s
      os = OS.kernel_name.downcase

      cp "../cli-ext/bin/cli-ext-hasura", "./internal/cliext/static-bin/#{os}/#{arch}/cli-ext"
      system "go", "build", *std_go_args(output: bin/"hasura", ldflags: ldflags), "./cmd/hasura/"

      generate_completions_from_executable(bin/"hasura", "completion", base_name: "hasura", shells: [:bash, :zsh])
    end
{'fraction_non_alphanumeric': 0.12016337059329321, 'fraction_numerical': 0.1498280309544282, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4586047', 'n_tokens_mistral': 2279, 'n_tokens_neox': 1899, 'n_words': 275}