<commit_before>module DummyApp
  extend self

  def setup(stash_files = true, &block)
    @prepared = true
    stash_all  if stash_files
    yield self if block_given?
    require File.expand_path("../../test_helper.rb", __FILE__)
  end

  def stash_all
    stash  "Gemfile", :gemfile
    stash  "Gemfile.lock"
    stash  "app/models/*.rb"
    stash  "config/initializers/enrichments.rb"
    stash  "config/routes.rb", :routes
    stash  "test/fixtures/*_users.yml"
    delete "db/migrate/*.rb"
  end

  def restore_all(force = nil)
    if @prepared
      unless force
        puts "Cannot (non-forced) restore files after having prepared the dummy app" unless force.nil?
        return
      end
    end

    delete  "db/migrate/*.rb"
    delete  "test/fixtures/cms_contents.yml"
    delete  "test/unit/*.rb"
    restore "app/models/*.rb.#{STASHED_EXT}"
    restore "**/*.#{STASHED_EXT}"
  end

  def restore_admin_fixtures
    puts "\n"
    restore "test/fixtures/*.yml.#{STASHED_EXT}"
  end

  def generate_cms_admin(logic = :devise)<commit_msg>Stashing config/initializers/devise.rb when running 'rake stash' Deleting config/locales/devise.en.yml when running 'rake restore'<commit_after>module DummyApp
  extend self

  def setup(stash_files = true, &block)
    @prepared = true
    stash_all  if stash_files
    yield self if block_given?
    require File.expand_path("../../test_helper.rb", __FILE__)
  end

  def stash_all
    stash  "Gemfile", :gemfile
    stash  "Gemfile.lock"
    stash  "app/models/*.rb"
    stash  "config/initializers/devise.rb"
    stash  "config/initializers/enrichments.rb"
    stash  "config/routes.rb", :routes
    stash  "test/fixtures/*_users.yml"
    delete "db/migrate/*.rb"
  end

  def restore_all(force = nil)
    if @prepared
      unless force
        puts "Cannot (non-forced) restore files after having prepared the dummy app" unless force.nil?
        return
      end
    end

    delete  "config/locales/devise.en.yml"
    delete  "db/migrate/*.rb"
    delete  "test/fixtures/cms_contents.yml"
    delete  "test/unit/*.rb"
    restore "app/models/*.rb.#{STASHED_EXT}"
    restore "**/*.#{STASHED_EXT}"
  end

  def restore_admin_fixtures
    puts "\n"
    restore "test/fixtures/*.yml.#{STASHED_EXT}"
  end

  def generate_cms_admin(logic = :devise)
{'fraction_non_alphanumeric': 0.11831230969986951, 'fraction_numerical': 0.0, 'mean_word_length': 2.885135135135135, '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': '902987', 'n_tokens_mistral': 839, 'n_tokens_neox': 823, 'n_words': 184}