<commit_before>require 'tempfile'
stderr_file = Tempfile.new("vcr.stderr")
$stderr.reopen(stderr_file.path)
current_dir = Dir.pwd

require 'rspec/core'

RSpec.configure do |config|
  config.after(:suite) do
    stderr_file.rewind
    lines = stderr_file.read.split("\n").uniq
    stderr_file.close!

    vcr_warnings, other_warnings = lines.partition { |line| line.include?(current_dir) }

    # For some weird reason, JRuby is giving me some warnings about
    # `@proxy` not being initialized, and putting a vcr file/line number
    # in the warning, but it's really happening in excon.
    if RUBY_PLATFORM == 'java'
      vcr_warnings.reject! do |line|
        line.include?('@proxy not initialized') && line.include?('excon')
      end
    end

    if vcr_warnings.any?
      puts
      puts "-" * 30 + " VCR Warnings: " + "-" * 30
      puts
      puts vcr_warnings.join("\n")
      puts
      puts "-" * 75
      puts
    end

    if other_warnings.any?
      File.open('tmp/warnings.txt', 'w') { |f| f.write(other_warnings.join("\n")) }
      puts
      puts "Non-VCR warnings written to tmp/warnings.txt"
      puts
    end

    # fail the build...
    raise "Failing build due to VCR warnings" if vcr_warnings.any?
  end
end

<commit_msg>Rubygems must be required before rspec on 1.8.<commit_after>require 'tempfile'
stderr_file = Tempfile.new("vcr.stderr")
$stderr.reopen(stderr_file.path)
current_dir = Dir.pwd

require 'rubygems' if RUBY_VERSION =~ /^1\.8/
require 'rspec/core'

RSpec.configure do |config|
  config.after(:suite) do
    stderr_file.rewind
    lines = stderr_file.read.split("\n").uniq
    stderr_file.close!

    vcr_warnings, other_warnings = lines.partition { |line| line.include?(current_dir) }

    # For some weird reason, JRuby is giving me some warnings about
    # `@proxy` not being initialized, and putting a vcr file/line number
    # in the warning, but it's really happening in excon.
    if RUBY_PLATFORM == 'java'
      vcr_warnings.reject! do |line|
        line.include?('@proxy not initialized') && line.include?('excon')
      end
    end

    if vcr_warnings.any?
      puts
      puts "-" * 30 + " VCR Warnings: " + "-" * 30
      puts
      puts vcr_warnings.join("\n")
      puts
      puts "-" * 75
      puts
    end

    if other_warnings.any?
      File.open('tmp/warnings.txt', 'w') { |f| f.write(other_warnings.join("\n")) }
      puts
      puts "Non-VCR warnings written to tmp/warnings.txt"
      puts
    end

    # fail the build...
    raise "Failing build due to VCR warnings" if vcr_warnings.any?
  end
end


{'fraction_non_alphanumeric': 0.12077669902912622, 'fraction_numerical': 0.006213592233009709, 'mean_word_length': 2.7551020408163267, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4193696', 'n_tokens_mistral': 911, 'n_tokens_neox': 891, 'n_words': 232}