Module: Utopia::Project
- Defined in:
- lib/utopia/project.rb,
lib/utopia/project/base.rb,
lib/utopia/project/guide.rb,
lib/utopia/project/guides.rb,
lib/utopia/project/linkify.rb,
lib/utopia/project/sidebar.rb,
lib/utopia/project/version.rb,
lib/utopia/project/document.rb,
lib/utopia/project/renderer.rb,
lib/utopia/project/import_map.rb,
lib/utopia/project/releases_document.rb
Overview
Provides project documentation generation and rendering.
Defined Under Namespace
Classes: Base, Document, Guide, Guides, Linkify, ReleasesDocument, Renderer, Sidebar
Constant Summary collapse
- SITE_ROOT =
The root directory of the web application files.
File.("../..", __dir__)
- PAGES_ROOT =
The root directory for the utopia middleware.
File.("pages", SITE_ROOT)
- PUBLIC_ROOT =
The root directory for static assets.
File.("public", SITE_ROOT)
- VERSION =
"0.41.0"- IMPORT_MAP =
Utopia::ImportMap.build(base: "/_components/") do |map| map.import("mermaid", "./mermaid/mermaid.esm.min.mjs") map.import("@socketry/syntax", "./@socketry/syntax/Syntax.js") end
Class Method Summary collapse
-
.call(builder, root = Dir.pwd, locales: nil) ⇒ Object
Appends a project application to the protocol HTTP middleware builder.
Class Method Details
.call(builder, root = Dir.pwd, locales: nil) ⇒ Object
Appends a project application to the protocol HTTP middleware builder.
39 40 41 42 43 44 45 46 47 48 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 |
# File 'lib/utopia/project.rb', line 39 def self.call(builder, root = Dir.pwd, locales: nil) if UTOPIA.production? # Handle exceptions in production with a error page and send an email notification: builder.use Utopia::Exceptions::Handler builder.use Utopia::Exceptions::Mailer end # We serve static files from the project root: builder.use Utopia::Static, root: root builder.use Utopia::Static, root: PUBLIC_ROOT builder.use Utopia::Redirection::Rewrite, { "/" => "/index" } builder.use Utopia::Redirection::DirectoryIndex builder.use Utopia::Redirection::Errors, { 404 => "/errors/file-not-found" } if locales builder.use Utopia::Localization, default_locale: locales.first, locales: locales end builder.use Utopia::Controller, root: PAGES_ROOT cache_root = File.("_gallery", root) builder.use Utopia::Content, root: PAGES_ROOT, namespaces: { # 'gallery' => Utopia::Gallery::Tags.new } end |