<commit_before>require File.expand_path('../boot', __FILE__)

require 'active_record/railtie'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'sprockets/railtie'

I18n.config.enforce_available_locales = false

Bundler.require(:default, Rails.env)

module RubyDocs
  class Application < Rails::Application
    ::REDIS_CONFIG = if Settings.redis?
      Settings.redis.to_hash
    else
      # Try to read from config/redis.yml
      YAML.load_file(Rails.root.join('config', 'redis.yml')).with_indifferent_access rescue nil
    end

    raise 'Redis config not found.' if REDIS_CONFIG.blank?

    ::REDIS_URL = "redis://#{REDIS_CONFIG[:host]}:#{REDIS_CONFIG[:port]}/#{REDIS_CONFIG[:db]}"

    require 'fakeredis' if %w(development test).include?(Rails.env)

    config.cache_store = :redis_store, REDIS_CONFIG.merge(namespace: 'cache', expires_in: 1.year)

    config.action_dispatch.rack_cache = %i(metastore entitystore).each_with_object({}) do |store, hash|
      hash[store] = "#{REDIS_URL}/rack_cache/#{store}"
    end

    config.autoload_paths += [
      config.root.join('app')
    ]

    config.assets.precompile += %w(
      show-doc-collection.css
    )

    config.secret_key_base = Settings.secret_key_base
  end
end

$DEBUG_RDOC = true<commit_msg>disable annoying i18n error message<commit_after>require File.expand_path('../boot', __FILE__)

require 'active_record/railtie'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'sprockets/railtie'

I18n.config.enforce_available_locales = false

Bundler.require(:default, Rails.env)

module RubyDocs
  class Application < Rails::Application
    ::REDIS_CONFIG = if Settings.redis?
      Settings.redis.to_hash
    else
      # Try to read from config/redis.yml
      YAML.load_file(Rails.root.join('config', 'redis.yml')).with_indifferent_access rescue nil
    end

    raise 'Redis config not found.' if REDIS_CONFIG.blank?

    ::REDIS_URL = "redis://#{REDIS_CONFIG[:host]}:#{REDIS_CONFIG[:port]}/#{REDIS_CONFIG[:db]}"

    require 'fakeredis' if %w(development test).include?(Rails.env)

    config.cache_store = :redis_store, REDIS_CONFIG.merge(namespace: 'cache', expires_in: 1.year)

    config.action_dispatch.rack_cache = %i(metastore entitystore).each_with_object({}) do |store, hash|
      hash[store] = "#{REDIS_URL}/rack_cache/#{store}"
    end

    config.autoload_paths += [
      config.root.join('app')
    ]

    config.assets.precompile += %w(
      show-doc-collection.css
    )

    config.secret_key_base = Settings.secret_key_base

    config.i18n.enforce_available_locales = false
  end
end

$DEBUG_RDOC = true
{'fraction_non_alphanumeric': 0.12892249527410207, 'fraction_numerical': 0.003780718336483932, 'mean_word_length': 4.23960396039604, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1163996', 'n_tokens_mistral': 949, 'n_tokens_neox': 909, 'n_words': 155}