Skip to content
This repository
Newer
Older
100644 108 lines (88 sloc) 2.56 kb
02c5137e » josevalim
2010-01-22 Add view paths to Engine setup.
1 require 'fileutils'
dc677f76 » Carlhuda
2009-12-22 tests pass with requiring the frameworks in rails.rb
2
accd9b46 » josh
2009-09-25 Restore "Start Rails::Application object
3 module Rails
7fcf8590 » josevalim
2010-01-21 Massive cleanup in Railties and load stack.
4 class Application < Engine
4f036032 » josevalim
2010-01-23 Break application.rb file in smaller chunks.
5 autoload :Bootstrap, 'rails/application/bootstrap'
6 autoload :Finisher, 'rails/application/finisher'
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
7 autoload :RoutesReloader, 'rails/application/routes_reloader'
8
4eab3aad » josevalim
2010-01-23 Ensure user set load paths have higher preference and move Bootstrap …
9 # TODO Check helpers works as expected
10 # TODO Check routes namespaces
e4d7e509 » Carl Lerche
2009-10-08 Moving more initializers into the application object
11 class << self
94bb3316 » jeremy
2009-12-23 Shift more responsibility from application class to its singleton ins…
12 private :new
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
13 alias :configure :class_eval
14
94bb3316 » jeremy
2009-12-23 Shift more responsibility from application class to its singleton ins…
15 def instance
16 @instance ||= new
897164dd » Yehuda Katz + Carl Lerche
2009-11-02 Conceptually unify instance & global initializers
17 end
18
e4d7e509 » Carl Lerche
2009-10-08 Moving more initializers into the application object
19 def config
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
20 @config ||= Configuration.new(self.original_root)
7fcf8590 » josevalim
2010-01-21 Massive cleanup in Railties and load stack.
21 end
22
02c5137e » josevalim
2010-01-22 Add view paths to Engine setup.
23 def original_root
24 @original_root ||= find_root_with_file_flag("config.ru", Dir.pwd)
7fcf8590 » josevalim
2010-01-21 Massive cleanup in Railties and load stack.
25 end
26
27 def inherited(base)
28 super
29 Railtie.plugins.delete(base)
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
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
897164dd » Yehuda Katz + Carl Lerche
2009-11-02 Conceptually unify instance & global initializers
40 def initialize
94bb3316 » jeremy
2009-12-23 Shift more responsibility from application class to its singleton ins…
41 require_environment
d982fe2b » Carlhuda
2009-12-21 Replace reopening the class with App.configure as an alias to class_eval
42 end
43
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
44 def routes
45 ActionController::Routing::Routes
897164dd » Yehuda Katz + Carl Lerche
2009-11-02 Conceptually unify instance & global initializers
46 end
5f8e48cb » josh
2009-12-14 Move route reloading into railties
47
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
48 def routes_reloader
49 @routes_reloader ||= RoutesReloader.new(config)
5f8e48cb » josh
2009-12-14 Move route reloading into railties
50 end
51
52 def reload_routes!
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
53 routes_reloader.reload!
54 end
5f8e48cb » josh
2009-12-14 Move route reloading into railties
55
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
56 def initialize!
57 run_initializers(self)
58 self
5f8e48cb » josh
2009-12-14 Move route reloading into railties
59 end
60
7fcf8590 » josevalim
2010-01-21 Massive cleanup in Railties and load stack.
61 def require_environment
98240c49 » josevalim
2010-01-23 Get rid of initializers global and create i18n railtie.
62 environment = config.paths.config.environment.to_a.first
63 require environment if environment
7fcf8590 » josevalim
2010-01-21 Massive cleanup in Railties and load stack.
64 end
65
94bb3316 » jeremy
2009-12-23 Shift more responsibility from application class to its singleton ins…
66 def load_tasks
67 require "rails/tasks"
468bdb3e » spohlenz
2009-12-28 Make plugins responsible for loading their own rake tasks
68 plugins.each { |p| p.load_tasks }
c02f2782 » Carl Lerche
2009-12-28 Add the ability to have plugins load rake tasks.
69 # Load all application tasks
70 # TODO: extract out the path to the rake tasks
94bb3316 » jeremy
2009-12-23 Shift more responsibility from application class to its singleton ins…
71 Dir["#{root}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
72 task :environment do
73 $rails_rake_task = true
74 initialize!
75 end
76 end
77
4ca97650 » josevalim
2010-01-19 Allow railties to specify generators paths.
78 def load_generators
79 plugins.each { |p| p.load_generators }
80 end
81
d1ffc54c » spastorino
2010-01-17 fixes the failure of config.plugins without :all option tests [#3718
82 # TODO: Fix this method. It loads all railties independent if :all is given
83 # or not, otherwise frameworks are never loaded.
82b9b151 » Yehuda Katz + Carl Lerche
2009-11-06 Refactor plugins
84 def plugins
85 @plugins ||= begin
bbe80ae6 » josh
2010-01-05 config.plugins should still work with an array of strings
86 plugin_names = (config.plugins || [:all]).map { |p| p.to_sym }
d1ffc54c » spastorino
2010-01-17 fixes the failure of config.plugins without :all option tests [#3718
87 Railtie.plugins.map(&:new) + Plugin.all(plugin_names, config.paths.vendor.plugins)
82b9b151 » Yehuda Katz + Carl Lerche
2009-11-06 Refactor plugins
88 end
89 end
90
603d4fba » josh
2010-01-16 Build middleware stack and reload routes after app initializers run
91 def app
80130d12 » josevalim
2010-01-23 Extract routes reloading responsibilities from application and load t…
92 @app ||= middleware.build(routes)
603d4fba » josh
2010-01-16 Build middleware stack and reload routes after app initializers run
93 end
94
897164dd » Yehuda Katz + Carl Lerche
2009-11-02 Conceptually unify instance & global initializers
95 def call(env)
fc4f2378 » josevalim
2010-01-21 Make filter parameters based on request, so they can be modified for …
96 env["action_dispatch.parameter_filter"] = config.filter_parameters
603d4fba » josh
2010-01-16 Build middleware stack and reload routes after app initializers run
97 app.call(env)
6d6ae084 » Carl Lerche
2009-10-07 Start moving the initializers into the application object
98 end
99
98240c49 » josevalim
2010-01-23 Get rid of initializers global and create i18n railtie.
100 def initializers
4eab3aad » josevalim
2010-01-23 Ensure user set load paths have higher preference and move Bootstrap …
101 initializers = Bootstrap.initializers
102 initializers += super
98240c49 » josevalim
2010-01-23 Get rid of initializers global and create i18n railtie.
103 plugins.each { |p| initializers += p.initializers }
4eab3aad » josevalim
2010-01-23 Ensure user set load paths have higher preference and move Bootstrap …
104 initializers += Finisher.initializers
98240c49 » josevalim
2010-01-23 Get rid of initializers global and create i18n railtie.
105 initializers
106 end
accd9b46 » josh
2009-09-25 Restore "Start Rails::Application object
107 end
108 end
Something went wrong with that request. Please try again.