<commit_before>require 'sinatra'
require 'json'
require 'mongoid'
require 'tire'
require 'yajl/json_gem'
require './models/app_version'
require './models/user'
require './models/favor'
require './models/favor_response'
require './models/favor_transaction'

Mongoid.logger = Logger.new($stdout)
Moped.logger = Logger.new($stdout)

Mongoid.logger.level = Logger::DEBUG
Moped.logger.level = Logger::DEBUG  
Mongoid.load!("config/mongoid.yml")

ENV['ELASTICSEARCH_URL'] = ENV['SEARCHBOX_URL'] || "http://localhost:9200"

Tire.configure do
  url ENV['ELASTICSEARCH_URL'] 
  logger 'elasticsearch.log', :level => 'debug'
end

get '/' do
  "FavorBank API #{ENV['RACK_ENV']}"
end

get '/info' do
  AppVersion.all.first.to_json
end

get '/init' do
  AppVersion.all.destroy
  AppVersion.create({:name => 'FavorBank-API', :version => 0.4})

  User.all.destroy
  Favor.all.destroy
  warner = User.create({
    :name => '<NAME>', 
    :email => '<EMAIL>',
    :locality => 'Las Vegas, NV 89104'
  })
  john = User.create({<commit_msg>merging<commit_after>require 'sinatra'
require 'json'
require 'mongoid'
require 'tire'
require 'yajl/json_gem'
require './models/app_version'
require './models/user'
require './models/favor'
require './models/favor_response'
require './models/favor_transaction'

Mongoid.logger = Logger.new($stdout)
Moped.logger = Logger.new($stdout)

Mongoid.logger.level = Logger::DEBUG
Moped.logger.level = Logger::DEBUG  
Mongoid.load!("config/mongoid.yml")

ENV['ELASTICSEARCH_URL'] = ENV['SEARCHBOX_URL'] || "http://localhost:9200"

Tire.configure do
  url ENV['ELASTICSEARCH_URL'] 
  logger $stdout, :level => 'debug'
end

get '/' do
  "FavorBank API #{ENV['RACK_ENV']}"
end

get '/info' do
  AppVersion.all.first.to_json
end

get '/init' do
  AppVersion.all.destroy
  AppVersion.create({:name => 'FavorBank-API', :version => 0.4})

  User.all.destroy
  Favor.all.destroy
  warner = User.create({
    :name => '<NAME>', 
    :email => '<EMAIL>',
    :locality => 'Las Vegas, NV 89104'
  })
  john = User.create({
{'fraction_non_alphanumeric': 0.17193675889328064, 'fraction_numerical': 0.010869565217391304, 'mean_word_length': 4.502717391304348, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '426692', 'n_tokens_mistral': 762, 'n_tokens_neox': 742, 'n_words': 149}