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_root 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_root ⇒ Object
The root directory containing slide templates.
Instance Method Details
#application ⇒ Object
The application class to use.
33 34 35 |
# File 'lib/presently/environment/application.rb', line 33 def application Presently::Application end |
#middleware ⇒ Object
Build the middleware stack with Presently’s public assets.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/presently/environment/application.rb', line 39 def middleware application = self.application = self. templates_root = self.templates_root 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 (syntax-js, CSS, 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_root: templates_root end end |
#slides_root ⇒ Object
The root directory containing slide Markdown files.
20 21 22 |
# File 'lib/presently/environment/application.rb', line 20 def File.("slides", self.root) end |
#templates_root ⇒ Object
The root directory containing slide templates. Defaults to the gem’s bundled templates.
27 28 29 |
# File 'lib/presently/environment/application.rb', line 27 def templates_root File.("../../../templates", __dir__) end |