Skip to content
This repository
Newer
Older
100644 100 lines (86 sloc) 3.298 kb
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
1 module Rails
2 class Application
3 module Finisher
4 include Initializable
8ef1ec42 » arunagw
2011-10-10 global variable `$rails_rake_task' not initialized Warning removed
5 $rails_rake_task = nil
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
6
6690d662 » josevalim
2010-04-05 Rename config.cookie_secret to config.secret_token and pass it as con…
7 initializer :add_generator_templates do
d649bf15 » josevalim
2010-10-06 Provide a cleaner syntax for paths configuration that does not rely o…
8 config.generators.templates.unshift(*paths["lib/templates"].existent)
6690d662 » josevalim
2010-04-05 Rename config.cookie_secret to config.secret_token and pass it as con…
9 end
10
6f83a503 » fxn
2010-06-22 renames load_(once_)paths to autoload_(once_)paths in dependencies an…
11 initializer :ensure_autoload_once_paths_as_subset do
12 extra = ActiveSupport::Dependencies.autoload_once_paths -
13 ActiveSupport::Dependencies.autoload_paths
924fa084 » josevalim
2010-01-23 First steps into making Plugin < Engine.
14
15 unless extra.empty?
16 abort <<-end_error
6f83a503 » fxn
2010-06-22 renames load_(once_)paths to autoload_(once_)paths in dependencies an…
17 autoload_once_paths must be a subset of the autoload_paths.
18 Extra items in autoload_once_paths: #{extra * ','}
924fa084 » josevalim
2010-01-23 First steps into making Plugin < Engine.
19 end_error
20 end
21 end
22
226d8e74 » josevalim
2010-01-27 Refactor MetalLoader and RoutesReloader to rely less on class configu…
23 initializer :add_builtin_route do |app|
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
24 if Rails.env.development?
117daba1 » carllerche
2010-09-17 Update Rails' built in routes to use RouteSet#append
25 app.routes.append do
26 match '/rails/info/properties' => "rails/info#properties"
27 end
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
28 end
29 end
30
e49f94d7 » josevalim
2010-02-19 Revert behavior from a5684df and ensure after_initializer is executed…
31 initializer :build_middleware_stack do
f8166669 » josevalim
2010-06-21 Alias app to build_middleware_stack for clarity.
32 build_middleware_stack
e49f94d7 » josevalim
2010-02-19 Revert behavior from a5684df and ensure after_initializer is executed…
33 end
34
820c0fed » drogus
2011-04-25 Explicitly define main_app proxy
35 initializer :define_main_app_helper do |app|
36 app.routes.define_mounted_helper(:main_app)
37 end
38
27f0add3 » josevalim
2011-12-12 Improve docs for Rails::Application and add routes_reloader_hook and …
39 initializer :add_to_prepare_blocks do
40 config.to_prepare_blocks.each do |block|
41 ActionDispatch::Reloader.to_prepare(&block)
42 end
43 end
44
45 # This needs to happen before eager load so it happens
46 # in exactly the same point regardless of config.cache_classes
47 initializer :run_prepare_callbacks do
48 ActionDispatch::Reloader.prepare!
49 end
50
351816fa » josevalim
2010-05-15 Ensure that eager_load actually takes place just after the middleware…
51 initializer :eager_load! do
52 if config.cache_classes && !$rails_rake_task
3afdfc35 » josevalim
2010-05-16 Expose remaining hooks to minimize the need for a Railtie based on fe…
53 ActiveSupport.run_load_hooks(:before_eager_load, self)
5a0d73f1 » josevalim
2010-06-02 Add lib to load paths when application is inherited to be able to loa…
54 eager_load!
351816fa » josevalim
2010-05-15 Ensure that eager_load actually takes place just after the middleware…
55 end
56 end
57
27f0add3 » josevalim
2011-12-12 Improve docs for Rails::Application and add routes_reloader_hook and …
58 # All initialization is done, including eager loading in production
351816fa » josevalim
2010-05-15 Ensure that eager_load actually takes place just after the middleware…
59 initializer :finisher_hook do
60 ActiveSupport.run_load_hooks(:after_initialize, self)
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
61 end
62
27f0add3 » josevalim
2011-12-12 Improve docs for Rails::Application and add routes_reloader_hook and …
63 # Set app reload just after the finisher hook to ensure
64 # routes added in the hook are still loaded.
693d2be8 » josevalim
2011-12-13 Move hooks back to initializers (we need an API that allows hooks to …
65 initializer :set_routes_reloader_hook do
66 reloader = routes_reloader
67 hook = lambda { reloader.execute_if_updated }
68 hook.call
69 self.reloaders << reloader
70 ActionDispatch::Reloader.to_prepare(&hook)
48bf667a » josevalim
2010-09-02 Ensure routes are loaded only after the initialization process finish…
71 end
72
fa1d9a88 » josevalim
2011-12-12 Speed up development by only reloading classes if dependencies files …
73 # Set app reload just after the finisher hook to ensure
74 # paths added in the hook are still loaded.
693d2be8 » josevalim
2011-12-13 Move hooks back to initializers (we need an API that allows hooks to …
75 initializer :set_dependencies_hook, :group => :all do
76 callback = lambda do
77 ActiveSupport::DescendantsTracker.clear
78 ActiveSupport::Dependencies.clear
79 end
80
81 if config.reload_classes_only_on_change
82 reloader = config.file_watcher.new(watchable_args, true, &callback)
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.
86 ActionDispatch::Reloader.to_prepare(:prepend => true, &callback)
87 else
88 ActionDispatch::Reloader.to_cleanup(&callback)
89 end
fa1d9a88 » josevalim
2011-12-12 Speed up development by only reloading classes if dependencies files …
90 end
91
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
92 # Disable dependency loading during request cycle
5d078692 » josevalim
2010-01-26 Ensure all initializers are collections.
93 initializer :disable_dependency_loading do
94 if config.cache_classes && !config.dependency_loading
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
95 ActiveSupport::Dependencies.unhook!
96 end
97 end
98 end
99 end
f38e89cf » josh
2010-03-20 Move railties/builtin into lib
100 end
Something went wrong with that request. Please try again.