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
50 51 52 |
# File 'lib/madness/server_base.rb', line 50 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!
33 34 35 36 37 38 39 |
# File 'lib/madness/server_base.rb', line 33 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
41 42 43 44 45 46 47 48 |
# File 'lib/madness/server_base.rb', line 41 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 |