Class: Madness::ServerBase
- Inherits:
-
Sinatra::Application
- Object
- Sinatra::Application
- Madness::ServerBase
- Defined in:
- lib/madness/server_base.rb
Overview
The base class for the sinatra server. Initialize what we can here, but since there are values that will become known only later, the #prepare method is provided.
Direct Known Subclasses
Class Method Summary collapse
- .config ⇒ Object
-
.prepare ⇒ Object
Since we cannot use any config values in the main body of the class, since they will be updated later, we need to set anything that relys on the config values just before running the server.
- .set_tempalate_locations ⇒ Object
Class Method Details
.config ⇒ Object
48 49 50 |
# File 'lib/madness/server_base.rb', line 48 def self.config Settings.instance end |
.prepare ⇒ Object
Since we cannot use any config values in the main body of the class, since they will be updated later, we need to set anything that relys on the config values just before running the server. The CommandLine class and the test suite should both call ‘Server.prepare` before calling Server.run!
31 32 33 34 35 36 37 |
# File 'lib/madness/server_base.rb', line 31 def self.prepare use Madness::Static, root: "#{config.path}/", :urls => %w[/] set :bind, config.bind set :port, config.port set_tempalate_locations end |
.set_tempalate_locations ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/madness/server_base.rb', line 39 def self.set_tempalate_locations theme = Theme.new config.theme set :views, theme.views_path set :public_folder, theme.public_path Sass::Plugin.[:template_location] = theme.css_source_path Sass::Plugin.[:css_location] = theme.css_target_path end |