Class: EngineOfWar::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/engine_of_war/app.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.gauges_key=(key) ⇒ Object



24
25
26
# File 'lib/engine_of_war/app.rb', line 24

def self.gauges_key=(key)
  use Rack::Gauges, tracker: key
end

.google_analytics_key=(key) ⇒ Object



20
21
22
# File 'lib/engine_of_war/app.rb', line 20

def self.google_analytics_key=(key)
  use Rack::GoogleAnalytics, tracker: key
end

.newrelic_key=(key) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/engine_of_war/app.rb', line 28

def self.newrelic_key=(key)
  unless ENV["RACK_ENV"] == "development"
    name = settings.site_title || "Unknown"
    unless ENV["RACK_ENV"] == "production"
      name << " (#{ENV["RACK_ENV"]})"
    end

    puts "Loading NewRelic for #{name}"

    require 'newrelic_rpm'
    require 'rpm_contrib'
    NewRelic::Agent.manual_start(monitor_mode: true, 
                                 license_key: key,
                                 app_name: name,
                                 monitor_mode: true,
                                 log_level: "info",
                                 log_file_path: "STDOUT",
                                 transaction_tracer: { enabled: false },
                                 error_collector: { enabled: true })
  end
end

Instance Method Details

#render_page_with_layout(page) ⇒ Object



50
51
52
53
54
# File 'lib/engine_of_war/app.rb', line 50

def render_page_with_layout(page)
  render_page(page, 
              layout: "layouts/#{page.layout}", 
              layout_engine: :haml)
end