Class: TShield::Server

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Controllers::Requests::Helpers
Defined in:
lib/tshield/server.rb

Overview

Base of TShield Server

Class Method Summary collapse

Methods included from Controllers::Requests::Helpers

#add_headers, build_headers, #configuration, #domain, #treat

Class Method Details

.load_controllersObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tshield/server.rb', line 26

def self.load_controllers
  return unless File.exist?('controllers')

  Dir.entries('controllers').each do |entry|
    next if entry =~ /^\.\.?$/

    entry.gsub!('.rb', '')
    require File.join('.', 'controllers', entry)
    controller_name = entry.split('_').collect(&:capitalize).join
    include Module.const_get("#{controller_name}::Actions")
    register Module.const_get(controller_name)
  end
end

.register_resourcesObject



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

def self.register_resources
  load_controllers
  register TShield::Controllers::Sessions
  register TShield::Controllers::Requests
end

.run!Object



40
41
42
43
44
# File 'lib/tshield/server.rb', line 40

def self.run!
  register_resources
  require 'byebug'
  super
end