Class: Arcabouco::WebServer
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Arcabouco::WebServer
- Defined in:
- lib/arcabouco/server.rb
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
Returns the value of attribute base_dir.
Instance Method Summary collapse
- #content_for_index ⇒ Object
-
#initialize ⇒ WebServer
constructor
A new instance of WebServer.
- #relative_to ⇒ Object
Constructor Details
Instance Attribute Details
#base_dir ⇒ Object
Returns the value of attribute base_dir.
17 18 19 |
# File 'lib/arcabouco/server.rb', line 17 def base_dir @base_dir end |
Instance Method Details
#content_for_index ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/arcabouco/server.rb', line 48 def content_for_index application_preload_html = "" application_preloader_filename = File.join Arcabouco.root, 'app', 'templates', 'application_preloader.html' if File.file?(application_preloader_filename) application_preload_html = File.read application_preloader_filename end erb :"#{relative_to}/index.html", locals: { :assets => $environment, :application_name => Arcabouco.application_name, :application_preload_html => application_preload_html}, layout: false, cache: false end |
#relative_to ⇒ Object
26 27 28 29 |
# File 'lib/arcabouco/server.rb', line 26 def relative_to "../" + Pathname.new(File.('../templates', File.dirname(__FILE__))).relative_path_from(Pathname.new(Arcabouco.root)).to_s # Pathname.new(File.expand_path('../templates', File.dirname(__FILE__))).relative_path_from(Pathname.new(Arcabouco.root)).to_s end |