Skip to content
Newer
Older
100644 108 lines (92 sloc) 3.58 KB
4f03603 @josevalim Break application.rb file in smaller chunks.
josevalim authored Jan 23, 2010
1 module Rails
2 class Application
3 module Finisher
4 include Initializable
5
6690d66 @josevalim Rename config.cookie_secret to config.secret_token and pass it as con…
josevalim authored Apr 5, 2010
6 initializer :add_generator_templates do
d649bf1 @josevalim Provide a cleaner syntax for paths configuration that does not rely o…
josevalim authored Oct 6, 2010
7 config.generators.templates.unshift(*paths["lib/templates"].existent)
6690d66 @josevalim Rename config.cookie_secret to config.secret_token and pass it as con…
josevalim authored Apr 5, 2010
8 end
9
6f83a50 @fxn renames load_(once_)paths to autoload_(once_)paths in dependencies an…
fxn authored Jun 22, 2010
10 initializer :ensure_autoload_once_paths_as_subset do
11 extra = ActiveSupport::Dependencies.autoload_once_paths -
12 ActiveSupport::Dependencies.autoload_paths
924fa08 @josevalim First steps into making Plugin < Engine.
josevalim authored Jan 23, 2010
13
14 unless extra.empty?
15 abort <<-end_error
6f83a50 @fxn renames load_(once_)paths to autoload_(once_)paths in dependencies an…
fxn authored Jun 22, 2010
16 autoload_once_paths must be a subset of the autoload_paths.
17 Extra items in autoload_once_paths: #{extra * ','}
924fa08 @josevalim First steps into making Plugin < Engine.
josevalim authored Jan 23, 2010
18 end_error
19 end
20 end
21
226d8e7 @josevalim Refactor MetalLoader and RoutesReloader to rely less on class configu…
josevalim authored Jan 27, 2010
22 initializer :add_builtin_route do |app|
4f03603 @josevalim Break application.rb file in smaller chunks.
josevalim authored Jan 23, 2010
23 if Rails.env.development?
117daba @carllerche Update Rails' built in routes to use RouteSet#append
carllerche authored Sep 17, 2010
24 app.routes.append do
56cdc81 @wycats Remove default match without specified method
wycats authored Apr 24, 2012
25 get '/rails/info/properties' => "rails/info#properties"
cb44e0f @schneems /rails/info/routes path shows routing information
schneems authored May 22, 2012
26 get '/rails/info/routes' => "rails/info#routes"
27 get '/rails/info' => "rails/info#index"
117daba @carllerche Update Rails' built in routes to use RouteSet#append
carllerche authored Sep 17, 2010
28 end
4f03603 @josevalim Break application.rb file in smaller chunks.
josevalim authored Jan 23, 2010
29 end
30 end
31
e49f94d @josevalim Revert behavior from a5684df and ensure after_initializer is executed…
josevalim authored Feb 19, 2010
32 initializer :build_middleware_stack do
f816666 @josevalim Alias app to build_middleware_stack for clarity.
josevalim authored Jun 21, 2010
33 build_middleware_stack
e49f94d @josevalim Revert behavior from a5684df and ensure after_initializer is executed…
josevalim authored Feb 19, 2010
34 end
35
820c0fe @drogus Explicitly define main_app proxy
drogus authored Apr 25, 2011
36 initializer :define_main_app_helper do |app|
37 app.routes.define_mounted_helper(:main_app)
38 end
39
27f0add @josevalim Improve docs for Rails::Application and add routes_reloader_hook and …
josevalim authored Dec 12, 2011
40 initializer :add_to_prepare_blocks do
41 config.to_prepare_blocks.each do |block|
42 ActionDispatch::Reloader.to_prepare(&block)
43 end
44 end
45
46 # This needs to happen before eager load so it happens
47 # in exactly the same point regardless of config.cache_classes
48 initializer :run_prepare_callbacks do
49 ActionDispatch::Reloader.prepare!
50 end
51
351816f @josevalim Ensure that eager_load actually takes place just after the middleware…
josevalim authored May 15, 2010
52 initializer :eager_load! do
1d9357d @jviney Fix `$rails_rake_task` global variable warning without replacing the …
jviney authored Jan 22, 2012
53 if config.cache_classes && !(defined?($rails_rake_task) && $rails_rake_task)
3afdfc3 @josevalim Expose remaining hooks to minimize the need for a Railtie based on fe…
josevalim authored May 16, 2010
54 ActiveSupport.run_load_hooks(:before_eager_load, self)
5a0d73f @josevalim Add lib to load paths when application is inherited to be able to loa…
josevalim authored Jun 2, 2010
55 eager_load!
351816f @josevalim Ensure that eager_load actually takes place just after the middleware…
josevalim authored May 15, 2010
56 end
57 end
58
27f0add @josevalim Improve docs for Rails::Application and add routes_reloader_hook and …
josevalim authored Dec 12, 2011
59 # All initialization is done, including eager loading in production
351816f @josevalim Ensure that eager_load actually takes place just after the middleware…
josevalim authored May 15, 2010
60 initializer :finisher_hook do
61 ActiveSupport.run_load_hooks(:after_initialize, self)
4f03603 @josevalim Break application.rb file in smaller chunks.
josevalim authored Jan 23, 2010
62 end
63
27f0add @josevalim Improve docs for Rails::Application and add routes_reloader_hook and …
josevalim authored Dec 12, 2011
64 # Set app reload just after the finisher hook to ensure
65 # routes added in the hook are still loaded.
693d2be @josevalim Move hooks back to initializers (we need an API that allows hooks to …
josevalim authored Dec 13, 2011
66 initializer :set_routes_reloader_hook do
67 reloader = routes_reloader
80256ab @josevalim FileUpdateChecker should be able to handle deleted files.
josevalim authored Dec 13, 2011
68 reloader.execute_if_updated
693d2be @josevalim Move hooks back to initializers (we need an API that allows hooks to …
josevalim authored Dec 13, 2011
69 self.reloaders << reloader
80256ab @josevalim FileUpdateChecker should be able to handle deleted files.
josevalim authored Dec 13, 2011
70 ActionDispatch::Reloader.to_prepare { reloader.execute_if_updated }
48bf667 @josevalim Ensure routes are loaded only after the initialization process finish…
josevalim authored Sep 2, 2010
71 end
72
fa1d9a8 @josevalim Speed up development by only reloading classes if dependencies files …
josevalim authored Dec 12, 2011
73 # Set app reload just after the finisher hook to ensure
74 # paths added in the hook are still loaded.
283a087 @josevalim Clean up the cache before the request in case we are running in the r…
josevalim authored Dec 15, 2011
75 initializer :set_clear_dependencies_hook, :group => :all do
693d2be @josevalim Move hooks back to initializers (we need an API that allows hooks to …
josevalim authored Dec 13, 2011
76 callback = lambda do
77 ActiveSupport::DescendantsTracker.clear
78 ActiveSupport::Dependencies.clear
79 end
80
81 if config.reload_classes_only_on_change
80256ab @josevalim FileUpdateChecker should be able to handle deleted files.
josevalim authored Dec 13, 2011
82 reloader = config.file_watcher.new(*watchable_args, &callback)
693d2be @josevalim Move hooks back to initializers (we need an API that allows hooks to …
josevalim authored Dec 13, 2011
83 self.reloaders << reloader
84 # We need to set a to_prepare callback regardless of the reloader result, i.e.
85 # models should be reloaded if any of the reloaders (i18n, routes) were updated.
1f5b9bb @josevalim Clean up FileUpdateChecker API.
josevalim authored Dec 13, 2011
86 ActionDispatch::Reloader.to_prepare(:prepend => true){ reloader.execute }
693d2be @josevalim Move hooks back to initializers (we need an API that allows hooks to …
josevalim authored Dec 13, 2011
87 else
88 ActionDispatch::Reloader.to_cleanup(&callback)
89 end
fa1d9a8 @josevalim Speed up development by only reloading classes if dependencies files …
josevalim authored Dec 12, 2011
90 end
91
4f03603 @josevalim Break application.rb file in smaller chunks.
josevalim authored Jan 23, 2010
92 # Disable dependency loading during request cycle
5d07869 @josevalim Ensure all initializers are collections.
josevalim authored Jan 26, 2010
93 initializer :disable_dependency_loading do
94 if config.cache_classes && !config.dependency_loading
4f03603 @josevalim Break application.rb file in smaller chunks.
josevalim authored Jan 23, 2010
95 ActiveSupport::Dependencies.unhook!
96 end
97 end
adff4a7 @wycats Initial queue implementation
wycats authored Apr 26, 2012
98
99 initializer :activate_queue_consumer do |app|
9fc9e89 @josevalim Use Rails::Queueing::Queue instead of Queue so people can build their…
josevalim authored Apr 28, 2012
100 if config.queue == Rails::Queueing::Queue
1385388 @carlosantoniodasilva Allow configuring a different queue consumer
carlosantoniodasilva authored May 3, 2012
101 app.queue_consumer = config.queue_consumer.start(app.queue)
102 at_exit { app.queue_consumer.shutdown }
adff4a7 @wycats Initial queue implementation
wycats authored Apr 27, 2012
103 end
104 end
4f03603 @josevalim Break application.rb file in smaller chunks.
josevalim authored Jan 23, 2010
105 end
106 end
f38e89c @josh Move railties/builtin into lib
josh authored Mar 20, 2010
107 end
Something went wrong with that request. Please try again.