<commit_before>require "fileutils"
require "rbconfig"
require "shellwords"

module CapybaraWebkitBuilder
  extend self

  SUCCESS_STATUS = 0
  COMMAND_NOT_FOUND_STATUS = 127

  def make_bin
    ENV['MAKE'] || 'make'
  end

  def qmake_bin
    ENV['QMAKE'] || default_qmake_binary
  end

  def default_qmake_binary
    case RbConfig::CONFIG['host_os']
    when /freebsd/
      "qmake-qt4"
    when /openbsd/
      "qmake-qt5"
    else
      "qmake"
    end
  end

  def sh(command)
    system(command)
    success = $?.exitstatus == SUCCESS_STATUS
    if $?.exitstatus == COMMAND_NOT_FOUND_STATUS
      puts "Command '#{command}' not available"
    elsif !success
      puts "Command '#{command}' failed"
    end
    success
  end

  def makefile(*configs)
    configs += default_configs
    configs = configs.map { |config| config.shellescape}.join(" ")
    sh("#{qmake_bin} #{configs}")
  end

  def qmake
    make "qmake"
  end

  def path_to_binary
    case RUBY_PLATFORM
    when /mingw32/
      "src/debug/webkit_server.exe"
    else
      "src/webkit_server"<commit_msg>Check for Windows platform in a jruby compatible way<commit_after>require "fileutils"
require "rbconfig"
require "shellwords"

module CapybaraWebkitBuilder
  extend self

  SUCCESS_STATUS = 0
  COMMAND_NOT_FOUND_STATUS = 127

  def make_bin
    ENV['MAKE'] || 'make'
  end

  def qmake_bin
    ENV['QMAKE'] || default_qmake_binary
  end

  def default_qmake_binary
    case RbConfig::CONFIG['host_os']
    when /freebsd/
      "qmake-qt4"
    when /openbsd/
      "qmake-qt5"
    else
      "qmake"
    end
  end

  def sh(command)
    system(command)
    success = $?.exitstatus == SUCCESS_STATUS
    if $?.exitstatus == COMMAND_NOT_FOUND_STATUS
      puts "Command '#{command}' not available"
    elsif !success
      puts "Command '#{command}' failed"
    end
    success
  end

  def makefile(*configs)
    configs += default_configs
    configs = configs.map { |config| config.shellescape}.join(" ")
    sh("#{qmake_bin} #{configs}")
  end

  def qmake
    make "qmake"
  end

  def path_to_binary
    if Gem.win_platform?
      "src/debug/webkit_server.exe"
    else
      "src/webkit_server"
{'fraction_non_alphanumeric': 0.10303587856485741, 'fraction_numerical': 0.006439742410303588, 'mean_word_length': 2.9259927797833933, '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': '7295439', 'n_tokens_mistral': 797, 'n_tokens_neox': 749, 'n_words': 177}