<commit_before>require "lit/engine"
require 'lit/loader'

module Lit
  mattr_accessor :authentication_function
  mattr_accessor :key_value_engine
  mattr_accessor :storage_options
  mattr_accessor :fallback
  class << self
    attr_accessor :loader
  end
  def self.init
    if self.loader.nil?
      self.loader ||= Loader.new
      #if loading all translations on start, migrations have to be performed
      #already, fails on first deploy
      #self.loader.cache.load_all_translations
      Lit.storage_options ||= {}
    end
    self.loader
  end

  def self.get_key_value_engine
    case Lit.key_value_engine
        when 'redis'
          require 'lit/adapters/redis_storage'
          return RedisStorage.new
        else
          require 'lit/adapters/hash_storage'
          return HashStorage.new
    end
  end<commit_msg>check if table exists before initializing lit - should solve deploy problems<commit_after>require "lit/engine"
require 'lit/loader'

module Lit
  mattr_accessor :authentication_function
  mattr_accessor :key_value_engine
  mattr_accessor :storage_options
  mattr_accessor :fallback
  class << self
    attr_accessor :loader
  end
  def self.init
    @@table_exists ||= Lit::Locale.table_exists?
    if self.loader.nil? && @@table_exists
      self.loader ||= Loader.new
      #if loading all translations on start, migrations have to be performed
      #already, fails on first deploy
      #self.loader.cache.load_all_translations
      Lit.storage_options ||= {}
    end
    self.loader
  end

  def self.get_key_value_engine
    case Lit.key_value_engine
        when 'redis'
          require 'lit/adapters/redis_storage'
          return RedisStorage.new
        else
          require 'lit/adapters/hash_storage'
          return HashStorage.new
    end
  end
{'fraction_non_alphanumeric': 0.06777777777777778, 'fraction_numerical': 0.0, 'mean_word_length': 2.923747276688453, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5160351', 'n_tokens_mistral': 552, 'n_tokens_neox': 541, 'n_words': 138}