public
Description: PLEASE CHECK http://github.com/lifo/docrails/wikis
Homepage: http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch
Clone URL: git://github.com/lifo/docrails.git
Added Rails.initialized? flag
josh (author)
Wed Jul 02 19:29:57 -0700 2008
commit  6c0edef26ee1c0e5f0964cae64c9f48da6daf1fa
tree    f2138bfae396e1b3fa840c7d3f6adb80b7f7ab21
parent  8f640c381d9d1b74f6a0fc3648c21da373661914
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *Edge*
0
 
0
+* Added Rails.initialized? flag [Josh Peek]
0
+
0
 * Make rake test:uncommitted work with Git. [Tim Pope]
0
 
0
 * Added Thin support to script/server. #488 [Bob Klosinski]
...
19
20
21
22
 
23
24
25
26
 
 
 
 
 
 
 
 
 
27
28
29
30
 
31
32
33
...
35
36
37
38
 
39
40
41
42
 
43
44
45
...
56
57
58
59
 
60
61
62
...
145
146
147
148
 
149
150
151
...
158
159
160
161
162
 
 
 
163
164
165
...
297
298
299
300
 
301
302
303
 
304
305
 
306
307
308
...
390
391
392
393
 
394
395
396
...
486
487
488
489
490
491
492
...
531
532
533
534
 
535
536
537
...
597
598
599
600
 
601
602
603
...
634
635
636
637
 
638
639
640
...
693
694
695
696
 
697
698
699
...
734
735
736
737
 
738
739
740
...
748
749
750
751
 
752
753
754
755
 
756
757
758
...
767
768
769
770
 
771
772
773
...
853
854
855
856
 
857
858
859
...
861
862
863
864
 
865
866
867
...
19
20
21
 
22
23
24
25
 
26
27
28
29
30
31
32
33
34
35
36
37
 
38
39
40
41
...
43
44
45
 
46
47
48
49
 
50
51
52
53
...
64
65
66
 
67
68
69
70
...
153
154
155
 
156
157
158
159
...
166
167
168
 
169
170
171
172
173
174
175
...
307
308
309
 
310
311
312
 
313
314
 
315
316
317
318
...
400
401
402
 
403
404
405
406
...
496
497
498
 
499
500
501
...
540
541
542
 
543
544
545
546
...
606
607
608
 
609
610
611
612
...
643
644
645
 
646
647
648
649
...
702
703
704
 
705
706
707
708
...
743
744
745
 
746
747
748
749
...
757
758
759
 
760
761
762
763
 
764
765
766
767
...
776
777
778
 
779
780
781
782
...
862
863
864
 
865
866
867
868
...
870
871
872
 
873
874
875
876
0
@@ -19,15 +19,23 @@ module Rails
0
     def configuration
0
       @@configuration
0
     end
0
-
0
+
0
     def configuration=(configuration)
0
       @@configuration = configuration
0
     end
0
-
0
+
0
+ def initialized?
0
+ @initialized || false
0
+ end
0
+
0
+ def initialized=(initialized)
0
+ @initialized ||= initialized
0
+ end
0
+
0
     def logger
0
       RAILS_DEFAULT_LOGGER
0
     end
0
-
0
+
0
     def root
0
       if defined?(RAILS_ROOT)
0
         RAILS_ROOT
0
@@ -35,11 +43,11 @@ module Rails
0
         nil
0
       end
0
     end
0
-
0
+
0
     def env
0
       ActiveSupport::StringInquirer.new(RAILS_ENV)
0
     end
0
-
0
+
0
     def cache
0
       RAILS_CACHE
0
     end
0
@@ -56,7 +64,7 @@ module Rails
0
       @@public_path = path
0
     end
0
   end
0
-
0
+
0
   # The Initializer is responsible for processing the Rails configuration, such
0
   # as setting the $LOAD_PATH, requiring the right frameworks, initializing
0
   # logging, and more. It can be run either as a single command that'll just
0
@@ -145,7 +153,7 @@ module Rails
0
       add_gem_load_paths
0
       load_gems
0
       check_gem_dependencies
0
-
0
+
0
       load_application_initializers
0
 
0
       # the framework is now fully initialized
0
@@ -158,8 +166,10 @@ module Rails
0
       initialize_routing
0
 
0
       # Observers are loaded after plugins in case Observers or observed models are modified by plugins.
0
-
0
       load_observers
0
+
0
+ # Flag initialized
0
+ Rails.initialized = true
0
     end
0
 
0
     # Check for valid Ruby version
0
@@ -297,12 +307,12 @@ module Rails
0
       silence_warnings do
0
         return if @environment_loaded
0
         @environment_loaded = true
0
-
0
+
0
         config = configuration
0
         constants = self.class.constants
0
-
0
+
0
         eval(IO.read(configuration.environment_path), binding, configuration.environment_path)
0
-
0
+
0
         (self.class.constants - constants).each do |const|
0
           Object.const_set(const, self.class.const_get(const))
0
         end
0
@@ -390,7 +400,7 @@ module Rails
0
       for framework in ([ :active_record, :action_controller, :action_mailer ] & configuration.frameworks)
0
         framework.to_s.camelize.constantize.const_get("Base").logger ||= RAILS_DEFAULT_LOGGER
0
       end
0
-
0
+
0
       RAILS_CACHE.logger ||= RAILS_DEFAULT_LOGGER
0
     end
0
 
0
@@ -486,7 +496,6 @@ module Rails
0
       Dispatcher.define_dispatcher_callbacks(configuration.cache_classes)
0
       Dispatcher.new(RAILS_DEFAULT_LOGGER).send :run_callbacks, :prepare_dispatch
0
     end
0
-
0
   end
0
 
0
   # The Configuration class holds all the parameters for the Initializer and
0
@@ -531,7 +540,7 @@ module Rails
0
     # The path to the database configuration file to use. (Defaults to
0
     # <tt>config/database.yml</tt>.)
0
     attr_accessor :database_configuration_file
0
-
0
+
0
     # The path to the routes configuration file to use. (Defaults to
0
     # <tt>config/routes.rb</tt>.)
0
     attr_accessor :routes_configuration_file
0
@@ -597,7 +606,7 @@ module Rails
0
     # a sub class would have access to fine grained modification of the loading behavior. See
0
     # the implementation of Rails::Plugin::Loader for more details.
0
     attr_accessor :plugin_loader
0
-
0
+
0
     # Enables or disables plugin reloading. You can get around this setting per plugin.
0
     # If <tt>reload_plugins?</tt> is false, add this to your plugin's <tt>init.rb</tt>
0
     # to make it reloadable:
0
@@ -634,7 +643,7 @@ module Rails
0
     def gem(name, options = {})
0
       @gems << Rails::GemDependency.new(name, options)
0
     end
0
-
0
+
0
     # Deprecated options:
0
     def breakpoint_server(_ = nil)
0
       $stderr.puts %(
0
@@ -693,7 +702,7 @@ module Rails
0
         else
0
           Pathname.new(::RAILS_ROOT).realpath.to_s
0
         end
0
-
0
+
0
       Object.const_set(:RELATIVE_RAILS_ROOT, ::RAILS_ROOT.dup) unless defined?(::RELATIVE_RAILS_ROOT)
0
       ::RAILS_ROOT.replace @root_path
0
     end
0
@@ -734,7 +743,7 @@ module Rails
0
     #
0
     # See Dispatcher#to_prepare.
0
     def to_prepare(&callback)
0
- after_initialize do
0
+ after_initialize do
0
         require 'dispatcher' unless defined?(::Dispatcher)
0
         Dispatcher.to_prepare(&callback)
0
       end
0
@@ -748,11 +757,11 @@ module Rails
0
     def framework_paths
0
       paths = %w(railties railties/lib activesupport/lib)
0
       paths << 'actionpack/lib' if frameworks.include? :action_controller or frameworks.include? :action_view
0
-
0
+
0
       [:active_record, :action_mailer, :active_resource, :action_web_service].each do |framework|
0
         paths << "#{framework.to_s.gsub('_', '')}/lib" if frameworks.include? framework
0
       end
0
-
0
+
0
       paths.map { |dir| "#{framework_root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
0
     end
0
 
0
@@ -767,7 +776,7 @@ module Rails
0
 
0
       def default_load_paths
0
         paths = []
0
-
0
+
0
         # Add the old mock paths only if the directories exists
0
         paths.concat(Dir["#{root_path}/test/mocks/#{environment}"]) if File.exists?("#{root_path}/test/mocks/#{environment}")
0
 
0
@@ -853,7 +862,7 @@ module Rails
0
       def default_plugin_loader
0
         Plugin::Loader
0
       end
0
-
0
+
0
       def default_cache_store
0
         if File.exist?("#{root_path}/tmp/cache/")
0
           [ :file_store, "#{root_path}/tmp/cache/" ]
0
@@ -861,7 +870,7 @@ module Rails
0
           :memory_store
0
         end
0
       end
0
-
0
+
0
       def default_gems
0
         []
0
       end

Comments

    No one has commented yet.