Class: Ella::Server
- Inherits:
-
Object
- Object
- Ella::Server
- Defined in:
- lib/ella/server.rb
Overview
This is not so much a server as a something which starts of the server and various listeners and initializers associated with Ella. From the point of view of the rest of Ella, this will be the server, though. This also restarts the server in development mode, something Sinatra is a bit shifty about on its own, due to Ruby restrictions.
Instance Method Summary collapse
- #css_path ⇒ Object
-
#initialize(mode: 'development', port: nil) ⇒ Server
constructor
A new instance of Server.
- #js_path ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(mode: 'development', port: nil) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 19 |
# File 'lib/ella/server.rb', line 12 def initialize(mode: 'development', port: nil) Ella.find_root Log.yell("Starting server in #{mode} mode...") @mode = mode @port = port establish_pipelines end |
Instance Method Details
#css_path ⇒ Object
31 32 33 |
# File 'lib/ella/server.rb', line 31 def css_path @pipelines[:css].path end |
#js_path ⇒ Object
35 36 37 |
# File 'lib/ella/server.rb', line 35 def js_path @pipelines[:js].path end |
#run ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/ella/server.rb', line 21 def run Ella.find_root @mode_path = File.join(Dir.pwd, 'temp/mode') File.open(@mode_path, 'w') { |f| f.puts(@mode) } RackfileGenerator.new.run Log.info('Staring Puma...') @mode == 'production' ? start_production_server : start_development_listener_loop end |