Class: Volt::App
- Includes:
- Repos, ServerSetup::App
- Defined in:
- lib/volt/volt/app.rb
Instance Attribute Summary collapse
-
#app_path ⇒ Object
readonly
Returns the value of attribute app_path.
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#channel_live_queries ⇒ Object
readonly
Returns the value of attribute channel_live_queries.
-
#component_paths ⇒ Object
readonly
Returns the value of attribute component_paths.
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#live_query_pool ⇒ Object
readonly
Returns the value of attribute live_query_pool.
-
#message_bus ⇒ Object
readonly
Returns the value of attribute message_bus.
-
#middleware ⇒ Object
readonly
Returns the value of attribute middleware.
-
#router ⇒ Object
readonly
Returns the value of attribute router.
-
#sprockets ⇒ Object
Returns the value of attribute sprockets.
Instance Method Summary collapse
-
#add_routes(&block) ⇒ Object
Called on the client side to add routes.
-
#add_template(*args) ⇒ Object
Callled on the client to add store compiled templates.
- #channel ⇒ Object
-
#initialize(app_path = nil) ⇒ App
constructor
A new instance of App.
-
#setup_browser ⇒ Object
Setup a Page instance.
- #tasks ⇒ Object
- #templates ⇒ Object
Methods included from ServerSetup::App
#load_app_code, #require_http_controllers, #reset_query_pool!, #run_app_and_initializers, #run_config, #setup_paths, #setup_postboot_middleware, #setup_preboot_middleware, #setup_router, #start_message_bus
Methods included from Repos
#check_for_client?, #cookies, #flash, #local_store, #page, #params, #store, #url
Constructor Details
#initialize(app_path = nil) ⇒ App
Returns a new instance of App.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/volt/volt/app.rb', line 49 def initialize(app_path=nil) if Volt.server? && !app_path raise "Volt::App.new requires an app path to boot" end @app_path = app_path $volt_app = self # Setup root path Volt.root = app_path if RUBY_PLATFORM == 'opal' setup_browser end if RUBY_PLATFORM != 'opal' # We need to run the root config first so we can setup the Rack::Session # middleware. run_config # 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' # 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 reset_query_pool! # Setup the middleware that we can only setup after all components boot. setup_postboot_middleware end end |
Instance Attribute Details
#app_path ⇒ Object (readonly)
Returns the value of attribute app_path.
44 45 46 |
# File 'lib/volt/volt/app.rb', line 44 def app_path @app_path end |
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
44 45 46 |
# File 'lib/volt/volt/app.rb', line 44 def browser @browser end |
#channel_live_queries ⇒ Object (readonly)
Returns the value of attribute channel_live_queries.
44 45 46 |
# File 'lib/volt/volt/app.rb', line 44 def channel_live_queries @channel_live_queries end |
#component_paths ⇒ Object (readonly)
Returns the value of attribute component_paths.
44 45 46 |
# File 'lib/volt/volt/app.rb', line 44 def component_paths @component_paths end |
#database ⇒ Object (readonly)
Returns the value of attribute database.
44 45 46 |
# File 'lib/volt/volt/app.rb', line 44 def database @database end |
#live_query_pool ⇒ Object (readonly)
Returns the value of attribute live_query_pool.
44 45 46 |
# File 'lib/volt/volt/app.rb', line 44 def live_query_pool @live_query_pool end |
#message_bus ⇒ Object (readonly)
Returns the value of attribute message_bus.
44 45 46 |
# File 'lib/volt/volt/app.rb', line 44 def end |
#middleware ⇒ Object (readonly)
Returns the value of attribute middleware.
44 45 46 |
# File 'lib/volt/volt/app.rb', line 44 def middleware @middleware end |
#router ⇒ Object (readonly)
Returns the value of attribute router.
44 45 46 |
# File 'lib/volt/volt/app.rb', line 44 def router @router end |
#sprockets ⇒ Object
Returns the value of attribute sprockets.
47 48 49 |
# File 'lib/volt/volt/app.rb', line 47 def sprockets @sprockets end |
Instance Method Details
#add_routes(&block) ⇒ Object
Called on the client side to add routes
101 102 103 104 105 |
# File 'lib/volt/volt/app.rb', line 101 def add_routes(&block) @router ||= Routes.new @router.define(&block) url.router = @router end |
#add_template(*args) ⇒ Object
Callled on the client to add store compiled templates
108 109 110 |
# File 'lib/volt/volt/app.rb', line 108 def add_template(*args) templates.add_template(*args) end |
#channel ⇒ Object
116 117 118 119 120 121 122 123 124 |
# File 'lib/volt/volt/app.rb', line 116 def channel @channel ||= begin if Volt.client? Channel.new else ChannelStub.new end end end |
#setup_browser ⇒ Object
Setup a Page instance.
127 128 129 |
# File 'lib/volt/volt/app.rb', line 127 def setup_browser @browser = Browser.new(self) end |
#tasks ⇒ Object
112 113 114 |
# File 'lib/volt/volt/app.rb', line 112 def tasks @tasks ||= Tasks.new(self) end |
#templates ⇒ Object
96 97 98 |
# File 'lib/volt/volt/app.rb', line 96 def templates @templates ||= Templates.new end |