Class: RutemaWeb::UI::SinatraApp

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Statistics, Timeline, ViewUtilities
Defined in:
lib/rutema_web/sinatra.rb

Constant Summary collapse

DEFAULT_SETTINGS =
{:show_setup_teardown=>true,:page_size=>10,:last_n_runs=>20,:sorting_order=>"start_time",:port=>7000}
@@logger =
Patir.setup_logger
@@cache =
{}

Constants included from ViewUtilities

ViewUtilities::IMG_LEFT, ViewUtilities::IMG_RIGHT, ViewUtilities::IMG_SCE_ERROR, ViewUtilities::IMG_SCE_OK, ViewUtilities::IMG_SCE_WARN, ViewUtilities::IMG_STEP_ERROR, ViewUtilities::IMG_STEP_OK, ViewUtilities::IMG_STEP_WARN, ViewUtilities::TIME_FORMAT

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Timeline

#timeline_data

Methods included from ViewUtilities

#cfg_link, #context_table, #run_link, #run_page_link, #run_summary, #run_url, #scenario_page_link, #scenario_status, #status_icon, #time_formatted

Instance Attribute Details

#contentObject

Returns the value of attribute content


160
161
162
# File 'lib/rutema_web/sinatra.rb', line 160

def content
  @content
end

#content_titleObject

Returns the value of attribute content_title


160
161
162
# File 'lib/rutema_web/sinatra.rb', line 160

def content_title
  @content_title
end

#panel_contentObject

Returns the value of attribute panel_content


160
161
162
# File 'lib/rutema_web/sinatra.rb', line 160

def panel_content
  @panel_content
end

#titleObject

Returns the value of attribute title


160
161
162
# File 'lib/rutema_web/sinatra.rb', line 160

def title
  @title
end

Class Method Details

.define_settings(cfg) ⇒ Object


252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/rutema_web/sinatra.rb', line 252

def self.define_settings cfg
  #the settings that are not public
  enable :logging
  enable :run
  enable :static
  set :server, %w[thin mongrel webrick]
  set :root, File.dirname(__FILE__)
  set :public, File.dirname(__FILE__) + '/public'
  #the settings that can be changed
    #set any missing values with the default
  cfg[:show_setup_teardown] ||= DEFAULT_SETTINGS[:show_setup_teardown]
  cfg[:page_size] ||= DEFAULT_SETTINGS[:page_size]
  cfg[:last_n_runs] ||= DEFAULT_SETTINGS[:last_n_runs]
  cfg[:port] ||= DEFAULT_SETTINGS[:port]
  #set them
  set :show_setup_teardown, cfg[:show_setup_teardown]
  set :page_size, cfg[:page_size]
  set :last_n_runs, cfg[:last_n_runs]
  set :port, cfg[:port]
end