<commit_before># Copyright (c) 2011, <NAME>
# License: 3-clause BSD (see project LICENSE file)
# self.ruby implementation sourced from RubyGems

require 'rbconfig'

module RCI
  CONFIG_FILE = 'config.yml'
  WORLD_CONFIG = Hash.new do |cfg,k|
    cfg[k] = RbConfig::CONFIG[k.to_s]
  end

  require 'yaml'
  YAML::ENGINE.yamler = 'psych' if defined?(YAML::ENGINE)

  begin
    USER_CONFIG = YAML.load_file(File.join(RCI_ROOT, CONFIG_FILE))
  rescue
    abort '[ERROR] problem loading \'%s\' configuration file' % CONFIG_FILE
  end

  # basic config.yml checks
  if USER_CONFIG[:tracer].select {|t| t[:active] }.length != 1
    abort '[ERROR] \'%s\' must configure only one active tracer' % CONFIG_FILE
  end

  # convenience merge of select user config into world config
  WORLD_CONFIG[:workloads_dir] = File.join(RCI_ROOT, RCI::USER_CONFIG[:dirs][:workloads])
  WORLD_CONFIG[:logs_dir] = File.join(RCI_ROOT, RCI::USER_CONFIG[:dirs][:logs])

  def self.ruby
    if @ruby.nil? then
      @ruby = File.join(WORLD_CONFIG[:bindir],
                        WORLD_CONFIG[:ruby_install_name])
      @ruby << WORLD_CONFIG[:EXEEXT]

      # escape string in case path to ruby executable contain spaces.
      @ruby.sub!(/.*\s.*/m, '"\&"')
    end

    @ruby
  end

end<commit_msg>Teach RCI to detect Windows hosts.<commit_after># Copyright (c) 2011, <NAME>
# License: 3-clause BSD (see project LICENSE file)
# self.ruby implementation sourced from RubyGems

require 'rbconfig'

module RCI
  CONFIG_FILE = 'config.yml'
  WORLD_CONFIG = Hash.new do |cfg,k|
    cfg[k] = RbConfig::CONFIG[k.to_s]
  end

  require 'yaml'
  YAML::ENGINE.yamler = 'psych' if defined?(YAML::ENGINE)

  begin
    USER_CONFIG = YAML.load_file(File.join(RCI_ROOT, CONFIG_FILE))
  rescue
    abort '[ERROR] problem loading \'%s\' configuration file' % CONFIG_FILE
  end

  # basic config.yml checks
  if USER_CONFIG[:tracer].select {|t| t[:active] }.length != 1
    abort '[ERROR] \'%s\' must configure only one active tracer' % CONFIG_FILE
  end

  # convenience merge of select user config into world config
  WORLD_CONFIG[:workloads_dir] = File.join(RCI_ROOT, RCI::USER_CONFIG[:dirs][:workloads])
  WORLD_CONFIG[:logs_dir] = File.join(RCI_ROOT, RCI::USER_CONFIG[:dirs][:logs])

  def self.ruby
    if @ruby.nil? then
      @ruby = File.join(WORLD_CONFIG[:bindir],
                        WORLD_CONFIG[:ruby_install_name])
      @ruby << WORLD_CONFIG[:EXEEXT]

      # escape string in case path to ruby executable contain spaces.
      @ruby.sub!(/.*\s.*/m, '"\&"')
    end

    @ruby
  end

  def self.windows?
    WORLD_CONFIG[:host_os] =~ /mswin|mingw/
  end

end
{'fraction_non_alphanumeric': 0.13269961977186312, 'fraction_numerical': 0.0045627376425855515, 'mean_word_length': 3.607705779334501, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6087330', 'n_tokens_mistral': 994, 'n_tokens_neox': 917, 'n_words': 229}