Class: Spider::HomeController

Inherits:
Controller show all
Includes:
HTTPMixin, StaticContent
Defined in:
lib/spiderfw/controller/home_controller.rb

Instance Attribute Summary

Attributes inherited from Controller

#dispatch_action, #executed_method, #is_target, #request, #response, #scene

Attributes included from Dispatcher

#dispatch_previous

Class Method Summary collapse

Methods inherited from Controller

#action_target?, #after, #before, before, before_methods, before_unless, #call_after, #call_before, #check_action, controller_action, controller_action?, #controller_action?, controller_actions, default_action, #done, #done=, #done?, #execute, find_resource, find_resource_path, #get_action_method, #get_scene, http_s_url, #init, #initialize, #inspect, #is_target?, layout_path, #prepare_scene, #request_path, route_path, template_path, url

Methods included from Annotations

included

Methods included from Logger

add, check_request_level, close, close_all, datetime_format, datetime_format=, #debug, debug, debug?, #debug?, enquire_loggers, #error, error, #error?, error?, fatal, #fatal, fatal?, #fatal?, info, #info, info?, #info?, #log, log, method_missing, open, reopen, request_level, send_to_loggers, set_request_level, unknown, #unknown, warn, #warn, warn?, #warn?

Methods included from Dispatcher

#add_chain_item, #can_dispatch?, #dispatch, #dispatch_chain, #dispatch_next, #dispatcher_get_route, #do_dispatch, #get_route, included, #route, #routes, #run_chain

Methods included from App::AppClass

#app, included

Constructor Details

This class inherits a constructor from Spider::Controller

Class Method Details

.app_pub_path(app = nil) ⇒ Object



23
24
25
26
27
# File 'lib/spiderfw/controller/home_controller.rb', line 23

def self.app_pub_path(app=nil)
    path = self.pub_path+'/apps'
    path += '/'+app.short_name if app
    path
end

.app_routesObject



29
30
31
# File 'lib/spiderfw/controller/home_controller.rb', line 29

def self.app_routes
    @app_routes ||= []
end


33
34
35
36
# File 'lib/spiderfw/controller/home_controller.rb', line 33

def self.print_app_routes(routes=app_routes)
    max_length = routes.inject(0){ |m, r| m > r[0].length ? m : r[0].length }
    routes.map{ |r| "#{r[0].ljust(max_length+3)} -> #{r[1]}"}.sort.join("\n")
end

.pub_pathObject



15
16
17
# File 'lib/spiderfw/controller/home_controller.rb', line 15

def self.pub_path
    Spider.paths[:root]+'/public'
end

.pub_urlObject



19
20
21
# File 'lib/spiderfw/controller/home_controller.rb', line 19

def self.pub_url
    HTTPMixin.reverse_proxy_mapping('/public')
end

.route_app(app) ⇒ Object

route ‘spider’, Spider.controller



8
9
10
11
12
13
# File 'lib/spiderfw/controller/home_controller.rb', line 8

def self.route_app(app)
    #app_path = app.name.gsub('::', '/')
    app_path = app.route_url
    route(app_path, app.controller, :ignore_case => true)
    self.app_routes << [app_path, app.controller]
end