Module: Utopia
- Defined in:
- lib/utopia.rb,
lib/utopia/http.rb,
lib/utopia/path.rb,
lib/utopia/setup.rb,
lib/utopia/shell.rb,
lib/utopia/locale.rb,
lib/utopia/static.rb,
lib/utopia/content.rb,
lib/utopia/session.rb,
lib/utopia/version.rb,
lib/utopia/responder.rb,
lib/utopia/controller.rb,
lib/utopia/exceptions.rb,
lib/utopia/middleware.rb,
lib/utopia/redirection.rb,
lib/utopia/content/link.rb,
lib/utopia/content/node.rb,
lib/utopia/content/tags.rb,
lib/utopia/localization.rb,
lib/utopia/path/matcher.rb,
lib/utopia/content/links.rb,
lib/utopia/content/markup.rb,
lib/utopia/content_length.rb,
lib/utopia/controller/base.rb,
lib/utopia/content/document.rb,
lib/utopia/content/response.rb,
lib/utopia/content/namespace.rb,
lib/utopia/exceptions/mailer.rb,
lib/utopia/session/lazy_hash.rb,
lib/utopia/static/local_file.rb,
lib/utopia/static/mime_types.rb,
lib/utopia/controller/actions.rb,
lib/utopia/controller/respond.rb,
lib/utopia/controller/rewrite.rb,
lib/utopia/exceptions/handler.rb,
lib/utopia/controller/variables.rb,
lib/utopia/session/serialization.rb,
lib/utopia/extensions/array_split.rb,
lib/utopia/extensions/date_comparisons.rb
Overview
Released under the MIT License. Copyright, 2009-2024, by Samuel Williams.
Defined Under Namespace
Modules: Exceptions, Extensions, HTTP, Redirection Classes: Content, ContentLength, Controller, Locale, Localization, Path, Responder, Session, Setup, Shell, Static
Constant Summary collapse
- VERSION =
"2.25.0"
- PAGES_PATH =
The default pages path for Content middleware.
'pages'.freeze
- VARIABLES_KEY =
This is used for shared controller variables which get consumed by the content middleware.
'utopia.variables'.freeze
Class Method Summary collapse
-
.default_path(*arguments) ⇒ Path
The same as Utopia.default_root but returns an instance of Path.
-
.default_root(subdirectory = PAGES_PATH, pwd = Dir.pwd) ⇒ Object
The default root directory for middleware to operate within, e.g.
- .Path(path) ⇒ Object
-
.setup(root = nil, **options) ⇒ Object
You can call this method exactly once per process.
Class Method Details
.default_path(*arguments) ⇒ Path
The same as default_root but returns an instance of Path.
25 26 27 |
# File 'lib/utopia/middleware.rb', line 25 def self.default_path(*arguments) Path[default_root(*arguments)] end |
.default_root(subdirectory = PAGES_PATH, pwd = Dir.pwd) ⇒ Object
The default root directory for middleware to operate within, e.g. the web-site directory. Convention over configuration.
19 20 21 |
# File 'lib/utopia/middleware.rb', line 19 def self.default_root(subdirectory = PAGES_PATH, pwd = Dir.pwd) File.(subdirectory, pwd) end |
.Path(path) ⇒ Object
388 389 390 |
# File 'lib/utopia/path.rb', line 388 def self.Path(path) Path.create(path) end |
.setup(root = nil, **options) ⇒ Object
You can call this method exactly once per process.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/utopia/setup.rb', line 118 def self.setup(root = nil, **) if @setup raise RuntimeError, "Utopia already setup!" end # We extract the root from the caller of this method: if root.nil? config_root = File.dirname(caller[0]) root = File.dirname(config_root) end @setup = Setup.new(root, **) @setup.apply! return @setup end |