2022-12-07 17:52:27 -05:00
|
|
|
require 'logger'
|
|
|
|
require 'sequel'
|
|
|
|
require 'sqlite3'
|
|
|
|
require 'sinatra'
|
2022-12-10 00:32:23 -05:00
|
|
|
require 'sinatra/namespace'
|
2022-12-07 17:52:27 -05:00
|
|
|
|
|
|
|
require_relative 'lib/config.rb'
|
|
|
|
|
|
|
|
set :public_folder, __dir__ + '/public'
|
|
|
|
|
|
|
|
set :views, settings.root + '/views'
|
|
|
|
|
|
|
|
# Load configuration file
|
|
|
|
conf = Config.new(File.join(__dir__, 'data/defaults.yaml'))
|
|
|
|
|
|
|
|
# Initialize logging
|
|
|
|
logger = Logger.new(STDOUT)
|
|
|
|
logger.level = Logger::INFO
|
|
|
|
|
|
|
|
# Load the Sequel timestamps plugin
|
|
|
|
Sequel::Model.plugin :timestamps
|
|
|
|
# Initialize Sequel gem for database actions
|
|
|
|
DB = Sequel.connect(adapter: conf.get('database.adapter'), database: conf.get('database.database'))
|
|
|
|
# Load models
|
|
|
|
require_relative 'lib/models/item.rb'
|
2022-12-08 01:32:41 -05:00
|
|
|
require_relative 'lib/models/item_comment.rb'
|
2022-12-08 17:26:44 -05:00
|
|
|
require_relative 'lib/models/license.rb'
|
2022-12-09 11:42:12 -05:00
|
|
|
require_relative 'lib/models/license_comment.rb'
|
2022-12-07 17:52:27 -05:00
|
|
|
|
2022-12-08 01:12:31 -05:00
|
|
|
# Load helper functions
|
|
|
|
require_relative 'lib/helpers.rb'
|
|
|
|
|
2022-12-07 17:52:27 -05:00
|
|
|
# Register route handlers
|
|
|
|
require_relative 'lib/routes.rb'
|