Skip to content

Commit

Permalink
+ finalize the app(s) after loading it (them)
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Oct 14, 2010
1 parent dc03727 commit a17cd1c
Show file tree
Hide file tree
Showing 6 changed files with 1,029 additions and 7 deletions.
13 changes: 13 additions & 0 deletions server/lib/picky/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
class Application
class << self

# Finalize the subclass as soon as it
# has finished loading.
#
# Note: finalize finalizes the routes.
#
def inherited app
@apps ||= []
@apps << app
end
def finalize_apps
@apps.each &:finalize
end

# An application simply delegates to the routing to handle a request.
#
def call env
Expand Down
4 changes: 4 additions & 0 deletions server/lib/picky/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def self.load_application
load_user 'app/logging'
load_user 'app/application'

# Finalize the applications.
#
Application.finalize_apps

# TODO Rewrite
#
Query::Qualifiers.instance.prepare
Expand Down
1 change: 0 additions & 1 deletion server/prototype_project/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ use Rack::Harakiri
#
# Note: Needs to be the same constant name as in app/application.rb.
#
PickySearch.finalize
run PickySearch
1 change: 0 additions & 1 deletion server/test_project/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ use Rack::Harakiri

# Finalize and start the application and start accepting requests.
#
BookSearch.finalize
run BookSearch
Loading

0 comments on commit a17cd1c

Please sign in to comment.