Skip to content
Newer
Older
100644 116 lines (93 sloc) 2.47 KB
02c5137 @josevalim Add view paths to Engine setup.
josevalim authored Jan 22, 2010
1 require 'fileutils'
dc677f7 tests pass with requiring the frameworks in rails.rb
Carlhuda authored Dec 22, 2009
2
accd9b4 @josh Restore "Start Rails::Application object
josh authored Sep 25, 2009
3 module Rails
7fcf859 @josevalim Massive cleanup in Railties and load stack.
josevalim authored Jan 21, 2010
4 class Application < Engine
4f03603 @josevalim Break application.rb file in smaller chunks.
josevalim authored Jan 23, 2010
5 autoload :Bootstrap, 'rails/application/bootstrap'
6 autoload :Finisher, 'rails/application/finisher'
13d66cd @josevalim Extract Railtie load from application.
josevalim authored Jan 23, 2010
7 autoload :Railties, 'rails/application/railties'
80130d1 @josevalim Extract routes reloading responsibilities from application and load t…
josevalim authored Jan 23, 2010
8 autoload :RoutesReloader, 'rails/application/routes_reloader'
9
4eab3aa @josevalim Ensure user set load paths have higher preference and move Bootstrap …
josevalim authored Jan 23, 2010
10 # TODO Check helpers works as expected
11 # TODO Check routes namespaces
788fce2 @josevalim Create configurable modules and ensure that they are added only on di…
josevalim authored Jan 23, 2010
12 # TODO raise "You cannot have more than one Rails::Application" if Rails.application
13 # TODO Ensure production settings are read properly
e4d7e50 Moving more initializers into the application object
Carl Lerche authored Oct 8, 2009
14 class << self
94bb331 @jeremy Shift more responsibility from application class to its singleton ins…
jeremy authored Dec 23, 2009
15 private :new
80130d1 @josevalim Extract routes reloading responsibilities from application and load t…
josevalim authored Jan 23, 2010
16 alias :configure :class_eval
17
94bb331 @jeremy Shift more responsibility from application class to its singleton ins…
jeremy authored Dec 24, 2009
18 def instance
19 @instance ||= new
897164d Conceptually unify instance & global initializers
Yehuda Katz + Carl Lerche authored Nov 2, 2009
20 end
21
7fcf859 @josevalim Massive cleanup in Railties and load stack.
josevalim authored Jan 21, 2010
22 def inherited(base)
23 super
788fce2 @josevalim Create configurable modules and ensure that they are added only on di…
josevalim authored Jan 23, 2010
24 Rails.application = base.instance
25 base.require_environment!
e4d7e50 Moving more initializers into the application object
Carl Lerche authored Oct 8, 2009
26 end
6f6a589 Create the application object from config/environment.rb
Yehuda Katz + Carl Lerche authored Sep 28, 2009
27
80130d1 @josevalim Extract routes reloading responsibilities from application and load t…
josevalim authored Jan 23, 2010
28 protected
29
30 def method_missing(*args, &block)
31 instance.send(*args, &block)
426348b @josh Update routes.rb template to use App name
josh authored Dec 21, 2009
32 end
897164d Conceptually unify instance & global initializers
Yehuda Katz + Carl Lerche authored Nov 3, 2009
33 end
6f6a589 Create the application object from config/environment.rb
Yehuda Katz + Carl Lerche authored Sep 29, 2009
34
788fce2 @josevalim Create configurable modules and ensure that they are added only on di…
josevalim authored Jan 23, 2010
35 def require_environment!
13d66cd @josevalim Extract Railtie load from application.
josevalim authored Jan 23, 2010
36 environment = config.paths.config.environment.to_a.first
37 require environment if environment
d982fe2 Replace reopening the class with App.configure as an alias to class_eval
Carlhuda authored Dec 21, 2009
38 end
39
788fce2 @josevalim Create configurable modules and ensure that they are added only on di…
josevalim authored Jan 23, 2010
40 def config
41 @config ||= ::Rails::Configuration.new(self.class.find_root_with_flag("config.ru", Dir.pwd))
42 end
43
80130d1 @josevalim Extract routes reloading responsibilities from application and load t…
josevalim authored Jan 23, 2010
44 def routes
13d66cd @josevalim Extract Railtie load from application.
josevalim authored Jan 23, 2010
45 ::ActionController::Routing::Routes
46 end
47
48 def railties
49 @railties ||= Railties.new(config)
897164d Conceptually unify instance & global initializers
Yehuda Katz + Carl Lerche authored Nov 3, 2009
50 end
5f8e48c @josh Move route reloading into railties
josh authored Dec 14, 2009
51
80130d1 @josevalim Extract routes reloading responsibilities from application and load t…
josevalim authored Jan 23, 2010
52 def routes_reloader
53 @routes_reloader ||= RoutesReloader.new(config)
5f8e48c @josh Move route reloading into railties
josh authored Dec 14, 2009
54 end
55
56 def reload_routes!
80130d1 @josevalim Extract routes reloading responsibilities from application and load t…
josevalim authored Jan 23, 2010
57 routes_reloader.reload!
58 end
5f8e48c @josh Move route reloading into railties
josh authored Dec 14, 2009
59
80130d1 @josevalim Extract routes reloading responsibilities from application and load t…
josevalim authored Jan 23, 2010
60 def initialize!
61 run_initializers(self)
62 self
5f8e48c @josh Move route reloading into railties
josh authored Dec 14, 2009
63 end
64
94bb331 @jeremy Shift more responsibility from application class to its singleton ins…
jeremy authored Dec 24, 2009
65 def load_tasks
788fce2 @josevalim Create configurable modules and ensure that they are added only on di…
josevalim authored Jan 23, 2010
66 initialize_tasks
13d66cd @josevalim Extract Railtie load from application.
josevalim authored Jan 23, 2010
67 super
68 railties.all { |r| r.load_tasks }
69 self
94bb331 @jeremy Shift more responsibility from application class to its singleton ins…
jeremy authored Dec 24, 2009
70 end
71
4ca9765 @josevalim Allow railties to specify generators paths.
josevalim authored Jan 19, 2010
72 def load_generators
788fce2 @josevalim Create configurable modules and ensure that they are added only on di…
josevalim authored Jan 23, 2010
73 initialize_generators
13d66cd @josevalim Extract Railtie load from application.
josevalim authored Jan 23, 2010
74 super
75 railties.all { |r| r.load_generators }
76 self
82b9b15 Refactor plugins
Yehuda Katz + Carl Lerche authored Nov 6, 2009
77 end
78
603d4fb @josh Build middleware stack and reload routes after app initializers run
josh authored Jan 16, 2010
79 def app
80130d1 @josevalim Extract routes reloading responsibilities from application and load t…
josevalim authored Jan 23, 2010
80 @app ||= middleware.build(routes)
603d4fb @josh Build middleware stack and reload routes after app initializers run
josh authored Jan 16, 2010
81 end
82
897164d Conceptually unify instance & global initializers
Yehuda Katz + Carl Lerche authored Nov 3, 2009
83 def call(env)
fc4f237 @josevalim Make filter parameters based on request, so they can be modified for …
josevalim authored Jan 21, 2010
84 env["action_dispatch.parameter_filter"] = config.filter_parameters
603d4fb @josh Build middleware stack and reload routes after app initializers run
josh authored Jan 16, 2010
85 app.call(env)
6d6ae08 Start moving the initializers into the application object
Carl Lerche authored Oct 7, 2009
86 end
87
98240c4 @josevalim Get rid of initializers global and create i18n railtie.
josevalim authored Jan 23, 2010
88 def initializers
4eab3aa @josevalim Ensure user set load paths have higher preference and move Bootstrap …
josevalim authored Jan 23, 2010
89 initializers = Bootstrap.initializers
90 initializers += super
13d66cd @josevalim Extract Railtie load from application.
josevalim authored Jan 23, 2010
91 railties.all { |r| initializers += r.initializers }
4eab3aa @josevalim Ensure user set load paths have higher preference and move Bootstrap …
josevalim authored Jan 23, 2010
92 initializers += Finisher.initializers
98240c4 @josevalim Get rid of initializers global and create i18n railtie.
josevalim authored Jan 23, 2010
93 initializers
94 end
788fce2 @josevalim Create configurable modules and ensure that they are added only on di…
josevalim authored Jan 23, 2010
95
96 protected
97
98 def initialize_tasks
99 require "rails/tasks"
100 task :environment do
101 $rails_rake_task = true
102 initialize!
103 end
104 end
105
106 def initialize_generators
107 require "rails/generators"
108 end
109
110 # Application is always reloadable when config.cache_classes is false.
111 def reloadable?(app)
112 true
113 end
accd9b4 @josh Restore "Start Rails::Application object
josh authored Sep 26, 2009
114 end
115 end
Something went wrong with that request. Please try again.