<commit_before>require 'formula'

class Bcftools < Formula
  homepage 'https://github.com/samtools/bcftools'
  version '0.2.0-rc6'
  url "https://github.com/samtools/bcftools/archive/#{version}.tar.gz"
  sha1 '544fb9f186960e55b492e5785023220fb3e004ea'
  depends_on 'chapmanb/cbl/htslib'

  def install
    inreplace 'Makefile', 'include $(HTSDIR)/htslib.mk', ''
    htslib = Formula.factory('htslib').opt_prefix
    inreplace 'Makefile' do |s|
      s.change_make_var! 'HTSDIR', htslib
      s.change_make_var! 'HTSLIB', "#{htslib}/lib/libhts.a"
      s.change_make_var! 'INCLUDES', "-I. -I#{htslib}/include"
      s.gsub! '$(HTSDIR)/htslib/', '$(HTSDIR)/include/htslib/'
      s.gsub! 'all:$(PROG) plugins', 'all:$(PROG)'
    end
    # Write version since current Makefile logic fails on non-gmake systems
    system "echo '#define BCFTOOLS_VERSION \"#{version}\"' > version.h"
    system 'make'
    system 'make', 'install', 'prefix=' + prefix
  end

  test do
    system 'bcftools'
  end
end
<commit_msg>bcftools: Tidy up the formula<commit_after>require "formula"

class Bcftools < Formula
  homepage "https://github.com/samtools/bcftools"
  version "0.2.0-rc6"
  url "https://github.com/samtools/bcftools/archive/#{version}.tar.gz"
  sha1 "544fb9f186960e55b492e5785023220fb3e004ea"
  head "https://github.com/samtools/bcftools.git"

  depends_on "htslib"

  def install
    inreplace "Makefile", "include $(HTSDIR)/htslib.mk", ""
    inreplace "Makefile", "$(HTSDIR)/version.h", "$(HTSDIR)/htslib/version.h"
    htslib = Formula["htslib"].opt_prefix
    system *%W[make bcftools HTSDIR=#{htslib}/include HTSLIB=#{htslib}/lib/libhts.a]
    system *%W[make install prefix=#{prefix} HTSDIR=#{htslib}/include HTSLIB=#{htslib}/lib/libhts.a]
  end

  test do
    system "#{bin}/bcftools 2>&1 |grep -q bcftools"
  end
end

{'fraction_non_alphanumeric': 0.15989010989010988, 'fraction_numerical': 0.038461538461538464, 'mean_word_length': 4.058333333333334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 5, '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': '4456540', 'n_tokens_mistral': 759, 'n_tokens_neox': 720, 'n_words': 130}