Skip to content
This repository
Newer
Older
100644 124 lines (109 sloc) 4.596 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
5
6690d662 » josevalim
2010-04-05 Rename config.cookie_secret to config.secret_token and pass it as con…
6 initializer :add_generator_templates do
d649bf15 » josevalim
2010-10-06 Provide a cleaner syntax for paths configuration that does not rely o…
7 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…
8 end
9
6f83a503 » fxn
2010-06-22 renames load_(once_)paths to autoload_(once_)paths in dependencies an…
10 initializer :ensure_autoload_once_paths_as_subset do
11 extra = ActiveSupport::Dependencies.autoload_once_paths -
12 ActiveSupport::Dependencies.autoload_paths
924fa084 » josevalim
2010-01-23 First steps into making Plugin < Engine.
13
14 unless extra.empty?
15 abort <<-end_error
6f83a503 » fxn
2010-06-22 renames load_(once_)paths to autoload_(once_)paths in dependencies an…
16 autoload_once_paths must be a subset of the autoload_paths.
17 Extra items in autoload_once_paths: #{extra * ','}
924fa084 » josevalim
2010-01-23 First steps into making Plugin < Engine.
18 end_error
19 end
20 end
21
226d8e74 » josevalim
2010-01-27 Refactor MetalLoader and RoutesReloader to rely less on class configu…
22 initializer :add_builtin_route do |app|
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
23 if Rails.env.development?
117daba1 » carllerche
2010-09-17 Update Rails' built in routes to use RouteSet#append
24 app.routes.append do
d6dec7fc » pixeltrix
2013-12-16 Add mailer previews feature based on mail_view gem
25 get '/rails/mailers' => "rails/mailers#index"
26 get '/rails/mailers/*path' => "rails/mailers#preview"
56cdc81c » wycats
2012-04-24 Remove default match without specified method
27 get '/rails/info/properties' => "rails/info#properties"
cb44e0fe » schneems
2012-05-22 /rails/info/routes path shows routing information
28 get '/rails/info/routes' => "rails/info#routes"
29 get '/rails/info' => "rails/info#index"
baea5d69 » schneems
2012-12-05 Use Rails to Render Default Index Page
30 get '/' => "rails/welcome#index"
117daba1 » carllerche
2010-09-17 Update Rails' built in routes to use RouteSet#append
31 end
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
32 end
33 end
34
e49f94d7 » josevalim
2010-02-19 Revert behavior from a5684df and ensure after_initializer is executed…
35 initializer :build_middleware_stack do
f8166669 » josevalim
2010-06-21 Alias app to build_middleware_stack for clarity.
36 build_middleware_stack
e49f94d7 » josevalim
2010-02-19 Revert behavior from a5684df and ensure after_initializer is executed…
37 end
38
820c0fed » drogus
2011-04-25 Explicitly define main_app proxy
39 initializer :define_main_app_helper do |app|
40 app.routes.define_mounted_helper(:main_app)
41 end
42
27f0add3 » josevalim
2011-12-12 Improve docs for Rails::Application and add routes_reloader_hook and …
43 initializer :add_to_prepare_blocks do
44 config.to_prepare_blocks.each do |block|
45 ActionDispatch::Reloader.to_prepare(&block)
46 end
47 end
48
49 # This needs to happen before eager load so it happens
50 # in exactly the same point regardless of config.cache_classes
51 initializer :run_prepare_callbacks do
52 ActionDispatch::Reloader.prepare!
53 end
54
351816fa » josevalim
2010-05-15 Ensure that eager_load actually takes place just after the middleware…
55 initializer :eager_load! do
e6747d87 » josevalim
2012-08-01 Allow users to choose when to eager_load the application or not.
56 if config.eager_load
3afdfc35 » josevalim
2010-05-16 Expose remaining hooks to minimize the need for a Railtie based on fe…
57 ActiveSupport.run_load_hooks(:before_eager_load, self)
2801786e » josevalim
2012-08-01 Get rid of config.preload_frameworks in favor of config.eager_load_na…
58 config.eager_load_namespaces.each(&:eager_load!)
351816fa » josevalim
2010-05-15 Ensure that eager_load actually takes place just after the middleware…
59 end
60 end
61
27f0add3 » josevalim
2011-12-12 Improve docs for Rails::Application and add routes_reloader_hook and …
62 # 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…
63 initializer :finisher_hook do
64 ActiveSupport.run_load_hooks(:after_initialize, self)
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
65 end
66
b9b06daa » fxn
2013-06-06 clearing autoloaded constants triggers routes reloading [Fixes #10685]
67 # Set routes reload after the finisher hook to ensure routes added in
68 # the hook are taken into account.
693d2be8 » josevalim
2011-12-13 Move hooks back to initializers (we need an API that allows hooks to …
69 initializer :set_routes_reloader_hook do
70 reloader = routes_reloader
80256abb » josevalim
2011-12-13 FileUpdateChecker should be able to handle deleted files.
71 reloader.execute_if_updated
693d2be8 » josevalim
2011-12-13 Move hooks back to initializers (we need an API that allows hooks to …
72 self.reloaders << reloader
b9b06daa » fxn
2013-06-06 clearing autoloaded constants triggers routes reloading [Fixes #10685]
73 ActionDispatch::Reloader.to_prepare do
74 # We configure #execute rather than #execute_if_updated because if
75 # autoloaded constants are cleared we need to reload routes also in
76 # case any was used there, as in
77 #
78 # mount MailPreview => 'mail_view'
79 #
80 # This means routes are also reloaded if i18n is updated, which
81 # might not be necessary, but in order to be more precise we need
82 # some sort of reloaders dependency support, to be added.
83 reloader.execute
84 end
48bf667a » josevalim
2010-09-02 Ensure routes are loaded only after the initialization process finish…
85 end
86
b9b06daa » fxn
2013-06-06 clearing autoloaded constants triggers routes reloading [Fixes #10685]
87 # Set clearing dependencies after the finisher hook to ensure paths
88 # added in the hook are taken into account.
5ad7f8ab » robin850
2012-10-14 Use Ruby 1.9 Hash syntax in railties
89 initializer :set_clear_dependencies_hook, group: :all do
693d2be8 » josevalim
2011-12-13 Move hooks back to initializers (we need an API that allows hooks to …
90 callback = lambda do
91 ActiveSupport::DescendantsTracker.clear
92 ActiveSupport::Dependencies.clear
93 end
94
95 if config.reload_classes_only_on_change
80256abb » josevalim
2011-12-13 FileUpdateChecker should be able to handle deleted files.
96 reloader = config.file_watcher.new(*watchable_args, &callback)
693d2be8 » josevalim
2011-12-13 Move hooks back to initializers (we need an API that allows hooks to …
97 self.reloaders << reloader
b9b06daa » fxn
2013-06-06 clearing autoloaded constants triggers routes reloading [Fixes #10685]
98
99 # Prepend this callback to have autoloaded constants cleared before
100 # any other possible reloading, in case they need to autoload fresh
101 # constants.
102 ActionDispatch::Reloader.to_prepare(prepend: true) do
103 # In addition to changes detected by the file watcher, if routes
104 # or i18n have been updated we also need to clear constants,
105 # that's why we run #execute rather than #execute_if_updated, this
106 # callback has to clear autoloaded constants after any update.
107 reloader.execute
108 end
693d2be8 » josevalim
2011-12-13 Move hooks back to initializers (we need an API that allows hooks to …
109 else
110 ActionDispatch::Reloader.to_cleanup(&callback)
111 end
fa1d9a88 » josevalim
2011-12-12 Speed up development by only reloading classes if dependencies files …
112 end
113
252ebf71 » tenderlove
2012-12-27 Revert "Move background jobs to the 'jobs' branch until fully baked. …
114 initializer :activate_queue_consumer do |app|
115 if config.queue.class == ActiveSupport::Queue
116 app.queue_consumer = config.queue_consumer || config.queue.consumer
117 app.queue_consumer.logger ||= Rails.logger if app.queue_consumer.respond_to?(:logger=)
118 app.queue_consumer.start
119 at_exit { app.queue_consumer.shutdown }
120 end
121 end
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
122 end
123 end
f38e89cf » josh
2010-03-20 Move railties/builtin into lib
124 end
Something went wrong with that request. Please try again.