-
-
Save adam12/9d3ca08a22d357821feea8b815fae2bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative "../framework/plugins/loader" | |
require_relative "../framework/plugins/variant" | |
plugin Framework::Plugins::Variant | |
plugin Framework::Plugins::Loader, log: false do |loader| | |
root = Pathname(__dir__).parent.parent | |
loader.inflector.inflect "db" => "DB" | |
loader.inflector.inflect "eid" => "EID" | |
loader.push_dir(root + "apps") | |
loader.push_dir(root + "lib") | |
loader.ignore(root + "lib/core_ext") | |
loader.ignore(root + "lib/roda") | |
loader.ignore(root + "lib/sequel/plugins") | |
if variant.development? | |
begin | |
Framework::Logger.debug(self) { "Attempting to enable reloading" } | |
require "listen" | |
loader.enable_reloading | |
Listen.to(root) do | |
Framework::Logger.info(self) { "Performing reload" } | |
RELOAD_RW_LOCK.with_write_lock do | |
loader.reload | |
end | |
end.start | |
rescue LoadError => ex | |
raise unless ex.path == "listen" | |
Framework::Logger.debug(self) { "Unable to to load 'listen'. Reloading disabled" } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment