<commit_before>##
# Process template files using provided config

require 'erb'
require 'fileutils'

Dir.chdir(@config['paths']['templates']) do
  templates = Dir.glob('**/*').select { |x| File.file? x }
end

templates.each do |path|
  puts "Handling template: #{path}"
  template = File.read "#{@config['paths']['templates']}/#{path}"
  parsed = ERB.new(template, nil, '<>').result(binding)

  target_path = "#{@config['paths']['mount']}/config/templates/#{path}"
  FileUtils.mkdir_p File.dirname(target_path)
  File.open(target_path, 'w') { |fh| fh.write parsed }

  File.symlink "/run/dock0/bootmnt/configs/templates/#{path}", "/#{path}"
end<commit_msg>scoping is for noobs<commit_after>##
# Process template files using provided config

require 'erb'
require 'fileutils'

templates = Dir.chdir(@config['paths']['templates']) do
  Dir.glob('**/*').select { |x| File.file? x }
end

templates.each do |path|
  puts "Handling template: #{path}"
  template = File.read "#{@config['paths']['templates']}/#{path}"
  parsed = ERB.new(template, nil, '<>').result(binding)

  target_path = "#{@config['paths']['mount']}/config/templates/#{path}"
  FileUtils.mkdir_p File.dirname(target_path)
  File.open(target_path, 'w') { |fh| fh.write parsed }

  File.symlink "/run/dock0/bootmnt/configs/templates/#{path}", "/#{path}"
end
{'fraction_non_alphanumeric': 0.20621683093252463, 'fraction_numerical': 0.001516300227445034, 'mean_word_length': 5.470588235294118, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1030374', 'n_tokens_mistral': 456, 'n_tokens_neox': 453, 'n_words': 94}