<commit_before>require 'formula'

class Libstfl < Formula
  homepage 'http://www.clifford.at/stfl/'
  url 'http://www.clifford.at/stfl/stfl-0.22.tar.gz'
  sha1 '226488be2b33867dfb233f0fa2dde2d066e494bd'

  bottle do
    cellar :any
    sha1 "9129d6d9e60372e18d6b52f4e2988d561a55d36f" => :mavericks
    sha1 "43c92335569f786b8d7055d178d12fbdf13133e9" => :mountain_lion
    sha1 "c20d248abf27a59b16d51f3383831f56fcd3c5e3" => :lion
  end

  depends_on :python => :optional
  depends_on 'swig' => :build

  patch :DATA

  def install
    args = ["CC=#{ENV.cc} -pthread", "prefix=#{prefix}"]

    args << "FOUND_RUBY = 0" unless MacOS::CLT.installed? # Ruby does not build on Xcode only. Help us fix this!

    if build.with? 'python'
      # Install into the site-packages in the Cellar (so uninstall works)
      inreplace 'python/Makefile.snippet' do |s|<commit_msg>libstfl: builds ruby bindings under Xcode-only on 10.9<commit_after>require 'formula'

class Libstfl < Formula
  homepage 'http://www.clifford.at/stfl/'
  url 'http://www.clifford.at/stfl/stfl-0.22.tar.gz'
  sha1 '226488be2b33867dfb233f0fa2dde2d066e494bd'

  bottle do
    cellar :any
    sha1 "9129d6d9e60372e18d6b52f4e2988d561a55d36f" => :mavericks
    sha1 "43c92335569f786b8d7055d178d12fbdf13133e9" => :mountain_lion
    sha1 "c20d248abf27a59b16d51f3383831f56fcd3c5e3" => :lion
  end

  depends_on :python => :optional
  depends_on 'swig' => :build

  patch :DATA

  def install
    args = ["CC=#{ENV.cc} -pthread", "prefix=#{prefix}"]

    args << "FOUND_RUBY = 0" unless MacOS::CLT.installed? || MacOS.version >= :mavericks

    if build.with? 'python'
      # Install into the site-packages in the Cellar (so uninstall works)
      inreplace 'python/Makefile.snippet' do |s|
{'fraction_non_alphanumeric': 0.1180515759312321, 'fraction_numerical': 0.132378223495702, 'mean_word_length': 4.075581395348837, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '463576', 'n_tokens_mistral': 851, 'n_tokens_neox': 725, 'n_words': 141}