<commit_before>require 'rake'
require 'rake/testtask'

task :default => [:clean, "#{$ext_name}.bundle"]


task :clean do
  cd $cwd do
    rm_rf "#{$ext_name}.bundle"
  end
end

file "#{$ext_name}.bundle" do
  cd $cwd do
    sh "cc -dynamic -bundle -undefined suppress -flat_namespace -I ../../../shotgun/lib/subtend -g -o #{$ext_name}.bundle #{$ext_name}.c"
  end
end<commit_msg>Ticket #91: Made spec/subtend/rake_helper.rb more portable.<commit_after>require 'rake'
require 'rake/clean'

input = "#{$cwd}/#{$ext_name}.c"
common = "-I shotgun/lib/subtend -g #{input}"

case PLATFORM
when /darwin/
  output = "#{$cwd}/#{$ext_name}.bundle"
  build_cmd = "cc -dynamic -bundle -undefined suppress -flat_namespace #{common} -o #{output}"
else
  output = "#{$cwd}/#{$ext_name}.so"
  build_cmd = "cc -shared #{common} -o #{output}"
end

CLOBBER.include(output)

task :default => [output]

file output => [input] do
  sh build_cmd
end

{'fraction_non_alphanumeric': 0.18446601941747573, 'fraction_numerical': 0.002157497303128371, 'mean_word_length': 4.0162162162162165, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '1524998', 'n_tokens_mistral': 348, 'n_tokens_neox': 340, 'n_words': 91}