Skip to content

Instantly share code, notes, and snippets.

@arthurgeek
Created August 19, 2014 20:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthurgeek/cf3c26e6143c1d1bbd1a to your computer and use it in GitHub Desktop.
Save arthurgeek/cf3c26e6143c1d1bbd1a to your computer and use it in GitHub Desktop.
Lotus Patch 2
diff --git a/lib/lotus/loader.rb b/lib/lotus/loader.rb
index e038d7f..9221840 100644
--- a/lib/lotus/loader.rb
+++ b/lib/lotus/loader.rb
@@ -23,7 +23,6 @@ module Lotus
load_configuration!
load_frameworks!
load_application!
- finalize!
end
end
@@ -38,27 +37,35 @@ module Lotus
config = configuration
unless application_module.const_defined?('Controller')
- controller = Lotus::Controller.duplicate(application_module) do
- handle_exceptions config.handle_exceptions
- default_format config.default_format
+ if configuration.frameworks.include?(:controller)
+ controller = Lotus::Controller.duplicate(application_module) do
+ handle_exceptions config.handle_exceptions
+ default_format config.default_format
- modules { include Lotus::Action::Cookies } if config.cookies
- end
+ modules { include Lotus::Action::Cookies } if config.cookies
+ end
- application_module.const_set('Controller', controller)
+ application_module.const_set('Controller', controller)
+ end
end
unless application_module.const_defined?('View')
- view = Lotus::View.duplicate(application_module) do
- root config.templates
- layout config.layout
- end
+ if configuration.frameworks.include?(:view)
+ view = Lotus::View.duplicate(application_module) do
+ root config.templates
+ layout config.layout
+ end
- application_module.const_set('View', view)
+ application_module.const_set('View', view)
+
+ finalize!
+ end
end
end
def load_application!
+ return if application.is_a?(Class)
+
configuration.load_paths.load!(configuration.root)
load_rack!
end
@@ -70,8 +77,6 @@ module Lotus
end
def load_rack!
- return if application.is_a?(Class)
-
namespace = configuration.namespace || application_module
resolver = Lotus::Routing::EndpointResolver.new(pattern: configuration.controller_pattern, namespace: namespace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment