<commit_before>require_relative 'forge_module'

def erb(mode, input, output)
  @mode = mode

  template = FORGE_MODULE.file(input)
  target = FORGE_MODULE.file(output)

  puts "[ERB] Rendering #{output} from #{input}"
  renderer = ERB.new(File.read(template), 0, '>')
  File.write(target, renderer.result)
end

file '.github/README.md' => 'README.md.erb' do
  erb(:github, 'README.md.erb', '.github/README.md')
end

file 'README.md' => 'README.md.erb' do
  erb(:release, 'README.md.erb', 'README.md')
end

desc 'Render README files from template'
task readme: ['README.md', '.github/README.md']

task build: :readme
<commit_msg>Force README regeneration<commit_after>require_relative 'forge_module'

def erb(mode, input, output)
  @mode = mode

  template = FORGE_MODULE.file(input)
  target = FORGE_MODULE.file(output)

  puts "[ERB] Rendering #{output} from #{input}"
  renderer = ERB.new(File.read(template), 0, '>')
  File.write(target, renderer.result)
end

desc 'Render README files from template'
task :readme do
  FileUtils.rm_f('.github/README.md')
  erb(:github, 'README.md.erb', '.github/README.md')

  FileUtils.rm_f('README.md')
  erb(:release, 'README.md.erb', 'README.md')
end

task build: :readme
task mdl: :readme

{'fraction_non_alphanumeric': 0.16328188464662877, 'fraction_numerical': 0.0016246953696181965, 'mean_word_length': 4.838862559241706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7418942', 'n_tokens_mistral': 483, 'n_tokens_neox': 472, 'n_words': 103}