From 2b18990c69a59b85c0c820a1ac389dc389474918 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Mon, 11 Aug 2014 23:59:31 -0300 Subject: [PATCH] Configuration has a mount_at property which allows an application specify a mount point for its routes --- lib/lotus/configuration.rb | 37 +++++++++++++++++++++++++++++++++++++ lib/lotus/loader.rb | 1 + 2 files changed, 38 insertions(+) diff --git a/lib/lotus/configuration.rb b/lib/lotus/configuration.rb index 6b2794337..b4d1c0ef7 100644 --- a/lib/lotus/configuration.rb +++ b/lib/lotus/configuration.rb @@ -708,6 +708,43 @@ def scheme(value = nil) end end + # Application route point mount. + # + # Specify a point mount for the application, by passing a String. + # + # By default it's an empty String. + # + # @since x.x.x + # + # @example Getting the value + # require 'lotus' + # + # module Bookshelf + # class Application < Lotus::Application + # end + # end + # + # Bookshelf::Application.configuration.mount_at + # # => nil + # + # @example Setting the value, by passing a block + # require 'lotus' + # + # module Bookshelf + # class Application < Lotus::Application + # configure do + # mount_at 'backend' + # end + # end + # end + # + # Bookshelf::Application.configuration.mount_at + # # => backend + def mount_at(mount_at = '') + @mount_at = mount_at unless mount_at.empty? + @mount_at + end + # The URI host for this application. # This is used by the router helpers to generate absolute URLs. # diff --git a/lib/lotus/loader.rb b/lib/lotus/loader.rb index e038d7f16..8bcfa5d77 100644 --- a/lib/lotus/loader.rb +++ b/lib/lotus/loader.rb @@ -82,6 +82,7 @@ def load_rack! scheme: configuration.scheme, host: configuration.host, port: configuration.port, + mount_at: configuration.mount_at, &configuration.routes )