<commit_before>module IntegrationHelper
  class TestRepo

    REPO = "https://github.com/renderedtext/test-boosters-tests.git".freeze

    attr_reader :project_path

    def initialize(test_project)
      @repo_path = "/tmp/test-boosters-tests"
      @project_path = "/tmp/test-boosters-tests/#{test_project}"
      @env = ""
    end

    def clone
      puts "Cloning Repo"
      system("[ ! -e #{@repo_path} ] && git clone #{REPO} #{@repo_path}")
    end

    def set_env_var(name, value)
      @env += "#{name}=#{value} "
    end

    def use_cucumber_config(file)
      system("mv config/#{file} config/cucumber.yml")
    end

    # :reek:TooManyStatements
    def run_command(command)
      Bundler.with_clean_env do
        cmd = "cd #{@project_path} && #{@env} #{command}"

        puts "Running: #{cmd}"

        output = `#{cmd}`

        puts output

        output
      end
    end

    def run_booster(command)
      run_command("BUNDLE_GEMFILE=#{Dir.pwd}/Gemfile bundle exec #{command}")
    end
  end
end<commit_msg>Raise exeption if yaml file doesn't exist<commit_after>module IntegrationHelper
  class TestRepo

    REPO = "https://github.com/renderedtext/test-boosters-tests.git".freeze

    attr_reader :project_path

    def initialize(test_project)
      @repo_path = "/tmp/test-boosters-tests"
      @project_path = "/tmp/test-boosters-tests/#{test_project}"
      @env = ""
    end

    def clone
      puts "Cloning Repo"
      system("[ ! -e #{@repo_path} ] && git clone #{REPO} #{@repo_path}")
    end

    def set_env_var(name, value)
      @env += "#{name}=#{value} "
    end

    def use_cucumber_config(file)
      if File.file?("#{@project_path}/config/#{file}")
        system("mv #{@project_path}/config/#{file} #{@project_path}/config/cucumber.yml")
      else
        raise "#{file} doesn't exist. Please use existing configuration yaml."
      end
    end

    # :reek:TooManyStatements
    def run_command(command)
      Bundler.with_clean_env do
        cmd = "cd #{@project_path} && #{@env} #{command}"

        puts "Running: #{cmd}"

        output = `#{cmd}`

        puts output

        output
      end
    end

    def run_booster(command)
      run_command("BUNDLE_GEMFILE=#{Dir.pwd}/Gemfile bundle exec #{command}")
    end
  end
end
{'fraction_non_alphanumeric': 0.13941253836036827, 'fraction_numerical': 0.0, 'mean_word_length': 2.662921348314607, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1772548', 'n_tokens_mistral': 779, 'n_tokens_neox': 769, 'n_words': 158}