<commit_before>require 'rubygems'
require 'rspec'
require 'mocha/api'

require 'tempfile'
require 'fileutils'
require 'pathname'

TMP_PATH     = File.join(Dir.tmpdir, 'braid_integration')
EDITOR_CMD   = "#{TMP_PATH}/editor"
EDITOR_CMD_PREFIX = "GIT_EDITOR=#{EDITOR_CMD}"
BRAID_PATH   = Pathname.new(File.dirname(__FILE__)).parent.realpath
FIXTURE_PATH = File.join(BRAID_PATH, 'spec', 'fixtures')
FileUtils.rm_rf(TMP_PATH)
FileUtils.mkdir_p(TMP_PATH)

BRAID_BIN = ((defined?(JRUBY_VERSION) || Gem.win_platform?) ? 'ruby ' : '') + File.join(BRAID_PATH, 'bin', 'braid')

def set_editor_message(message = 'Make some changes')
  File.write(EDITOR_CMD, <<CMD)
#!/usr/bin/env ruby
File.write(ARGV[0], #{message.inspect})
CMD
  FileUtils.chmod 0755, EDITOR_CMD
end

def assert_no_diff(file1, file2)
  run_command("diff -U 3 #{file1} #{file2}")
end
<commit_msg>Attempt to get tests to work in earlier versions of ruby<commit_after>require 'rubygems'
require 'rspec'
require 'mocha/api'

require 'tempfile'
require 'fileutils'
require 'pathname'

TMP_PATH     = File.join(Dir.tmpdir, 'braid_integration')
EDITOR_CMD   = "#{TMP_PATH}/editor"
EDITOR_CMD_PREFIX = "export GIT_EDITOR=#{EDITOR_CMD};"
BRAID_PATH   = Pathname.new(File.dirname(__FILE__)).parent.realpath
FIXTURE_PATH = File.join(BRAID_PATH, 'spec', 'fixtures')
FileUtils.rm_rf(TMP_PATH)
FileUtils.mkdir_p(TMP_PATH)

BRAID_BIN = ((defined?(JRUBY_VERSION) || Gem.win_platform?) ? 'ruby ' : '') + File.join(BRAID_PATH, 'bin', 'braid')

def set_editor_message(message = 'Make some changes')
  File.write(EDITOR_CMD, <<CMD)
#!/usr/bin/env ruby
File.open(ARGV[0], 'w') { |file| file.write(#{message.inspect}) }
CMD
  FileUtils.chmod 0755, EDITOR_CMD
end

def assert_no_diff(file1, file2)
  run_command("diff -U 3 #{file1} #{file2}")
end

{'fraction_non_alphanumeric': 0.15496911847276812, 'fraction_numerical': 0.011229646266142616, 'mean_word_length': 6.394190871369295, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '328802', 'n_tokens_mistral': 717, 'n_tokens_neox': 704, 'n_words': 131}