<commit_before># encoding: UTF-8


Sequel.extension :inflector

require 'logger'
require 'fileutils'

module Spontaneous
  SLASH = "/".freeze
  class << self
    def init(options={})
      self.environment = options.delete(:environment) || :development
      self.mode = options.delete(:mode) || :back
      self.config = options
      # DataMapper::Logger.new(log_dir / "#{mode}.log", :debug)
      # DataMapper.setup(:default, db_settings)
      self.database = Sequel.connect(db_settings)
      Schema.load
    end

    def database=(database)
      @database = database
    end

    def database
      @database
    end

    def config=(config={})
      config.delete(:db)
      @config = {
        :template_root => root / "templates",
        :template_extension => "erb",
        :db => db_settings
      }
      @config[mode] = mode_settings
      @config.merge(config)
    end

    def config
      @config
    end

    def log_dir
      root / "log"
    end

    def config_dir
      root / "config"
    end

    def mode_settings
      config_file = root / "config" / "#{mode}.yml"
      config = YAML.load_file(config_file)
      config[environment]
    end

    def db_settings
      @db_settings = YAML.load_file(File.join(config_dir, "database.yml"))
      @db_settings[environment]
    end

    def mode=(mode)
      @mode = mode
    end

    def mode
      @mode
    end

    def front?
      mode == :front
    end

    def back?
      mode == :back
    end

    def environment=(env)
      @environment = env
    end

    def environment
      @environment
    end

    alias_method :env, :environment

    def development?
      environment == :development
    end

    def production?
      environment == :production
    end

    def template_root=(template_root)
      @template_root = File.expand_path(template_root)
    end

    def template_root
      @template_root ||= root / "templates"
    end

    def template_path(*args)
      File.join(template_root, *args)
    end

    def schema_root=(schema_root)
      @schema_root = schema_root
    end

    def schema_root
      @schema_root ||= root / "schema"
    end

    def template_ext
      Cutaneous.extension
    end

    attr_accessor :render_engine

    def media_dir=(dir)
      @media_dir = File.expand_path(dir)
    end

    def media_dir
      @media_dir ||= File.expand_path(root / "public/media")
    end

    def media_path(*args)
      Media.media_path(*args)
    end

    def root
      @root ||= File.expand_path(Dir.pwd)
    end

    def root=(root)
      @root = File.expand_path(root)
    end

    def application_dir
      @application_dir ||= File.expand_path("../../application", __FILE__)
    end

    def application_file(*args)
      File.join(application_dir, *args)
    end

    def static_dir
      application_dir / "static"
    end

    def js_dir
      application_dir / "js"
    end

    def css_dir
      application_dir / "css"
    end
  end

  autoload :ProxyObject, "spontaneous/proxy_object"
  autoload :Plugins, "spontaneous/plugins"

  autoload :Constants, "spontaneous/constants"


  autoload :Content, "spontaneous/content"
  autoload :Page, "spontaneous/page"
  autoload :Facet, "spontaneous/facet"

  autoload :FieldTypes, "spontaneous/field_types"

  autoload :Entry, "spontaneous/entry"
  autoload :PageEntry, "spontaneous/page_entry"
  autoload :EntrySet, "spontaneous/entry_set"


  autoload :Style, "spontaneous/style"
  autoload :StyleDefinitions, "spontaneous/style_definitions"
  autoload :RenderContext, "spontaneous/render_context"
  autoload :RenderFormatProxy, "spontaneous/render_format_proxy"

  autoload :Site, "spontaneous/site"
  autoload :Schema, "spontaneous/schema"<commit_msg>added config to autoload list<commit_after># encoding: UTF-8


Sequel.extension :inflector

require 'logger'
require 'fileutils'

module Spontaneous
  SLASH = "/".freeze
  class << self
    def init(options={})
      self.environment = options.delete(:environment) || :development
      self.mode = options.delete(:mode) || :back
      self.config = options
      # DataMapper::Logger.new(log_dir / "#{mode}.log", :debug)
      # DataMapper.setup(:default, db_settings)
      self.database = Sequel.connect(db_settings)
      Schema.load
    end

    def database=(database)
      @database = database
    end

    def database
      @database
    end

    def config=(config={})
      config.delete(:db)
      @config = {
        :template_root => root / "templates",
        :template_extension => "erb",
        :db => db_settings
      }
      @config[mode] = mode_settings
      @config.merge(config)
    end

    def config
      @config
    end

    def log_dir
      root / "log"
    end

    def config_dir
      root / "config"
    end

    def mode_settings
      config_file = root / "config" / "#{mode}.yml"
      config = YAML.load_file(config_file)
      config[environment]
    end

    def db_settings
      @db_settings = YAML.load_file(File.join(config_dir, "database.yml"))
      @db_settings[environment]
    end

    def mode=(mode)
      @mode = mode
    end

    def mode
      @mode
    end

    def front?
      mode == :front
    end

    def back?
      mode == :back
    end

    def environment=(env)
      @environment = env
    end

    def environment
      @environment
    end

    alias_method :env, :environment

    def development?
      environment == :development
    end

    def production?
      environment == :production
    end

    def template_root=(template_root)
      @template_root = File.expand_path(template_root)
    end

    def template_root
      @template_root ||= root / "templates"
    end

    def template_path(*args)
      File.join(template_root, *args)
    end

    def schema_root=(schema_root)
      @schema_root = schema_root
    end

    def schema_root
      @schema_root ||= root / "schema"
    end

    def template_ext
      Cutaneous.extension
    end

    attr_accessor :render_engine

    def media_dir=(dir)
      @media_dir = File.expand_path(dir)
    end

    def media_dir
      @media_dir ||= File.expand_path(root / "public/media")
    end

    def media_path(*args)
      Media.media_path(*args)
    end

    def root
      @root ||= File.expand_path(Dir.pwd)
    end

    def root=(root)
      @root = File.expand_path(root)
    end

    def application_dir
      @application_dir ||= File.expand_path("../../application", __FILE__)
    end

    def application_file(*args)
      File.join(application_dir, *args)
    end

    def static_dir
      application_dir / "static"
    end

    def js_dir
      application_dir / "js"
    end

    def css_dir
      application_dir / "css"
    end
  end

  autoload :ProxyObject, "spontaneous/proxy_object"
  autoload :Plugins, "spontaneous/plugins"

  autoload :Constants, "spontaneous/constants"
  autoload :Config, "spontaneous/config"


  autoload :Content, "spontaneous/content"
  autoload :Page, "spontaneous/page"
  autoload :Facet, "spontaneous/facet"

  autoload :FieldTypes, "spontaneous/field_types"

  autoload :Entry, "spontaneous/entry"
  autoload :PageEntry, "spontaneous/page_entry"
  autoload :EntrySet, "spontaneous/entry_set"


  autoload :Style, "spontaneous/style"
  autoload :StyleDefinitions, "spontaneous/style_definitions"
  autoload :RenderContext, "spontaneous/render_context"
  autoload :RenderFormatProxy, "spontaneous/render_format_proxy"

  autoload :Site, "spontaneous/site"
  autoload :Schema, "spontaneous/schema"
{'fraction_non_alphanumeric': 0.10126751167444964, 'fraction_numerical': 0.000266844563042028, 'mean_word_length': 2.602114368092263, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '2084664', 'n_tokens_mistral': 2478, 'n_tokens_neox': 2377, 'n_words': 532}