Class: Arcabouco::WebServer

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/arcabouco/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWebServer

Returns a new instance of WebServer.



21
22
23
24
# File 'lib/arcabouco/server.rb', line 21

def initialize()
  self.base_dir = Arcabouco.root
  super
end

Instance Attribute Details

#base_dirObject

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_indexObject



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_toObject



26
27
28
29
# File 'lib/arcabouco/server.rb', line 26

def relative_to
  "../" + Pathname.new(File.expand_path('../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