<commit_before>$:.unshift 'lib'

require 'rubygems'
require 'tempfile'
require 'fileutils'
require 'mongify/cli/application'
require 'mongify'
require 'spec/support/generate_database'
require 'spec/support/config_reader'

::CONNECTION_CONFIG = ConfigReader.new(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__)))) + '/spec/support/database.yml')
::DATABASE_PRINT = File.read(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__)))) + '/spec/support/database_output.txt')

class MongifyWorld
  def run(cmd)
    stderr_file = Tempfile.new('mongify-world')
    stderr_file.close
    @last_stdout = `#{cmd} 2> #{stderr_file.path}`
    @last_exit_status = $?.exitstatus
    @last_stderr = IO.read(stderr_file.path)
  end

  def mongify(args)
    run("ruby -Ilib -rubygems bin/mongify #{args}")
  end
end

World do
  MongifyWorld.new
end
<commit_msg>Small update to how cucumber reads env file<commit_after>$:.unshift 'lib'

require 'rubygems'
require 'tempfile'
require 'fileutils'
require 'mongify/cli/application'
require 'mongify'
require 'spec/support/generate_database'
require 'spec/support/config_reader'

::CONNECTION_CONFIG = ConfigReader.new(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__)))) + '/spec/support/database.yml')
::DATABASE_PRINT = File.read(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__)))) + '/spec/support/database_output.txt')

module MongifyWorld
  def run(cmd)
    stderr_file = Tempfile.new('mongify-world')
    stderr_file.close
    @last_stdout = `#{cmd} 2> #{stderr_file.path}`
    @last_exit_status = $?.exitstatus
    @last_stderr = IO.read(stderr_file.path)
  end

  def mongify(args)
    run("ruby -Ilib -rubygems bin/mongify #{args}")
  end
end

World(MongifyWorld)

{'fraction_non_alphanumeric': 0.1412365286443562, 'fraction_numerical': 0.0011344299489506524, 'mean_word_length': 5.533333333333333, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4856844', 'n_tokens_mistral': 612, 'n_tokens_neox': 605, 'n_words': 106}