<commit_before>module SuspendersTestHelpers
  APP_NAME = "dummy_app"

  def remove_project_directory
    FileUtils.rm_rf(project_path)
  end

  def create_tmp_directory
    FileUtils.mkdir_p(tmp_path)
  end

  def run_suspenders(arguments = nil)
    arguments = "--path=#{root_path} #{arguments}"
    run_in_tmp do
      add_fakes_to_path

      with_revision_for_honeybadger do
        debug `#{suspenders_bin} _#{rails_version}_ #{APP_NAME} #{arguments}`
      end

      Dir.chdir(APP_NAME) do
        commit_all
      end
    end
  end

  def with_app
    drop_dummy_database
    remove_project_directory
    rails_new
    setup_app_dependencies

    yield
  end

  def rails_new
    run_in_tmp do
      add_fakes_to_path

      with_revision_for_honeybadger do
        debug `#{system_rails_bin} _#{rails_version}_ new #{APP_NAME} -d postgresql -m #{rails_template_path}`
      end

      Dir.chdir(APP_NAME) do
        commit_all
      end
    end
  end

  def generate(generator)
    run_in_project do
      with_revision_for_honeybadger do
        debug `bin/spring stop`
        debug `#{project_rails_bin} generate #{generator}`
      end
    end
  end

  def destroy(generator)
    run_in_project do
      with_revision_for_honeybadger do
        debug `bin/spring stop`
        debug `#{project_rails_bin} destroy #{generator}`
      end
    end
  end

  def suspenders_help_command
    run_in_tmp do
      debug `#{suspenders_bin} -h`
    end
  end

  def setup_app_dependencies
    run_in_project do
      debug `bundle check || bundle install`
    end
  rescue Errno::ENOENT
    # The project_path might not exist, in which case we can skip this.
  end
<commit_msg>Skip spring in `rails new` for testing<commit_after>module SuspendersTestHelpers
  APP_NAME = "dummy_app"

  def remove_project_directory
    FileUtils.rm_rf(project_path)
  end

  def create_tmp_directory
    FileUtils.mkdir_p(tmp_path)
  end

  def run_suspenders(arguments = nil)
    arguments = "--path=#{root_path} #{arguments}"
    run_in_tmp do
      add_fakes_to_path

      with_revision_for_honeybadger do
        debug `#{suspenders_bin} _#{rails_version}_ #{APP_NAME} #{arguments}`
      end

      Dir.chdir(APP_NAME) do
        commit_all
      end
    end
  end

  def with_app
    drop_dummy_database
    remove_project_directory
    rails_new
    setup_app_dependencies

    yield
  end

  def rails_new
    run_in_tmp do
      add_fakes_to_path

      with_revision_for_honeybadger do
        debug `#{system_rails_bin} _#{rails_version}_ new #{APP_NAME} --skip-spring -d postgresql -m #{rails_template_path}`
      end

      Dir.chdir(APP_NAME) do
        commit_all
      end
    end
  end

  def generate(generator)
    run_in_project do
      with_revision_for_honeybadger do
        debug `#{project_rails_bin} generate #{generator}`
      end
    end
  end

  def destroy(generator)
    run_in_project do
      with_revision_for_honeybadger do
        debug `#{project_rails_bin} destroy #{generator}`
      end
    end
  end

  def suspenders_help_command
    run_in_tmp do
      debug `#{suspenders_bin} -h`
    end
  end

  def setup_app_dependencies
    run_in_project do
      debug `bundle check || bundle install`
    end
  rescue Errno::ENOENT
    # The project_path might not exist, in which case we can skip this.
  end

{'fraction_non_alphanumeric': 0.06206896551724138, 'fraction_numerical': 0.0, 'mean_word_length': 2.786606129398411, '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': '6116125', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1114, 'n_words': 265}