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
#initialize ⇒ WebServer
23 24 25 26 |
# File 'lib/arcabouco/server.rb', line 23 def initialize() self.base_dir = Arcabouco.root super end |
Instance Attribute Details
#base_dir ⇒ Object
Returns the value of attribute base_dir.
19 20 21 |
# File 'lib/arcabouco/server.rb', line 19 def base_dir @base_dir end |
Instance Method Details
#content_for_index ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/arcabouco/server.rb', line 50 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 main_js = Uglifier.compile(File.read(File.join(Arcabouco.gem_root,'templates','bootstrap_code.js'))) erb :"#{relative_to}/index.html", locals: { :assets => $environment, :application_name => Arcabouco.application_name, :application_preload_html => application_preload_html, :main_js => main_js }, layout: false, cache: false end |
#relative_to ⇒ Object
28 29 30 31 |
# File 'lib/arcabouco/server.rb', line 28 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 |