Module: Presently::Environment::Application
- Includes:
- Lively::Environment::Application
- Defined in:
- lib/presently/environment/application.rb
Overview
The environment configuration for a Presently application server.
Extends the Lively environment with Presently-specific middleware and configuration. Override #slides_root and #templates_roots to customize paths.
Instance Method Summary collapse
-
#application ⇒ Object
The application class to use.
-
#middleware ⇒ Object
Build the middleware stack with Presently’s public assets.
-
#slides_root ⇒ Object
The root directory containing slide Markdown files.
-
#templates_roots ⇒ Object
Additional directories to search for slide templates.
Instance Method Details
#application ⇒ Object
The application class to use.
35 36 37 |
# File 'lib/presently/environment/application.rb', line 35 def application Presently::Application end |
#middleware ⇒ Object
Build the middleware stack with Presently’s public assets.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/presently/environment/application.rb', line 41 def middleware application = self.application = self. templates_roots = self.templates_roots root = self.root ::Protocol::HTTP::Middleware.build do |builder| # Serve assets from the user's public directory: builder.use Lively::Assets, root: File.("public", root) # Serve Presently's bundled assets (CSS, JS, components, etc.): builder.use Lively::Assets, root: File.("../../../public", __dir__) # Serve Lively's built-in assets (Live.js, morphdom, etc.): builder.use Lively::Assets, root: File.("public", Gem.loaded_specs["lively"].full_gem_path) builder.use application, slides_root: , templates_roots: templates_roots end end |
#slides_root ⇒ Object
The root directory containing slide Markdown files.
21 22 23 |
# File 'lib/presently/environment/application.rb', line 21 def File.("slides", self.root) end |
#templates_roots ⇒ Object
Additional directories to search for slide templates. These are searched before the gem’s bundled templates, allowing selective overrides without duplicating all templates.
29 30 31 |
# File 'lib/presently/environment/application.rb', line 29 def templates_roots [File.("templates", self.root)].select{|d| File.directory?(d)} end |