module

Marten

Constants

Log = ::Log.for("marten")
VERSION = "0.6.4"

Class methods

apps

Returns the apps registry.

This method returns an instance of Marten::Apps::Registry, giving access to the details of the installed applications.

Source
assets

Returns the assets engine.

This method returns an instance of Marten::Asset::Engine, which allows to find assets and to generate their URLs.

Source
cache

Returns the global cache store.

This method returns a Marten::Cache::Store::Base object that can be interacted with to store string values in a global cache.

Source
configure(env : Nil | String | Symbol = nil, &)

Allows to configure a Marten project.

This method allows to define the setting values of a Marten project. When called without argument, it allows to define shared setting values (ie. shared across all environments):

Marten.configure do |config|
  config.installed_apps = [
    FooApp,
    BarApp,
  ]
end

This method can also be called with a specific argument in order to ensure that the underlying settings are defined for a specific environment only:

Marten.configure :development do |config|
  config.secret_key = "INSECURE"
end
Source
env

Returns the current Marten environment.

This method returns a Marten::Conf::Env object, which allows to interact with the current environment. For example:

Marten.env              # => <Marten::Conf::Env:0x1052b8060 @id="development">
Marten.env.id           # => "development"
Marten.env.development? # => true
Source
media_files_storage

Returns the media files storage.

This method returns an instance of a Marten::Core::Storage::Base subclass. This object allows to perform file operations like saving files, deleting files, generating URLs...

Source
root

Returns the root path of the Marten project.

This method returns a Path object, which allows to interact with the root path of the current project. The path returned by this method will correspond to the root_path setting if it is defined, otherwise it will correspond to the parent of the src folder.

Source
routes

Returns the main routes map.

This method returns the main routes map, initialized according to the routes configuration and allowing to perform reverse URL resolutions.

Source
settings

Returns the settings of the application.

This method returns the main Marten::Conf::GlobalSettings object, which contains the settings configured for the current environment.

Source
setup

Setups the Marten project.

This involves setup-ing the configured settings, applications, assets, templates, and the I18n tooling.

Source
start(host : String | Nil = nil, port : Int32 | Nil = nil, args : Array(String) = ARGV)

Starts the Marten server.

Source
templates

Returns the Marten templates engine.

This method returns an instance of Marten::Template::Engine, which allows to find templates and to render them.

Source

Nested types