lib/lotus/application.rb in lotusrb-0.2.0 vs lib/lotus/application.rb in lotusrb-0.2.1
- old
+ new
@@ -143,18 +143,43 @@
# end
def self.load!(application = self)
Lotus::Loader.new(application).load!
end
- # Preload all the registered applications
+ # Preload all the registered applications, by yielding their configurations
+ # and preparing the frameworks.
#
+ # This is useful for testing suites, where we want to make Lotus frameworks
+ # ready, but not preload applications code.
+ #
+ # This allows to test components such as views or actions in isolation and
+ # to have faster boot times.
+ #
# @return [void]
#
# @since 0.2.0
def self.preload!
synchronize do
applications.each(&:load!)
end
+
+ nil
+ end
+
+ # Full preload for all the registered applications.
+ #
+ # This is useful in console where we want all the application code available.
+ #
+ # @return [void]
+ #
+ # @since 0.2.1
+ # @api private
+ def self.preload_applications!
+ synchronize do
+ applications.each { |app| app.new }
+ end
+
+ nil
end
# Return the configuration for this application
#
# @since 0.1.0