<commit_before>require 'rubygems'
require 'digest/md5'
require 'builder'
require 'sinatra/base'
require 'rubygems/user_interaction'
require 'rubygems/indexer'
require 'rubygems/package'
require 'rss/atom'
require 'tempfile'
require 'json'

module Geminabox

  require_relative 'geminabox/version'
  require_relative 'geminabox/proxy'

  def self.geminabox_path(file)
    File.join File.dirname(__FILE__), 'geminabox', file
  end

  autoload :Hostess,              geminabox_path('hostess')
  autoload :GemStore,             geminabox_path('gem_store')
  autoload :GemStoreError,        geminabox_path('gem_store_error')
  autoload :RubygemsDependency,   geminabox_path('rubygems_dependency')
  autoload :GemListMerge,         geminabox_path('gem_list_merge')
  autoload :GemVersion,           geminabox_path('gem_version')
  autoload :GemVersionCollection, geminabox_path('gem_version_collection')
  autoload :Server,               geminabox_path('server')
  autoload :DiskCache,            geminabox_path('disk_cache')
  autoload :IncomingGem,          geminabox_path('incoming_gem')

  class << self

    attr_accessor(
      :data,
      :public_folder,
      :build_legacy,
      :incremental_updates,
      :views,
      :allow_replace,
      :gem_permissions,
      :allow_delete,
      :rubygems_proxy
    )

    def set_defaults(defaults)
      defaults.each do |method, default|
        variable = "@#{method}"
        instance_variable_set(variable, default) unless instance_variable_get(variable)
      end
    end

    def settings
      Server.settings
    end
  end

  set_defaults(<commit_msg>Allows rack server to be run via "run Geminabox" as well as "run Geminabox::Server"<commit_after>require 'rubygems'
require 'digest/md5'
require 'builder'
require 'sinatra/base'
require 'rubygems/user_interaction'
require 'rubygems/indexer'
require 'rubygems/package'
require 'rss/atom'
require 'tempfile'
require 'json'

module Geminabox

  require_relative 'geminabox/version'
  require_relative 'geminabox/proxy'

  def self.geminabox_path(file)
    File.join File.dirname(__FILE__), 'geminabox', file
  end

  autoload :Hostess,              geminabox_path('hostess')
  autoload :GemStore,             geminabox_path('gem_store')
  autoload :GemStoreError,        geminabox_path('gem_store_error')
  autoload :RubygemsDependency,   geminabox_path('rubygems_dependency')
  autoload :GemListMerge,         geminabox_path('gem_list_merge')
  autoload :GemVersion,           geminabox_path('gem_version')
  autoload :GemVersionCollection, geminabox_path('gem_version_collection')
  autoload :Server,               geminabox_path('server')
  autoload :DiskCache,            geminabox_path('disk_cache')
  autoload :IncomingGem,          geminabox_path('incoming_gem')

  class << self

    attr_accessor(
      :data,
      :public_folder,
      :build_legacy,
      :incremental_updates,
      :views,
      :allow_replace,
      :gem_permissions,
      :allow_delete,
      :rubygems_proxy
    )

    def set_defaults(defaults)
      defaults.each do |method, default|
        variable = "@#{method}"
        instance_variable_set(variable, default) unless instance_variable_get(variable)
      end
    end

    def settings
      Server.settings
    end
    
    def call(env)
      Server.call env
    end
  end

  set_defaults(
{'fraction_non_alphanumeric': 0.09074573225516622, 'fraction_numerical': 0.0005989817310572028, 'mean_word_length': 3.4592790387182912, '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': '2079884', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1113, 'n_words': 207}