19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/yodatra/boot.rb', line 19
def self.registered app
raise "Check it out O'man! You're trying to boot the app [#{app}] which is already booted!" if app.booted
if app.booting
app.register Sinatra::ActiveRecordExtension
app_file = "#{app.config_directory}/application.rb"
require File.expand_path(app_file) if File.exist? app_file
env_file = "#{app.envs_directory}/#{app.environment}.rb"
require File.expand_path(env_file) if File.exist? env_file
%w(models_directory controllers_directory).each do |to_load|
Dir["#{app.send(to_load)}/**/*.rb"].sort.each do |file_path|
require File.expand_path(file_path)
end
end
app.set :booting, false
app.set :booted, true
end
end
|