<commit_before>#!/usr/bin/env ruby
require 'rubygems'
require 'fileutils'
Root = File.expand_path('../', File.dirname(__FILE__))
require "#{Root}/config/environment_config.rb"

source_dir = ARGV[0]
target_dir = ARGV[1]
Dir.foreach(target_dir){|f|raise "#{target_dir} is not an empty directory" unless f =~ /^\./}

#modified from http://iamneato.com/2009/07/28/copy-folders-recursively
def recursive_copy(src_dir,dest_dir,level=0)
  Dir.foreach(src_dir) do |file|
    next if file =~ /^\./
    s = File.join(src_dir, file)
    d = File.join(dest_dir, file)
    if File.directory?(s)
      FileUtils.mkdir(d)
      recursive_copy(s,d,level+1)
    elsif level > 0
      FileUtils.cp(s, d)
    end
  end
end

recursive_copy(source_dir,target_dir)
Git = R8::EnvironmentConfig::GitExecutable
Dir.foreach(target_dir) do |dir|
  Dir.chdir(File.join(target_dir,dir)) do 
    `#{Git} init`
    `#{Git} add .`
    `#{Git} commit -m 'initializing #{dir}'`
  end
end

<commit_msg>patch to windows repo<commit_after>#!/usr/bin/env ruby
require 'rubygems'
require 'fileutils'
Root = File.expand_path('../', File.dirname(__FILE__))
require "#{Root}/config/environment_config.rb"

source_dir = ARGV[0]
target_dir = ARGV[1]
Dir.foreach(target_dir){|f|raise "#{target_dir} is not an empty directory" unless f =~ /^\./}

#modified from http://iamneato.com/2009/07/28/copy-folders-recursively
def recursive_copy(src_dir,dest_dir,level=0)
  Dir.foreach(src_dir) do |file|
    next if file =~ /^\./
    s = File.join(src_dir, file)
    d = File.join(dest_dir, file)
    if File.directory?(s)
      FileUtils.mkdir(d)
      recursive_copy(s,d,level+1)
    elsif level > 0
      FileUtils.cp(s, d)
    end
  end
end

recursive_copy(source_dir,target_dir)
Git = R8::EnvironmentConfig::GitExecutable
Dir.foreach(target_dir) do |dir|
  Dir.chdir(File.join(target_dir,dir)) do 
    `#{Git} init`
    `#{Git} add .`
    `#{Git} commit -m 'initializing-#{dir}'`
  end
end


{'fraction_non_alphanumeric': 0.16014418125643667, 'fraction_numerical': 0.014418125643666324, 'mean_word_length': 4.033678756476684, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5200306', 'n_tokens_mistral': 781, 'n_tokens_neox': 748, 'n_words': 146}