lib/volt/volt/app.rb in volt-0.9.6 vs lib/volt/volt/app.rb in volt-0.9.7.pre2

- old
+ new

@@ -45,13 +45,11 @@ if RUBY_PLATFORM != 'opal' # Include server app setup include Volt::ServerSetup::App end - attr_reader :component_paths, :router, :live_query_pool, - :channel_live_queries, :app_path, :database, :message_bus, - :middleware, :browser + attr_reader :component_paths, :router, :app_path, :database, :message_bus, :middleware, :browser attr_accessor :sprockets, :opal_files def initialize(app_path=nil) app_path ||= Dir.pwd @@ -75,45 +73,51 @@ if RUBY_PLATFORM != 'opal' # We need to run the root config first so we can setup the Rack::Session # middleware. run_config + # abort_on_exception is a useful debugging tool, and in my opinion something + # you probbaly want on. That said you can disable it if you need. + unless RUBY_PLATFORM == 'opal' + Thread.abort_on_exception = Volt.config.abort_on_exception + end + # Setup all of the middleware we can before we load the users components # since the users components might want to add middleware during boot. setup_preboot_middleware # Setup all app paths setup_paths # Require in app and initializers run_app_and_initializers unless RUBY_PLATFORM == 'opal' + reset_query_pool! + require_components - # abort_on_exception is a useful debugging tool, and in my opinion something - # you probbaly want on. That said you can disable it if you need. - unless RUBY_PLATFORM == 'opal' - Thread.abort_on_exception = Volt.config.abort_on_exception - end - load_app_code # Load up the main component dependencies. This is needed to load in # any opal_gem calls in dependencies.rb # TODO: Needs to support all components if Dir.exists?(Volt.root + '/app/main') AssetFiles.from_cache(app_url, 'main', component_paths) end - reset_query_pool! - # Setup the middleware that we can only setup after all components boot. setup_postboot_middleware setup_routes + # Try to load the db to make sure its connected. Also will run + # migrations on volt-sql in dev + trigger!('boot') + start_message_bus + + trigger!('post_boot') end end def templates @templates ||= Templates.new @@ -146,9 +150,13 @@ end # Setup a Page instance. def setup_browser @browser = Browser.new(self) + end + + def inspect + "#<#{self.class.to_s}:#{object_id}>" end end end if Volt.client?