<commit_before>require "formula"

class Pulse < Formula
  homepage "https://ind.ie/pulse/"
  url "https://source.ind.ie/project/pulse.git", :tag => "0.1.3"
  head "https://source.ind.ie/project/pulse.git"

  bottle do
    sha1 "3a317698b3e2cc48de45852ded68e683d3237db1" => :yosemite
    sha1 "7e4692f0e48b959c28efe7c1619affd51e4a95c4" => :mavericks
    sha1 "d6a0a72a1c19d38a685579b6f12b28be1c878900" => :mountain_lion
  end

  depends_on "go" => :build
  depends_on :hg => :build

  def install
    ENV["GOPATH"] = cached_download/".gopath"
    ENV.append_path "PATH", "#{ENV["GOPATH"]}/bin"

    hack_dir = cached_download/".gopath/src/source.ind.ie/project/"
    rm_rf  hack_dir
    mkdir_p hack_dir
    ln_s cached_download, "#{hack_dir}/pulse"
    ln_s cached_download/".git", ".git"

    system "./build.sh", "noupgrade"
    prefix.install %w{ CONTRIBUTING.md LICENSE README.md }
    bin.install "pulse"
  end

  def plist; <<-EOS.undent
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>EnvironmentVariables</key>
        <dict>
          <key>STNORESTART</key>
          <string>yes</string>
        </dict>
        <key>KeepAlive</key>
        <true/>
        <key>Label</key><commit_msg>pulse: set GIT_DIR instead of symlinking<commit_after>require "formula"

class Pulse < Formula
  homepage "https://ind.ie/pulse/"
  url "https://source.ind.ie/project/pulse.git", :tag => "0.1.3"
  head "https://source.ind.ie/project/pulse.git"

  bottle do
    sha1 "3a317698b3e2cc48de45852ded68e683d3237db1" => :yosemite
    sha1 "7e4692f0e48b959c28efe7c1619affd51e4a95c4" => :mavericks
    sha1 "d6a0a72a1c19d38a685579b6f12b28be1c878900" => :mountain_lion
  end

  depends_on "go" => :build
  depends_on :hg => :build

  def install
    ENV["GOPATH"] = cached_download/".gopath"
    ENV.append_path "PATH", "#{ENV["GOPATH"]}/bin"

    # FIXME do this without mutating the cache!
    hack_dir = cached_download/".gopath/src/source.ind.ie/project/"
    rm_rf  hack_dir
    mkdir_p hack_dir
    ln_s cached_download, "#{hack_dir}/pulse"
    ENV["GIT_DIR"] = cached_download/".git"

    system "./build.sh", "noupgrade"
    prefix.install %w{ CONTRIBUTING.md LICENSE README.md }
    bin.install "pulse"
  end

  def plist; <<-EOS.undent
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>EnvironmentVariables</key>
        <dict>
          <key>STNORESTART</key>
          <string>yes</string>
        </dict>
        <key>KeepAlive</key>
        <true/>
        <key>Label</key>
{'fraction_non_alphanumeric': 0.15628375945264675, 'fraction_numerical': 0.0662585523946705, 'mean_word_length': 3.067349926793558, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 2, '>': 49, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2798073', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1091, 'n_words': 180}