@@ -19,30 +19,26 @@ class ServerBase < Sinatra::Application
1919 # on the config values just before running the server.
2020 # The CommandLine class and the test suite should both call
2121 # `Server.prepare` before calling Server.run!
22- def self . prepare
23- use Madness ::Static , root : "#{ config . path } /" , urls : %w[ / ] , cascade : true
24- set :bind , config . bind
25- set :port , config . port
22+ class << self
23+ include ServerHelper
2624
27- set_basic_auth if config . auth
28- set_tempalate_locations
29- end
30-
31- def self . set_tempalate_locations
32- theme = Theme . new config . theme
25+ def prepare
26+ set :bind , config . bind
27+ set :port , config . port
3328
34- set :views , theme . views_path
35- set :public_folder , theme . public_path
36- end
29+ set_basic_auth if config . auth
30+ set_tempalate_locations
31+ end
3732
38- def self . set_basic_auth
39- use Rack ::Auth ::Basic , config . auth_zone do |username , password |
40- config . auth . split ( ':' ) == [ username , password ]
33+ def set_tempalate_locations
34+ set :views , theme . views_path
4135 end
42- end
4336
44- def self . config
45- Settings . instance
37+ def set_basic_auth
38+ use Rack ::Auth ::Basic , config . auth_zone do |username , password |
39+ config . auth . split ( ':' ) == [ username , password ]
40+ end
41+ end
4642 end
4743 end
4844end
0 commit comments