Skip to content
This repository
Newer
Older
100644 116 lines (95 sloc) 2.551 kb
02c5137e » josevalim
2010-01-22 Add view paths to Engine setup.
1 require 'fileutils'
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
2 require 'rails/railties_path'
3 require 'rails/plugin'
2fde9d77 » josevalim
2010-01-24 Solve some pendencies.
4 require 'rails/engine'
dc677f76 » Carlhuda
2009-12-22 tests pass with requiring the frameworks in rails.rb
5
accd9b46 » josh
2009-09-25 Restore "Start Rails::Application object
6 module Rails
7fcf8590 » josevalim
2010-01-21 Massive cleanup in Railties and load stack.
7 class Application < Engine
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
8 autoload :Bootstrap, 'rails/application/bootstrap'
f8bf1982 » josevalim
2010-01-26 Add tests for explicit engines.
9 autoload :Configurable, 'rails/application/configurable'
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
10 autoload :Configuration, 'rails/application/configuration'
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
11 autoload :Finisher, 'rails/application/finisher'
13d66cdf » josevalim
2010-01-23 Extract Railtie load from application.
12 autoload :Railties, 'rails/application/railties'
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
13 autoload :RoutesReloader, 'rails/application/routes_reloader'
14
e4d7e509 » Carl Lerche
2009-10-08 Moving more initializers into the application object
15 class << self
94bb3316 » jeremy
2009-12-23 Shift more responsibility from application class to its singleton ins…
16 private :new
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
17 alias :configure :class_eval
18
94bb3316 » jeremy
2009-12-23 Shift more responsibility from application class to its singleton ins…
19 def instance
db99324a » josevalim
2010-01-26 Ensure calling a method in Rails::Application does not instantiate a …
20 if self == Rails::Application
21 Rails.application
92126521 » josh
2010-01-24 Add Rails::Application pointer to the default app to add symmetry to …
22 else
db99324a » josevalim
2010-01-26 Ensure calling a method in Rails::Application does not instantiate a …
23 @@instance ||= new
92126521 » josh
2010-01-24 Add Rails::Application pointer to the default app to add symmetry to …
24 end
897164dd » Yehuda Katz + Carl Lerche
2009-11-02 Conceptually unify instance & global initializers
25 end
26
7fcf8590 » josevalim
2010-01-21 Massive cleanup in Railties and load stack.
27 def inherited(base)
2fde9d77 » josevalim
2010-01-24 Solve some pendencies.
28 raise "You cannot have more than one Rails::Application" if Rails.application
7fcf8590 » josevalim
2010-01-21 Massive cleanup in Railties and load stack.
29 super
788fce25 » josevalim
2010-01-23 Create configurable modules and ensure that they are added only on di…
30 Rails.application = base.instance
e4d7e509 » Carl Lerche
2009-10-08 Moving more initializers into the application object
31 end
6f6a589d » Yehuda Katz + Carl Lerche
2009-09-28 Create the application object from config/environment.rb
32
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
33 protected
34
35 def method_missing(*args, &block)
36 instance.send(*args, &block)
426348b4 » josh
2009-12-21 Update routes.rb template to use App name
37 end
897164dd » Yehuda Katz + Carl Lerche
2009-11-02 Conceptually unify instance & global initializers
38 end
6f6a589d » Yehuda Katz + Carl Lerche
2009-09-28 Create the application object from config/environment.rb
39
788fce25 » josevalim
2010-01-23 Create configurable modules and ensure that they are added only on di…
40 def require_environment!
13d66cdf » josevalim
2010-01-23 Extract Railtie load from application.
41 environment = config.paths.config.environment.to_a.first
42 require environment if environment
d982fe2b » Carlhuda
2009-12-21 Replace reopening the class with App.configure as an alias to class_eval
43 end
44
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
45 def routes
13d66cdf » josevalim
2010-01-23 Extract Railtie load from application.
46 ::ActionController::Routing::Routes
47 end
48
49 def railties
50 @railties ||= Railties.new(config)
897164dd » Yehuda Katz + Carl Lerche
2009-11-02 Conceptually unify instance & global initializers
51 end
5f8e48cb » josh
2009-12-14 Move route reloading into railties
52
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
53 def routes_reloader
54 @routes_reloader ||= RoutesReloader.new(config)
5f8e48cb » josh
2009-12-14 Move route reloading into railties
55 end
56
57 def reload_routes!
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
58 routes_reloader.reload!
59 end
5f8e48cb » josh
2009-12-14 Move route reloading into railties
60
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
61 def initialize!
62 run_initializers(self)
63 self
5f8e48cb » josh
2009-12-14 Move route reloading into railties
64 end
65
94bb3316 » jeremy
2009-12-23 Shift more responsibility from application class to its singleton ins…
66 def load_tasks
788fce25 » josevalim
2010-01-23 Create configurable modules and ensure that they are added only on di…
67 initialize_tasks
13d66cdf » josevalim
2010-01-23 Extract Railtie load from application.
68 super
69 railties.all { |r| r.load_tasks }
70 self
94bb3316 » jeremy
2009-12-23 Shift more responsibility from application class to its singleton ins…
71 end
72
4ca97650 » josevalim
2010-01-19 Allow railties to specify generators paths.
73 def load_generators
788fce25 » josevalim
2010-01-23 Create configurable modules and ensure that they are added only on di…
74 initialize_generators
13d66cdf » josevalim
2010-01-23 Extract Railtie load from application.
75 super
76 railties.all { |r| r.load_generators }
77 self
82b9b151 » Yehuda Katz + Carl Lerche
2009-11-06 Refactor plugins
78 end
79
603d4fba » josh
2010-01-16 Build middleware stack and reload routes after app initializers run
80 def app
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
81 @app ||= middleware.build(routes)
603d4fba » josh
2010-01-16 Build middleware stack and reload routes after app initializers run
82 end
83
897164dd » Yehuda Katz + Carl Lerche
2009-11-02 Conceptually unify instance & global initializers
84 def call(env)
fc4f2378 » josevalim
2010-01-21 Make filter parameters based on request, so they can be modified for …
85 env["action_dispatch.parameter_filter"] = config.filter_parameters
603d4fba » josh
2010-01-16 Build middleware stack and reload routes after app initializers run
86 app.call(env)
6d6ae084 » Carl Lerche
2009-10-07 Start moving the initializers into the application object
87 end
88
98240c49 » josevalim
2010-01-23 Get rid of initializers global and create i18n railtie.
89 def initializers
5d078692 » josevalim
2010-01-26 Ensure all initializers are collections.
90 initializers = Bootstrap.initializers_for(self)
13d66cdf » josevalim
2010-01-23 Extract Railtie load from application.
91 railties.all { |r| initializers += r.initializers }
2d1f9fb9 » josh
2010-01-25 Plugins need to load before app initializers
92 initializers += super
5d078692 » josevalim
2010-01-26 Ensure all initializers are collections.
93 initializers += Finisher.initializers_for(self)
98240c49 » josevalim
2010-01-23 Get rid of initializers global and create i18n railtie.
94 initializers
95 end
788fce25 » josevalim
2010-01-23 Create configurable modules and ensure that they are added only on di…
96
97 protected
98
99 def initialize_tasks
100 require "rails/tasks"
101 task :environment do
102 $rails_rake_task = true
103 initialize!
104 end
105 end
106
107 def initialize_generators
108 require "rails/generators"
109 end
110
111 # Application is always reloadable when config.cache_classes is false.
112 def reloadable?(app)
113 true
114 end
accd9b46 » josh
2009-09-25 Restore "Start Rails::Application object
115 end
116 end
Something went wrong with that request. Please try again.