Copied initial project structure from Raven

This commit is contained in:
2023-03-02 13:24:24 -05:00
parent c509297b1c
commit 69ec98cba1
20 changed files with 2064 additions and 1 deletions

20
lib/config.rb Normal file
View File

@ -0,0 +1,20 @@
require 'yaml'
class Config
def initialize(config_path)
@data = YAML::load_file(config_path)
end
def get(key, depth = 0)
bits = key.split('.')
value = @data
bits.each do |bit|
value = value[bit]
end
return value
end
end

21
lib/helpers.rb Normal file
View File

@ -0,0 +1,21 @@
helpers do
def nullable(value)
if (value) and (value != '')
return value
else
return 'N/a'
end
end
def date_format(date)
dt = date.to_datetime
return dt.strftime('%B %d, %Y @ %I:%M:%S %p %Z')
end
def date_format_input(date)
dt = date.to_datetime
return dt.strftime('%Y-%m-%dT%H:%M:%S')
end
end

1
lib/routes.rb Normal file
View File

@ -0,0 +1 @@
require_relative 'routes/index.rb'

10
lib/routes/index.rb Normal file
View File

@ -0,0 +1,10 @@
namespace '/' do
get '' do
erb :index, :locals => {
:title => 'Dashboard'
}
end
end