<commit_before>require 'simplecov'
SimpleCov.start

require 'rubygems'
require 'bundler'
Bundler.setup :default, :development, :test
require 'pry'

$: << ::File.expand_path('..', File.dirname(__FILE__))
$: << ::File.expand_path('../spec/support', File.dirname(__FILE__))

require 'protobuf'
require ::File.dirname(__FILE__) + '/support/all'

$: << ::File.expand_path("../../lib/protobuf/descriptors", __FILE__)
require 'google/protobuf/compiler/plugin.pb'

# Including a way to turn on debug logger for spec runs
if ENV["DEBUG"]
  debug_log = ::File.expand_path('../debug_specs.log', File.dirname(__FILE__) )
  ::Protobuf::Logger.configure(:file => debug_log, :level => ::Logger::DEBUG)
end

# Get rid of the deprecation env var if present (messes with specs).
ENV.delete("PB_IGNORE_DEPRECATIONS")

::RSpec.configure do |c|
  c.include(::Sander6::CustomMatchers)
  c.mock_with :rspec

  c.before(:suite) do
    unless defined?(JRUBY_VERSION)
      unless ENV['NO_COMPILE_TEST_PROTOS']
        $stdout.puts 'Compiling test protos (use NO_COMPILE_TEST_PROTOS=1 to skip)'
        proto_path = File.expand_path("../support/", __FILE__)
        cmd = %Q{ rprotoc --proto_path=#{proto_path} --ruby_out=#{proto_path} #{File.join(proto_path, '**', '*.proto')} }
        puts cmd
        %x{#{cmd}}
      end
    end
  end
end

Dir[File.expand_path('../support/**/*.pb.rb', __FILE__)].each do |proto_file|
  require proto_file
end

class ::Protobuf::Rpc::Client
  def ==(other)
    connector.options == other.options && \
      success_cb == other.success_cb && \
      failure_cb == other.failure_cb
  end
end

def reset_service_location(service)
  service.host = nil
  service.port = nil
end<commit_msg>Compile with protoc --plugin in spec_helper<commit_after>require 'simplecov'
SimpleCov.start

require 'rubygems'
require 'bundler'
Bundler.setup :default, :development, :test
require 'pry'

$: << ::File.expand_path('..', File.dirname(__FILE__))
$: << ::File.expand_path('../spec/support', File.dirname(__FILE__))

require 'protobuf'
require ::File.dirname(__FILE__) + '/support/all'

$: << ::File.expand_path("../../lib/protobuf/descriptors", __FILE__)
require 'google/protobuf/compiler/plugin.pb'

# Including a way to turn on debug logger for spec runs
if ENV["DEBUG"]
  debug_log = ::File.expand_path('../debug_specs.log', File.dirname(__FILE__) )
  ::Protobuf::Logger.configure(:file => debug_log, :level => ::Logger::DEBUG)
end

# Get rid of the deprecation env var if present (messes with specs).
ENV.delete("PB_IGNORE_DEPRECATIONS")

::RSpec.configure do |c|
  c.include(::Sander6::CustomMatchers)
  c.mock_with :rspec

  c.before(:suite) do
    unless defined?(JRUBY_VERSION)
      unless ENV['NO_COMPILE_TEST_PROTOS']
        $stdout.puts 'Compiling test protos (use NO_COMPILE_TEST_PROTOS=1 to skip)'
        proto_path = File.expand_path("../support/", __FILE__)
        cmd = %Q{ protoc --plugin=./bin/protoc-gen-ruby --ruby_out=#{proto_path} -I #{proto_path} #{File.join(proto_path, '**', '*.proto')} }
        puts cmd
        %x{#{cmd}}
      end
    end
  end
end

Dir[File.expand_path('../support/**/*.pb.rb', __FILE__)].each do |proto_file|
  require proto_file
end

class ::Protobuf::Rpc::Client
  def ==(other)
    connector.options == other.options && \
      success_cb == other.success_cb && \
      failure_cb == other.failure_cb
  end
end

def reset_service_location(service)
  service.host = nil
  service.port = nil
end
{'fraction_non_alphanumeric': 0.16153399186519465, 'fraction_numerical': 0.0011621150493898896, 'mean_word_length': 4.138805970149254, 'pattern_counts': {'":': 0, '<': 15, '<?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': '3350973', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1179, 'n_words': 252}